From 26d870a30a61ea441cec526c343552bec788b856 Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Wed, 7 Jul 2021 22:33:29 +0300 Subject: [PATCH] neovim: add more config --- home/.config/nvim/init.lua | 2 +- home/.config/nvim/lua/colors/nord.lua | 15 ++++ home/.config/nvim/lua/mappings.lua | 23 ++++++- home/.config/nvim/lua/modules/colorizer.lua | 23 ++++--- .../lua/modules/{tree.lua => nvimtree.lua} | 0 home/.config/nvim/lua/modules/terminal.lua | 20 ++++++ home/.config/nvim/lua/modules/treesitter.lua | 6 ++ home/.config/nvim/lua/modules/ts-rainbow.lua | 7 ++ home/.config/nvim/lua/options.lua | 2 +- home/.config/nvim/lua/plugins.lua | 68 +++++++++++++++++-- 10 files changed, 143 insertions(+), 23 deletions(-) rename home/.config/nvim/lua/modules/{tree.lua => nvimtree.lua} (100%) create mode 100644 home/.config/nvim/lua/modules/terminal.lua create mode 100644 home/.config/nvim/lua/modules/treesitter.lua create mode 100644 home/.config/nvim/lua/modules/ts-rainbow.lua diff --git a/home/.config/nvim/init.lua b/home/.config/nvim/init.lua index f7f50c5..1be0f80 100644 --- a/home/.config/nvim/init.lua +++ b/home/.config/nvim/init.lua @@ -35,8 +35,8 @@ local load_core = function() disable_distribution_plugins() leader_map() require('plugins') - require('events').load_autocmds() require('mappings') + require('events').load_autocmds() end load_core() diff --git a/home/.config/nvim/lua/colors/nord.lua b/home/.config/nvim/lua/colors/nord.lua index 49fef47..5be6fa6 100644 --- a/home/.config/nvim/lua/colors/nord.lua +++ b/home/.config/nvim/lua/colors/nord.lua @@ -179,6 +179,12 @@ function M.highlight() vim.cmd('hi! link asciidocQuotedUnconstrainedEmphasized asciidocQuotedEmphasized') vim.cmd('hi! link asciidocURL markdownLinkText') + hi('awkCharClass', c.teal, '', '', '') + hi('awkPatterns' , c.blue, '', '', '') + vim.cmd('hi! link awkArrayElement Identifier') + vim.cmd('hi! link awkBoolLogic Keyword') + vim.cmd('hi! link awkBrktRegExp SpecialChar') + hi('DiffAdd' , c.green , c.grey1, '', '') hi('DiffChange', c.yellow, c.grey1, '', '') hi('DiffDelete', c.red , c.grey1, '', '') @@ -197,6 +203,15 @@ function M.highlight() hi('DashboardCenter' , c.blue , '', 'bold' , '') hi('DashboardShortcut', c.grey_bright, '', 'bold,italic', '') hi('DashboardFooter' , c.green , '', 'bold' , '') + + -- ts-rainbow + hi('rainbowcol1', c.red, '', 'bold', '') + hi('rainbowcol2', c.orange, '', 'bold', '') + hi('rainbowcol3', c.yellow, '', 'bold', '') + hi('rainbowcol4', c.green, '', 'bold', '') + hi('rainbowcol5', c.cyan, '', 'bold', '') + hi('rainbowcol6', c.blue, '', 'bold', '') + hi('rainbowcol7', c.purple, '', 'bold', '') end return M diff --git a/home/.config/nvim/lua/mappings.lua b/home/.config/nvim/lua/mappings.lua index 188fa74..44203c5 100644 --- a/home/.config/nvim/lua/mappings.lua +++ b/home/.config/nvim/lua/mappings.lua @@ -55,12 +55,29 @@ function toggleIndentStyle() end map('n', '', ':lua toggleIndentStyle()', opt) ------------------------ --- Plugins' bindings -- ------------------------ -- Move between tabs map('n', '', [[BufferLineCycleNext]], opt) map('n', '', [[BufferLineCyclePrev]], opt) -- NvimTree map('n', '', ':NvimTreeToggle', opt) + +--------------- +-- Which-key -- +--------------- +local wk = require('which-key') + +-- Don't need to show bufferline numbers +wk.register({ + ['1'] = 'which_key_ignore', + ['2'] = 'which_key_ignore', + ['3'] = 'which_key_ignore', + ['4'] = 'which_key_ignore', + ['5'] = 'which_key_ignore', + ['6'] = 'which_key_ignore', + ['7'] = 'which_key_ignore', + ['8'] = 'which_key_ignore', + ['9'] = 'which_key_ignore' +}) + +-- ToggleTerm diff --git a/home/.config/nvim/lua/modules/colorizer.lua b/home/.config/nvim/lua/modules/colorizer.lua index 2431060..ba96932 100644 --- a/home/.config/nvim/lua/modules/colorizer.lua +++ b/home/.config/nvim/lua/modules/colorizer.lua @@ -1,13 +1,14 @@ return require('colorizer').setup( - {'*';}, + {'*'}, { - RGB = true; -- #RGB hex codes - RRGGBB = true; -- #RRGGBB hex codes - names = true; -- "Name" codes like Blue - RRGGBBAA = true; -- #RRGGBBAA hex codes - rgb_fn = true; -- CSS rgb() and rgba() functions - hsl_fn = true; -- CSS hsl() and hsla() functions - css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true; -- Enable all CSS *functions*: rgb_fn, hsl_fn - mode = 'background'; -- Set the display mode. -}) + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = true, -- "Name" codes like Blue + RRGGBBAA = true, -- #RRGGBBAA hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn + mode = 'background' -- Set the display mode. + } +) diff --git a/home/.config/nvim/lua/modules/tree.lua b/home/.config/nvim/lua/modules/nvimtree.lua similarity index 100% rename from home/.config/nvim/lua/modules/tree.lua rename to home/.config/nvim/lua/modules/nvimtree.lua diff --git a/home/.config/nvim/lua/modules/terminal.lua b/home/.config/nvim/lua/modules/terminal.lua new file mode 100644 index 0000000..1a91861 --- /dev/null +++ b/home/.config/nvim/lua/modules/terminal.lua @@ -0,0 +1,20 @@ +local M = {} + +M.config = function() + require('toggleterm').setup { + open_mapping = [[]], + shade_terminals = false, + float_opts = { + border = 'curved', + width = 80, + height = 80, + winblend = 3, + highlights = { + border = 'Normal', + background = 'Normal' + } + } + } +end + +return M diff --git a/home/.config/nvim/lua/modules/treesitter.lua b/home/.config/nvim/lua/modules/treesitter.lua new file mode 100644 index 0000000..49cafcd --- /dev/null +++ b/home/.config/nvim/lua/modules/treesitter.lua @@ -0,0 +1,6 @@ +return require('nvim-treesitter.configs').setup { + ensure_installed = 'maintained', + highlight = { + enable = true + } +} diff --git a/home/.config/nvim/lua/modules/ts-rainbow.lua b/home/.config/nvim/lua/modules/ts-rainbow.lua new file mode 100644 index 0000000..93b63c8 --- /dev/null +++ b/home/.config/nvim/lua/modules/ts-rainbow.lua @@ -0,0 +1,7 @@ +return require('nvim-treesitter.configs').setup { + rainbow = { + enable = true, + extended_mode = false, + max_file_lines = 1000 + } +} diff --git a/home/.config/nvim/lua/options.lua b/home/.config/nvim/lua/options.lua index 288b5c0..2f70c1a 100644 --- a/home/.config/nvim/lua/options.lua +++ b/home/.config/nvim/lua/options.lua @@ -2,7 +2,7 @@ local opt = vim.opt local function load_options() vim.cmd('filetype indent plugin on') - vim.cmd('syntax on') + vim.cmd('syntax enable') vim.cmd('set iskeyword+=-') -- General settings diff --git a/home/.config/nvim/lua/plugins.lua b/home/.config/nvim/lua/plugins.lua index 3ef8cfa..d002a20 100644 --- a/home/.config/nvim/lua/plugins.lua +++ b/home/.config/nvim/lua/plugins.lua @@ -38,17 +38,19 @@ return packer.startup( 'kyazdani42/nvim-tree.lua', cmd = 'NvimTreeToggle', setup = function() - require('modules.tree') + require('modules.nvimtree') end } - - -- Editing use { - 'norcalli/nvim-colorizer.lua', - event = 'BufRead', + 'folke/which-key.nvim', + require('which-key').setup() + } + + -- Utils + use { + 'akinsho/nvim-toggleterm.lua', config = function() - require('modules.colorizer') - vim.cmd('ColorizerReloadAllBuffers') + require('modules.terminal').config() end } @@ -61,6 +63,58 @@ return packer.startup( end } + -- Highlighting + use { + 'norcalli/nvim-colorizer.lua', + event = 'BufRead', + config = function() + require('modules.colorizer') + vim.cmd('ColorizerReloadAllBuffers') + end + } + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate', + event = 'BufRead', + config = function() + require('modules.treesitter') + end + } + use { + 'p00f/nvim-ts-rainbow', + after = 'nvim-treesitter', + config = function() + require('modules.ts-rainbow') + end + } + use { + 'romgrk/nvim-treesitter-context', + after = 'nvim-treesitter' + } + -- LSP + use { + 'neovim/nvim-lspconfig' + } + use { + 'kabouzeid/nvim-lspinstall', + after = 'nvim-lspconfig' + } + + -- Editing + use { + 'terrortylor/nvim-comment', + cmd = 'CommentToggle', + config = function() + require('nvim_comment').setup() + end + } + use { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = function() + require('nvim-autopairs').setup() + end + } end )