Skip to content

Commit bed671a

Browse files
dam9000hchienjo
authored andcommitted
Make the Nerd Font an optional requirement (nvim-lua#716)
1 parent 39ef2e9 commit bed671a

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
@@ -89,6 +89,9 @@ P.S. You can delete this when you're done too. It's your config now! :)
8989
vim.g.mapleader = ' '
9090
vim.g.maplocalleader = ' '
9191

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

@@ -310,10 +313,8 @@ require('lazy').setup {
310313
},
311314
{ 'nvim-telescope/telescope-ui-select.nvim' },
312315

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

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

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

0 commit comments

Comments
 (0)