neovim: add more plugins

This commit is contained in:
Hoang Nguyen 2021-08-31 05:44:47 +07:00
parent c31868c416
commit 7deb0d68f1
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
8 changed files with 204 additions and 94 deletions

View File

@ -9,7 +9,7 @@ local disable_distribution_plugins = function()
vim.g.loaded_vimball = 1
vim.g.loaded_vimballPlugin = 1
vim.g.loaded_matchit = 1
-- vim.g.loaded_matchparen = 1
vim.g.loaded_matchparen = 1
vim.g.loaded_2html_plugin = 1
vim.g.loaded_logiPat = 1
vim.g.loaded_rrhelper = 1

View File

@ -111,8 +111,8 @@ local function highlight_editors()
-- Statusline
hi('StatusLine' , c.cyan, c.grey3, '', '')
hi('StatusLineNC' , c.fg , c.grey3, '', '')
hi('StatusLineTerm' , c.cyan, c.grey3, '', '')
hi('StatusLineTermNC', c.fg , c.grey3, '', '')
-- hi('StatusLineTerm' , c.cyan, c.grey3, '', '')
-- hi('StatusLineTermNC', c.fg , c.grey3, '', '')
-- Search
hi('IncSearch', c.white2, c.dark_blue, 'underline', '')
@ -229,7 +229,7 @@ local function highlight_treesitter()
hi('TSTagDelimiter', c.fg, '', '', '')
vim.cmd('hi! link TSAnnotation Annotation')
vim.cmd('hi! link TSConstructor Function')
vim.cmd('hi! link TSError Error')
-- vim.cmd('hi! link TSError Error')
vim.cmd('hi! link TSFuncBuiltin Function')
vim.cmd('hi! link TSFunction Function')
vim.cmd('hi! link TSFuncMacro Function')
@ -265,7 +265,7 @@ local function highlight_lsp()
hi('LspReferenceText', c.fg, c.grey_bright, '', '')
hi('LspReferenceRead', c.fg, c.grey_bright, '', '')
hi('LspReferenceWrite', c.fg, c.grey_bright, '', '')
hi('LspCodeLens', c.grey_bright, '', 'italic', '')
vim.cmd('hi! link LspCodeLens Comment')
end
-- Specify groups for plugins

View File

@ -53,14 +53,14 @@ function M.load_autocmds()
{"BufEnter,BufWinEnter,WinEnter,CmdwinEnter", "*", [[if bufname('%') == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif]]}
},
wins = {
-- Equalize window dimensions when resizing vim window
{"VimResized", "*", [[tabdo wincmd =]]},
-- Force writing shada on leaving nvim
{"VimLeave", "*", [[if has('nvim') | wshada! | else | wviminfo! | endif]]},
-- Check if file changed when its window is focus, more eager than 'autoread'
{"FocusGained", "* checktime"}
},
-- wins = {
-- -- Equalize window dimensions when resizing vim window
-- {"VimResized", "*", [[tabdo wincmd =]]},
-- -- Force writing shada on leaving nvim
-- {"VimLeave", "*", [[if has('nvim') | wshada! | else | wviminfo! | endif]]},
-- -- Check if file changed when its window is focus, more eager than 'autoread'
-- {"FocusGained", "* checktime"}
-- },
ft = {
{"FileType", "dashboard", "set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2"},

View File

@ -0,0 +1,31 @@
vim.cmd [[ call wilder#setup({'modes': [':', '/', '?']}) ]]
-- Doesn't work yet. Bugs in Neovim (see neovim/neovim#14809 and gelguy/wilder.nvim#53)
-- so can't do multi-line config inside vim.cmd [[ ]] with \
vim.cmd [[
call wilder#set_option('renderer', wilder#renderer_mux({
\ ':': wilder#popupmenu_renderer({
\ 'highlighter': wilder#basic_highlighter(),
\ 'left': wilder#popupmenu_devicons(),
\ 'right': [' ', wilder#popupmenu_scrollbar()]
\ }),
\ '/': wilder#wildmenu_renderer({
\ 'highlighter': wilder#basic_highlighter(),
\ 'separator': ' · ',
\ 'right': [' ', wilder#wildmenu_index()]
\ })
\ }))
]]
vim.cmd [[
call wilder#set_option('pipeline', [
\ wilder#branch(
\ wilder#python_file_finder_pipeline({
\ 'file_command': ['fd', '--type', 'f', '--follow', '--hidden', '--exclude', '.git'],
\ 'dir_command': ['fd', '--type', 'd', '--follow', '--hidden', '--exclude', '.git']
\ }),
\ wilder#cmdline_pipeline({'language': 'python'}),
\ wilder#python_search_pipeline()
\ )
\ ])
]]

