2024-01-05 09:06:34 +01:00
|
|
|
-- Enable experimental faster module loader
|
|
|
|
vim.loader.enable()
|
2022-06-15 07:45:13 +02:00
|
|
|
|
|
|
|
---- Built in settings ----
|
2024-02-22 12:09:11 +01:00
|
|
|
-- Create convenient aliases
|
2022-06-15 07:45:13 +02:00
|
|
|
local o = vim.o
|
|
|
|
local g = vim.g
|
|
|
|
local fn = vim.fn
|
|
|
|
local opt = vim.opt
|
|
|
|
|
2023-01-20 19:36:31 +01:00
|
|
|
-- Whether to enable workman remappings
|
|
|
|
local workman = false
|
2022-06-15 07:45:13 +02:00
|
|
|
|
|
|
|
-- Set font
|
2024-01-05 09:06:34 +01:00
|
|
|
o.guifont = 'IosevkaTermSlab Nerd Font,IosevkaTerm Nerd Font,Iosevka Term Slab,Iosevka:h10:#e-subpixelantialias'
|
2024-03-18 15:44:59 +01:00
|
|
|
g.neovide_floating_z_height = 1
|
2024-04-03 15:26:26 +02:00
|
|
|
g.neovide_confirm_quit = true -- Confirm closing neovide window when changes are unsaved
|
|
|
|
g.neovide_cursor_smooth_blink = true
|
2022-06-15 07:45:13 +02:00
|
|
|
if fn.hostname() == 'tappy' then
|
|
|
|
g.neovide_refresh_rate = 144
|
|
|
|
end
|
2023-01-20 19:36:31 +01:00
|
|
|
|
2024-03-23 07:38:07 +01:00
|
|
|
opt.guicursor:append('a:blinkon1500-blinkoff1500-blinkwait1200') -- Blink cursor once every 1.5 seconds
|
2022-06-15 07:45:13 +02:00
|
|
|
o.mouse = 'a' -- Enable mouse input
|
|
|
|
o.termguicolors = true -- Enable 24bit terminal colors
|
|
|
|
|
|
|
|
-- Other interface settings
|
|
|
|
o.clipboard = 'unnamedplus' -- Use system clipboard by default
|
|
|
|
o.hidden = true -- Allow buffers to not be attached to a window
|
|
|
|
o.linebreak = true -- Enable word-wrapping at the end of visual lines
|
|
|
|
o.breakindent = true -- preserve indentention on lines continuing from a wrap
|
2024-01-05 09:06:34 +01:00
|
|
|
opt.breakindentopt = {
|
2024-02-22 12:09:11 +01:00
|
|
|
'sbr' -- 'showbreak' character should appear before virtual indentention
|
2024-01-05 09:06:34 +01:00
|
|
|
}
|
2023-01-20 19:36:31 +01:00
|
|
|
o.hlsearch = true -- Highlight search results
|
2022-06-15 07:45:13 +02:00
|
|
|
o.scrolloff = 5 -- Margin between cursor and screen top/bottom
|
|
|
|
o.showmatch = true -- Highlight matching brackets
|
|
|
|
o.splitright = true -- Open new windows below
|
|
|
|
o.splitbelow = true -- Open new windows to the right
|
2023-11-30 15:43:20 +01:00
|
|
|
o.splitkeep = 'screen' -- Keep window position when creating splits
|
2022-06-15 07:45:13 +02:00
|
|
|
o.title = true -- Set title of terminal window
|
|
|
|
o.updatetime = 300 -- Write swap file every 300 ms (supposedly reduces delays)
|
|
|
|
o.foldlevel = 99 -- Keep all folds open
|
|
|
|
o.foldlevelstart = 99
|
2023-09-04 15:57:31 +02:00
|
|
|
o.foldenable = true -- Don't disable folds
|
2022-06-15 07:45:13 +02:00
|
|
|
o.conceallevel = 2 -- Hide concealed text, use replacement if defined
|
2024-02-22 12:09:11 +01:00
|
|
|
o.sbr = '┆'
|
2022-06-15 07:45:13 +02:00
|
|
|
opt.listchars = { -- Symbols for whitespace chars when 'list' is enabled
|
|
|
|
tab = '🭰 ',
|
|
|
|
trail = '-',
|
|
|
|
nbsp = '+'
|
|
|
|
}
|
2023-03-17 10:37:54 +01:00
|
|
|
opt.fillchars = { -- Characters to fill certain types of empty space with
|
|
|
|
diff = ' ',
|
|
|
|
fold = ' ',
|
2024-01-05 09:06:34 +01:00
|
|
|
foldopen = '',
|
|
|
|
foldsep = ' ',
|
|
|
|
foldclose = ''
|
2023-03-17 10:37:54 +01:00
|
|
|
}
|
2023-04-19 10:43:45 +02:00
|
|
|
opt.diffopt:append({'indent-heuristic', 'algorithm:histogram'})
|
2023-11-30 15:43:20 +01:00
|
|
|
if fn.has('nvim-0.10') then
|
|
|
|
o.smoothscroll = true -- Scroll by screen lines instead of physical lines
|
|
|
|
opt.display:append('lastline')
|
|
|
|
end
|
2022-06-15 07:45:13 +02:00
|
|
|
|
|
|
|
o.tabstop = 4 -- A physical tab is 4 characters wide
|
|
|
|
o.shiftwidth = 4 -- A unit of indentention is 4 levels wide
|
|
|
|
o.wrapmargin = 0 -- Disable hard line wrapping
|
2023-04-12 10:27:14 +02:00
|
|
|
o.textwidth = 0 -- Comments lines should wrap at 100 chars
|
2023-10-18 18:34:04 +02:00
|
|
|
o.laststatus = 3 -- Use one global status bar
|
2022-06-15 07:45:13 +02:00
|
|
|
-- Set <Leader> key
|
|
|
|
g.mapleader = ' '
|
2023-11-30 15:43:20 +01:00
|
|
|
g.maplocalleader = '\\'
|
2022-06-15 07:45:13 +02:00
|
|
|
vim.cmd 'filetype plugin indent on'
|
|
|
|
|
2023-11-30 15:43:20 +01:00
|
|
|
o.exrc = true -- Load .nvim.lua .nvimrc and .exrc files
|
|
|
|
|
2022-06-15 07:45:13 +02:00
|
|
|
-- Enable persistent undo
|
|
|
|
if fn.has('persistent_undo') then
|
2023-06-22 16:30:49 +02:00
|
|
|
o.undodir = fn.stdpath('data') .. '/undo'
|
2022-06-15 07:45:13 +02:00
|
|
|
o.undofile = true
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Use rg as grep program
|
|
|
|
if fn.executable('rg') then
|
|
|
|
o.grepprg = 'rg --vimgrep --smart-case --hidden'
|
|
|
|
o.grepformat = '%f:%l:%c:%m'
|
|
|
|
end
|
|
|
|
|
2023-01-20 19:36:31 +01:00
|
|
|
if vim.fn.executable('darkman') then
|
|
|
|
local mode = vim.trim(vim.fn.system('darkman get'))
|
2023-01-20 21:40:16 +01:00
|
|
|
if mode == 'dark' or mode == 'light' then
|
|
|
|
vim.o.background = mode
|
2023-01-20 19:36:31 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-08-15 15:05:12 +02:00
|
|
|
local zoom_notification = nil
|
|
|
|
|
|
|
|
--- "Zoom" by changing gui font size
|
|
|
|
--- @param delta integer
|
2023-11-10 17:00:41 +01:00
|
|
|
function _G.zoom(delta)
|
2023-03-17 10:09:09 +01:00
|
|
|
local properties = {
|
2022-08-15 15:05:12 +02:00
|
|
|
hide_from_history = true,
|
2024-05-21 13:22:22 +02:00
|
|
|
render = 'compact',
|
2024-01-05 09:06:34 +01:00
|
|
|
on_close = function()
|
|
|
|
zoom_notification = nil
|
|
|
|
end
|
2023-03-17 10:09:09 +01:00
|
|
|
}
|
|
|
|
if zoom_notification ~= nil then
|
2023-04-12 10:27:14 +02:00
|
|
|
properties.replace = zoom_notification.id
|
2023-03-17 10:09:09 +01:00
|
|
|
end
|
2024-05-21 13:22:22 +02:00
|
|
|
|
|
|
|
local message
|
|
|
|
if vim.g.neovide_scale_factor ~= nil then
|
|
|
|
properties.title = 'Zoom'
|
|
|
|
vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + (delta * 0.05)
|
|
|
|
message = 'Zoom set to ' .. vim.g.neovide_scale_factor * 100 .. '%'
|
|
|
|
else
|
|
|
|
properties.title = 'Font size'
|
|
|
|
local size = fn.substitute(o.guifont, [[^.*:h\([^:]*\).*$]], [[\1]], '')
|
|
|
|
size = size + delta
|
|
|
|
local guifont = fn.substitute(o.guifont, [[:h\([^:]*\)]], ':h' .. size, '')
|
|
|
|
o.guifont = guifont
|
|
|
|
message = 'Font size set to ' .. size
|
|
|
|
end
|
|
|
|
zoom_notification = vim.notify(message, vim.log.levels.INFO, properties)
|
2022-08-15 15:05:12 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local function zoom_in()
|
|
|
|
zoom(1)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function zoom_out()
|
|
|
|
zoom(-1)
|
|
|
|
end
|
|
|
|
|
2024-02-22 12:09:11 +01:00
|
|
|
vim.keymap.set('n', '<C-w>!', '<Cmd>copen<CR>', { desc = 'Quickfix window' })
|
|
|
|
vim.keymap.set('n', '<F2>', '<Cmd>set number! relativenumber!<CR>', { desc = 'Toggle relative numbers' })
|
|
|
|
vim.keymap.set('n', '<F3>', '<Cmd>set number!<CR>', { desc = 'Toggle line numbers' })
|
|
|
|
vim.keymap.set('n', '<F4>', '<Cmd>set list!<CR>', { desc = 'Annotate whitespace' })
|
|
|
|
vim.keymap.set('n', '<A-h>', '<C-w>h', { desc = 'Go to the left window' })
|
|
|
|
vim.keymap.set('n', '<A-l>', '<C-w>l', { desc = 'Go to the right window' })
|
|
|
|
vim.keymap.set('n', '<A-j>', '<C-w>j', { desc = 'Go to the up window' })
|
|
|
|
vim.keymap.set('n', '<A-k>', '<C-w>k', { desc = 'Go to the down window' })
|
|
|
|
vim.keymap.set('n', '<C-+>' , zoom_in, { desc = 'Zoom in' })
|
|
|
|
vim.keymap.set('n', '<C-->' , zoom_out, { desc = 'Zoom out' })
|
|
|
|
vim.keymap.set('n', '<C-l>', function()
|
|
|
|
local ok, notify = pcall(require, 'notify')
|
|
|
|
if ok then notify.dismiss {} end
|
|
|
|
vim.lsp.buf.clear_references()
|
|
|
|
vim.cmd('nohlsearch|diffupdate|normal! <C-l>')
|
|
|
|
end, { desc = 'Clear' })
|
|
|
|
|
|
|
|
-- Quickfix mappings
|
|
|
|
local function quickfix_toggle()
|
|
|
|
for _, win in pairs(vim.fn.getwininfo()) do
|
|
|
|
if win.quickfix == 1 then
|
|
|
|
vim.cmd.cclose()
|
|
|
|
return
|
2023-01-20 19:36:31 +01:00
|
|
|
end
|
2022-06-17 09:54:49 +02:00
|
|
|
end
|
2024-02-22 12:09:11 +01:00
|
|
|
vim.cmd.copen()
|
2022-06-17 09:54:49 +02:00
|
|
|
end
|
2024-02-22 12:09:11 +01:00
|
|
|
vim.keymap.set('n', '<Leader>qq', quickfix_toggle, { desc = 'Open' })
|
|
|
|
vim.keymap.set('n', '<Leader>qc', '<Cmd>cclose<CR>', { desc = 'Close' })
|
|
|
|
vim.keymap.set('n', '<Leader>qj', '<Cmd>cnext<CR>', { desc = 'Next' })
|
|
|
|
vim.keymap.set('n', '<Leader>qk', '<Cmd>cprev<CR>', { desc = 'Previous' })
|
|
|
|
vim.keymap.set('n', '<Leader>qh', '<Cmd>colder<CR>', { desc = 'Older list' })
|
|
|
|
vim.keymap.set('n', '<Leader>ql', '<Cmd>cnewer<CR>', { desc = 'Newer list' })
|
|
|
|
vim.keymap.set('n', '<Leader>c', '<Cmd>vert te<CR>', { desc = 'Terminal (vsplit)' })
|
|
|
|
vim.keymap.set('n', '<Leader>C', '<Cmd>tab te<CR>', { desc = 'Terminal (tab)' })
|
2024-12-05 21:32:29 +01:00
|
|
|
vim.keymap.set('t', '<C-s>', '<C-\\><C-n>', { desc = 'Normal mode' })
|
2024-02-22 12:09:11 +01:00
|
|
|
|
|
|
|
-- Diagnostic mappings
|
|
|
|
vim.keymap.set('n', '<Leader>eo', vim.diagnostic.open_float, { desc = 'Open diagnostic' })
|
|
|
|
vim.keymap.set('n', '<Leader>eq', vim.diagnostic.setqflist, { desc = 'Save to quickfix' })
|
|
|
|
vim.keymap.set('n', '<Leader>e]', vim.diagnostic.goto_next, { desc = 'Next diagnostic' })
|
|
|
|
vim.keymap.set('n', '<Leader>e[', vim.diagnostic.goto_prev, { desc = 'Previous diagnostic' })
|
|
|
|
vim.keymap.set('n', '<Leader>ee', function() vim.diagnostic.goto_next { severity = vim.diagnostic.severity.E } end, { desc = 'Next error' })
|
|
|
|
vim.keymap.set('n', '<Leader>eE', function() vim.diagnostic.goto_prev { severity = vim.diagnostic.severity.E } end, { desc = 'Previous error' })
|
|
|
|
vim.keymap.set('n', '<Leader>ew', function() vim.diagnostic.goto_next { severity = vim.diagnostic.severity.W } end, { desc = 'Next warning' })
|
|
|
|
vim.keymap.set('n', '<Leader>eW', function() vim.diagnostic.goto_prev { severity = vim.diagnostic.severity.W } end, { desc = 'Previous warning' })
|
|
|
|
vim.keymap.set('n', ']e', function() vim.diagnostic.goto_next { severity = vim.diagnostic.severity.E } end, { desc = 'Next error' })
|
|
|
|
vim.keymap.set('n', '[e', function() vim.diagnostic.goto_prev { severity = vim.diagnostic.severity.E } end, { desc = 'Previous error' })
|
|
|
|
vim.keymap.set('n', ']w', function() vim.diagnostic.goto_next { severity = vim.diagnostic.severity.W } end, { desc = 'Next warning' })
|
|
|
|
vim.keymap.set('n', '[w', function() vim.diagnostic.goto_prev { severity = vim.diagnostic.severity.W } end, { desc = 'Previous warning' })
|
|
|
|
vim.keymap.set('n', '<Leader>eh', vim.diagnostic.hide, { desc = 'Hide diagnostics' })
|
|
|
|
vim.keymap.set('n', '<Leader>es', vim.diagnostic.show, { desc = 'Show diagnostics' })
|
|
|
|
vim.keymap.set('n', '<Leader>eC', vim.diagnostic.reset, { desc = 'Clear diagnostics' })
|
2022-06-15 07:45:13 +02:00
|
|
|
|
2024-12-05 21:32:29 +01:00
|
|
|
if vim.g.neovide then
|
|
|
|
vim.keymap.set('l', '<C-v>', '<C-r>+', { desc = 'Paste' })
|
|
|
|
vim.keymap.set('l', '<C-S-v>', '<C-r>+', { desc = 'Paste' })
|
|
|
|
vim.keymap.set('t', '<C-S-v>', '<C-\\><C-n>pi', { desc = 'Paste' })
|
|
|
|
end
|
|
|
|
|
2022-06-15 07:45:13 +02:00
|
|
|
-- Commands
|
|
|
|
vim.cmd [[
|
2023-01-20 19:36:31 +01:00
|
|
|
command! Light set background=light
|
|
|
|
command! Dark set background=dark
|
2022-06-15 07:45:13 +02:00
|
|
|
]]
|
|
|
|
|
|
|
|
-- Autocommands
|
2023-01-20 19:36:31 +01:00
|
|
|
local augroup = vim.api.nvim_create_augroup('luarc', {clear = true})
|
|
|
|
local au = function(autocmd, opts)
|
|
|
|
opts.group = augroup
|
|
|
|
vim.api.nvim_create_autocmd(autocmd, opts)
|
|
|
|
end
|
|
|
|
au('User', {
|
|
|
|
pattern = 'StartifyReady',
|
|
|
|
callback = function()
|
|
|
|
if workman then
|
|
|
|
vim.keymap.set('', 'n', 'gj', {silent = true, buffer = true})
|
|
|
|
vim.keymap.set('', 'e', 'gk', {silent = true, buffer = true})
|
|
|
|
end
|
2023-10-18 18:23:43 +02:00
|
|
|
end,
|
|
|
|
desc = 'Override Startify mappings',
|
2023-01-20 19:36:31 +01:00
|
|
|
})
|
|
|
|
au('TextYankPost', {
|
2023-06-17 10:13:05 +02:00
|
|
|
callback = function() vim.highlight.on_yank() end,
|
2023-01-20 19:36:31 +01:00
|
|
|
desc = 'Highlight when text is yanked',
|
|
|
|
})
|
|
|
|
au('BufReadPost', {
|
|
|
|
callback = function()
|
|
|
|
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
|
|
|
local lcount = vim.api.nvim_buf_line_count(0)
|
|
|
|
if mark[1] > 0 and mark[1] <= lcount then
|
|
|
|
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
desc = 'Remember cursor position across restarts'
|
|
|
|
})
|
2022-06-15 07:45:13 +02:00
|
|
|
|
|
|
|
-- Diagnostics
|
|
|
|
vim.diagnostic.config {
|
|
|
|
-- Configure underlining diagnostics
|
|
|
|
underline = {
|
|
|
|
-- Only underline warnings and up
|
2023-04-12 10:27:14 +02:00
|
|
|
severity = { min = vim.diagnostic.severity.WARN }
|
2022-06-15 07:45:13 +02:00
|
|
|
}
|
|
|
|
}
|
2023-06-22 20:46:31 +02:00
|
|
|
fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
|
|
|
|
fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
|
|
|
|
fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
|
|
|
|
fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
|
2022-06-15 07:45:13 +02:00
|
|
|
|
2024-02-22 12:09:11 +01:00
|
|
|
au('LspAttach', { callback = function(event)
|
|
|
|
require'which-key'.register({
|
|
|
|
['<Leader>l'] = {
|
|
|
|
name = 'LSP',
|
|
|
|
D = {vim.lsp.buf.declaration, 'Declaration'},
|
|
|
|
d = {'<Cmd>Telescope lsp_definitions<CR>', 'Definition'},
|
|
|
|
i = {'<Cmd>Telescope lsp_implementations<CR>', 'Implementation'},
|
|
|
|
I = {vim.lsp.buf.implementation, 'Implementation (quickfix)'},
|
|
|
|
r = {vim.lsp.buf.rename, 'Rename'},
|
2024-12-05 21:32:29 +01:00
|
|
|
h = {function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end, 'Inlay hints'},
|
2024-02-22 12:09:11 +01:00
|
|
|
l = {vim.lsp.codelens.refresh, 'Show codelenses'},
|
|
|
|
L = {vim.lsp.codelens.run, 'Run codelens'},
|
|
|
|
t = {'<Cmd>Telescope lsp_type_definitions<CR>', 'Type definition'},
|
|
|
|
u = {'<Cmd>Telescope lsp_references<CR>', 'Usages/references'},
|
|
|
|
U = {vim.lsp.buf.references, 'Usages/references (quickfix)'},
|
|
|
|
},
|
|
|
|
g = {
|
|
|
|
d = {vim.lsp.buf.definition, 'Goto definition'},
|
|
|
|
D = {vim.lsp.buf.implementation, 'Goto implementation'},
|
|
|
|
R = {vim.lsp.buf.rename, 'Rename'},
|
|
|
|
y = {vim.lsp.buf.type_definition, 'Type definition'},
|
|
|
|
},
|
|
|
|
['<C-h>'] = {vim.lsp.buf.document_highlight, 'Highlight object under cursor'},
|
|
|
|
}, { buffer = event.buf })
|
|
|
|
end })
|
2022-06-15 07:45:13 +02:00
|
|
|
|
2024-02-22 12:09:11 +01:00
|
|
|
function _G.mason_path(package)
|
2023-11-12 09:52:29 +01:00
|
|
|
return vim.fn.stdpath('data') .. '/mason/packages/' .. package
|
|
|
|
end
|
2022-06-15 07:45:13 +02:00
|
|
|
|
2024-02-22 12:09:11 +01:00
|
|
|
-- Bootstrap plugin system
|
|
|
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
2024-02-22 20:51:05 +01:00
|
|
|
if not vim.loop.fs_stat(lazypath) then
|
2024-02-22 12:09:11 +01:00
|
|
|
vim.fn.system({
|
|
|
|
"git",
|
|
|
|
"clone",
|
|
|
|
"--filter=blob:none",
|
|
|
|
"https://github.com/folke/lazy.nvim.git",
|
|
|
|
"--branch=stable", -- latest stable release
|
|
|
|
lazypath,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
|
|
|
|
require('lazy').setup({
|
2022-06-15 07:45:13 +02:00
|
|
|
-- Themes --
|
2024-02-22 12:09:11 +01:00
|
|
|
{'miikanissi/modus-themes.nvim', opts = {}},
|
|
|
|
'arcticicestudio/nord-vim',
|
|
|
|
'folke/tokyonight.nvim',
|
|
|
|
{'catppuccin/nvim', name = 'catppuccin', opts = {
|
|
|
|
integrations = {
|
|
|
|
barbar = true,
|
2023-01-20 19:36:31 +01:00
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
}},
|
|
|
|
'navarasu/onedark.nvim',
|
2022-06-15 07:45:13 +02:00
|
|
|
|
|
|
|
-- Filetype plugins --
|
2024-02-22 12:09:11 +01:00
|
|
|
'rhysd/vim-crystal',
|
|
|
|
'bakpakin/fennel.vim',
|
|
|
|
'mboughaba/i3config.vim',
|
2024-12-05 21:32:29 +01:00
|
|
|
{'OXY2DEV/markview.nvim', lazy = false, opts = { initial_state = false }},
|
2024-02-22 12:09:11 +01:00
|
|
|
'mracos/mermaid.vim',
|
|
|
|
'lifepillar/pgsql.vim',
|
|
|
|
'ajouellette/sway-vim-syntax',
|
|
|
|
'cespare/vim-toml',
|
2024-12-05 21:32:29 +01:00
|
|
|
'mfussenegger/nvim-ansible',
|
2024-02-22 12:09:11 +01:00
|
|
|
|
|
|
|
-- Editing
|
|
|
|
{'LunarWatcher/auto-pairs', init = function()
|
|
|
|
vim.g.AutoPairsMultilineClose = 0
|
|
|
|
vim.g.AutoPairsMapBS = 1
|
2024-04-03 15:45:26 +02:00
|
|
|
vim.g.AutoPairsMapCR = 1
|
2024-02-22 12:09:11 +01:00
|
|
|
vim.g.AutoPairsCompatibleMaps = 1
|
|
|
|
vim.g.AutoPairsShortcutToggleMultilineClose = ''
|
|
|
|
end},
|
|
|
|
'ojroques/nvim-bufdel',
|
|
|
|
{'stevearc/conform.nvim', config = function ()
|
2024-01-05 09:06:34 +01:00
|
|
|
require'conform'.setup {
|
2024-02-22 12:09:11 +01:00
|
|
|
formatters_by_ft = {
|
|
|
|
html = {"prettier"},
|
|
|
|
},
|
2024-01-05 09:06:34 +01:00
|
|
|
format_on_save = {
|
|
|
|
lsp_fallback = true,
|
|
|
|
filter = function(client)
|
|
|
|
return client.name == 'rust-analyzer'
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
2023-11-30 15:43:20 +01:00
|
|
|
vim.api.nvim_create_user_command(
|
|
|
|
'Conform',
|
|
|
|
function()
|
2024-01-05 09:06:34 +01:00
|
|
|
require'conform'.format {
|
|
|
|
lsp_fallback = true,
|
|
|
|
}
|
2023-11-30 15:43:20 +01:00
|
|
|
end,
|
2024-01-05 09:06:34 +01:00
|
|
|
{
|
|
|
|
desc = 'Format buffer',
|
|
|
|
}
|
2023-11-30 15:43:20 +01:00
|
|
|
)
|
2024-02-22 12:09:11 +01:00
|
|
|
au('LspAttach', { callback = function()
|
|
|
|
vim.bo.formatexpr = "v:lua.require'conform'.formatexpr()"
|
|
|
|
end })
|
|
|
|
end},
|
|
|
|
'direnv/direnv.vim',
|
|
|
|
'jbyuki/instant.nvim',
|
|
|
|
{'mizlan/iswap.nvim', config = function()
|
|
|
|
require'iswap'.setup {}
|
|
|
|
vim.keymap.set('', '<Leader>s', '<Cmd>ISwapWith<CR>', { desc = 'Swap' })
|
|
|
|
end},
|
|
|
|
{'windwp/nvim-projectconfig', opts = {
|
|
|
|
-- Load project configuration when changing directory
|
|
|
|
autocmd = true,
|
|
|
|
}},
|
|
|
|
'tpope/vim-repeat',
|
|
|
|
'tpope/vim-sleuth',
|
|
|
|
'AndrewRadev/splitjoin.vim',
|
|
|
|
{'kylechui/nvim-surround', opts = {}},
|
|
|
|
'wellle/targets.vim',
|
|
|
|
{'vim-test/vim-test', init = function()
|
2024-12-05 21:32:29 +01:00
|
|
|
-- Uncomment to move test output to the side instead of bottom
|
|
|
|
-- vim.g['test#neovim#term_position'] = 'vert'
|
|
|
|
vim.g['echo_command'] = 1
|
2022-06-15 07:45:13 +02:00
|
|
|
vim.g['test#strategy'] = 'neovim'
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'julian/vim-textobj-variable-segment', dependencies = {'kana/vim-textobj-user'}},
|
|
|
|
{'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opts = {
|
|
|
|
-- Configure the nvim-ts-autotag plugin
|
|
|
|
autotag = {
|
|
|
|
enable = true,
|
|
|
|
},
|
|
|
|
ensure_installed = {'lua', 'html', 'c', 'cpp', 'nix', 'vim', 'vimdoc', 'rust', 'bash', 'markdown', 'java', 'markdown_inline'},
|
|
|
|
highlight = { enable = true, disable = {'rust', 'bash'} },
|
|
|
|
incremental_selection = { enable = true },
|
|
|
|
}, config = function(_, opts)
|
|
|
|
require'nvim-treesitter.configs'.setup(opts)
|
|
|
|
end},
|
|
|
|
'windwp/nvim-ts-autotag',
|
|
|
|
{'kevinhwang91/nvim-ufo', dependencies = 'kevinhwang91/promise-async', config = function()
|
|
|
|
local ufo = require('ufo')
|
2023-09-04 15:57:31 +02:00
|
|
|
vim.keymap.set('n', 'zR', ufo.openAllFolds)
|
|
|
|
vim.keymap.set('n', 'zR', ufo.closeAllFolds)
|
|
|
|
ufo.setup {}
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
'hrsh7th/vim-vsnip',
|
2022-06-15 07:45:13 +02:00
|
|
|
|
|
|
|
-- LSP --
|
2024-02-22 12:09:11 +01:00
|
|
|
{'neovim/nvim-lspconfig', dependencies = {'hrsh7th/cmp-nvim-lsp', 'williamboman/mason-lspconfig.nvim'}, config = function()
|
|
|
|
local lspconfig = require'lspconfig'
|
|
|
|
-- Tweak the advertized LSP client capabilities
|
|
|
|
local capabilities = require'cmp_nvim_lsp'.default_capabilities()
|
|
|
|
-- Set options for nvim-ufo
|
|
|
|
capabilities.textDocument.foldingRange = {
|
|
|
|
dynamicRegistration = false,
|
|
|
|
lineFoldingOnly = true,
|
|
|
|
}
|
|
|
|
-- Update the default for all servers
|
|
|
|
lspconfig.util.default_config.capabilities = capabilities
|
|
|
|
|
|
|
|
-- Set up language servers
|
2024-12-05 21:32:29 +01:00
|
|
|
lspconfig.ansiblels.setup {}
|
2024-02-22 12:09:11 +01:00
|
|
|
lspconfig.bashls.setup {}
|
|
|
|
lspconfig.clangd.setup {}
|
|
|
|
lspconfig.eslint.setup { autostart = false }
|
|
|
|
lspconfig.lemminx.setup {}
|
|
|
|
lspconfig.lua_ls.setup {
|
|
|
|
settings = {
|
|
|
|
Lua = {
|
|
|
|
runtime = {
|
|
|
|
version = 'LuaJIT',
|
|
|
|
},
|
|
|
|
diagnostics = {
|
|
|
|
globals = {'vim'},
|
|
|
|
},
|
|
|
|
workspace = {
|
|
|
|
library = vim.api.nvim_get_runtime_file('', true),
|
|
|
|
checkThirdParty = false,
|
|
|
|
},
|
|
|
|
telemetry = {
|
|
|
|
enable = false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lspconfig.nil_ls.setup {}
|
2024-03-23 07:38:07 +01:00
|
|
|
lspconfig.basedpyright.setup {}
|
2024-02-22 12:09:11 +01:00
|
|
|
lspconfig.vimls.setup {}
|
|
|
|
|
|
|
|
-- TODO decide what to do with autocmd
|
|
|
|
end},
|
|
|
|
{'hrsh7th/nvim-cmp', dependencies = {
|
|
|
|
'rcarriga/cmp-dap',
|
|
|
|
'hrsh7th/cmp-nvim-lua',
|
|
|
|
'hrsh7th/cmp-nvim-lsp',
|
|
|
|
'hrsh7th/cmp-buffer',
|
|
|
|
'hrsh7th/cmp-path',
|
|
|
|
'hrsh7th/cmp-cmdline',
|
|
|
|
'dcampos/nvim-snippy',
|
|
|
|
'dcampos/cmp-snippy',
|
2024-04-03 15:45:26 +02:00
|
|
|
'LunarWatcher/auto-pairs'
|
2024-02-22 12:09:11 +01:00
|
|
|
}, config = function()
|
|
|
|
local cmp = require'cmp'
|
|
|
|
local cmp_dap = require'cmp_dap'
|
|
|
|
local snippy = require'snippy'
|
|
|
|
vim.opt.completeopt:append({'menuone', 'noinsert', 'noselect'})
|
|
|
|
local has_words_before = function()
|
|
|
|
unpack = unpack or table.unpack
|
|
|
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
|
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
|
|
|
end
|
|
|
|
cmp.setup {
|
|
|
|
enabled = function()
|
|
|
|
return vim.bo.buftype ~= 'prompt' or cmp_dap.is_dap_buffer()
|
|
|
|
end,
|
|
|
|
preselect = cmp.PreselectMode.None,
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
require('snippy').expand_snippet(args.body)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
mapping = cmp.mapping.preset.insert {
|
|
|
|
-- Next item, or expand or jump snippet, or fallback
|
|
|
|
['<Tab>'] = cmp.mapping(
|
|
|
|
function(fallback)
|
|
|
|
if cmp.visible() then
|
|
|
|
cmp.select_next_item()
|
|
|
|
elseif snippy.can_expand_or_advance() then
|
|
|
|
snippy.expand_or_advance()
|
|
|
|
elseif has_words_before() then
|
|
|
|
cmp.complete()
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
{'i', 's'}
|
|
|
|
),
|
|
|
|
-- Prev item, or jump snippet back, or fallback
|
|
|
|
['<S-Tab>'] = cmp.mapping(
|
|
|
|
function(fallback)
|
|
|
|
if cmp.visible() then
|
|
|
|
cmp.select_prev_item()
|
|
|
|
elseif snippy.can_jump(-1) then
|
|
|
|
snippy.previous()
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
{'i', 's'}
|
|
|
|
),
|
|
|
|
-- Scroll documentation up
|
|
|
|
['<C-e>'] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}),
|
|
|
|
-- Scroll documentation down
|
|
|
|
['<C-y>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}),
|
|
|
|
-- Complete common substring
|
|
|
|
['<C-l>'] = cmp.mapping(cmp.mapping.complete_common_string(), {'i', 'c'}),
|
|
|
|
-- Complete
|
|
|
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete {}, {'i', 'c'}),
|
|
|
|
-- Confirm
|
|
|
|
['<CR>'] = cmp.mapping(cmp.mapping.confirm { select = false }, {'i', 'c'}),
|
|
|
|
},
|
|
|
|
sources = {
|
|
|
|
{ name = 'path' },
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
{ name = 'nvim_lua' },
|
|
|
|
{ name = 'snippy' },
|
|
|
|
},
|
|
|
|
-- Experimental features
|
|
|
|
experimental = {
|
|
|
|
-- Show completion result as virtual text
|
|
|
|
ghost_text = true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
cmp.setup.cmdline(':', {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'path' }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name = 'cmdline',
|
|
|
|
option = {
|
|
|
|
ignore_cmds = { 'Man', '!' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
})
|
|
|
|
cmp.setup.cmdline({'/', '?'}, {
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
sources = {
|
|
|
|
{ name = 'buffer' }
|
|
|
|
},
|
|
|
|
})
|
|
|
|
cmp.setup.filetype({'dap-repl', 'dapui_watches', 'dapui_hover'}, {
|
|
|
|
sources = {
|
|
|
|
{ name = 'dap' },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end},
|
|
|
|
{'mfussenegger/nvim-jdtls', dependencies = {'neovim/nvim-lspconfig'}, config = function()
|
|
|
|
au('FileType', {
|
|
|
|
pattern = 'java',
|
|
|
|
callback = function()
|
|
|
|
local jdtls = require 'jdtls'
|
|
|
|
jdtls.tests = require'jdtls.tests'
|
|
|
|
jdtls.dap = require'jdtls.dap'
|
|
|
|
_G.jdt = jdtls
|
|
|
|
local lspconfig = require'lspconfig'
|
|
|
|
|
|
|
|
local root_dir = jdtls.setup.find_root({'.git', 'mvnw', 'gradlew'})
|
|
|
|
|
|
|
|
local config = {
|
|
|
|
-- The command to launch jdtls with
|
|
|
|
cmd = {
|
|
|
|
'jdtls',
|
|
|
|
-- Enable logging
|
|
|
|
'--jvm-arg=-Dlog.level=ALL',
|
|
|
|
'--jvm-arg=-Dlog.protocol=true',
|
|
|
|
-- Enable lombok
|
|
|
|
'--jvm-arg=-javaagent:' .. mason_path('jdtls') .. '/lombok.jar',
|
|
|
|
-- store workpace data in ~/.local/share/eclipse/<project-name>
|
|
|
|
'-data', vim.fn.expand('~/.local/share/eclipse/') .. vim.fn.fnamemodify(root_dir, ':p:h:t')
|
|
|
|
},
|
|
|
|
|
|
|
|
root_dir = root_dir,
|
|
|
|
|
|
|
|
capabilities = lspconfig.util.default_config.capabilities,
|
|
|
|
|
|
|
|
settings = {
|
2024-03-18 15:44:59 +01:00
|
|
|
java = {
|
|
|
|
autobuild = { enabled = false },
|
|
|
|
},
|
2024-02-22 12:09:11 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
init_options = {
|
|
|
|
-- JDTLS plugins
|
|
|
|
bundles = (function()
|
|
|
|
-- add java-debug-adapter
|
|
|
|
local bundles = {
|
|
|
|
vim.fn.glob(mason_path'java-debug-adapter' .. '/extension/server/com.microsoft.java.debug.plugin-*.jar', true)
|
|
|
|
}
|
|
|
|
-- add java-test
|
|
|
|
vim.list_extend(bundles, vim.split(
|
|
|
|
vim.fn.glob(vim.fn.expand('~/.local/share/vscode-java-test/server') .. '/*.jar', true),
|
|
|
|
'\n'
|
|
|
|
))
|
|
|
|
|
|
|
|
return bundles
|
|
|
|
end)(),
|
|
|
|
},
|
|
|
|
|
|
|
|
on_attach = function(client, bufnr)
|
|
|
|
jdtls.setup_dap()
|
2024-12-05 21:32:29 +01:00
|
|
|
vim.keymap.set('n', '<Leader>lo', jdtls.organize_imports, { desc = 'Organize imports', buffer = bufnr })
|
|
|
|
vim.keymap.set('n', '<Leader>Xm', jdtls.test_nearest_method, { desc = 'Test nearest method', buffer = bufnr })
|
|
|
|
vim.keymap.set('n', '<Leader>Xc', jdtls.test_class, { desc = 'Test class', buffer = bufnr })
|
|
|
|
vim.keymap.set('n', '<Leader>Xg', jdtls.tests.goto_subjects, { desc = 'Go to test', buffer = bufnr })
|
|
|
|
vim.keymap.set('n', '<Leader>Xb', 'JdtCompile full', { desc = 'Build', buffer = bufnr })
|
2024-02-22 12:09:11 +01:00
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
|
|
|
jdtls.start_or_attach(config)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
end},
|
2024-02-22 20:51:05 +01:00
|
|
|
{'mrcjkb/rustaceanvim', config = function ()
|
|
|
|
vim.g.rustaceanvim = {
|
|
|
|
server = {
|
|
|
|
default_settings = {
|
|
|
|
['rust-analyzer'] = {
|
|
|
|
cargo = {
|
|
|
|
-- Load OUT_DIR when running check on save, needed for proc macros
|
|
|
|
loadOutDirsFromCheck = true,
|
|
|
|
},
|
|
|
|
checkOnSave = true,
|
|
|
|
-- Error checking settings
|
|
|
|
check = {
|
|
|
|
-- Use clippy for error checking
|
|
|
|
command = "clippy",
|
|
|
|
-- Also run checks for tests
|
|
|
|
allTargets = true,
|
|
|
|
},
|
|
|
|
diagnostics = {
|
|
|
|
-- Disable diagnostics with false positives
|
|
|
|
disabled = {'unresolved-import'},
|
|
|
|
},
|
|
|
|
procMacro = {
|
|
|
|
-- Enable proc macro support
|
|
|
|
enable = true,
|
|
|
|
},
|
|
|
|
rustfmt = {
|
|
|
|
extraArgs = { '+nightly' }
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end},
|
2024-03-16 11:53:10 +01:00
|
|
|
{'Saecki/crates.nvim', opts = {
|
|
|
|
lsp = {
|
|
|
|
enabled = true,
|
|
|
|
actions = true,
|
|
|
|
completion = true,
|
|
|
|
hover = true,
|
|
|
|
}
|
|
|
|
}},
|
2024-02-22 12:09:11 +01:00
|
|
|
{'pmizio/typescript-tools.nvim', opts = {
|
|
|
|
settings = {
|
|
|
|
tsserve_file_preferences = {
|
|
|
|
quotePreference = 'single'
|
|
|
|
},
|
|
|
|
tsserver_plugins = (function ()
|
2024-02-22 20:51:05 +01:00
|
|
|
if fn.has('nvim-0.10') == 0 then return end
|
2024-12-05 21:32:29 +01:00
|
|
|
if vim.fn.executable('npm') == 1 and vim.system({'npm', 'list', '-g', '@styled/typescript-styled-plugin'}):wait().code == 0 then
|
2024-02-22 12:09:11 +01:00
|
|
|
return {'@styled/typescript-styled-plugin'}
|
|
|
|
else
|
|
|
|
return {}
|
|
|
|
end
|
|
|
|
end)()
|
|
|
|
}
|
|
|
|
}},
|
2024-03-23 07:38:07 +01:00
|
|
|
{'dmmulroy/ts-error-translator.nvim', opts = {}},
|
2024-02-22 12:09:11 +01:00
|
|
|
{'nvimtools/none-ls.nvim', dependencies = {'nvim-lua/plenary.nvim'}, config = function()
|
2022-06-15 07:45:13 +02:00
|
|
|
local null_ls = require'null-ls'
|
|
|
|
null_ls.setup {
|
|
|
|
sources = {
|
2023-04-19 10:43:45 +02:00
|
|
|
null_ls.builtins.diagnostics.zsh,
|
2022-06-15 07:45:13 +02:00
|
|
|
}
|
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'SmiteshP/nvim-navic', config = function()
|
|
|
|
au('LspAttach', { callback = function(event)
|
|
|
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
|
|
|
if not client then return end
|
|
|
|
if client.server_capabilities.documentSymbolProvider then
|
|
|
|
require'nvim-navic'.attach(client, event.buf)
|
|
|
|
end
|
|
|
|
end })
|
|
|
|
end},
|
|
|
|
{'utilyre/barbecue.nvim', opts = {
|
2024-03-16 11:53:10 +01:00
|
|
|
show_modified = true,
|
|
|
|
lead_custom_section = function()
|
|
|
|
return { {' ', 'WinBar'} }
|
|
|
|
end,
|
2024-02-22 12:09:11 +01:00
|
|
|
}},
|
|
|
|
|
|
|
|
-- UI Elements --
|
|
|
|
{'vim-airline/vim-airline', dependencies = {'vim-airline/vim-airline-themes'}, init = function ()
|
|
|
|
-- Permit spaces after tabs but not in between when doing mixed indent checking
|
|
|
|
-- (mainly for multiline /* */ style comments)
|
|
|
|
vim.g['airline#extensions#whitespace#mixed_indent_algo'] = 2
|
|
|
|
-- truncate leading branch paths, i.e. agraven/foo → a/foo
|
|
|
|
vim.g['airline#extensions#branch#format'] = 2
|
|
|
|
vim.g['airline#extensions#c_like_langs'] = {'typescript'}
|
|
|
|
-- Hide encoding section
|
|
|
|
vim.g['airline#extensions#default#layout'] = {{'a', 'b', 'c'}, {'x', 'z', 'warning', 'error'}}
|
|
|
|
vim.g.airline_detect_spell = 1 -- Show if 'spell' is enabled
|
|
|
|
vim.g.airline_detect_spelllang = 1 -- Display what language spell is using if enabled
|
|
|
|
vim.g.airline_inactive_collapse = 1 -- Show only filename in inactive windows
|
|
|
|
vim.g.airline_highlighting_cache = 1 -- Improves performance
|
|
|
|
vim.g.airline_theme = 'ayu_mirage' -- Airline's theme
|
|
|
|
vim.g.airline_powerline_fonts = 1 -- Enable symbols from the powerline font patch
|
|
|
|
|
|
|
|
-- This doesn't work in lua for some reason
|
|
|
|
vim.cmd [[
|
|
|
|
if !exists('g:airline_symbols')
|
|
|
|
let g:airline_symbols = {} " Initialize the table of symbols
|
|
|
|
endif
|
|
|
|
let g:airline_symbols.linenr = ' ' " Symbol before line number
|
|
|
|
let g:airline_symbols.maxlinenr = '' " Symbol after max line number
|
|
|
|
let g:airline_symbols.colnr = ' ' " Symbol before column number
|
|
|
|
let g:airline_symbols.dirty = '+' " Symbol on modified branch
|
|
|
|
let g:airline_symbols.notexists = '?' " Symbol for untracked file
|
|
|
|
]]
|
|
|
|
end},
|
|
|
|
{'romgrk/barbar.nvim', lazy = false, keys = {
|
|
|
|
{'<A-,>', '<Cmd>BufferPrevious<CR>', { desc = 'Next buffer' }},
|
|
|
|
{'<A-.>', '<Cmd>BufferNext<CR>', { desc = 'Previous buffer' }},
|
|
|
|
{'<A-b>', '<Cmd>BufferPick<CR>', { desc = 'Pick buffer' }},
|
|
|
|
{'<A-p>', '<Cmd>BufferPin<CR>', { desc = 'Pin buffer' }},
|
|
|
|
{'<A-d>', '<Cmd>BufferClose<CR>', { desc = 'Delete buffer' }},
|
|
|
|
{'<A-x>', '<Cmd>BufferPickDelete<CR>', { desc = 'Delete picked buffer' }},
|
|
|
|
{'<A-<>', '<Cmd>BufferMovePrevious<CR>', { desc = 'Move buffer left' }},
|
|
|
|
{'<A->>', '<Cmd>BufferMoveNext<CR>', { desc = 'Move buffer right' }},
|
|
|
|
{'<Leader>b,', '<Cmd>BufferPrevious<CR>', { desc = 'Next buffer' }},
|
|
|
|
{'<Leader>b.', '<Cmd>BufferNext<CR>', { desc = 'Previous buffer' }},
|
|
|
|
{'<Leader>bb', '<Cmd>BufferPick<CR>', { desc = 'Pick buffer' }},
|
|
|
|
{'<Leader>bp', '<Cmd>BufferPin<CR>', { desc = 'Pin buffer' }},
|
|
|
|
{'<Leader>bd', '<Cmd>BufferClose<CR>', { desc = 'Delete buffer' }},
|
|
|
|
{'<Leader>bx', '<Cmd>BufferPickDelete<CR>', { desc = 'Delete picked buffer' }},
|
|
|
|
{'<Leader>bh', '<Cmd>BufferMovePrevious<CR>', { desc = 'Move buffer left' }},
|
|
|
|
{'<Leader>bl', '<Cmd>BufferMoveNext<CR>', { desc = 'Move buffer right' }},
|
|
|
|
}},
|
|
|
|
{'luckasRanarison/clear-action.nvim', config = function()
|
2023-11-12 09:54:58 +01:00
|
|
|
require'clear-action'.setup {
|
2024-01-05 09:06:34 +01:00
|
|
|
signs = {
|
|
|
|
enable = true,
|
2024-02-22 12:09:11 +01:00
|
|
|
-- Only show one symbol instead of several per category
|
2024-01-05 09:06:34 +01:00
|
|
|
combine = true,
|
2024-02-22 12:09:11 +01:00
|
|
|
-- Don't show the number of actions,
|
2024-01-05 09:06:34 +01:00
|
|
|
show_count = false,
|
2024-02-22 12:09:11 +01:00
|
|
|
-- Which icons to use for code action sings
|
|
|
|
icons = {
|
|
|
|
combined = '🛈',
|
|
|
|
},
|
2024-01-05 09:06:34 +01:00
|
|
|
},
|
2023-11-12 09:54:58 +01:00
|
|
|
popup = { enable = true },
|
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
au('LspAttach', { callback = function(event)
|
|
|
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
|
|
|
local code_action
|
|
|
|
if client and client.name ~= 'jdtls' then
|
|
|
|
code_action = require'clear-action'.code_action
|
|
|
|
else
|
|
|
|
code_action = vim.lsp.buf.code_action
|
|
|
|
end
|
|
|
|
vim.keymap.set('n', 'ga', code_action, { buffer = event.buf, desc = 'Code action' })
|
2024-12-05 21:32:29 +01:00
|
|
|
vim.keymap.set('n', '<Leader>la', vim.lsp.buf.code_action, { buffer = event.buf, desc = 'Code action' })
|
2024-02-22 12:09:11 +01:00
|
|
|
end })
|
|
|
|
end},
|
|
|
|
{'MattesGroeger/vim-bookmarks', config = function()
|
2023-04-12 10:27:14 +02:00
|
|
|
vim.g.bookmark_no_default_key_mappings = 1
|
2022-06-15 07:45:13 +02:00
|
|
|
vim.g.bookmark_save_per_working_dir = 1
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'kristijanhusak/vim-dadbod-ui', dependencies = {'tpope/vim-dadbod', 'kristijanhusak/vim-dadbod-completion'}, config = function()
|
2024-01-05 09:06:34 +01:00
|
|
|
vim.g.db_ui_use_nerd_fonts = 1
|
|
|
|
vim.g.db_ui_auto_execute_table_helpers = 1
|
|
|
|
vim.g.db_ui_win_position = 'right'
|
|
|
|
vim.o.previewheight = 40
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
|
|
group = 'luarc',
|
|
|
|
pattern = {'sql','mysql','plsql'},
|
|
|
|
callback = function()
|
|
|
|
require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} })
|
|
|
|
end,
|
|
|
|
desc = 'SQL dadbod completion',
|
|
|
|
})
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'mfussenegger/nvim-dap', dependencies = {'folke/which-key.nvim'}, config = function()
|
2022-08-18 12:15:48 +02:00
|
|
|
local dap = require'dap'
|
2024-01-05 09:06:34 +01:00
|
|
|
vim.fn.sign_define('DapBreakpoint', {text = '⯃', texthl = 'DiagnosticError'})
|
2022-08-18 12:15:48 +02:00
|
|
|
dap.adapters.codelldb = {
|
|
|
|
type = 'server',
|
|
|
|
port = '${port}',
|
|
|
|
executable = {
|
2023-11-12 09:52:29 +01:00
|
|
|
--command = mason_path('codelldb') .. '/extension/adapter/codelldb',
|
|
|
|
--args = {'--liblldb', mason_path('codelldb') .. '/extension/lldb/lib/liblldb.so', '--port', '${port}'},
|
2024-02-22 20:51:05 +01:00
|
|
|
command = 'codelldb',
|
2022-08-18 12:15:48 +02:00
|
|
|
args = {'--port', '${port}'},
|
|
|
|
},
|
|
|
|
}
|
2023-04-19 10:43:45 +02:00
|
|
|
dap.adapters.sh = {
|
|
|
|
type = 'executable',
|
2023-11-12 09:52:29 +01:00
|
|
|
command = mason_path('bash-debug-adapter') .. '/bash-debug-adapter'
|
|
|
|
}
|
|
|
|
dap.adapters['pwa-node'] = {
|
|
|
|
type = 'server',
|
|
|
|
host = 'localhost',
|
|
|
|
port = '${port}',
|
|
|
|
executable = {
|
|
|
|
command = 'node',
|
|
|
|
args = {
|
|
|
|
mason_path('js-debug-adapter') .. '/js-debug/src/dapDebugServer.js',
|
|
|
|
'${port}'
|
|
|
|
},
|
|
|
|
},
|
2023-04-19 10:43:45 +02:00
|
|
|
}
|
2022-08-18 12:15:48 +02:00
|
|
|
dap.configurations.cpp = {
|
|
|
|
{
|
|
|
|
name = 'Launch file',
|
|
|
|
type = 'codelldb',
|
|
|
|
request = 'launch',
|
|
|
|
program = function()
|
|
|
|
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
|
|
|
end,
|
|
|
|
cwd = '${workspaceFolder}',
|
|
|
|
stopOnEntry = true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
dap.configurations.rust = dap.configurations.cpp
|
2023-04-19 10:43:45 +02:00
|
|
|
dap.configurations.c = dap.configurations.cpp
|
|
|
|
dap.configurations.sh = {
|
|
|
|
{
|
|
|
|
name = 'Bash debugger',
|
|
|
|
type = 'sh',
|
|
|
|
request = 'launch',
|
|
|
|
program = '${file}',
|
|
|
|
cwd = '${fileDirname}',
|
2023-11-12 09:52:29 +01:00
|
|
|
pathBashdb = mason_path('bash-debug-adapter') .. '/extension/bashdb_dir/bashdb',
|
|
|
|
pathBashdbLib = mason_path('bash-debug-adapter') .. '/extension/bashdb_dir',
|
2023-04-19 10:43:45 +02:00
|
|
|
pathBash = 'bash',
|
|
|
|
pathCat = 'cat',
|
|
|
|
pathMkfifo = 'mkfifo',
|
|
|
|
pathPkill = 'pkill',
|
|
|
|
env = {},
|
2023-11-30 15:43:20 +01:00
|
|
|
args = function()
|
2023-04-19 10:43:45 +02:00
|
|
|
return vim.fn.split(vim.fn.input('Arguments: ', '', 'file'))
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
}
|
2023-11-12 09:52:29 +01:00
|
|
|
dap.configurations.javascript = {
|
|
|
|
{
|
|
|
|
type = 'pwa-node',
|
|
|
|
request = 'launch',
|
|
|
|
name = 'Launch current file',
|
|
|
|
program = '${file}',
|
|
|
|
cwd = '${workspaceFolder}',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = 'pwa-node',
|
|
|
|
request = 'launch',
|
|
|
|
name = 'Launch file',
|
|
|
|
program = function()
|
|
|
|
return vim.fn.input('Path to file: ', vim.fn.getcwd() .. '/', 'file')
|
|
|
|
end,
|
|
|
|
cwd = '${workspaceFolder}',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = 'pwa-node',
|
|
|
|
request = 'attach',
|
|
|
|
name = 'Attach',
|
|
|
|
processId = require'dap.utils'.pick_process,
|
|
|
|
cwd = '${workspaceFolder}',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = 'pwa-node',
|
|
|
|
request = 'launch',
|
|
|
|
name = 'Debug Mocha Tests',
|
|
|
|
-- trace = true, -- include debugger info
|
|
|
|
runtimeExecutable = 'node',
|
|
|
|
runtimeArgs = {
|
|
|
|
'./node_modules/mocha/bin/mocha',
|
|
|
|
},
|
|
|
|
rootPath = '${workspaceFolder}',
|
|
|
|
cwd = '${workspaceFolder}',
|
|
|
|
console = 'integratedTerminal',
|
|
|
|
internalConsoleOptions = 'neverOpen',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dap.configurations.typescript = dap.configurations.javascript
|
|
|
|
|
2023-01-20 19:36:31 +01:00
|
|
|
local function conditional_breakpoint()
|
|
|
|
vim.ui.input({prompt = 'Breakpoint condition'}, function(condition)
|
|
|
|
if not condition then return end
|
|
|
|
dap.toggle_breakpoint(condition)
|
|
|
|
end)
|
|
|
|
end
|
2022-08-18 12:15:48 +02:00
|
|
|
require'which-key'.register {
|
|
|
|
['<Leader>d'] = {
|
|
|
|
name = 'Debug',
|
|
|
|
c = {dap.continue, 'Continue/start'},
|
|
|
|
s = {dap.terminate, 'Stop'},
|
|
|
|
b = {dap.toggle_breakpoint, 'Breakpoint'},
|
2023-01-20 19:36:31 +01:00
|
|
|
B = {conditional_breakpoint, 'Conditional breakpoint'},
|
2023-11-01 15:49:18 +01:00
|
|
|
e = {function() dap.set_exception_breakpoints('default') end, 'Exception breakpoints'},
|
2022-08-18 12:15:48 +02:00
|
|
|
o = {dap.step_over, 'Step over'},
|
|
|
|
i = {dap.step_into, 'Step into'},
|
|
|
|
O = {dap.step_out, 'Step out'},
|
|
|
|
r = {dap.step_back, 'Step back'},
|
|
|
|
R = {dap.reverse_continue, 'Continue backwards'},
|
|
|
|
C = {dap.run_to_cursor, 'Continue to cursor'},
|
2023-06-17 10:13:05 +02:00
|
|
|
p = {dap.pause, 'Pause execution'}
|
2022-08-18 12:15:48 +02:00
|
|
|
}
|
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
2024-04-03 15:45:26 +02:00
|
|
|
{'rcarriga/nvim-dap-ui', dependencies = {
|
|
|
|
'mfussenegger/nvim-dap',
|
|
|
|
'nvim-neotest/nvim-nio'
|
|
|
|
}, config = function()
|
2023-01-20 19:36:31 +01:00
|
|
|
local dapui, dap = require'dapui', require'dap'
|
|
|
|
dapui.setup()
|
2024-02-22 12:09:11 +01:00
|
|
|
-- Hooks for opening the debugger ui automatically
|
2023-11-30 15:43:20 +01:00
|
|
|
dap.listeners.after.event_initialized.dapui_config = function()
|
2023-01-20 19:36:31 +01:00
|
|
|
dapui.open {}
|
|
|
|
end
|
2023-11-30 15:43:20 +01:00
|
|
|
dap.listeners.before.event_terminated.dapui_config = function()
|
2023-01-20 19:36:31 +01:00
|
|
|
dapui.close {}
|
|
|
|
end
|
2023-11-30 15:43:20 +01:00
|
|
|
dap.listeners.before.event_exited.dapui_config = function()
|
2023-01-20 19:36:31 +01:00
|
|
|
dapui.close {}
|
|
|
|
end
|
2022-08-18 12:15:48 +02:00
|
|
|
require'which-key'.register {
|
2024-04-03 15:45:26 +02:00
|
|
|
['<Leader>dd'] = {dapui.toggle, 'Toggle'}
|
2022-08-18 12:15:48 +02:00
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'theHamsta/nvim-dap-virtual-text', dependencies = {'mfussenegger/nvim-dap'}, opts = {
|
|
|
|
-- Clear virtual text when the debugger does a continue
|
|
|
|
clear_on_continue = true,
|
|
|
|
}},
|
2024-05-16 16:42:42 +02:00
|
|
|
{'LiadOz/nvim-dap-repl-highlights', opts = {}},
|
2024-12-05 21:32:29 +01:00
|
|
|
{'lucaSartore/nvim-dap-exception-breakpoints', dependencies = {'mfussenegger/nvim-dap'}, config = function()
|
|
|
|
vim.keymap.set('n', '<Leader>de', require'nvim-dap-exception-breakpoints', { desc = 'Exception breakpoints'})
|
|
|
|
end},
|
2024-02-22 12:09:11 +01:00
|
|
|
{'sindrets/diffview.nvim', opts = {
|
|
|
|
-- Use nicer highlighting for diffs
|
|
|
|
enhanced_diff_hl = true,
|
2024-12-05 21:32:29 +01:00
|
|
|
win_config = {
|
|
|
|
win_opts = {
|
|
|
|
wrap = false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
key_bindings = {
|
|
|
|
view = {
|
|
|
|
["gq"] = "<CMD>DiffviewClose<CR>",
|
|
|
|
},
|
|
|
|
file_panel = {
|
|
|
|
["gq"] = "<CMD>DiffviewClose<CR>",
|
|
|
|
}
|
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
}},
|
2024-02-22 21:06:54 +01:00
|
|
|
{'stevearc/dressing.nvim', opts = {
|
2024-02-22 12:09:11 +01:00
|
|
|
input = {
|
2024-12-05 21:32:29 +01:00
|
|
|
-- Allow exiting insert mode in picker
|
2024-02-22 12:09:11 +01:00
|
|
|
insert_only = false,
|
|
|
|
win_options = {
|
|
|
|
-- Reuse telescope's highlights for windows made by dressing
|
|
|
|
winhighlight = 'NormalFloat:TelescopeNormal,FloatBorder:TelescopeBorder'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
select = {
|
|
|
|
enabled = false,
|
|
|
|
},
|
|
|
|
}, config = function(_, opts)
|
2022-06-15 10:29:26 +02:00
|
|
|
vim.cmd'highlight link FloatTitle TelescopeBorder'
|
2024-02-22 12:09:11 +01:00
|
|
|
require'dressing'.setup(opts)
|
|
|
|
end},
|
|
|
|
{'j-hui/fidget.nvim', dependencies = {'kyazdani42/nvim-tree.lua', lazy = false}, opts = {
|
|
|
|
progress = {
|
|
|
|
lsp = {
|
|
|
|
-- Workaround for rust-analyzer messages getting stuck
|
|
|
|
progress_ringbuf_size = 2048,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
integration = {
|
|
|
|
-- Disable nvim-tree integration, has bugs when restoring sessions
|
|
|
|
["nvim-tree"] = {
|
|
|
|
enable = false,
|
|
|
|
}
|
2022-06-15 10:29:26 +02:00
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
}},
|
|
|
|
{'tpope/vim-fugitive', lazy = false, dependencies = {'tpope/vim-rhubarb', 'shumphrey/fugitive-gitlab.vim'}, keys = {
|
|
|
|
{'<Leader>g', '<Cmd>vert Git<CR>', desc = 'Git status'},
|
|
|
|
{'<Leader>G', '<Cmd>tab Git<CR>', desc = 'Git status (tab)'},
|
|
|
|
}},
|
2024-04-03 15:45:26 +02:00
|
|
|
{'harrisoncramer/gitlab.nvim', dependencies = {
|
|
|
|
'MunifTanjim/nui.nvim',
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
'sindrets/diffview.nvim',
|
|
|
|
}, build = function()
|
|
|
|
require'gitlab.server'.build(true)
|
|
|
|
end, opts = {
|
2024-05-16 16:42:42 +02:00
|
|
|
attachment_dir = vim.fn.expand('~/Downloads/'),
|
2024-12-05 21:32:29 +01:00
|
|
|
keymaps = {
|
|
|
|
global = {
|
|
|
|
disable_all = true,
|
|
|
|
}
|
|
|
|
},
|
2024-05-16 16:42:42 +02:00
|
|
|
popup = {
|
2024-12-05 21:32:29 +01:00
|
|
|
-- Backup popup input in these registers
|
|
|
|
temp_registers = {'p', 'P'}
|
2024-05-16 16:42:42 +02:00
|
|
|
},
|
2024-04-03 15:45:26 +02:00
|
|
|
discussion_tree = {
|
2024-12-05 21:32:29 +01:00
|
|
|
-- Place the discussion tree at the bottom
|
2024-04-03 15:45:26 +02:00
|
|
|
position = 'bottom',
|
|
|
|
},
|
2024-12-05 21:32:29 +01:00
|
|
|
create_mr = {
|
|
|
|
-- Mark source branch for deletion by default
|
|
|
|
delete_branch = true,
|
|
|
|
}
|
2024-04-03 15:45:26 +02:00
|
|
|
}, config = function(plugin, opts)
|
|
|
|
local gitlab = require('gitlab')
|
|
|
|
gitlab.setup(opts)
|
|
|
|
require'which-key'.register {
|
|
|
|
['<Leader>a'] = {
|
|
|
|
name = '+gitlab',
|
2024-05-16 16:42:42 +02:00
|
|
|
o = {gitlab.review, 'Review'},
|
2024-04-03 15:45:26 +02:00
|
|
|
s = {gitlab.summary, 'Summary'},
|
2024-05-16 16:42:42 +02:00
|
|
|
a = {gitlab.add_assignee, 'Add assignee'},
|
2024-12-05 21:32:29 +01:00
|
|
|
A = {gitlab.delete_assignee, 'Remove assignee'},
|
2024-05-16 16:42:42 +02:00
|
|
|
r = {gitlab.add_reviewer, 'Add reviewer'},
|
2024-12-05 21:32:29 +01:00
|
|
|
R = {gitlab.delete_reviewer, 'Remove reviewer'},
|
|
|
|
Y = {gitlab.approve, 'Approve'},
|
|
|
|
N = {gitlab.revoke, 'Unapprove'},
|
|
|
|
M = {gitlab.merge, 'Merge'},
|
|
|
|
f = {gitlab.choose_merge_request, 'Pick MR'},
|
2024-05-16 16:42:42 +02:00
|
|
|
n = {gitlab.create_note, 'Note'},
|
|
|
|
m = {gitlab.create_mr, 'Create MR'},
|
|
|
|
x = {gitlab.open_in_browser, 'Open in browser'},
|
|
|
|
p = {gitlab.pipeline, 'Pipeline'},
|
2024-12-05 21:32:29 +01:00
|
|
|
P = {gitlab.publish_all_drafts, 'Publish all drafts'},
|
|
|
|
q = {function ()
|
|
|
|
gitlab.close_review()
|
|
|
|
require'gitlab.server'.shutdown()
|
|
|
|
end, 'Close review'},
|
2024-04-03 15:45:26 +02:00
|
|
|
}
|
|
|
|
}
|
2024-05-16 16:42:42 +02:00
|
|
|
require'which-key'.register({
|
|
|
|
['<Leader>a'] = {
|
|
|
|
c = {gitlab.create_multiline_comment, 'Multiline comment'},
|
|
|
|
C = {gitlab.create_comment_suggestion, 'Suggestion'},
|
|
|
|
}
|
|
|
|
}, { mode = "v" })
|
2024-04-03 15:45:26 +02:00
|
|
|
end},
|
2024-05-16 16:42:42 +02:00
|
|
|
{'lewis6991/gitsigns.nvim', dependencies = {'folke/which-key.nvim'}, opts = {
|
2024-02-22 12:09:11 +01:00
|
|
|
on_attach = function()
|
|
|
|
local gitsigns = require'gitsigns'
|
2024-12-05 21:32:29 +01:00
|
|
|
vim.keymap.set('n', ']c', function() gitsigns.nav_hunk('next') end, {desc = 'Next hunk'})
|
|
|
|
vim.keymap.set('n', '[c', function() gitsigns.nav_hunk('prev') end, {desc = 'Previous hunk'})
|
2024-02-22 12:09:11 +01:00
|
|
|
|
|
|
|
require'which-key'.register {
|
|
|
|
['<Leader>h'] = {
|
|
|
|
name = '+gitsigns',
|
|
|
|
s = {gitsigns.stage_hunk, 'Stage hunk'},
|
|
|
|
S = {gitsigns.stage_buffer, 'Stage buffer'},
|
|
|
|
r = {gitsigns.reset_hunk, 'Reset hunk'},
|
|
|
|
v = {gitsigns.select_hunk, 'Visual select hunk'},
|
|
|
|
d = {gitsigns.toggle_deleted, 'Toggle deleted lines'},
|
|
|
|
w = {gitsigns.toggle_word_diff, 'Toggle word diffs'},
|
|
|
|
l = {gitsigns.blame_line, 'Blame current line'},
|
|
|
|
L = {gitsigns.toggle_current_line_blame, 'Toggle line blame'},
|
|
|
|
b = {':Gitsigns change_base ', 'Change diff base'},
|
|
|
|
B = {gitsigns.reset_base, 'Reset diff base'},
|
|
|
|
p = {gitsigns.preview_hunk_inline, 'Preview hunk'},
|
|
|
|
P = {gitsigns.preview_hunk, 'Preview hunk popup'},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
}},
|
|
|
|
{'junegunn/goyo.vim', config = function()
|
|
|
|
vim.g.goyo_height = '95%'
|
|
|
|
end},
|
|
|
|
{url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim', config = function()
|
2022-08-15 15:05:12 +02:00
|
|
|
require'lsp_lines'.setup()
|
2023-04-12 10:27:14 +02:00
|
|
|
vim.diagnostic.config {
|
|
|
|
virtual_text = {
|
|
|
|
severity = { min = vim.diagnostic.severity.WARN },
|
|
|
|
},
|
|
|
|
virtual_lines = {
|
|
|
|
only_current_line = true,
|
|
|
|
}
|
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'williamboman/mason.nvim', opts = {}},
|
|
|
|
{'williamboman/mason-lspconfig.nvim', dependencies = {'williamboman/mason.nvim'}, opts = {
|
|
|
|
automatic_installation = true
|
|
|
|
}},
|
2024-03-18 15:44:59 +01:00
|
|
|
{'NeogitOrg/neogit', lazy = false, opts = {
|
2024-02-22 12:09:11 +01:00
|
|
|
disable_context_highlighting = true,
|
|
|
|
integrations = {
|
|
|
|
diffview = true,
|
|
|
|
},
|
|
|
|
signs = {
|
|
|
|
item = {"", ""},
|
|
|
|
section = {"", ""},
|
|
|
|
},
|
2024-03-18 15:44:59 +01:00
|
|
|
}, keys = {
|
|
|
|
{'<Leader><C-g>', '<Cmd>Neogit<CR>', { desc = 'Neogit' }}
|
2024-02-22 12:09:11 +01:00
|
|
|
}},
|
|
|
|
{'rcarriga/nvim-notify', dependencies = {'nvim-telescope/telescope.nvim'}, opts = {
|
2024-12-05 21:32:29 +01:00
|
|
|
stages = 'fade',
|
|
|
|
render = 'compact',
|
2024-02-22 12:09:11 +01:00
|
|
|
}, config = function(_, opts)
|
|
|
|
require'notify'.setup(opts)
|
2022-06-15 07:45:13 +02:00
|
|
|
vim.notify = require'notify'
|
|
|
|
require'telescope'.load_extension('notify')
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'stevearc/overseer.nvim', dependencies = {'folke/which-key.nvim'}, config = function(plugin, opts)
|
|
|
|
require'overseer'.setup(opts)
|
2024-01-05 09:06:34 +01:00
|
|
|
require'which-key'.register {
|
|
|
|
['<Leader>r'] = {
|
|
|
|
name = 'Overseer (run tasks)',
|
2024-03-23 07:38:07 +01:00
|
|
|
r = {'<Cmd>OverseerToggle bottom<CR>', 'Open' },
|
|
|
|
R = {'<Cmd>OverseerToggle right<CR>', 'Open (right)' },
|
2024-01-05 09:06:34 +01:00
|
|
|
n = {'<Cmd>OverseerRun<CR>', 'New task' },
|
|
|
|
c = {'<Cmd>OverseerRunCmd<CR>', 'Run shell command' },
|
|
|
|
l = {'<Cmd>OverseerLoadBundle!<CR>', 'Load task list'},
|
|
|
|
L = {'<Cmd>OverseerLoadBundle<CR>', 'Load and start task list'},
|
|
|
|
s = {'<Cmd>OverseerSaveBundle<CR>', 'Save task list'}
|
|
|
|
}
|
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'mhinz/vim-startify', init = function()
|
|
|
|
-- Don't change working directory when opening files
|
|
|
|
g.startify_change_to_dir = 0
|
|
|
|
-- Change working dir to version control root when opening file
|
|
|
|
g.startify_change_to_vcs_root = 1
|
|
|
|
-- Enable unicode box drawing in fortune message
|
|
|
|
g.startify_fortune_use_unicode = 1
|
|
|
|
-- Items to show on the startup screen
|
|
|
|
g.startify_lists = {
|
|
|
|
{ type = 'sessions', header = {' Sessions'} },
|
|
|
|
{ type = 'bookmarks', header = {' Bookmarks'} },
|
|
|
|
{ type = 'commands', header = {' Commands'} },
|
2024-12-05 21:32:29 +01:00
|
|
|
{ type = 'dir', header = {' Recently used ' .. fn.getcwd()} },
|
|
|
|
{ type = 'files', header = {' Recently used'} },
|
2024-02-22 12:09:11 +01:00
|
|
|
}
|
2024-04-03 15:26:26 +02:00
|
|
|
g.startify_bookmarks = {
|
|
|
|
{ c = '~/.config/nvim/init.lua' },
|
|
|
|
}
|
|
|
|
g.startify_commands = {
|
|
|
|
{ L = {'Lazy - plugin manager', 'Lazy'} },
|
|
|
|
{ M = {'Mason - tool manager', 'Mason'} },
|
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'nvim-telescope/telescope.nvim', dependencies = {
|
2024-12-05 21:32:29 +01:00
|
|
|
'LunarWatcher/auto-pairs',
|
2024-02-22 12:09:11 +01:00
|
|
|
'nvim-telescope/telescope-fzf-native.nvim',
|
|
|
|
'nvim-telescope/telescope-file-browser.nvim',
|
|
|
|
'nvim-telescope/telescope-project.nvim',
|
2024-12-05 21:32:29 +01:00
|
|
|
'nvim-telescope/telescope-live-grep-args.nvim',
|
2024-02-22 12:09:11 +01:00
|
|
|
'nvim-telescope/telescope-ui-select.nvim',
|
|
|
|
'nvim-telescope/telescope-dap.nvim',
|
|
|
|
'debugloop/telescope-undo.nvim',
|
|
|
|
'folke/which-key.nvim',
|
|
|
|
}, config = function()
|
2023-10-18 18:23:43 +02:00
|
|
|
local ok, telescope = pcall(require, 'telescope')
|
|
|
|
if not ok then return end
|
|
|
|
telescope.builtin = require'telescope.builtin'
|
2024-02-22 12:09:11 +01:00
|
|
|
--telescope.themes = require'telescope.themes'
|
2023-10-18 18:23:43 +02:00
|
|
|
telescope.setup {
|
2022-06-15 07:45:13 +02:00
|
|
|
defaults = {
|
|
|
|
sorting_strategy = 'ascending',
|
|
|
|
mappings = {
|
|
|
|
n = {
|
|
|
|
n = 'move_selection_next',
|
|
|
|
e = 'move_selection_previous',
|
|
|
|
},
|
|
|
|
i = {
|
|
|
|
['<C-h>'] = 'which_key',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
extensions = {
|
|
|
|
fzf = {
|
|
|
|
override_generic_sorter = true,
|
|
|
|
override_file_sorter = true,
|
|
|
|
},
|
|
|
|
file_browser = {
|
|
|
|
hijack_netrw = false,
|
|
|
|
respect_gitignore = false,
|
|
|
|
},
|
|
|
|
project = {
|
|
|
|
-- TODO; check if this is right
|
|
|
|
full_path = true,
|
|
|
|
},
|
2024-02-22 21:06:54 +01:00
|
|
|
['ui-select'] = require'telescope.themes'.get_cursor {
|
|
|
|
layout_config = {
|
|
|
|
height = 15,
|
2024-12-05 21:32:29 +01:00
|
|
|
width = 100,
|
2024-02-22 21:06:54 +01:00
|
|
|
},
|
|
|
|
},
|
2022-06-15 07:45:13 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
require'which-key'.register {
|
|
|
|
["<Leader>f"] = {
|
|
|
|
name = 'Telescope',
|
|
|
|
["<Space>"] = {'<Cmd>Telescope<CR>', 'List pickers'},
|
|
|
|
f = {'<Cmd>Telescope find_files<CR>', 'Files'},
|
2024-12-05 21:32:29 +01:00
|
|
|
F = {'<Cmd>Telescope file_browser hidden=true<CR>', 'File browser'},
|
2023-11-30 15:43:20 +01:00
|
|
|
['<C-f>'] = {
|
|
|
|
function()
|
|
|
|
vim.ui.input(
|
|
|
|
{ completion = 'dir' },
|
2024-01-05 09:06:34 +01:00
|
|
|
function(input) telescope.builtin.find_files { search_dirs = {input} } end
|
|
|
|
)
|
2023-11-30 15:43:20 +01:00
|
|
|
end,
|
|
|
|
'Files in subdirectory'
|
|
|
|
},
|
2022-06-15 07:45:13 +02:00
|
|
|
d = {'<Cmd>Telescope find_files find_command=fd,--type,d,-I<CR>', 'Directories'},
|
|
|
|
r = {'<Cmd>Telescope oldfiles<CR>', 'Recent files'},
|
2024-12-05 21:32:29 +01:00
|
|
|
g = {'<Cmd>Telescope live_grep_args<CR>', 'Grep'},
|
2023-11-30 15:43:20 +01:00
|
|
|
G = {function()
|
2023-10-18 18:23:43 +02:00
|
|
|
vim.ui.input({ completion = 'dir' }, function(input)
|
2024-03-18 15:44:59 +01:00
|
|
|
if not input then return end
|
2023-10-18 18:23:43 +02:00
|
|
|
telescope.builtin.live_grep { search_dirs = {input} }
|
|
|
|
end)
|
|
|
|
end, 'Grep in subdirectory'},
|
2022-06-15 07:45:13 +02:00
|
|
|
b = {'<Cmd>Telescope buffers<CR>', 'Buffers'},
|
|
|
|
e = {'<Cmd>Telescope diagnostics<CR>', 'Diagnostics'},
|
|
|
|
h = {'<Cmd>Telescope help_tags<CR>', 'Help page'},
|
2023-06-22 20:46:31 +02:00
|
|
|
o = {'<Cmd>Telescope options<CR>', 'Options'},
|
2022-06-15 07:45:13 +02:00
|
|
|
p = {'<Cmd>Telescope project<CR>', 'Projects'},
|
|
|
|
s = {'<Cmd>Telescope lsp_dynamic_workspace_symbols<CR>', 'Symbols'},
|
2023-06-17 10:13:05 +02:00
|
|
|
S = {'<Cmd>Telescope lsp_document_symbols<CR>', 'Symbols - current file'},
|
2022-06-15 07:45:13 +02:00
|
|
|
n = {'<Cmd>Telescope notify<CR>', 'Notifications'},
|
2024-02-22 12:09:11 +01:00
|
|
|
m = {'<Cmd>Telescope man_pages sections=ALL<CR>', 'Man pages'},
|
2022-06-15 07:45:13 +02:00
|
|
|
[':'] = {'<Cmd>Telescope commands<CR>', 'Commands'},
|
2023-01-29 13:05:33 +01:00
|
|
|
u = {'<Cmd>Telescope undo<CR>', 'Undo'},
|
2024-03-18 15:44:59 +01:00
|
|
|
['.'] = {'<Cmd>Telescope resume<CR>', 'Resume'},
|
2022-06-15 07:45:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
require'telescope'.load_extension('fzf')
|
|
|
|
require'telescope'.load_extension('file_browser')
|
2024-12-05 21:32:29 +01:00
|
|
|
require'telescope'.load_extension('live_grep_args')
|
2022-06-15 07:45:13 +02:00
|
|
|
require'telescope'.load_extension('project')
|
|
|
|
require'telescope'.load_extension('ui-select')
|
2024-01-05 09:06:34 +01:00
|
|
|
require'telescope'.load_extension('dap')
|
2023-01-29 13:05:33 +01:00
|
|
|
require'telescope'.load_extension('undo')
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
2024-03-23 07:38:07 +01:00
|
|
|
{'nvim-neotest/neotest', dependencies = {
|
|
|
|
'nvim-neotest/neotest-vim-test',
|
|
|
|
'rouge8/neotest-rust',
|
|
|
|
}, config = function()
|
2023-11-01 15:49:18 +01:00
|
|
|
require'neotest'.setup {
|
|
|
|
adapters = {
|
2024-03-23 07:38:07 +01:00
|
|
|
require'neotest-vim-test' { allow_file_types = {'java'} },
|
2024-02-22 20:51:05 +01:00
|
|
|
require'neotest-rust' {},
|
2023-11-01 15:49:18 +01:00
|
|
|
}
|
|
|
|
}
|
2024-03-23 07:38:07 +01:00
|
|
|
require'which-key'.register {
|
|
|
|
['<Leader>x'] = {
|
|
|
|
name = 'Test',
|
|
|
|
s = {'<Cmd>Neotest summary<CR>','Summary'},
|
|
|
|
a = {'<Cmd>Neotest attach<CR>', 'Attach to running test'},
|
|
|
|
k = {'<Cmd>Neotest stop<CR>', 'Stop'},
|
|
|
|
o = {'<Cmd>Neotest output-panel<CR>', 'Output'}
|
|
|
|
}
|
|
|
|
}
|
2024-02-22 12:09:11 +01:00
|
|
|
end},
|
|
|
|
{'kyazdani42/nvim-tree.lua', opts = {
|
|
|
|
actions = {
|
|
|
|
open_file = {
|
|
|
|
window_picker = {
|
|
|
|
exclude = {
|
|
|
|
filetype = {'Outline', 'qf'},
|
|
|
|
},
|
|
|
|
}
|
2023-06-17 10:13:05 +02:00
|
|
|
},
|
2024-02-22 12:09:11 +01:00
|
|
|
},
|
|
|
|
-- Don't disable netrw
|
|
|
|
disable_netrw = false,
|
|
|
|
-- Show LSP diagnostics in the sign column
|
|
|
|
diagnostics = {
|
2024-12-05 21:32:29 +01:00
|
|
|
--enable = true, -- triggers deprecation warning
|
2024-02-22 12:09:11 +01:00
|
|
|
icons = {
|
|
|
|
hint = "",
|
2023-06-17 10:13:05 +02:00
|
|
|
},
|
2022-06-15 07:45:13 +02:00
|
|
|
},
|
2024-02-22 12:09:11 +01:00
|
|
|
git = {
|
|
|
|
-- Don't hide .gitignore'd files by default
|
|
|
|
ignore = false,
|
|
|
|
-- Extend timeout
|
|
|
|
timeout = 5000,
|
|
|
|
},
|
|
|
|
-- Reload the tree when its window is focused
|
|
|
|
reload_on_bufenter = true,
|
|
|
|
-- Appeareance settings
|
|
|
|
renderer = {
|
|
|
|
-- highlight git status (unstaged, staged, clean)
|
|
|
|
highlight_git = true,
|
|
|
|
-- Highlight open files
|
|
|
|
highlight_opened_files = 'name',
|
|
|
|
-- Don't hightlight files as spceial
|
|
|
|
special_files = {},
|
|
|
|
-- Combine nested folders with only one child
|
|
|
|
group_empty = true,
|
|
|
|
-- Icon settings
|
|
|
|
icons = {
|
|
|
|
-- Hide git attribute icons
|
|
|
|
show = {
|
|
|
|
git = false,
|
|
|
|
folder = true,
|
|
|
|
file = true,
|
|
|
|
folder_arrow = true,
|
2022-08-18 12:15:48 +02:00
|
|
|
},
|
2024-02-22 12:09:11 +01:00
|
|
|
-- Change icons
|
|
|
|
glyphs = {
|
|
|
|
-- Set a default icon so entries are aligned
|
|
|
|
default = '🗋'
|
2024-01-05 09:06:34 +01:00
|
|
|
},
|
2022-08-18 12:15:48 +02:00
|
|
|
},
|
|
|
|
},
|
2024-02-22 12:09:11 +01:00
|
|
|
-- Match tree cwd to vim's cwd
|
|
|
|
update_cwd = true,
|
|
|
|
view = {
|
|
|
|
width = 45,
|
2022-06-15 07:45:13 +02:00
|
|
|
},
|
2024-02-22 12:09:11 +01:00
|
|
|
}, config = function(plugin, opts)
|
|
|
|
require'nvim-tree'.setup(opts)
|
|
|
|
-- Handle restoring sessions with nvim-tree windows properly
|
|
|
|
au('BufEnter', {
|
|
|
|
pattern = 'NvimTree*',
|
|
|
|
callback = function()
|
|
|
|
local api = require('nvim-tree.api')
|
|
|
|
local view = require('nvim-tree.view')
|
2023-11-30 15:43:20 +01:00
|
|
|
|
2024-02-22 12:09:11 +01:00
|
|
|
if not view.is_visible() then
|
|
|
|
api.tree.open()
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
vim.cmd'highlight NvimTreeOpenedFile guifg=NONE guibg=NONE gui=italic'
|
|
|
|
|
|
|
|
vim.keymap.set('n', '<Leader>t', '<Cmd>NvimTreeFindFile<CR>', {desc = 'Nvim Tree'})
|
|
|
|
end},
|
|
|
|
{'hedyhli/outline.nvim', opts = {
|
|
|
|
outline_window = {
|
|
|
|
-- Use absolute number of columns instead of percentage for sizing
|
|
|
|
relative_width = false,
|
|
|
|
-- Window should be 30 columns wide
|
|
|
|
width = 30,
|
|
|
|
},
|
|
|
|
}, keys = {
|
|
|
|
{'<Leader>o', '<Cmd>Outline<CR>', desc = 'Symbols outline'}
|
|
|
|
}},
|
|
|
|
{'folke/which-key.nvim', opts = {}, config = function (plugin, opts)
|
|
|
|
require'which-key'.setup(opts)
|
|
|
|
require'which-key'.register {
|
|
|
|
['<Leader>q'] = { name = 'Quickfix' },
|
|
|
|
['<Leader>l'] = { name = 'LSP' },
|
|
|
|
['<Leader>b'] = { name = 'Buffer' },
|
|
|
|
['<Leader>e'] = { name = 'Diagnostic' },
|
|
|
|
}
|
|
|
|
end},
|
|
|
|
|
|
|
|
-- Utilities
|
|
|
|
{'ryanoasis/vim-devicons', dependencies = {'mhinz/vim-startify'}},
|
|
|
|
{'kyazdani42/nvim-web-devicons', opts = { default = true }},
|
|
|
|
{'ellisonleao/dotenv.nvim', opts = {
|
|
|
|
enable_on_load = false,
|
|
|
|
verbose = true,
|
|
|
|
}}
|
2023-09-04 15:57:31 +02:00
|
|
|
})
|
2023-01-20 19:55:05 +01:00
|
|
|
vim.cmd 'colorscheme tokyonight-night'
|