Skip to content

Commit 23706db

Browse files
dam9000chrisdd2
authored andcommitted
Make the Nerd Font an optional requirement (nvim-lua#716)
1 parent 39bc8c9 commit 23706db

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ If you are experiencing issues, please make sure you have the latest versions.
2727
External Requirements:
2828
- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`)
2929
- [ripgrep](https://github.com/BurntSushi/ripgrep#installation)
30+
- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons
31+
- if you have it set `vim.g.have_nerd_font` in `init.lua` to true
3032
- Language Setup:
3133
- If want to write Typescript, you need `npm`
3234
- If want to write Golang, you will need `go`

init.lua

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ P.S. You can delete this when you're done too. It's your config now! :)
9090
vim.g.mapleader = ' '
9191
vim.g.maplocalleader = ' '
9292

93+
-- Set to true if you have a Nerd Font installed
94+
vim.g.have_nerd_font = false
95+
9396
-- [[ Setting options ]]
9497
-- See `:help vim.opt`
9598
-- NOTE: You can change these options as you wish!
@@ -218,7 +221,7 @@ vim.opt.rtp:prepend(lazypath)
218221
-- :Lazy update
219222
--
220223
-- NOTE: Here is where you install your plugins.
221-
require('lazy').setup {
224+
require('lazy').setup({
222225
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
223226
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
224227

@@ -312,10 +315,8 @@ require('lazy').setup {
312315
},
313316
{ 'nvim-telescope/telescope-ui-select.nvim' },
314317

315-
-- Useful for getting pretty icons, but requires special font.
316-
-- If you already have a Nerd Font, or terminal set up with fallback fonts
317-
-- you can enable this
318-
-- { 'nvim-tree/nvim-web-devicons' }
318+
-- Useful for getting pretty icons, but requires a Nerd Font.
319+
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
319320
},
320321
config = function()
321322
-- Telescope is a fuzzy finder that comes with a lot of different things that
@@ -760,7 +761,8 @@ require('lazy').setup {
760761
-- You could remove this setup call if you don't like it,
761762
-- and try some other statusline plugin
762763
local statusline = require 'mini.statusline'
763-
statusline.setup()
764+
-- set use_icons to true if you have a Nerd Font
765+
statusline.setup { use_icons = vim.g.have_nerd_font }
764766

765767
-- You can configure sections in the statusline by overriding their
766768
-- default behavior. For example, here we set the section for
@@ -817,7 +819,27 @@ require('lazy').setup {
817819
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
818820
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
819821
-- { import = 'custom.plugins' },
820-
}
822+
}, {
823+
ui = {
824+
-- If you have a Nerd Font, set icons to an empty table which will use the
825+
-- default lazy.nvim defined Nerd Font icons otherwise define a unicode icons table
826+
icons = vim.g.have_nerd_font and {} or {
827+
cmd = '',
828+
config = '🛠',
829+
event = '📅',
830+
ft = '📂',
831+
init = '',
832+
keys = '🗝',
833+
plugin = '🔌',
834+
runtime = '💻',
835+
require = '🌙',
836+
source = '📄',
837+
start = '🚀',
838+
task = '📌',
839+
lazy = '💤 ',
840+
},
841+
},
842+
})
821843

822844
-- The line beneath this is called `modeline`. See `:help modeline`
823845
-- vim: ts=2 sts=2 sw=2 et

0 commit comments

Comments
 (0)