neovim: add more config

This commit is contained in:
Hoang Nguyen 2021-07-07 22:33:29 +03:00
parent 0098bc351f
commit e03162b21a
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
10 changed files with 143 additions and 23 deletions

View File

@ -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()

View File

@ -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

View File

@ -55,12 +55,29 @@ function toggleIndentStyle()
end
map('n', '<A-t>', ':lua toggleIndentStyle()<CR>', opt)
-----------------------
-- Plugins' bindings --
-----------------------
-- Move between tabs
map('n', '<TAB>', [[<Cmd>BufferLineCycleNext<CR>]], opt)
map('n', '<S-TAB>', [[<Cmd>BufferLineCyclePrev<CR>]], opt)
-- NvimTree
map('n', '<C-n>', ':NvimTreeToggle<CR>', opt)
---------------
-- Which-key --
---------------
local wk = require('which-key')
-- Don't need to show bufferline numbers
wk.register({
['<leader>1'] = 'which_key_ignore',
['<leader>2'] = 'which_key_ignore',
['<leader>3'] = 'which_key_ignore',
['<leader>4'] = 'which_key_ignore',
['<leader>5'] = 'which_key_ignore',
['<leader>6'] = 'which_key_ignore',
['<leader>7'] = 'which_key_ignore',
['<leader>8'] = 'which_key_ignore',
['<leader>9'] = 'which_key_ignore'
})
-- ToggleTerm

View File

@ -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.
}
)

View File

@ -0,0 +1,20 @@
local M = {}
M.config = function()
require('toggleterm').setup {
open_mapping = [[<c-\>]],
shade_terminals = false,
float_opts = {
border = 'curved',
width = 80,
height = 80,
winblend = 3,
highlights = {
border = 'Normal',
background = 'Normal'
}
}
}
end
return M

View File

@ -0,0 +1,6 @@
return require('nvim-treesitter.configs').setup {
ensure_installed = 'maintained',
highlight = {
enable = true
}
}

View File

@ -0,0 +1,7 @@
return require('nvim-treesitter.configs').setup {
rainbow = {
enable = true,
extended_mode = false,
max_file_lines = 1000
}
}

View File

@ -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

View File

@ -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
)