View File

@ -1,7 +1,7 @@
local function tree_options()
vim.g.nvim_tree_width = 35
vim.g.nvim_tree_ignore = {'.git', '.hg', '.svn', 'node_modules'}
vim.g.nvim_tree_auto_open = 1
vim.g.nvim_tree_auto_open = 0
vim.g.nvim_tree_auto_close = 1
vim.g.nvim_tree_auto_ignore_ft = {'dashboard'}
vim.g.nvim_tree_follow = 1

View File

@ -0,0 +1,33 @@
return require('nvim-treesitter.configs').setup {
textobjects = {
select = {
enable = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner"
}
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]["] = "@function.outer",
["]m"] = "@class.outer"
},
goto_next_end = {
["]]"] = "@function.outer",
["]M"] = "@class.outer"
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer"
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer"
}
}
}
}

View File

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

View File

@ -13,9 +13,9 @@ return require('packer').startup(
function(use)
use {'wbthomason/packer.nvim', opt = true}
-----------------
-- UI elements --
-----------------
--------
-- UI --
--------
use {
'glepnir/dashboard-nvim',
cmd = {
@ -32,7 +32,7 @@ return require('packer').startup(
require('modules.dashboard')
end
}
use {
use { -- TODO: consider moving to felline.nvim
'glepnir/galaxyline.nvim',
branch = 'main',
requires = 'kyazdani42/nvim-web-devicons',
@ -42,6 +42,7 @@ return require('packer').startup(
}
use {
'akinsho/nvim-bufferline.lua',
event = 'BufRead',
config = function()
require('modules.bufferline')
end
@ -81,7 +82,7 @@ return require('packer').startup(
}
use {
'RRethy/vim-illuminate',
event = {'BufRead', 'BufNewFile'}
event = {'BufReadPre', 'BufNewFile'}
}
use {
'lukas-reineke/indent-blankline.nvim',
@ -95,7 +96,10 @@ return require('packer').startup(
run = ':TSUpdate',
event = 'BufRead',
config = function()
require('modules.treesitter')
require('nvim-treesitter.configs').setup {
ensure_installed = 'maintained',
highlight = {enable = true}
}
end
}
use {
@ -105,7 +109,7 @@ return require('packer').startup(
require('nvim-treesitter.configs').setup {
rainbow = {
enable = true,
extended_mode = false,
extended_mode = true,
max_file_lines = 1000
}
}
@ -115,6 +119,23 @@ return require('packer').startup(
'romgrk/nvim-treesitter-context',
after = 'nvim-treesitter'
}
use { -- TODO: define whichkey
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter',
config = function()
require('modules.textobjects')
end
}
use {
'andymass/vim-matchup',
after = 'nvim-treesitter',
config = function()
vim.g.matchup_matchparen_offscreen = {method = 'popup'}
require('nvim-treesitter.configs').setup {
matchup = {enable = true}
}
end
}
---------
-- LSP --
@ -126,6 +147,14 @@ return require('packer').startup(
require('modules.lsp')
end
}
use {
'ray-x/lsp_signature.nvim',
after = 'nvim-lspconfig'
}
use { -- TODO: colors + config
'glepnir/lspsaga.nvim',
after = 'nvim-lspconfig'
}
use {
'onsails/lspkind-nvim',
event = 'InsertEnter',
@ -133,9 +162,13 @@ return require('packer').startup(
require('lspkind').init({with_text = false})
end
}
use {
'ahmedkhalf/lsp-rooter.nvim',
after = 'nvim-lspconfig'
}
use {
'folke/trouble.nvim',
event = 'BufRead',
cmd = {'Trouble', 'TroubleToggle', 'TroubleRefresh'},
config = function()
require('modules.lsptrouble')
end
@ -150,15 +183,15 @@ return require('packer').startup(
}
end
}
use {
use { -- TODO: replace with nvim-cmp
'hrsh7th/nvim-compe',
event = 'InsertEnter',
config = function()
require('modules.completion')
end
}
use {
'L3MON4D3/LuaSnip', -- can't lazy-load (conflicts with autopairs' map_cr)
use { -- TODO: lazy-loaded + work with autopairs
'L3MON4D3/LuaSnip',
requires = 'rafamadriz/friendly-snippets',
config = function()
require('modules.snippets')
@ -189,6 +222,13 @@ return require('packer').startup(
require('modules.telescope-nvim')
end
}
use { -- Telescope file browser doesn't support dotfiles
'mcchrish/nnn.vim',
cmd = 'NnnPicker',
config = function()
require('modules.picker')
end
}
use { -- TODO: colors + config
'pwntester/octo.nvim',
cmd = 'Octo',
@ -240,6 +280,78 @@ return require('packer').startup(
vim.g.compe.source.vim_dadbod_completion = true
end
}
use {
'iamcco/markdown-preview.nvim',
run = 'cd app && yarn install',
ft = {'markdown', 'pandoc.markdown', 'rmd'},
config = function()
require('modules.markdown-preview')
end
}
use {
'turbio/bracey.vim',
run = 'npm install --prefix server',
cmd = 'Bracey'
}
use {
'folke/zen-mode.nvim',
cmd = 'ZenMode',
wants = 'twilight.nvim',
requires = {{'folke/twilight.nvim', opt = true}},
config = function()
require('modules.zen')
end
}
use { -- shouldn't be lazy-loaded (otherwise bindings don't work)
'kristijanhusak/orgmode.nvim',
ft = 'org',
config = function()
require('modules.org')
end
}
use {
'echuraev/translate-shell.vim',
cmd = {'Trans', 'TransSelectDirection'},
config = function()
require('modules.translate-shell')
end
}
use {
'akinsho/nvim-toggleterm.lua',
cmd = 'ToggleTerm',
config = function()
require('modules.terminal')
end
}
-- use {
-- 'gelguy/wilder.nvim',
-- run = ':UpdateRemotePlugins',
-- event = 'CmdlineEnter',
-- config = function()
-- require('modules.cmdline')
-- end
-- }
use {
'karb94/neoscroll.nvim',
event = 'WinScrolled',
config = function()
require('neoscroll').setup()
end
}
use { -- TODO: colors
'michaelb/sniprun',
run = 'bash ./install.sh 1',
cmd = 'SnipRun'
}
use {
'sbdchd/neoformat',
cmd = 'Neoformat'
}
use {'tweekmonster/startuptime.vim', cmd = 'StartupTime'} -- Just for benchmarking
------------
-- Editor --
------------
use {
'windwp/nvim-autopairs',
event = 'InsertCharPre',
@ -264,7 +376,7 @@ return require('packer').startup(
}
use {
'junegunn/vim-easy-align',
keys = 'ga'
cmd = 'EasyAlign'
}
use {
'terrortylor/nvim-comment',
@ -289,71 +401,11 @@ return require('packer').startup(
wants = 'nvim-treesitter',
config = function()
require('nvim-treesitter.configs').setup {
autotag = {
enable = true
}
autotag = {enable = true}
}
end
}
use {
'ahmedkhalf/lsp-rooter.nvim',
after = 'nvim-lspconfig'
}
use {
'iamcco/markdown-preview.nvim',
run = 'cd app && yarn install',
ft = {'markdown', 'pandoc.markdown', 'rmd'},
config = function()
require('modules.markdown-preview')
end
}
use {
'turbio/bracey.vim',
run = 'npm install --prefix server',
cmd = 'Bracey'
}
use {
'folke/zen-mode.nvim',
cmd = 'ZenMode',
wants = 'twilight.nvim',
requires = {{'folke/twilight.nvim', opt = true}},
config = function()
require('modules.zen')
end
}
use {
'kristijanhusak/orgmode.nvim', -- shouldn't be lazy-loaded (otherwise bindings don't work)
ft = 'org',
config = function()
require('modules.org')
end
}
use {
'echuraev/translate-shell.vim',
cmd = {'Trans', 'TransSelectDirection'},
config = function()
require('modules.translate-shell')
end
}
use {
'akinsho/nvim-toggleterm.lua',
cmd = 'ToggleTerm',
config = function()
require('modules.terminal')
end
}
-- Just for benchmarking
use {'tweekmonster/startuptime.vim', cmd = 'StartupTime'}
-- File picker, since Telescope file browser doesn't support dotfiles
use {
'mcchrish/nnn.vim',
cmd = 'NnnPicker',
config = function()
require('modules.picker')
end
}
-- TODO: lspsaga, nvim-lint, format(ter).nvim, rest.nvim, sqls.nvim,
-- nvim-spectre, nvim-dap, dial.nvim, asynctasks.nvim
-- TODO: nvim-lint, rest.nvim, sqls.nvim, nvim-spectre, nvim-dap-ui, dial.nvim, asynctasks.nvim
end
)