104 lines
2.6 KiB
Lua
104 lines
2.6 KiB
Lua
|
|
-- Config shortcuts
|
||
|
|
local keymap = vim.keymap
|
||
|
|
local vr = vim.version.range
|
||
|
|
|
||
|
|
|
||
|
|
------------------
|
||
|
|
-- INSTALL PLUGINS
|
||
|
|
------------------
|
||
|
|
|
||
|
|
vim.pack.add {
|
||
|
|
-- Better code completion
|
||
|
|
{ src = 'https://github.com/saghen/blink.cmp', version = vr '1.*' },
|
||
|
|
|
||
|
|
-- Better marks
|
||
|
|
'https://github.com/chentoast/marks.nvim',
|
||
|
|
|
||
|
|
-- Surround selections with quotes etc.
|
||
|
|
{ src = 'https://github.com/kylechui/nvim-surround', version = vr '4.*' },
|
||
|
|
|
||
|
|
-- Substitute and exchange operator
|
||
|
|
'https://github.com/gbprod/substitute.nvim',
|
||
|
|
|
||
|
|
-- Highlight todo comments
|
||
|
|
'https://github.com/folke/todo-comments.nvim',
|
||
|
|
|
||
|
|
-- Highlight colors (hex codes etc.)
|
||
|
|
'https://github.com/brenoprata10/nvim-highlight-colors',
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
---------------------
|
||
|
|
-- INITIALIZE PLUGINS
|
||
|
|
---------------------
|
||
|
|
|
||
|
|
-- Better code completion
|
||
|
|
require('blink.cmp').setup {
|
||
|
|
keymap = {
|
||
|
|
preset = 'super-tab',
|
||
|
|
},
|
||
|
|
cmdline = {
|
||
|
|
keymap = {
|
||
|
|
preset = 'inherit',
|
||
|
|
['<Tab>'] = {
|
||
|
|
'show',
|
||
|
|
'select_and_accept',
|
||
|
|
'fallback',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
completion = {
|
||
|
|
menu = { auto_show = true },
|
||
|
|
},
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
-- Better marks
|
||
|
|
require('marks').setup {
|
||
|
|
-- Show builtin marks in gutter: last jump position (`), last change (.),
|
||
|
|
-- last selection in visual mode (</>).
|
||
|
|
-- TODO: See which of those are really helpful and remove the others.
|
||
|
|
builtin_marks = { '`', '.', '<', '>' },
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
-- Surround selections with quotes etc.
|
||
|
|
require('nvim-surround').setup {}
|
||
|
|
|
||
|
|
|
||
|
|
-- Substitute and exchange operator
|
||
|
|
local substitute = require('substitute')
|
||
|
|
substitute.setup {}
|
||
|
|
|
||
|
|
-- ... Use "s" key for substitute (by default "s" is equivalent to "cl")
|
||
|
|
keymap.set('n', 's', substitute.operator)
|
||
|
|
keymap.set('n', 'ss', substitute.line)
|
||
|
|
keymap.set('n', 'S', substitute.eol)
|
||
|
|
keymap.set('x', 's', substitute.visual)
|
||
|
|
|
||
|
|
-- ... Prefix with "," to use system clipboard (remap to use the substitute mappings above)
|
||
|
|
keymap.set({'n', 'x'}, ',s', '"+s', { remap = true })
|
||
|
|
keymap.set({'n', 'x'}, ',S', '"+S', { remap = true })
|
||
|
|
|
||
|
|
|
||
|
|
-- Highlight todo comments
|
||
|
|
require('todo-comments').setup {
|
||
|
|
-- Disable gutter icons
|
||
|
|
signs = false,
|
||
|
|
|
||
|
|
-- Customize highlighting
|
||
|
|
highlight = {
|
||
|
|
before = '',
|
||
|
|
-- By default ("wide"), the surrounding space and colon are highlighted too,
|
||
|
|
-- which makes the colon invisible
|
||
|
|
keyword = 'bg',
|
||
|
|
after = 'fg',
|
||
|
|
-- Highlight keywords always, not just when followed by a colon (the default)
|
||
|
|
pattern = '<(KEYWORDS)>',
|
||
|
|
},
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
-- Highlight colors (hex codes etc.)
|
||
|
|
require('nvim-highlight-colors').setup {}
|