neovim: revamp

- packer: load vim-eft, nvim-spectre, nvim-dap, persistence.nvim on key
  press instead of on Vim event
- keybindings: redefine multiple, move keybindings for plugins loaded on
  key press to their configs
- plugins: add winshift.nvim, better-escape.nvim, window-picker.nvim,
  neogen, spellsitter.nvim, nvim-lightbulb, close-buffers.nvim
- init.lua: move autocmds back inside async loop (filetype events already
  got handled by filetype.nvim)
- zen-mode.nvim + twilight.nvim: move from 'tools' to 'editor' group
- lsp: change signs characters for unification
- dap: initial config, keybindings
- feline.nvim: reorder elements, add nvim-lightbulb signs
- chore: unify the way setup() is called, and format stuff
This commit is contained in:
FollieHiyuki 2021-10-12 02:33:22 +07:00
parent a2a7caa279
commit 61b5cb5b70
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
11 changed files with 502 additions and 208 deletions

View File

@ -1,5 +1,6 @@
local async local async
async = vim.loop.new_async(vim.schedule_wrap(function() async = vim.loop.new_async(vim.schedule_wrap(function()
require('autocmd')
require('plugins') require('plugins')
require('mappings') require('mappings')
async:close() async:close()
@ -10,5 +11,4 @@ local options = require('options')
options.disable_default_plugins() options.disable_default_plugins()
options.load_options() options.load_options()
require('colors.' .. vim.g.global_theme).highlight() require('colors.' .. vim.g.global_theme).highlight()
require('autocmd')
async:send() async:send()

View File

@ -1,20 +1,16 @@
local definitions = { local definitions = {
-- ':h hex-editing' bufs = {
-- binary = { -- Reload vim config automatically
-- {'BufReadPre' , '*.bin,*.exe', 'let &bin=1'}, {'BufWritePost', [[$VIM_PATH/{*.vim,*.yaml,vimrc} nested source $MYVIMRC | redraw]]},
-- {'BufReadPost' , '*.bin,*.exe', 'if &bin | %!xxd'}, -- Reload Vim script automatically if setlocal autoread
-- {'BufReadPost' , '*.bin,*.exe', 'set ft=xxd | endif'}, {'BufWritePost,FileWritePost', '*.vim', [[nested if &l:autoread > 0 | source <afile> | echo 'source ' . bufname('%') | endif]]},
-- {'BufWritePre' , '*.bin,*.exe', 'if &bin | %!xxd -r'}, -- No undo for temporary files
-- {'BufWritePre' , '*.bin,*.exe', 'endif'}, {'BufWritePre', '/tmp/*', 'setlocal noundofile'},
-- {'BufWritePost', '*.bin,*.exe', 'if &bin | %!xxd'}, {'BufWritePre', 'COMMIT_EDITMSG', 'setlocal noundofile'},
-- {'BufWritePost', '*.bin,*.exe', 'set nomod | endif'} {'BufWritePre', 'MERGE_MSG', 'setlocal noundofile'},
-- }, {'BufWritePre', '*.tmp', 'setlocal noundofile'},
{'BufWritePre', '*.bak', 'setlocal noundofile'}
-- Auto-hide UI elements in specific buffers },
-- buf = {
-- {'BufEnter', 'term://*', 'setlocal norelativenumber nonumber'},
-- {'BufEnter,BufWinEnter,WinEnter,CmdwinEnter', '*', [[if bufname('%') == 'NvimTree' | set laststatus=0 | else | set laststatus=2 | endif]]}
-- },
wins = { wins = {
-- Equalize window dimensions when resizing vim window -- Equalize window dimensions when resizing vim window
@ -22,7 +18,7 @@ local definitions = {
-- Force writing shada on leaving nvim -- Force writing shada on leaving nvim
{'VimLeave', '*', [[if has('nvim') | wshada! | else | wviminfo! | endif]]}, {'VimLeave', '*', [[if has('nvim') | wshada! | else | wviminfo! | endif]]},
-- Check if file changed when its window is focus, more eager than 'autoread' -- Check if file changed when its window is focus, more eager than 'autoread'
-- {'FocusGained', '* checktime'} {'FocusGained', '* checktime'}
}, },
yank = { yank = {

View File

@ -280,27 +280,27 @@ local function highlight_lsp()
vim.api.nvim_command('hi! link LspCodeLens Comment') vim.api.nvim_command('hi! link LspCodeLens Comment')
-- Theses are for neovim 0.6 -- Theses are for neovim 0.6
vim.api.nvim_command('hi! link DiagnosticVirtualTextWarn LspDiagnosticsVirtualTextWarning') -- vim.api.nvim_command('hi! link DiagnosticVirtualTextWarn LspDiagnosticsVirtualTextWarning')
vim.api.nvim_command('hi! link DiagnosticUnderlineWarn LspDiagnosticsUnderlineWarning') -- vim.api.nvim_command('hi! link DiagnosticUnderlineWarn LspDiagnosticsUnderlineWarning')
vim.api.nvim_command('hi! link DiagnosticFloatingWarn LspDiagnosticsFloatingWarning') -- vim.api.nvim_command('hi! link DiagnosticFloatingWarn LspDiagnosticsFloatingWarning')
vim.api.nvim_command('hi! link DiagnosticSignWarn LspDiagnosticsSignWarning') -- vim.api.nvim_command('hi! link DiagnosticSignWarn LspDiagnosticsSignWarning')
vim.api.nvim_command('hi! link DiagnosticVirtualTextError LspDiagnosticsVirtualTextError') -- vim.api.nvim_command('hi! link DiagnosticVirtualTextError LspDiagnosticsVirtualTextError')
vim.api.nvim_command('hi! link DiagnosticUnderlineError LspDiagnosticsUnderlineError') -- vim.api.nvim_command('hi! link DiagnosticUnderlineError LspDiagnosticsUnderlineError')
vim.api.nvim_command('hi! link DiagnosticFloatingError LspDiagnosticsFloatingError') -- vim.api.nvim_command('hi! link DiagnosticFloatingError LspDiagnosticsFloatingError')
vim.api.nvim_command('hi! link DiagnosticSignError LspDiagnosticsSignError') -- vim.api.nvim_command('hi! link DiagnosticSignError LspDiagnosticsSignError')
vim.api.nvim_command('hi! link DiagnosticVirtualTextInfo LspDiagnosticsVirtualTextInformation') -- vim.api.nvim_command('hi! link DiagnosticVirtualTextInfo LspDiagnosticsVirtualTextInformation')
vim.api.nvim_command('hi! link DiagnosticUnderlineInfo LspDiagnosticsUnderlineInformation') -- vim.api.nvim_command('hi! link DiagnosticUnderlineInfo LspDiagnosticsUnderlineInformation')
vim.api.nvim_command('hi! link DiagnosticFloatingInfo LspDiagnosticsFloatingInformation') -- vim.api.nvim_command('hi! link DiagnosticFloatingInfo LspDiagnosticsFloatingInformation')
vim.api.nvim_command('hi! link DiagnosticSignInfo LspDiagnosticsSignInformation') -- vim.api.nvim_command('hi! link DiagnosticSignInfo LspDiagnosticsSignInformation')
vim.api.nvim_command('hi! link DiagnosticVirtualTextHint LspDiagnosticsVirtualTextHint') -- vim.api.nvim_command('hi! link DiagnosticVirtualTextHint LspDiagnosticsVirtualTextHint')
vim.api.nvim_command('hi! link DiagnosticUnderlineHint LspDiagnosticsUnderlineHint') -- vim.api.nvim_command('hi! link DiagnosticUnderlineHint LspDiagnosticsUnderlineHint')
vim.api.nvim_command('hi! link DiagnosticFloatingHint LspDiagnosticsFloatingHint') -- vim.api.nvim_command('hi! link DiagnosticFloatingHint LspDiagnosticsFloatingHint')
vim.api.nvim_command('hi! link DiagnosticSignHint LspDiagnosticsSignHint') -- vim.api.nvim_command('hi! link DiagnosticSignHint LspDiagnosticsSignHint')
end end
-- Specify groups for plugins -- Specify groups for plugins
local function highlight_plugins() local function highlight_plugins()
-- nvim-cmp (experimental custom menu) -- nvim-cmp
hi('CmpItemAbbr', c.fg, '', '', '') hi('CmpItemAbbr', c.fg, '', '', '')
hi('CmpItemAbbrMatch', c.yellow, '', '', '') hi('CmpItemAbbrMatch', c.yellow, '', '', '')
hi('CmpItemAbbrMatchFuzzy', c.yellow, '', '', '') hi('CmpItemAbbrMatchFuzzy', c.yellow, '', '', '')
@ -365,8 +365,13 @@ local function highlight_plugins()
hi('IndentBlanklineChar', c.grey1, '', '', '') hi('IndentBlanklineChar', c.grey1, '', '', '')
hi('IndentBlanklineContextChar', c.grey1, '', '', '') hi('IndentBlanklineContextChar', c.grey1, '', '', '')
-- window-picker.nvim
hi('WindowPicker', c.fg, c.blue, 'bold', '')
hi('WindowPickerSwap', c.fg, c.orange, 'bold', '')
-- vim-illuminate -- vim-illuminate
vim.api.nvim_command('hi! link illuminatedWord Underline') vim.api.nvim_command('hi! link illuminatedWord Underline')
vim.api.nvim_command('hi! link illuminatedCurWord Underline')
-- trouble.nvim -- trouble.nvim
hi('LspTroubleText', c.blue, '', 'bold', '') hi('LspTroubleText', c.blue, '', 'bold', '')

View File

@ -1,15 +1,5 @@
local M = {} local M = {}
local function hi(group, guifg, guibg, attr, guisp)
local fg = guifg ~= '' and 'guifg=' .. guifg or 'guifg=NONE'
local bg = guibg ~= '' and 'guibg=' .. guibg or 'guibg=NONE'
local style = attr ~= '' and 'gui=' .. attr or 'gui=NONE'
local sp = guisp ~= '' and 'guisp=' .. guisp or ''
local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp
vim.api.nvim_command(hl)
end
M.colors = { M.colors = {
black = '#282C34', black = '#282C34',
grey1 = '#3E4452', grey1 = '#3E4452',
@ -34,6 +24,16 @@ M.colors = {
local c = M.colors local c = M.colors
local function hi(group, guifg, guibg, attr, guisp)
local fg = guifg ~= '' and 'guifg=' .. guifg or 'guifg=NONE'
local bg = guibg ~= '' and 'guibg=' .. guibg or 'guibg=NONE'
local style = attr ~= '' and 'gui=' .. attr or 'gui=NONE'
local sp = guisp ~= '' and 'guisp=' .. guisp or ''
local hl = 'hi ' .. group .. ' ' .. fg .. ' ' .. bg .. ' ' .. style .. ' ' .. sp
vim.api.nvim_command(hl)
end
function M.highlight() function M.highlight()
hi('ModeMsg', c.green, '', '', '') hi('ModeMsg', c.green, '', '', '')
end end

View File

@ -18,9 +18,6 @@ local function pandoc_convert(ofiletype)
vim.fn.jobstart(cmd) vim.fn.jobstart(cmd)
end end
-- No one likes Esc
api.nvim_set_keymap('i', 'jk', [[<Esc>]], {noremap = true, silent = true})
-- Escape to normal mode in terminal buffer -- Escape to normal mode in terminal buffer
api.nvim_set_keymap('t', '<Esc>', '<C-\\><C-n>', {noremap = true, silent = true}) api.nvim_set_keymap('t', '<Esc>', '<C-\\><C-n>', {noremap = true, silent = true})
@ -28,17 +25,13 @@ api.nvim_set_keymap('t', '<Esc>', '<C-\\><C-n>', {noremap = true, silent = true}
api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true}) api.nvim_set_keymap('v', '<', '<gv', {noremap = true, silent = true})
api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true}) api.nvim_set_keymap('v', '>', '>gv', {noremap = true, silent = true})
-- vim-eft -- winshift.nvim
api.nvim_set_keymap('n', 'f', '<Plug>(eft-f)', {}) api.nvim_set_keymap('n', '<C-w><C-m>', ':WinShift<CR>', {noremap = true, silent = true})
api.nvim_set_keymap('x', 'f', '<Plug>(eft-f)', {}) api.nvim_set_keymap('n', '<C-w>m', ':WinShift<CR>', {noremap = true, silent = true})
api.nvim_set_keymap('n', 'F', '<Plug>(eft-F)', {}) api.nvim_set_keymap('n', '<C-A-h>', ':WinShift left<CR>', {noremap = true, silent = true})
api.nvim_set_keymap('x', 'F', '<Plug>(eft-F)', {}) api.nvim_set_keymap('n', '<C-A-j>', ':WinShift down<CR>', {noremap = true, silent = true})
api.nvim_set_keymap('n', 't', '<Plug>(eft-t)', {}) api.nvim_set_keymap('n', '<C-A-k>', ':WinShift up<CR>', {noremap = true, silent = true})
api.nvim_set_keymap('x', 't', '<Plug>(eft-t)', {}) api.nvim_set_keymap('n', '<C-A-l>', ':WinShift right<CR>', {noremap = true, silent = true})
api.nvim_set_keymap('n', 'T', '<Plug>(eft-T)', {})
api.nvim_set_keymap('x', 'T', '<Plug>(eft-T)', {})
api.nvim_set_keymap('n', ';', '<Plug>(eft-repeat)', {})
api.nvim_set_keymap('x', ';', '<Plug>(eft-repeat)', {})
----------------- -----------------
-- Normal mode -- -- Normal mode --
@ -51,18 +44,14 @@ wk.register({
H = {'^', 'Start of the line'}, H = {'^', 'Start of the line'},
L = {'$', 'End of the line'}, L = {'$', 'End of the line'},
-- Easier moving between windows -- Close a window
-- ['<C-h>'] = {'<C-w>h', 'Go to the left window'}, ['<C-q>'] = {'<C-w>q', 'Quit current window'},
-- ['<C-l>'] = {'<C-w>l', 'Go to the right window'},
-- ['<C-j>'] = {'<C-w>j', 'Go to the down window'},
-- ['<C-k>'] = {'<C-w>k', 'Go to the up window'},
['<C-q>'] = {'<C-w>q', 'Quit a window'},
-- Copy the whole buffer -- Copy the whole buffer
['<C-a>'] = {'<Cmd>%y+<CR>', 'Copy whole buffer'}, ['<C-a>'] = {':%y+<CR>', 'Copy whole buffer'},
-- Close buffer -- Close buffer
['<C-x>'] = {':bd!<CR>', 'Close buffer'}, ['<C-x>'] = {':bdelete<CR>', 'Close current buffer'},
-- Remove trailing whitespace -- Remove trailing whitespace
['<A-w>'] = {':%s/\\s\\+$//e<CR>', 'Remove trailing'}, ['<A-w>'] = {':%s/\\s\\+$//e<CR>', 'Remove trailing'},
@ -108,14 +97,17 @@ wk.register({
D = 'Go to declaration', D = 'Go to declaration',
i = 'Go to implementation', i = 'Go to implementation',
r = 'Go to references', r = 'Go to references',
R = {'<Cmd>TroubleToggle lsp_references<CR>', 'Reference list'} R = {':TroubleToggle lsp_references<CR>', 'Reference list'}
}, },
K = {name = 'Hover'}, K = {name = 'Hover'},
z = {name = 'Misc utils'}, z = {name = 'Misc utils'},
-- Window picker
['-'] = {':WindowPick<CR>', 'Choose window'},
-- Move between tabs -- Move between tabs
['<TAB>'] = {'<Cmd>BufferLineCycleNext<CR>', 'Next buffer'}, ['<TAB>'] = {':BufferLineCycleNext<CR>', 'Next buffer'},
['<S-TAB>'] = {'<Cmd>BufferLineCyclePrev<CR>', 'Previous buffer'}, ['<S-TAB>'] = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
-- NvimTree -- NvimTree
['<C-n>'] = {':NvimTreeToggle<CR>', 'NvimTree'}, ['<C-n>'] = {':NvimTreeToggle<CR>', 'NvimTree'},
@ -134,25 +126,21 @@ wk.register({
-- Normal mode (with leader key) -- -- Normal mode (with leader key) --
----------------------------------- -----------------------------------
wk.register({ wk.register({
a = {
name = 'Action',
a = {':EasyAlign<CR>', 'Align elements'},
s = {':ISwapWith<CR>', 'Swap elements'}
},
b = { b = {
name = 'Buffer/Tab', name = 'Buffer',
c = {':ColorizerToggle<CR>', 'Colorizer'}, c = {':ColorizerToggle<CR>', 'Colorizer'},
d = {':bdelete<CR>', 'Close buffer'}, d = {
name = 'Delete',
a = {':BDelete all<CR>', 'All buffers'},
d = {':BDelete this<CR>', 'Current buffer'},
h = {':BDelete hidden<CR>', 'Hidden buffers'},
n = {':BDelete nameless<CR>', 'Buffers without name'},
o = {':BDelete other<CR>', 'Other buffers'}
},
j = {':BufferLineCyclePrev<CR>', 'Previous buffer'}, j = {':BufferLineCyclePrev<CR>', 'Previous buffer'},
k = {':BufferLineCycleNext<CR>', 'Next buffer'}, k = {':BufferLineCycleNext<CR>', 'Next buffer'},
n = {':enew<CR>', 'New buffer'}, n = {':enew<CR>', 'New buffer'},
u = {':UndotreeToggle<CR>', 'Undotree'}, u = {':UndotreeToggle<CR>', 'Undotree'},
z = {':ZenMode<CR>', 'Zen mode'},
D = {'<Cmd>tabclose<CR>', 'Close tab'},
J = {'<Cmd>tabprev<CR>', 'Previous tab'},
K = {'<Cmd>tabnext<CR>', 'Next tab'},
N = {'<Cmd>tabnew<CR>', 'New tab'},
v = { v = {
name = 'Convert', name = 'Convert',
m = {function() pandoc_convert('md') end, 'To Markdown'}, m = {function() pandoc_convert('md') end, 'To Markdown'},
@ -166,23 +154,29 @@ wk.register({
d = { d = {
name = 'DAP', name = 'DAP',
b = {':lua require("dap").toggle_breakpoint()<CR>', 'Toggle breakpoint'}, b = 'Toggle breakpoint',
c = {':lua require("dapui").close()<CR>', 'Close UI'}, B = 'Set breakpoint with condition',
e = {':lua require("dapui").eval()<CR>', 'Evaluate cursorword'}, c = 'Run to cursor',
f = {':lua require("dapui").float_element()<CR>', 'Float elements'}, d = 'Disconnect adapter',
i = {':lua require("dap").repl.open()<CR>', 'Inspect via REPL'}, e = 'Hover under cursor (UI)',
n = {':lua require("dap").step_into()<CR>', 'Step through code'}, f = 'Open float window (UI)',
o = {':lua require("dapui").open()<CR>', 'Open UI'}, i = 'Step into function/method',
s = {':lua require("dap").continue()<CR>', 'Debug session'}, l = 'List breakpoints',
t = {':lua require("dapui").open()<CR>', 'Toggle UI'} n = 'Resume the execution',
o = 'Step out of function/method',
r = 'Inspect in REPL',
t = 'Toggle UI',
v = 'Run again 1 step',
z = 'Re-run the last adapter'
}, },
e = { e = {
name = 'Session', name = 'Editor',
s = {':lua require("persistence").save()<CR>', 'Save session for current directory'}, a = {':EasyAlign<CR>', 'Align elements'},
d = {':lua require("persistence").stop()<CR>', 'Stop automatically saving'}, g = 'Generate annotations',
l = {':lua require("persistence").load({last = true})<CR>', 'Load last session'}, s = {':ISwapWith<CR>', 'Swap elements'},
r = {':lua require("persistence").load()<CR>', 'Load session for current directory'} t = {':Twilight<CR>', 'Twilight mode'},
z = {':ZenMode<CR>', 'Zen mode'}
}, },
-- Telescope -- Telescope
@ -223,6 +217,8 @@ wk.register({
S = 'Stage buffer', S = 'Stage buffer',
u = 'Undo hunk', u = 'Undo hunk',
U = 'Reset buffer index', U = 'Reset buffer index',
y = 'Get remote url for cursorline',
Y = 'Get remote url',
n = {':Neogit<CR>', 'Neogit'}, n = {':Neogit<CR>', 'Neogit'},
f = { f = {
name = 'Telescope', name = 'Telescope',
@ -279,6 +275,13 @@ wk.register({
} }
}, },
p = {
name = 'Find/Replace',
o = 'Open spectre',
p = 'Search in current file',
w = 'Find/replace cursorword'
},
r = { r = {
name = 'REST', name = 'REST',
c = {'<Plug>RestNvim', 'Run request under cursor'}, c = {'<Plug>RestNvim', 'Run request under cursor'},
@ -287,10 +290,11 @@ wk.register({
}, },
s = { s = {
name = 'Find/Replace', name = 'Session',
o = {':lua require("spectre").open()<CR>', 'Open spectre'}, s = 'Save session for current directory',
p = {'viw:lua require("spectre").open_file_search()<CR>', 'Search in current file'}, d = 'Stop automatically saving',
w = {':lua require("spectre").open_visual({select_word = true})<CR>', 'Find/replace cursorword'}, l = 'Load last session',
r = 'Load session for current directory'
}, },
-- t = { -- t = {
@ -327,13 +331,14 @@ wk.register({
d = { d = {
name = 'DAP', name = 'DAP',
e = {':lua require("dapui").eval()<CR>', 'Evaluate highlighted text'} e = 'Hover on range (UI)'
}, },
g = { g = {
name = 'Git', name = 'Git',
r = 'Reset hunk', r = 'Reset hunk',
s = 'Stage hunk' s = 'Stage hunk',
y = 'Get remote url for range'
}, },
j = { j = {
@ -344,7 +349,7 @@ wk.register({
c = {'c<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'} c = {'c<C-R>=system(\'trans -brief -no-ansi :\', getreg(""))[:-2]<S-Left><S-Left><Right>', 'Translate and replace with direction'}
}, },
s = {':lua require("spectre").open_visual()<CR>', 'Find/Replace'} p = 'Find/Replace'
}, {mode = 'v', prefix = '<leader>'}) }, {mode = 'v', prefix = '<leader>'})
------------------------ ------------------------

View File

@ -62,22 +62,25 @@ function M.cmp_conf()
return vim_item return vim_item
end end
}, },
-- documentation = {
-- border = {'╭', '─', '╮', '│', '╯', '─', '╰', '│'}
-- },
mapping = { mapping = {
['<C-Space>'] = cmp.mapping.complete(), ['<C-Space>'] = cmp.mapping.complete(),
['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(), ['<C-n>'] = cmp.mapping.select_next_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-e>'] = cmp.mapping.close(), ['<C-d>'] = cmp.mapping.close(),
-- Change choice nodes for luasnip -- Change choice nodes for luasnip
['<C-h>'] = cmp.mapping(function(fallback) ['<C-j>'] = cmp.mapping(function(fallback)
if luasnip.choice_active() then if luasnip.choice_active() then
luasnip.change_choice(-1) luasnip.change_choice(-1)
else else
fallback() fallback()
end end
end, {'i', 's'}), end, {'i', 's'}),
['<C-l>'] = cmp.mapping(function(fallback) ['<C-k>'] = cmp.mapping(function(fallback)
if luasnip.choice_active() then if luasnip.choice_active() then
luasnip.change_choice(1) luasnip.change_choice(1)
else else
@ -132,21 +135,21 @@ end
-- function M.tabnine_conf() -- function M.tabnine_conf()
-- local tabnine = require('cmp_tabnine.config') -- local tabnine = require('cmp_tabnine.config')
-- tabnine:setup({ -- tabnine:setup {
-- max_lines = 1000, -- max_lines = 1000,
-- max_num_results = 20, -- max_num_results = 20,
-- sort = true, -- sort = true,
-- run_on_every_keystroke = true -- run_on_every_keystroke = true
-- }) -- }
-- end -- end
function M.autopairs_conf() function M.autopairs_conf()
require('nvim-autopairs').setup {fast_wrap = {}} require('nvim-autopairs').setup {fast_wrap = {}}
require('nvim-autopairs.completion.cmp').setup({ require('nvim-autopairs.completion.cmp').setup {
map_cr = true, -- map <CR> on insert mode map_cr = true, -- map <CR> on insert mode
map_complete = true, -- it will auto insert `(` after select function or method item map_complete = true, -- it will auto insert `(` after select function or method item
auto_select = true -- automatically select the first item auto_select = true -- automatically select the first item
}) }
end end
function M.snippets_conf() function M.snippets_conf()
@ -189,12 +192,12 @@ end
-- end -- end
function M.autotag_conf() function M.autotag_conf()
require('nvim-ts-autotag').setup({ require('nvim-ts-autotag').setup {
filetypes = { filetypes = {
'html', 'javascript', 'javascriptreact', 'typescript', 'html', 'javascript', 'javascriptreact', 'typescript',
'typescriptreact', 'svelte', 'vue' 'typescriptreact', 'svelte', 'vue'
} }
}) }
end end
return M return M

View File

@ -16,6 +16,11 @@ function M.colorizer_conf()
}) })
end end
function M.illuminate_conf()
vim.g.Illuminate_delay = 500
vim.g.Illuminate_ftblacklist = {'alpha', 'NvimTree', 'undotree', 'packer'}
end
function M.blankline_conf() function M.blankline_conf()
require('indent_blankline').setup { require('indent_blankline').setup {
char = '', char = '',
@ -55,7 +60,7 @@ function M.treesitter_conf()
parser_configs.http = { parser_configs.http = {
install_info = { install_info = {
url = 'https://github.com/NTBBloodbath/tree-sitter-http', url = 'https://github.com/NTBBloodbath/tree-sitter-http',
files = { 'src/parser.c' }, files = {'src/parser.c'},
branch = 'main' branch = 'main'
} }
} }
@ -99,6 +104,13 @@ function M.treesitter_conf()
} }
end end
-- function M.spellsitter_conf()
-- require('spellsitter').setup {
-- hl = 'SpellBad',
-- captures = {'comment'}
-- }
-- end
function M.iswap_conf() function M.iswap_conf()
require('iswap').setup { require('iswap').setup {
-- The keys that will be used as a selection, in order -- The keys that will be used as a selection, in order
@ -141,16 +153,91 @@ function M.matchup_conf()
vim.g.matchup_matchparen_offscreen = {method = 'popup'} vim.g.matchup_matchparen_offscreen = {method = 'popup'}
end end
function M.twilight_conf()
require('twilight').setup {
dimming = {
alpha = 0.25, -- amount of dimming
-- we try to get the foreground from the highlight groups or fallback color
color = {'Normal', '#ffffff'},
inactive = false -- when true, other windows will be fully dimmed (unless they contain the same buffer)
},
context = 10,
treesitter = true,
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
'function',
'method',
'table',
'if_statement'
},
exclude = {'alpha', 'packer', 'NvimTree', 'qf'}
}
end
function M.zenmode_conf()
require('zen-mode').setup {
window = {
options = {
signcolumn = 'no',
number = false,
relativenumber = false,
cursorline = false,
cursorcolumn = false,
foldcolumn = '0'
}
},
-- on_open = function()
-- vim.api.nvim_command('TSContextDisable')
-- vim.api.nvim_command('IndentBlanklineDisable')
-- end,
-- on_close = function()
-- vim.api.nvim_command('TSContextEnable')
-- vim.api.nvim_command('IndentBlanklineEnable')
-- end
}
end
function M.betterescape_conf()
require('better_escape').setup {
mapping = {'jk', 'kj'},
timeout = vim.opt.timeoutlen:get(),
clear_empty_lines = false,
keys = '<Esc>'
}
end
function M.hop_conf() function M.hop_conf()
require('hop').setup {keys = 'etovxqpdygfblzhckisuran'} require('hop').setup {keys = 'etovxqpdygfblzhckisuran'}
end end
function M.eft_conf() function M.eft_conf()
vim.g.eft_index_function = {all = function() return true end} vim.g.eft_index_function = {all = function() return true end}
-- Mappings
vim.api.nvim_set_keymap('n', 'f', '<Plug>(eft-f)', {})
vim.api.nvim_set_keymap('x', 'f', '<Plug>(eft-f)', {})
vim.api.nvim_set_keymap('n', 'F', '<Plug>(eft-F)', {})
vim.api.nvim_set_keymap('x', 'F', '<Plug>(eft-F)', {})
vim.api.nvim_set_keymap('n', 't', '<Plug>(eft-t)', {})
vim.api.nvim_set_keymap('x', 't', '<Plug>(eft-t)', {})
vim.api.nvim_set_keymap('n', 'T', '<Plug>(eft-T)', {})
vim.api.nvim_set_keymap('x', 'T', '<Plug>(eft-T)', {})
vim.api.nvim_set_keymap('n', ';', '<Plug>(eft-repeat)', {})
vim.api.nvim_set_keymap('x', ';', '<Plug>(eft-repeat)', {})
end end
function M.comment_conf() function M.comment_conf()
require('nvim_comment').setup({comment_empty = false}) require('nvim_comment').setup {comment_empty = false}
end
function M.neogen_conf()
require('neogen').setup {
enabled = true,
input_after_comment = true,
jump_map = '<C-e>'
}
-- Mappings
vim.api.nvim_set_keymap('n', '<leader>eg', ':lua require("neogen").generate()<CR>', {noremap = true, silent = true})
end end
function M.project_conf() function M.project_conf()
@ -162,6 +249,40 @@ function M.project_conf()
silent_chdir = true, silent_chdir = true,
datapath = vim.fn.stdpath('data') datapath = vim.fn.stdpath('data')
} }
-- cd on local window changes with 'lcd' (more eager)
-- see https://github.com/ahmedkhalf/project.nvim/issues/23
-- _G.set_window_project_dir = function()
-- local root, _ = require('project_nvim.project').get_project_root()
-- if root then
-- vim.api.nvim_command('lcd ' .. root)
-- end
-- end
-- vim.api.nvim_command('autocmd BufEnter * lua set_window_project_dir()')
end
function M.gitlinker_conf()
require('gitlinker').setup {
opts = {
remote = nil, -- force the use of a specific remote
-- adds current line nr in the url for normal mode
add_current_line_on_normal_mode = true,
-- callback for what to do with the url
action_callback = require('gitlinker.actions').copy_to_clipboard,
-- print the url after performing the action
print_url = true,
},
callbacks = {
['git.folliehiyuki.com'] = require('gitlinker.hosts').get_gitea_type_url,
['git.disroot.org'] = require('gitlinker.hosts').get_gitea_type_url,
['gitlab.alpinelinux.org'] = require('gitlinker.hosts').get_gitlab_type_url
},
-- default mapping to call url generation with action_callback
mappings = '<leader>gy'
}
-- Mapping to get remote url
vim.api.nvim_set_keymap('n', '<leader>gY', ':lua require("gitlinker").get_repo_url()<CR>', {noremap = true, silent = true})
end end
return M return M

View File

@ -284,9 +284,9 @@ function M.lsp_conf()
-- Replace the default lsp diagnostic letters with prettier symbols -- Replace the default lsp diagnostic letters with prettier symbols
vim.fn.sign_define('LspDiagnosticsSignError', {text = ''}) vim.fn.sign_define('LspDiagnosticsSignError', {text = ''})
vim.fn.sign_define('LspDiagnosticsSignWarning', {text = ''}) vim.fn.sign_define('LspDiagnosticsSignWarning', {text = ''})
vim.fn.sign_define('LspDiagnosticsSignInformation', {text = ''}) vim.fn.sign_define('LspDiagnosticsSignInformation', {text = ''})
vim.fn.sign_define('LspDiagnosticsSignHint', {text = ''}) vim.fn.sign_define('LspDiagnosticsSignHint', {text = ''})
end end
function M.sqls_conf() function M.sqls_conf()
@ -295,6 +295,12 @@ function M.sqls_conf()
} }
end end
function M.lightbulb_conf()
vim.api.nvim_command [[
autocmd CursorHold,CursorHoldI * lua require('nvim-lightbulb').update_lightbulb {sign = {enabled = false}, status_text = {enabled = true, text = ' Code action', text_unavailable = ''}}
]]
end
function M.trouble_conf() function M.trouble_conf()
require('trouble').setup { require('trouble').setup {
mode = 'lsp_workspace_diagnostics', mode = 'lsp_workspace_diagnostics',
@ -307,9 +313,9 @@ function M.trouble_conf()
}, },
signs = { signs = {
error = '', error = '',
warning = '', warning = '',
hint = '',
information = '', information = '',
hint = '',
other = '' other = ''
} }
} }
@ -379,13 +385,75 @@ end
function M.dap_conf() function M.dap_conf()
local dap = require('dap') local dap = require('dap')
vim.fn.sign_define('DapBreakpoint', {text='', texthl='Red'}) vim.fn.sign_define('DapBreakpoint', {text='', texthl='Orange'})
vim.fn.sign_define('DapLogPoint', {text='', texthl='Red'}) vim.fn.sign_define('DapLogPoint', {text='', texthl='Orange'})
vim.fn.sign_define('DapStopped', {text='', texthl='Red'}) vim.fn.sign_define('DapStopped', {text='', texthl='Orange'})
vim.fn.sign_define('DapBreakpointRejected', {text='', texthl='Red'}) vim.fn.sign_define('DapBreakpointRejected', {text='', texthl='Red'})
-- Mappings
vim.api.nvim_command('n', '<leader>dn', ':lua require("dap").continue()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>dd', ':lua require("dap").disconnect()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>db', ':lua require("dap").toggle_breakpoint()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>dB', ':lua require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>dl', ':lua require("dap").list_breakpoints()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>dc', ':lua require("dap").run_to_cursor()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>dz', ':lua require("dap").run_last()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<F9>', ':lua require("dap").step_over()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>dv', ':lua require("dap").step_over()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<F10>', ':lua require("dap").step_into()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>di', ':lua require("dap").step_into()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<F11>', ':lua require("dap").step_out()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>do', ':lua require("dap").step_out()<CR>', {noremap = true, silent = true})
vim.api.nvim_command('n', '<leader>dr', ':lua require("dap").repl.open()<CR>', {noremap = true, silent = true})
end end
function M.dapui_conf() function M.dapui_conf()
local dap, dapui = require('dap'), require('dapui')
dap.listeners.after.event_initialized['dapui_config'] = function() dapui.open() end
dap.listeners.before.event_terminated['dapui_config'] = function() dapui.close() end
dap.listeners.before.event_exited['dapui_config'] = function() dapui.close() end
require('dapui').setup {
icons = {expanded = '', collapsed = ''},
mappings = {
expand = {'<CR>', '<2-LeftMouse>'},
open = 'o',
remove = 'd',
edit = 'e',
repl = 'r'
},
sidebar = {
elements = {
-- Provide as ID strings or tables with 'id' and 'size' keys
-- 'size' can be float or integer > 1
{id = 'scopes', size = 0.25},
{id = 'breakpoints', size = 0.25},
{id = 'stacks', size = 0.25},
{id = 'watches', size = 0.25},
},
size = 40,
position = 'left'
},
tray = {
elements = {'repl'},
size = 10,
position = 'bottom'
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
mappings = {
close = {'q', '<Esc>'}
}
},
windows = {indent = 1}
}
-- Mappings
vim.api.nvim_set_keymap('n', '<leader>de', ':lua require("dapui").eval()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('v', '<leader>de', ':lua require("dapui").eval()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>df', ':lua require("dapui").float_element()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>dt', ':lua require("dapui").toggle()<CR>', {noremap = true, silent = true})
end end
return M return M

View File

@ -34,7 +34,7 @@ function M.telescope_conf()
}, },
extensions = { extensions = {
project = { project = {
base_dirs = {{'~/Code', max_depth = 4}}, base_dirs = {{os.getenv('HOME') .. '/Code', max_depth = 4}},
hidden_files = true hidden_files = true
}, },
fzf = { fzf = {
@ -92,7 +92,7 @@ function M.markdown_preview_conf()
end end
function M.rest_conf() function M.rest_conf()
require('rest-nvim').setup({ require('rest-nvim').setup {
-- Open request results in a horizontal split -- Open request results in a horizontal split
result_split_horizontal = false, result_split_horizontal = false,
-- Skip SSL verification, useful for unknown certificates -- Skip SSL verification, useful for unknown certificates
@ -104,36 +104,13 @@ function M.rest_conf()
}, },
-- Jump to request line on run -- Jump to request line on run
jump_to_request = false, jump_to_request = false,
})
end
function M.zenmode_conf()
require('zen-mode').setup {
window = {
options = {
signcolumn = 'no',
number = false,
relativenumber = false,
cursorline = false,
cursorcolumn = false,
foldcolumn = '0'
}
},
on_open = function()
vim.api.nvim_command('TSContextDisable')
vim.api.nvim_command('IndentBlanklineDisable')
end,
on_close = function()
vim.api.nvim_command('TSContextEnable')
-- vim.api.nvim_command('IndentBlanklineEnable')
end
} }
end end
function M.orgmode_conf() function M.orgmode_conf()
local c = require('colors.' .. vim.g.global_theme).colors local c = require('colors.' .. vim.g.global_theme).colors
require('orgmode').setup({ require('orgmode').setup {
-- General settings -- General settings
org_agenda_files = {'~/Documents/Org/agenda/*'}, org_agenda_files = {'~/Documents/Org/agenda/*'},
org_default_notes_file = '~/Documents/Org/notes.org', org_default_notes_file = '~/Documents/Org/notes.org',
@ -166,7 +143,7 @@ function M.orgmode_conf()
-- Tags settings -- Tags settings
org_use_tag_inheritance = false org_use_tag_inheritance = false
}) }
end end
function M.vimtex_conf() function M.vimtex_conf()
@ -174,6 +151,12 @@ end
function M.spectre_conf() function M.spectre_conf()
require('spectre').setup() require('spectre').setup()
-- Mappings
vim.api.nvim_set_keymap('n', '<leader>po', ':lua require("spectre").open()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>pp', 'viw:lua require("spectre").open_file_search()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>pw', ':lua require("spectre").open_visual({select_word = true})<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('v', '<leader>p', ':lua require("spectre").open_visual()<CR>', {noremap = true, silent = true})
end end
function M.translate_conf() function M.translate_conf()
@ -302,10 +285,16 @@ function M.session_conf()
dir = vim.fn.expand(vim.fn.stdpath('data') .. '/sessions/'), dir = vim.fn.expand(vim.fn.stdpath('data') .. '/sessions/'),
options = {'buffers', 'curdir', 'tabpages', 'winsize'} options = {'buffers', 'curdir', 'tabpages', 'winsize'}
} }
-- Mappings
vim.api.nvim_set_keymap('n', '<leader>ss', ':lua require("persistence").save()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>sd', ':lua require("persistence").stop()<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>sl', ':lua require("persistence").load({last = true})<CR>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>sr', ':lua require("persistence").load()<CR>', {noremap = true, silent = true})
end end
function M.filetype_conf() function M.filetype_conf()
require('filetype').setup({ require('filetype').setup {
overrides = { overrides = {
extensions = { extensions = {
md = 'markdown', md = 'markdown',
@ -321,10 +310,51 @@ function M.filetype_conf()
}, },
complex = { complex = {
['*_log'] = 'log', ['*_log'] = 'log',
['G*_LOG'] = 'log' ['G*_LOG'] = 'log',
['.*waybar/config'] = 'jsonc'
} }
} }
}) }
end
function M.closebuf_conf()
require('close_buffers').setup {
preserve_window_layout = {'this'},
next_buffer_cmd = function(windows)
require('bufferline').cycle(1)
local bufnr = vim.api.nvim_get_current_buf()
for _, window in ipairs(windows) do
vim.api.nvim_win_set_buf(window, bufnr)
end
end
}
end
function M.winshift_conf()
require('winshift').setup {
highlight_moving_win = true, -- Highlight the window being moved
focused_hl_group = 'Visual', -- The highlight group used for the moving window
moving_win_options = {
-- These are local options applied to the moving window while it's
-- being moved. They are unset when you leave Win-Move mode.
wrap = false,
cursorline = false,
cursorcolumn = false,
colorcolumn = '',
}
}
end
function M.winpicker_conf()
require('window-picker').setup {
keys = 'alskdjfhgwoeiruty',
-- Swap windows by holding shift + letter
swap_shift = true,
exclude = {qf = true, NvimTree = true, packer = true, alpha = true},
-- Flash the cursor line of the newly focused window
flash_duration = 300
}
end end
return M return M

View File

@ -71,7 +71,7 @@ function M.dashboard_conf()
button('SPC f d', 'ﱮ Recent directories'), button('SPC f d', 'ﱮ Recent directories'),
button('SPC f m', ' Bookmarks'), button('SPC f m', ' Bookmarks'),
button('SPC f p', ' Projects'), button('SPC f p', ' Projects'),
button('SPC e l', ' Load last session') button('SPC s l', ' Load last session')
}, },
opts = {spacing = 1} opts = {spacing = 1}
} }
@ -89,8 +89,8 @@ function M.dashboard_conf()
-- Hide tabline in dashboard buffer -- Hide tabline in dashboard buffer
vim.api.nvim_command [[ vim.api.nvim_command [[
autocmd FileType alpha set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2 autocmd FileType alpha set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
]] ]]
end end
function M.statusline_conf() function M.statusline_conf()
@ -181,33 +181,46 @@ function M.statusline_conf()
hl = {fg = colors.fg, style = 'bold'}, hl = {fg = colors.fg, style = 'bold'},
right_sep = ' ' right_sep = ' '
}, },
codeact = {
provider = function()
local present, state = pcall(require, 'nvim-lightbulb')
if present then
return state.get_status_text()
else
return ''
end
end,
hl = {fg = colors.green, style = 'bold'}
},
diagerr = { diagerr = {
provider = 'diagnostic_errors', provider = 'diagnostic_errors',
icon = '', icon = '',
hl = {fg = colors.red}, hl = {fg = colors.red},
right_sep = ' ' left_sep = ' '
}, },
diagwarn = { diagwarn = {
provider = 'diagnostic_warnings', provider = 'diagnostic_warnings',
icon = '', icon = ' ',
hl = {fg = colors.yellow}, hl = {fg = colors.yellow},
right_sep = ' ' left_sep = ' '
}, },
diaghint = { diaghint = {
provider = 'diagnostic_hints', provider = 'diagnostic_hints',
icon = ' ', icon = ' ',
hl = {fg = colors.cyan}, hl = {fg = colors.cyan},
right_sep = ' ' left_sep = ' '
}, },
diaginfo = { diaginfo = {
provider = 'diagnostic_info', provider = 'diagnostic_info',
icon = '', icon = '',
hl = {fg = colors.blue} hl = {fg = colors.blue},
left_sep = ' '
}, },
lspclient = { lspclient = {
provider = 'lsp_client_names', provider = 'lsp_client_names',
icon = ' LSP:', icon = ' LSP:',
hl = {fg = colors.purple, style = 'bold'} hl = {fg = colors.purple, style = 'bold'},
left_sep = ' '
}, },
format = { format = {
provider = file_osinfo, provider = file_osinfo,
@ -268,10 +281,11 @@ function M.statusline_conf()
table.insert(components.active[1], comps.fileinfo) table.insert(components.active[1], comps.fileinfo)
table.insert(components.active[1], comps.lineinfo) table.insert(components.active[1], comps.lineinfo)
table.insert(components.active[1], comps.percent) table.insert(components.active[1], comps.percent)
table.insert(components.active[1], comps.diagerr) table.insert(components.active[3], comps.codeact)
table.insert(components.active[1], comps.diagwarn) table.insert(components.active[3], comps.diagerr)
table.insert(components.active[1], comps.diaghint) table.insert(components.active[3], comps.diagwarn)
table.insert(components.active[1], comps.diaginfo) table.insert(components.active[3], comps.diaghint)
table.insert(components.active[3], comps.diaginfo)
table.insert(components.active[3], comps.lspclient) table.insert(components.active[3], comps.lspclient)
table.insert(components.active[3], comps.format) table.insert(components.active[3], comps.format)
table.insert(components.active[3], comps.encode) table.insert(components.active[3], comps.encode)
@ -351,9 +365,9 @@ function M.nvimtree_conf()
git = { git = {
unstaged = '', unstaged = '',
staged = '', staged = '',
unmerged = '', unmerged = '',
renamed = '', renamed = '',
untracked = '', untracked = '',
deleted = '', deleted = '',
ignored = '' ignored = ''
}, },
@ -361,17 +375,11 @@ function M.nvimtree_conf()
arrow_open = '', arrow_open = '',
arrow_closed = '', arrow_closed = '',
default = '', default = '',
open = '', open = '',
empty = '', empty = '',
empty_open = '', empty_open = '',
symlink = '', symlink = '',
symlink_open = '' symlink_open = ''
},
lsp = {
hint = '',
info = '',
warning = '',
error = ''
} }
} }
@ -386,7 +394,15 @@ function M.nvimtree_conf()
}, },
hijack_cursor = true, hijack_cursor = true,
update_cwd = true, update_cwd = true,
lsp_diagnostics = true, diagnostics = {
enable = true,
icons = {
hint = '',
info = '',
warning = '',
error = ''
}
},
update_focused_file = { update_focused_file = {
enable = true, enable = true,
update_cwd = true, update_cwd = true,

View File

@ -60,7 +60,8 @@ return packer.startup(function(use)
} }
use { use {
'RRethy/vim-illuminate', 'RRethy/vim-illuminate',
event = 'CursorHold' event = 'CursorHold',
setup = editor.illuminate_conf
} }
-- use { -- TODO: config (lua -> fennel) + learn clojure, fennel, guile scheme -- use { -- TODO: config (lua -> fennel) + learn clojure, fennel, guile scheme
-- 'Olical/conjure', -- 'Olical/conjure',
@ -73,6 +74,11 @@ return packer.startup(function(use)
event = 'BufRead', event = 'BufRead',
config = editor.treesitter_conf config = editor.treesitter_conf
} }
-- use {
-- 'lewis6991/spellsitter.nvim',
-- event = {'BufRead', 'BufNew', 'BufNewFile'},
-- config = editor.spellsitter_conf
-- }
use { use {
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
after = 'nvim-treesitter', after = 'nvim-treesitter',
@ -84,14 +90,8 @@ return packer.startup(function(use)
-- Putting config into `treesitter_conf` doesn't work for some reason -- Putting config into `treesitter_conf` doesn't work for some reason
config = editor.rainbow_conf config = editor.rainbow_conf
} }
use { use {'romgrk/nvim-treesitter-context', after = 'nvim-treesitter'}
'romgrk/nvim-treesitter-context', use {'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter'}
after = 'nvim-treesitter'
}
use {
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter'
}
use { use {
'mizlan/iswap.nvim', 'mizlan/iswap.nvim',
cmd = {'ISwapWith', 'ISwap'}, cmd = {'ISwapWith', 'ISwap'},
@ -103,7 +103,24 @@ return packer.startup(function(use)
after = 'nvim-treesitter', after = 'nvim-treesitter',
config = editor.matchup_conf config = editor.matchup_conf
} }
use {'machakann/vim-sandwich', keys = 's'} use {'machakann/vim-sandwich', keys = 's'} -- TODO: check out surround.nvim
use {
'folke/zen-mode.nvim',
cmd = 'ZenMode',
wants = 'twilight.nvim',
requires = {{
'folke/twilight.nvim',
cmd = {'Twilight', 'TwilightEnable'},
config = editor.twilight_conf,
opt = true
}},
config = editor.zenmode_conf
}
use {
'max397574/better-escape.nvim',
event = 'InsertCharPre',
config = editor.betterescape_conf
}
use { use {
'phaazon/hop.nvim', 'phaazon/hop.nvim',
cmd = {'HopChar1', 'HopChar2', 'HopWord', 'HopPattern', 'HopLine'}, cmd = {'HopChar1', 'HopChar2', 'HopWord', 'HopPattern', 'HopLine'},
@ -111,21 +128,28 @@ return packer.startup(function(use)
} }
use { use {
'hrsh7th/vim-eft', 'hrsh7th/vim-eft',
event = {'BufRead', 'BufNewFile'}, keys = {
setup = editor.eft_conf {'n', 'f'}, {'x', 'f'}, {'n', 'F'}, {'x', 'F'},
} {'n', 't'}, {'x', 't'}, {'n', 'T'}, {'x', 'T'},
use { {'n', ';'}, {'x', ';'}
'junegunn/vim-easy-align', },
cmd = 'EasyAlign' config = editor.eft_conf
} }
use {'junegunn/vim-easy-align', cmd = 'EasyAlign'}
use { use {
'terrortylor/nvim-comment', 'terrortylor/nvim-comment',
keys = 'gc', keys = 'gc',
config = editor.comment_conf config = editor.comment_conf
} }
use {
'danymat/neogen',
keys = '<leader>eg',
wants = 'nvim-treesitter',
config = editor.neogen_conf
}
use { use {
'editorconfig/editorconfig-vim', 'editorconfig/editorconfig-vim',
event = {'BufNewFile', 'BufRead'} event = {'BufRead', 'BufNewFile'}
} }
use { -- TODO: move to nvim-parinfer (lua) use { -- TODO: move to nvim-parinfer (lua)
'eraserhd/parinfer-rust', 'eraserhd/parinfer-rust',
@ -137,6 +161,12 @@ return packer.startup(function(use)
event = 'BufEnter', event = 'BufEnter',
config = editor.project_conf config = editor.project_conf
} }
use {
'ruifm/gitlinker.nvim',
wants = 'plenary.nvim',
keys = {'<leader>gy', '<leader>gY'},
config = editor.gitlinker_conf
}
--------- ---------
-- LSP -- -- LSP --
@ -155,6 +185,11 @@ return packer.startup(function(use)
wants = 'nvim-lspconfig', wants = 'nvim-lspconfig',
config = lsp.sqls_conf config = lsp.sqls_conf
} }
use {
'kosayoda/nvim-lightbulb',
after = 'nvim-lspconfig',
config = lsp.lightbulb_conf
}
use { use {
'folke/trouble.nvim', 'folke/trouble.nvim',
cmd = {'Trouble', 'TroubleToggle', 'TroubleRefresh'}, cmd = {'Trouble', 'TroubleToggle', 'TroubleRefresh'},
@ -179,9 +214,13 @@ return packer.startup(function(use)
} }
use { -- TODO: config, scripts to install/update dap servers use { -- TODO: config, scripts to install/update dap servers
'rcarriga/nvim-dap-ui', 'rcarriga/nvim-dap-ui',
event = 'BufReadPre', keys = '<leader>d',
wants = 'nvim-dap', wants = 'nvim-dap',
requires = {{'mfussenegger/nvim-dap', config = lsp.dap_conf, opt = true}}, requires = {{
'mfussenegger/nvim-dap',
config = lsp.dap_conf,
opt = true
}},
config = lsp.dapui_conf config = lsp.dapui_conf
} }
@ -312,13 +351,6 @@ return packer.startup(function(use)
run = 'npm install --prefix server', run = 'npm install --prefix server',
cmd = 'Bracey' cmd = 'Bracey'
} }
use {
'folke/zen-mode.nvim',
cmd = 'ZenMode',
wants = 'twilight.nvim',
requires = {{'folke/twilight.nvim', opt = true}},
config = tools.zenmode_conf
}
use { -- shouldn't be lazy-loaded (global bindings don't work) use { -- shouldn't be lazy-loaded (global bindings don't work)
'kristijanhusak/orgmode.nvim', 'kristijanhusak/orgmode.nvim',
ft = 'org', ft = 'org',
@ -326,7 +358,7 @@ return packer.startup(function(use)
} }
use { use {
'windwp/nvim-spectre', 'windwp/nvim-spectre',
event = {'BufRead', 'BufNewFile'}, keys = '<leader>p',
wants = 'plenary.nvim', wants = 'plenary.nvim',
config = tools.spectre_conf config = tools.spectre_conf
} }
@ -373,18 +405,36 @@ return packer.startup(function(use)
} }
use { use {
'folke/persistence.nvim', 'folke/persistence.nvim',
event = 'BufEnter', event = 'BufReadPre',
keys = '<leader>s',
config = tools.session_conf config = tools.session_conf
} }
use { -- Replace default filetype.vim use { -- Replace default filetype.vim
'nathom/filetype.nvim', 'nathom/filetype.nvim',
event = {'BufRead', 'BufNewFile'},
config = tools.filetype_conf config = tools.filetype_conf
} }
use {
'kazhala/close-buffers.nvim',
cmd = {'BDelete', 'BWipeout'},
wants = 'bufferline.nvim',
config = tools.closebuf_conf
}
use {
'sindrets/winshift.nvim',
cmd = 'WinShift',
config = tools.winshift_conf
}
use {
'ten3roberts/window-picker.nvim',
cmd = {'WindowPick', 'WindowSwap', 'WindowSwapStay'},
config = tools.winpicker_conf
}
use {'dstein64/vim-startuptime', cmd = 'StartupTime'} -- Just for benchmarking use {'dstein64/vim-startuptime', cmd = 'StartupTime'} -- Just for benchmarking
-- TODO: dial.nvim, rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, -- TODO: dial.nvim, rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*,
-- nvim-bqf, nvim-comment-frame, nvim-revJ.lua, nvim-remote-containers, -- nvim-bqf, nvim-comment-frame, nvim-revJ.lua, nvim-remote-containers,
-- tex.nvim, telescope-lsp-handlers.nvim -- tex.nvim, telescope-lsp-handlers.nvim, telescope-dap.nvim
-- Install plugins if missing -- Install plugins if missing
packer.install() packer.install()