Compare commits
6 commits
39b495affd
...
36d411dafa
Author | SHA1 | Date | |
---|---|---|---|
36d411dafa | |||
22cfa037df | |||
643d282bac | |||
ce9f101024 | |||
d1b0dfe112 | |||
6b28e6417b |
3 changed files with 233 additions and 80 deletions
|
@ -4,13 +4,17 @@
|
||||||
"LuaSnip": { "branch": "master", "commit": "500981ff6cefc7343e3959ef0f939bd0bfd49ba9" },
|
"LuaSnip": { "branch": "master", "commit": "500981ff6cefc7343e3959ef0f939bd0bfd49ba9" },
|
||||||
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
|
"Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" },
|
||||||
"bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" },
|
"bats.vim": { "branch": "master", "commit": "6a5d2ef22b0ede503d867770afd02ebb1f97b709" },
|
||||||
|
"cmp-beancount": { "branch": "main", "commit": "da154ea94d598e6649d6ad01efa0a8611eff460d" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
|
"cmp-calc": { "branch": "main", "commit": "50792f34a628ea6eb31d2c90e8df174671e4e7a0" },
|
||||||
"cmp-cmdline": { "branch": "main", "commit": "8fcc934a52af96120fe26358985c10c035984b53" },
|
"cmp-cmdline": { "branch": "main", "commit": "8fcc934a52af96120fe26358985c10c035984b53" },
|
||||||
|
"cmp-digraphs": { "branch": "master", "commit": "5efc1f0078d7c5f3ea1c8e3aad04da3fd6e081a9" },
|
||||||
"cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" },
|
"cmp-latex-symbols": { "branch": "main", "commit": "165fb66afdbd016eaa1570e41672c4c557b57124" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
||||||
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
|
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
|
||||||
"cmp-pandoc-references": { "branch": "master", "commit": "2c808dff631a783ddd2c554c4c6033907589baf6" },
|
"cmp-pandoc-references": { "branch": "master", "commit": "2c808dff631a783ddd2c554c4c6033907589baf6" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"cmp-rg": { "branch": "master", "commit": "1cad8eb315643d0df13c37401c03d7986f891011" },
|
||||||
"cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" },
|
"cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" },
|
||||||
"cmp-tmux": { "branch": "main", "commit": "984772716f66d8ee88535a6bf3f94c4b4e1301f5" },
|
"cmp-tmux": { "branch": "main", "commit": "984772716f66d8ee88535a6bf3f94c4b4e1301f5" },
|
||||||
"cmp-treesitter": { "branch": "master", "commit": "b40178b780d547bcf131c684bc5fd41af17d05f2" },
|
"cmp-treesitter": { "branch": "master", "commit": "b40178b780d547bcf131c684bc5fd41af17d05f2" },
|
||||||
|
@ -19,6 +23,7 @@
|
||||||
"dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" },
|
"dial.nvim": { "branch": "master", "commit": "54b503f906bc9e5ab85288414840a1b86d40769f" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "5f44f829481640be0f96759c965ae22a3bcaf7ce" },
|
"dressing.nvim": { "branch": "master", "commit": "5f44f829481640be0f96759c965ae22a3bcaf7ce" },
|
||||||
"easyread.nvim": { "branch": "main", "commit": "73df5f4dc8fd38bef079b890b2a34412844c00b1" },
|
"easyread.nvim": { "branch": "main", "commit": "73df5f4dc8fd38bef079b890b2a34412844c00b1" },
|
||||||
|
"fidget.nvim": { "branch": "main", "commit": "688b4fec4517650e29c3e63cfbb6e498b3112ba1" },
|
||||||
"formatter.nvim": { "branch": "master", "commit": "ed949c13e1a942db29ababa35e8c7864ced90eb6" },
|
"formatter.nvim": { "branch": "master", "commit": "ed949c13e1a942db29ababa35e8c7864ced90eb6" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "25ddcd96540a2ce41d714bd7fea2e7f75fea8ead" },
|
"friendly-snippets": { "branch": "main", "commit": "25ddcd96540a2ce41d714bd7fea2e7f75fea8ead" },
|
||||||
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
|
"fwatch.nvim": { "branch": "main", "commit": "a691f7349dc66285cd75a1a698dd28bca45f2bf8" },
|
||||||
|
@ -27,13 +32,13 @@
|
||||||
"lazy.nvim": { "branch": "main", "commit": "887eb75591520a01548134c4623617b639289d0b" },
|
"lazy.nvim": { "branch": "main", "commit": "887eb75591520a01548134c4623617b639289d0b" },
|
||||||
"lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
|
"lightspeed.nvim": { "branch": "main", "commit": "299eefa6a9e2d881f1194587c573dad619fdb96f" },
|
||||||
"lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" },
|
"lsp-format.nvim": { "branch": "master", "commit": "ca0df5c8544e51517209ea7b86ecc522c98d4f0a" },
|
||||||
"lsp-zero.nvim": { "branch": "main", "commit": "5b68fbdc91102de41fb53da79f52752370d71a7e" },
|
"lsp-zero.nvim": { "branch": "v2.x", "commit": "7cb74b241c9d99b5d44f2111696cd9306848b25b" },
|
||||||
"lsp_signature.nvim": { "branch": "master", "commit": "4665921ff8e30601c7c1328625b3abc1427a6143" },
|
"lsp_signature.nvim": { "branch": "master", "commit": "4665921ff8e30601c7c1328625b3abc1427a6143" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
|
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
|
||||||
"magma-nvim-goose": { "branch": "main", "commit": "5d916c39c1852e09fcd39eab174b8e5bbdb25f8f" },
|
"magma-nvim-goose": { "branch": "main", "commit": "5d916c39c1852e09fcd39eab174b8e5bbdb25f8f" },
|
||||||
"markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" },
|
"markdown-preview.nvim": { "branch": "master", "commit": "9becceee5740b7db6914da87358a183ad11b2049" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "a31e011135a79d63c71254c250c9158e1056a1cb" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "2b811031febe5f743e07305738181ff367e1e452" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "3ee3174e30e33c9d58fa07b0a73a6e180474b59c" },
|
"mason.nvim": { "branch": "main", "commit": "a192887fd0c29275cf2acb4a83bcbdf63399f8df" },
|
||||||
"mini.nvim": { "branch": "main", "commit": "427751024313e2270ca723eb16af7b218c83a7fc" },
|
"mini.nvim": { "branch": "main", "commit": "427751024313e2270ca723eb16af7b218c83a7fc" },
|
||||||
"neural": { "branch": "main", "commit": "155618730b87a67655bdde373ee27bfce8b07ac9" },
|
"neural": { "branch": "main", "commit": "155618730b87a67655bdde373ee27bfce8b07ac9" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "0dc148c6ec06577fcf06cbab3b7dac96d48ba6be" },
|
"nui.nvim": { "branch": "main", "commit": "0dc148c6ec06577fcf06cbab3b7dac96d48ba6be" },
|
||||||
|
@ -45,7 +50,7 @@
|
||||||
"nvim-surround": { "branch": "main", "commit": "b98862527c4727c171f8626e04d8ae88ef6cb736" },
|
"nvim-surround": { "branch": "main", "commit": "b98862527c4727c171f8626e04d8ae88ef6cb736" },
|
||||||
"nvim-toggleterm.lua": { "branch": "main", "commit": "a5638b2206c3930a16a24e5c184dddd572f8cd34" },
|
"nvim-toggleterm.lua": { "branch": "main", "commit": "a5638b2206c3930a16a24e5c184dddd572f8cd34" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "c38646edf2bdfac157ca619697ecad9ea87fd469" },
|
"nvim-treesitter": { "branch": "master", "commit": "c38646edf2bdfac157ca619697ecad9ea87fd469" },
|
||||||
"nvim-treesitter-context": { "branch": "master", "commit": "895ec44f5c89bc67ba5440aef3d1f2efa3d59a41" },
|
"nvim-treesitter-context": { "branch": "master", "commit": "88d1627285f7477883516ef60521601862dae7a1" },
|
||||||
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "b913508f503527ff540f7fe2dcf1bf1d1f259887" },
|
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "b913508f503527ff540f7fe2dcf1bf1d1f259887" },
|
||||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "729d83ecb990dc2b30272833c213cc6d49ed5214" },
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "729d83ecb990dc2b30272833c213cc6d49ed5214" },
|
||||||
"nvim-ts-rainbow2": { "branch": "master", "commit": "cee4601ff8aac73dee4afa1074814343bb5a0b80" },
|
"nvim-ts-rainbow2": { "branch": "master", "commit": "cee4601ff8aac73dee4afa1074814343bb5a0b80" },
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
local lsp = require("lsp-zero")
|
local lsp = require("lsp-zero")
|
||||||
|
|
||||||
vim.diagnostic.config { virtual_text = true }
|
vim.diagnostic.config { virtual_text = true }
|
||||||
|
vim.fn.sign_define("DiagnosticSignError", { text = "✘", texthl = "DiagnosticSignError" })
|
||||||
|
vim.fn.sign_define("DiagnosticSignWarn", { text = "", texthl = "DiagnosticSignWarn" })
|
||||||
|
vim.fn.sign_define("DiagnosticSignInfo", { text = "", texthl = "DiagnosticSignInfo" })
|
||||||
|
vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
|
||||||
|
|
||||||
lsp.preset({
|
lsp.ensure_installed({
|
||||||
name = "recommended",
|
'arduino_language_server', 'bashls', 'beancount', 'clangd', 'dockerls',
|
||||||
set_lsp_keymaps = false,
|
'docker_compose_language_service', 'lua_ls', 'pyright', 'ruff_lsp', 'taplo',
|
||||||
suggest_lsp_servers = true
|
'yamlls'
|
||||||
})
|
})
|
||||||
|
lsp.preset({ name = "recommended", set_lsp_keymaps = false })
|
||||||
lsp.on_attach(function(client, bufnr)
|
lsp.on_attach(function(client, bufnr)
|
||||||
require("lsp-format").on_attach(client, bufnr)
|
require("lsp-format").on_attach(client, bufnr)
|
||||||
|
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
map('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>',
|
map('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>',
|
||||||
{ buffer = bufnr, desc = 'Previous diagnostic' })
|
{ buffer = bufnr, desc = 'Previous diagnostic' })
|
||||||
|
@ -31,8 +37,25 @@ lsp.on_attach(function(client, bufnr)
|
||||||
{ buffer = bufnr, desc = 'Codeactions' })
|
{ buffer = bufnr, desc = 'Codeactions' })
|
||||||
map('n', '<localleader>ln', '<cmd>lua vim.lsp.buf.rename()<cr>',
|
map('n', '<localleader>ln', '<cmd>lua vim.lsp.buf.rename()<cr>',
|
||||||
{ buffer = bufnr, desc = 'Rename element' })
|
{ buffer = bufnr, desc = 'Rename element' })
|
||||||
map('n', '<localleader>lr', '<cmd>lua vim.lsp.buf.references()<cr>',
|
if vim.fn.exists(':Telescope') then
|
||||||
{ buffer = bufnr, desc = 'References' })
|
map('n', '<localleader>lr', '<cmd>Telescope lsp_references()<cr>',
|
||||||
|
{ buffer = bufnr, desc = 'References' })
|
||||||
|
map('n', '<localleader>lf', '<cmd>Telescope lsp_definitions<cr>',
|
||||||
|
{ buffer = bufnr, desc = 'Definition' })
|
||||||
|
map('n', '<localleader>lt', '<cmd>Telescope lsp_type_definitions<cr>',
|
||||||
|
{ buffer = bufnr, desc = 'Type definition' })
|
||||||
|
map('n', '<localleader>lm', '<cmd>Telescope lsp_implementations<cr>',
|
||||||
|
{ buffer = bufnr, desc = 'Implementation' })
|
||||||
|
else
|
||||||
|
map('n', '<localleader>lr', '<cmd>lua vim.lsp.buf.references()<cr>',
|
||||||
|
{ buffer = bufnr, desc = 'References' })
|
||||||
|
map('n', '<localleader>lf', '<cmd>lua vim.lsp.buf.definition()<cr>',
|
||||||
|
{ buffer = bufnr, desc = 'Definition' })
|
||||||
|
map('n', '<localleader>lt', '<cmd>lua vim.lsp.buf.type_definition()<cr>',
|
||||||
|
{ buffer = bufnr, desc = 'Type definition' })
|
||||||
|
map('n', '<localleader>lm', '<cmd>lua vim.lsp.buf.implementation()<cr>',
|
||||||
|
{ buffer = bufnr, desc = 'Implementation' })
|
||||||
|
end
|
||||||
if client.server_capabilities.document_formatting then
|
if client.server_capabilities.document_formatting then
|
||||||
map('n', '<localleader>lf', "<cmd>lua vim.lsp.buf.formatting()<CR>",
|
map('n', '<localleader>lf', "<cmd>lua vim.lsp.buf.formatting()<CR>",
|
||||||
{ buffer = bufnr, desc = 'Format document' })
|
{ buffer = bufnr, desc = 'Format document' })
|
||||||
|
@ -40,51 +63,155 @@ lsp.on_attach(function(client, bufnr)
|
||||||
|
|
||||||
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>',
|
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>',
|
||||||
{ buffer = bufnr, desc = 'Hover definition' })
|
{ buffer = bufnr, desc = 'Hover definition' })
|
||||||
map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>',
|
map('n', '<localleader>lc', '<cmd>lua vim.lsp.buf.declaration()<cr>',
|
||||||
{ buffer = bufnr, desc = 'Definition' })
|
|
||||||
map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>',
|
|
||||||
{ buffer = bufnr, desc = 'Declaration' })
|
{ buffer = bufnr, desc = 'Declaration' })
|
||||||
map('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>',
|
map('n', '<localleader>ls', '<cmd>lua vim.lsp.buf.signature_help()<cr>',
|
||||||
{ buffer = bufnr, desc = 'Signature help' })
|
{ buffer = bufnr, desc = 'Signature help' })
|
||||||
map('n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<cr>',
|
|
||||||
{ buffer = bufnr, desc = 'Implementation' })
|
|
||||||
map('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<cr>',
|
|
||||||
{ buffer = bufnr, desc = 'Type definition' })
|
|
||||||
end)
|
end)
|
||||||
lsp.nvim_workspace()
|
lsp.nvim_workspace()
|
||||||
-- ensure python virtualenv is determined automatically on lsp start
|
-- ensure python virtualenv is determined automatically on lsp start
|
||||||
lsp.configure("pyright", {
|
lsp.configure("pyright", {
|
||||||
on_attach = function(client, _)
|
on_attach = function(client, _)
|
||||||
local python_path, msg = require('util.pyenv').get_path(client.config
|
local python_path, msg = require('util.pyenv').get_path(client.config
|
||||||
.root_dir)
|
.root_dir)
|
||||||
vim.notify(string.format('%s\n%s', msg, python_path))
|
vim.notify(string.format('%s\n%s', msg, python_path))
|
||||||
client.config.settings.python.pythonPath = python_path
|
client.config.settings.python.pythonPath = python_path
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
-- set up arduino with the help of arduino.nvim plugin
|
-- set up arduino with the help of arduino.nvim plugin
|
||||||
lsp.configure("arduino_language_server",
|
require('lspconfig').arduino_language_server.setup({
|
||||||
{ on_new_config = require('arduino').on_new_config })
|
on_new_config = require('arduino').on_new_config
|
||||||
lsp.setup_nvim_cmp({
|
|
||||||
sources = {
|
|
||||||
{ name = 'path' }, { name = 'nvim_lsp', keyword_length = 2 },
|
|
||||||
{ name = 'pandoc_references' }, { name = 'buffer', keyword_length = 3 },
|
|
||||||
{ name = 'luasnip', keyword_length = 2 }, { name = 'tmux' },
|
|
||||||
{ name = 'otter' }, { name = 'latex_symbols' }, { name = 'vCard' },
|
|
||||||
{ name = 'nvim_lua' }, { name = 'buffer' }, { name = 'spell' }
|
|
||||||
},
|
|
||||||
documentation = {
|
|
||||||
max_height = 50,
|
|
||||||
max_width = 90,
|
|
||||||
border = 'rounded',
|
|
||||||
col_offset = 0,
|
|
||||||
side_padding = 1,
|
|
||||||
winhighlight = 'Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None',
|
|
||||||
zindex = 1001
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
|
||||||
|
|
||||||
lsp.setup()
|
lsp.setup()
|
||||||
|
|
||||||
|
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
local has_words_before = function()
|
||||||
|
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
|
||||||
|
|
||||||
|
local kind_icons = {
|
||||||
|
Text = "",
|
||||||
|
Method = "",
|
||||||
|
Function = "",
|
||||||
|
Constructor = "",
|
||||||
|
Field = "",
|
||||||
|
Variable = "",
|
||||||
|
Class = "ﴯ",
|
||||||
|
Interface = "",
|
||||||
|
Module = "",
|
||||||
|
Property = "ﰠ",
|
||||||
|
Unit = "",
|
||||||
|
Value = "",
|
||||||
|
Enum = "",
|
||||||
|
Keyword = "",
|
||||||
|
Snippet = "",
|
||||||
|
Color = "",
|
||||||
|
File = "",
|
||||||
|
Reference = "",
|
||||||
|
Folder = "",
|
||||||
|
EnumMember = "",
|
||||||
|
Constant = "",
|
||||||
|
Struct = "",
|
||||||
|
Event = "",
|
||||||
|
Operator = "",
|
||||||
|
TypeParameter = ""
|
||||||
|
}
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
|
cmp.setup({
|
||||||
|
window = {
|
||||||
|
documentation = cmp.config.window.bordered()
|
||||||
|
},
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'otter' },
|
||||||
|
{ name = 'luasnip', keyword_length = 2 },
|
||||||
|
{ name = 'pandoc_references' },
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
|
{
|
||||||
|
name = 'beancount',
|
||||||
|
option = {
|
||||||
|
account = vim.env["HOME"] .. '/documents/records/budget/main.beancount' -- TODO implement dynamically
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ name = 'calc' },
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'buffer', keyword_length = 3 },
|
||||||
|
{ name = 'digraphs' },
|
||||||
|
{ name = 'latex_symbols' },
|
||||||
|
{ name = 'spell', keyword_length = 3 },
|
||||||
|
{ name = 'tmux' },
|
||||||
|
{ name = 'rg', keyword_length = 5 },
|
||||||
|
{ name = 'vCard' },
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<CR>"] = cmp.mapping({
|
||||||
|
i = function(fallback)
|
||||||
|
if cmp.visible() and cmp.get_active_entry() then
|
||||||
|
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
s = cmp.mapping.confirm({ select = true }),
|
||||||
|
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }), -- disable selection in cmd mode
|
||||||
|
}),
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
|
||||||
|
-- they way you will only jump inside the snippet region
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
fields = { "kind", "abbr", "menu" },
|
||||||
|
format = function(entry, vim_item)
|
||||||
|
-- Kind icons, removing kind text leaving only icon
|
||||||
|
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
|
||||||
|
vim_item.kind = string.format('%s', kind_icons[vim_item.kind])
|
||||||
|
-- Source
|
||||||
|
vim_item.menu = ({
|
||||||
|
buffer = "[Buf]",
|
||||||
|
calc = "[Cal]",
|
||||||
|
digraphs = "[Dig]",
|
||||||
|
latex_symbols = "[LaTeX]",
|
||||||
|
luasnip = "[Snip]",
|
||||||
|
nvim_lsp = "[Lsp]",
|
||||||
|
nvim_lua = "[Lua]",
|
||||||
|
pandoc_references = "[Bib]",
|
||||||
|
spell = "[Spl]",
|
||||||
|
vCard = "[vCrd]",
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end
|
||||||
|
},
|
||||||
|
})
|
||||||
-- `/` cmdline setup.
|
-- `/` cmdline setup.
|
||||||
cmp.setup.cmdline('/', {
|
cmp.setup.cmdline('/', {
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
|
|
@ -4,13 +4,13 @@ return {
|
||||||
-- vim plugs
|
-- vim plugs
|
||||||
-- essential
|
-- essential
|
||||||
{ 'numToStr/Navigator.nvim', branch = "master", config = true }, -- allow seamless navigation between vim buffers and tmux/wezterm splits
|
{ 'numToStr/Navigator.nvim', branch = "master", config = true }, -- allow seamless navigation between vim buffers and tmux/wezterm splits
|
||||||
{ 'jeffkreeftmeijer/vim-numbertoggle', event = "BufEnter" }, -- toggles numbers to absolute for all buffers but the current which is relative
|
{ 'jeffkreeftmeijer/vim-numbertoggle', event = "BufEnter" }, -- toggles numbers to absolute for all buffers but the current which is relative
|
||||||
{ 'ojroques/vim-oscyank', event = "VeryLazy" }, -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
|
{ 'ojroques/vim-oscyank', event = "VeryLazy" }, -- yank from *anywhere* (even ssh session) to clipboard, using :OSCYank
|
||||||
{ 'ggandor/lightspeed.nvim', event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak
|
{ 'ggandor/lightspeed.nvim', event = "VeryLazy" }, -- jump between letters with improved fFtT quicksearch, mimics sneak
|
||||||
-- files
|
-- files
|
||||||
{ 'vifm/vifm.vim' }, -- integrate file manager
|
{ 'vifm/vifm.vim' }, -- integrate file manager
|
||||||
{
|
{
|
||||||
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
|
'lewis6991/gitsigns.nvim', -- show vcs changes on left-hand gutter
|
||||||
opts = { numhl = true, signcolumn = false },
|
opts = { numhl = true, signcolumn = false },
|
||||||
event = "BufRead"
|
event = "BufRead"
|
||||||
}, {
|
}, {
|
||||||
|
@ -25,10 +25,10 @@ return {
|
||||||
'mhartington/formatter.nvim', -- auto formatting on save
|
'mhartington/formatter.nvim', -- auto formatting on save
|
||||||
config = function() require('plug._format') end,
|
config = function() require('plug._format') end,
|
||||||
event = "VeryLazy"
|
event = "VeryLazy"
|
||||||
}, -- editing
|
}, -- editing
|
||||||
{ 'kylechui/nvim-surround', version = '*', config = true, event = "VeryLazy" }, -- surround things with other things using ys/cs/ds
|
{ 'kylechui/nvim-surround', version = '*', config = true, event = "VeryLazy" }, -- surround things with other things using ys/cs/ds
|
||||||
{
|
{
|
||||||
'monaqa/dial.nvim', -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
|
'monaqa/dial.nvim', -- extend the ^a / ^x possibilities to dates, hex, alphabets, markdown headers
|
||||||
config = function()
|
config = function()
|
||||||
local augend = require("dial.augend")
|
local augend = require("dial.augend")
|
||||||
require("dial.config").augends:register_group {
|
require("dial.config").augends:register_group {
|
||||||
|
@ -44,15 +44,15 @@ return {
|
||||||
augend.constant.alias.Alpha, augend.constant.alias.alpha,
|
augend.constant.alias.Alpha, augend.constant.alias.alpha,
|
||||||
augend.hexcolor.new { case = "lower" }, augend.constant.new {
|
augend.hexcolor.new { case = "lower" }, augend.constant.new {
|
||||||
elements = { "and", "or" },
|
elements = { "and", "or" },
|
||||||
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
|
word = true, -- if false, "sand" is incremented into "sor", "doctor" into "doctand", etc.
|
||||||
cyclic = true -- "or" is incremented into "and".
|
cyclic = true -- "or" is incremented into "and".
|
||||||
},
|
},
|
||||||
augend.constant
|
augend.constant
|
||||||
.new {
|
.new {
|
||||||
elements = { "&&", "||" },
|
elements = { "&&", "||" },
|
||||||
word = false,
|
word = false,
|
||||||
cyclic = true
|
cyclic = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
|
@ -61,7 +61,7 @@ return {
|
||||||
'tommcdo/vim-exchange', -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
'tommcdo/vim-exchange', -- adds exchange operator with cx. common use: cxiw . on 2 words to switch
|
||||||
event = "VeryLazy"
|
event = "VeryLazy"
|
||||||
}, {
|
}, {
|
||||||
'junegunn/vim-easy-align', -- Align tables and other alignable things
|
'junegunn/vim-easy-align', -- Align tables and other alignable things
|
||||||
event = "VeryLazy"
|
event = "VeryLazy"
|
||||||
}, { 'edKotinsky/Arduino.nvim', ft = 'arduino', config = true }, -- statusline
|
}, { 'edKotinsky/Arduino.nvim', ft = 'arduino', config = true }, -- statusline
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ return {
|
||||||
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
|
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
|
||||||
config = function() require('plug._lualine') end
|
config = function() require('plug._lualine') end
|
||||||
}, -- writing
|
}, -- writing
|
||||||
{ 'vim-pandoc/vim-criticmarkup', ft = writing_ft }, {
|
{ 'vim-pandoc/vim-criticmarkup', ft = writing_ft }, {
|
||||||
'mickael-menu/zk-nvim',
|
'mickael-menu/zk-nvim',
|
||||||
config = function() require('zk').setup({ picker = "telescope" }) end
|
config = function() require('zk').setup({ picker = "telescope" }) end
|
||||||
}, {
|
}, {
|
||||||
|
@ -84,7 +84,8 @@ return {
|
||||||
'quarto-dev/quarto-nvim',
|
'quarto-dev/quarto-nvim',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'jmbuhr/otter.nvim', 'neovim/nvim-lspconfig',
|
'jmbuhr/otter.nvim', 'neovim/nvim-lspconfig',
|
||||||
'vim-pandoc/vim-pandoc-syntax'
|
'vim-pandoc/vim-pandoc-syntax', 'hrsh7th/nvim-cmp',
|
||||||
|
'nvim-treesitter/nvim-treesitter'
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require 'quarto'.setup {
|
require 'quarto'.setup {
|
||||||
|
@ -109,18 +110,23 @@ return {
|
||||||
desc = "Inspect object in kernel"
|
desc = "Inspect object in kernel"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, { 'micarmst/vim-spellsync', event = "VeryLazy" }, -- personal dict improvements for git sync
|
}, { 'micarmst/vim-spellsync', event = "VeryLazy" }, -- personal dict improvements for git sync
|
||||||
{ 'folke/zen-mode.nvim', config = true, event = "VeryLazy" }, -- provide distraction free writing
|
{ 'folke/zen-mode.nvim', config = true, event = "VeryLazy" }, -- provide distraction free writing
|
||||||
{ 'folke/twilight.nvim', event = "VeryLazy" }, -- provide even distraction free-er writing (lowlight paragraphs)
|
{ 'folke/twilight.nvim', event = "VeryLazy" }, -- provide even distraction free-er writing (lowlight paragraphs)
|
||||||
{ 'JellyApple102/easyread.nvim', config = true, ft = writing_ft, cmd = 'EasyreadToggle' }, -- enable 'speed-reading' mode (bionic reading)
|
|
||||||
{ 'marty-oehme/zettelkasten.nvim', ft = writing_ft, event = "VeryLazy" }, -- simple static markdown linking
|
|
||||||
{
|
{
|
||||||
"iamcco/markdown-preview.nvim", -- generate an auto-updating html preview for md files
|
'JellyApple102/easyread.nvim',
|
||||||
|
config = true,
|
||||||
|
ft = writing_ft,
|
||||||
|
cmd = 'EasyreadToggle'
|
||||||
|
}, -- enable 'speed-reading' mode (bionic reading)
|
||||||
|
{ 'marty-oehme/zettelkasten.nvim', ft = writing_ft, event = "VeryLazy" }, -- simple static markdown linking
|
||||||
|
{
|
||||||
|
"iamcco/markdown-preview.nvim", -- generate an auto-updating html preview for md files
|
||||||
build = function() vim.fn["mkdp#util#install"]() end,
|
build = function() vim.fn["mkdp#util#install"]() end,
|
||||||
ft = writing_ft
|
ft = writing_ft
|
||||||
}, -- languages
|
}, -- languages
|
||||||
{ 'euclidianAce/BetterLua.vim', ft = 'lua' }, -- better syntax highlighting for lua
|
{ 'euclidianAce/BetterLua.vim', ft = 'lua' }, -- better syntax highlighting for lua
|
||||||
{ 'aliou/bats.vim', ft = { "bash", "sh", "zsh", "bats" } }, -- enable syntax for bats shell-code testing library
|
{ 'aliou/bats.vim', ft = { "bash", "sh", "zsh", "bats" } }, -- enable syntax for bats shell-code testing library
|
||||||
|
|
||||||
-- REPL work
|
-- REPL work
|
||||||
{
|
{
|
||||||
|
@ -172,7 +178,7 @@ return {
|
||||||
},
|
},
|
||||||
{ 'nvim-treesitter/playground', cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
|
{ 'nvim-treesitter/playground', cmd = "TSPlaygroundToggle" }, -- interactively view and query the treesitter tree
|
||||||
{
|
{
|
||||||
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
|
'RRethy/nvim-treesitter-textsubjects', -- allows using . and ; to target treesitter branches
|
||||||
config = function()
|
config = function()
|
||||||
require 'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
textsubjects = {
|
textsubjects = {
|
||||||
|
@ -194,24 +200,39 @@ return {
|
||||||
"VonHeikemen/lsp-zero.nvim",
|
"VonHeikemen/lsp-zero.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "neovim/nvim-lspconfig", branch = "master" },
|
{ "neovim/nvim-lspconfig", branch = "master" },
|
||||||
"williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", {
|
"williamboman/mason.nvim",
|
||||||
"hrsh7th/nvim-cmp",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
branch = "main",
|
{
|
||||||
dependencies = {
|
"hrsh7th/nvim-cmp",
|
||||||
"hrsh7th/cmp-buffer", "hrsh7th/cmp-path",
|
branch = "main",
|
||||||
"saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-nvim-lsp",
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lua", "andersevenrud/cmp-tmux",
|
"andersevenrud/cmp-tmux",
|
||||||
"hrsh7th/cmp-nvim-lsp", "kdheepak/cmp-latex-symbols",
|
"cbarrete/completion-vcard",
|
||||||
"ray-x/cmp-treesitter", "f3fora/cmp-spell",
|
"f3fora/cmp-spell",
|
||||||
"hrsh7th/cmp-cmdline", "cbarrete/completion-vcard",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
"jc-doyle/cmp-pandoc-references"
|
"hrsh7th/cmp-path",
|
||||||
}
|
"hrsh7th/cmp-buffer",
|
||||||
}, "L3MON4D3/LuaSnip", "rafamadriz/friendly-snippets",
|
"hrsh7th/cmp-calc",
|
||||||
{ "lukas-reineke/lsp-format.nvim", config = true }
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"hrsh7th/cmp-nvim-lua",
|
||||||
|
"dmitmel/cmp-digraphs",
|
||||||
|
"jc-doyle/cmp-pandoc-references",
|
||||||
|
"kdheepak/cmp-latex-symbols",
|
||||||
|
"lukas-reineke/cmp-rg",
|
||||||
|
"crispgm/cmp-beancount",
|
||||||
|
"ray-x/cmp-treesitter",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
{ "lukas-reineke/lsp-format.nvim", config = true },
|
||||||
|
{ "j-hui/fidget.nvim", config = true } -- loading animations for some LSP
|
||||||
},
|
},
|
||||||
config = function() require('plug._lsp') end
|
config = function() require('plug._lsp') end,
|
||||||
|
branch = "v2.x"
|
||||||
}, { 'simrat39/symbols-outline.nvim', config = true, event = "VeryLazy" }, -- vista-like outline view for code
|
}, { 'simrat39/symbols-outline.nvim', config = true, event = "VeryLazy" }, -- vista-like outline view for code
|
||||||
{ 'ray-x/lsp_signature.nvim', config = true }, -- UI improvements
|
{ 'ray-x/lsp_signature.nvim', config = true }, -- UI improvements
|
||||||
{ 'stevearc/dressing.nvim', config = true }, {
|
{ 'stevearc/dressing.nvim', config = true }, {
|
||||||
'rcarriga/nvim-notify',
|
'rcarriga/nvim-notify',
|
||||||
config = function() vim.notify = require("notify") end
|
config = function() vim.notify = require("notify") end
|
||||||
|
|
Loading…
Reference in a new issue