nvim: update
This commit is contained in:
@@ -1,30 +1,24 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "33b06d72d220aa56a7ce80a0dd6f06c70cd82b9d" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-git": { "branch": "main", "commit": "ec049036e354ed8ed0215f2427112882e1ea7051" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "02fd64fb3d4b18ec029c0e0683c3dc3ec6d2c5b8" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "fc78a3ca96f4db9f8893bb7e2fd9823e0780451b" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "3388a26417c48b15d5266d954f62a4d47fe99490" },
|
||||
"lsp-format-modifications.nvim": { "branch": "main", "commit": "006d4cd88f4f09fdc4375fcb75dd5b7d981a723b" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "7c493713bc2cb392706866eeba53aaef6c8e9fc6" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "d5ca361c77a7a5f58476f1d0aab43532c4bbb289" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||
"neodim": { "branch": "master", "commit": "7d31f389a6bb01707fb9b7a811abdb685c09ab08" },
|
||||
"nord": { "branch": "main", "commit": "4cc19936b1b57ba08eb461c5f450b3976cbb8e0c" },
|
||||
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "ca4d3330d386e76967e53b85953c170658255ecb" },
|
||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "2c007c79eedfca0ec652c50d571cb0c52d1577ba" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "ca7c4c33cac2ad66ec69d45e465379716ef0cc97" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "acada1a685f5decd0f10e1672963bf3425eafa45" },
|
||||
"oil.nvim": { "branch": "master", "commit": "9a59256c8e88b29d2150e99b5960b2f111e51f75" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "3403e2e9391ed0a28c3afddd8612701b647c8e26" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "b1729954329236f59d075bec79fdee7a6f3ce88b" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "5874cac1b76c97ebb3fc03225bd7215d4e671cd2" },
|
||||
"oil.nvim": { "branch": "master", "commit": "dba037598843973b8c54bc5ce0318db4a0da439d" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "bf3d8c7bcbf20a7e7f4af36c2d5390ca6ad43281" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "320b18fba2a4f2fe3c8225c778c687e0d2620384" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-tmux-navigator": { "branch": "master", "commit": "424b5caa154bff34dc258ee53cec5a8e36cf7ea8" }
|
||||
}
|
||||
|
||||
@@ -31,4 +31,21 @@ require("lazy").setup({
|
||||
change_detection = {
|
||||
notify = false,
|
||||
},
|
||||
ui = {
|
||||
icons = {
|
||||
cmd = "⌘",
|
||||
config = "🛠",
|
||||
event = "📅",
|
||||
ft = "📂",
|
||||
init = "⚙",
|
||||
keys = "🗝",
|
||||
plugin = "🔌",
|
||||
runtime = "💻",
|
||||
require = "🌙",
|
||||
source = "📄",
|
||||
start = "🚀",
|
||||
task = "📌",
|
||||
lazy = "💤 ",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -27,6 +27,13 @@ opt.timeoutlen = 1000 -- Delay for mappings
|
||||
opt.ttimeoutlen = 0 -- Delay between modes
|
||||
opt.termguicolors = true -- 24-bit RGB color
|
||||
|
||||
opt.autoindent = true
|
||||
|
||||
opt.updatetime = 100
|
||||
opt.timeout = true
|
||||
opt.timeoutlen = 1000
|
||||
opt.ttimeoutlen = 10
|
||||
|
||||
opt.listchars = {
|
||||
nbsp = '⦸', -- CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
|
||||
extends = '»', -- RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
|
||||
@@ -88,19 +95,7 @@ opt.wildignore = {
|
||||
'.lock', '.DS_Store', 'tags.lock'
|
||||
}
|
||||
|
||||
-- CtrlSF
|
||||
-- g.ctrlsf_ackprg = 'rg'
|
||||
-- g.ctrlsf_regex_pattern = 1
|
||||
-- g.ctrlsf_case_sensitive = 'smart'
|
||||
-- g.ctrlsf_default_root = 'project'
|
||||
-- g.ctrlsf_context = '-B 1 -A 1'
|
||||
-- g.ctrlsf_position = 'bottom'
|
||||
-- g.ctrlsf_winsize = '40%'
|
||||
-- g.ctrlsf_mapping = {
|
||||
-- next = 'n',
|
||||
-- prev = 'N',
|
||||
-- }
|
||||
|
||||
-- find the correct ruby interpreter
|
||||
g.ruby_host_prog = 'asdf exec neovim-ruby-host'
|
||||
|
||||
-- highlight yanked text briefly
|
||||
@@ -133,8 +128,3 @@ vim.api.nvim_create_autocmd({ 'InsertEnter', 'WinLeave' }, {
|
||||
|
||||
-- Experimental
|
||||
opt.iskeyword:prepend { '-' } -- treat dash separated words as a word textobject
|
||||
|
||||
opt.updatetime = 100
|
||||
opt.timeout = true
|
||||
opt.timeoutlen = 1000
|
||||
opt.ttimeoutlen = 10
|
||||
|
||||
1
nvim/.config/nvim/lua/plugins/fugitive.lua
Normal file
1
nvim/.config/nvim/lua/plugins/fugitive.lua
Normal file
@@ -0,0 +1 @@
|
||||
return { 'tpope/vim-fugitive' }
|
||||
@@ -44,26 +44,6 @@ return {
|
||||
'neovim/nvim-lspconfig',
|
||||
event = { 'BufReadPost', 'BufNewFile' },
|
||||
init = function()
|
||||
-- client log level
|
||||
vim.lsp.set_log_level(vim.lsp.log_levels.INFO)
|
||||
|
||||
vim.api.nvim_create_user_command('LspFormat', function()
|
||||
vim.lsp.buf.format { async = false }
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = au,
|
||||
desc = 'LSP tagfunc',
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
vim.api.nvim_set_option_value(
|
||||
'tagfunc',
|
||||
'v:lua.vim.lsp.tagfunc',
|
||||
{ buf = bufnr }
|
||||
)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = au,
|
||||
desc = 'LSP keymaps',
|
||||
@@ -92,41 +72,10 @@ return {
|
||||
end)
|
||||
map('n', '<leader>li', vim.lsp.buf.incoming_calls)
|
||||
map('n', '<leader>lo', vim.lsp.buf.outgoing_calls)
|
||||
vim.opt.shortmess:append 'c'
|
||||
-- vim.opt.shortmess:append 'c'
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = au,
|
||||
desc = 'LSP highlight',
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
if
|
||||
client
|
||||
and client.supports_method 'textDocument/documentHighlight'
|
||||
then
|
||||
local augroup_lsp_highlight = 'lsp_highlight'
|
||||
vim.api.nvim_create_augroup(
|
||||
augroup_lsp_highlight,
|
||||
{ clear = false }
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'CursorHold', 'CursorHoldI' },
|
||||
{
|
||||
group = augroup_lsp_highlight,
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd('CursorMoved', {
|
||||
group = augroup_lsp_highlight,
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = au,
|
||||
@@ -139,34 +88,6 @@ return {
|
||||
and client.supports_method 'textDocument/inlayHint'
|
||||
and pcall(require, 'vim.lsp.inlay_hint') -- NOTE: check that API exists
|
||||
then
|
||||
-- vim.notify(
|
||||
-- 'register inlay hints',
|
||||
-- vim.lsp.log_levels.DEBUG
|
||||
-- )
|
||||
vim.api.nvim_create_autocmd({
|
||||
'BufWritePost',
|
||||
'BufEnter',
|
||||
'InsertLeave',
|
||||
'FocusGained',
|
||||
'CursorHold',
|
||||
}, {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.inlay_hint.enable(
|
||||
true,
|
||||
{ bufnr = bufnr }
|
||||
)
|
||||
end,
|
||||
})
|
||||
vim.api.nvim_create_autocmd('InsertEnter', {
|
||||
callback = function()
|
||||
vim.lsp.inlay_hint.enable(
|
||||
false,
|
||||
{ bufnr = bufnr }
|
||||
)
|
||||
end,
|
||||
})
|
||||
-- initial request
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||
end
|
||||
end,
|
||||
@@ -191,59 +112,15 @@ return {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = au,
|
||||
desc = 'LSP notify',
|
||||
callback = function(args)
|
||||
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
-- if client then
|
||||
-- vim.notify(
|
||||
-- ('%s attached to buffer %s'):format(
|
||||
-- client.name,
|
||||
-- args.buf
|
||||
-- ),
|
||||
-- vim.log.levels.DEBUG
|
||||
-- )
|
||||
-- end
|
||||
end,
|
||||
})
|
||||
|
||||
-- local function periodic_refresh_semantic_tokens()
|
||||
-- -- vim.notify(
|
||||
-- -- 'periodic refresh semantic tokens',
|
||||
-- -- vim.log.levels.DEBUG
|
||||
-- -- )
|
||||
-- vim.lsp.semantic_tokens.force_refresh()
|
||||
-- vim.defer_fn(periodic_refresh_semantic_tokens, 30000)
|
||||
-- end
|
||||
|
||||
-- local function debounce(ms, fn)
|
||||
-- local timer = assert(vim.uv.new_timer())
|
||||
-- return function(...)
|
||||
-- local argv = { ... }
|
||||
-- timer:start(ms, 0, function()
|
||||
-- timer:stop()
|
||||
-- vim.schedule_wrap(fn)(unpack(argv))
|
||||
-- end)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- vim.api.nvim_create_autocmd({ 'TextChanged', 'InsertLeave' }, {
|
||||
-- callback = debounce(1000, function()
|
||||
-- -- vim.notify('refresh semantic tokens', vim.log.levels.DEBUG)
|
||||
-- vim.lsp.semantic_tokens.force_refresh()
|
||||
-- end),
|
||||
-- })
|
||||
end,
|
||||
dependencies = {
|
||||
{
|
||||
'folke/neoconf.nvim',
|
||||
cmd = 'Neoconf',
|
||||
config = false,
|
||||
dependencies = { 'nvim-lspconfig' },
|
||||
},
|
||||
{ 'folke/neodev.nvim', opts = {} },
|
||||
-- {
|
||||
-- 'folke/neoconf.nvim',
|
||||
-- cmd = 'Neoconf',
|
||||
-- config = false,
|
||||
-- dependencies = { 'nvim-lspconfig' },
|
||||
-- },
|
||||
-- { 'folke/neodev.nvim', opts = {} },
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'mason.nvim',
|
||||
{
|
||||
@@ -251,9 +128,6 @@ return {
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
-- 'ruby-lsp ',
|
||||
-- 'pylyzer',
|
||||
-- 'rust_analyzer',
|
||||
'dockerls',
|
||||
'docker_compose_language_service',
|
||||
'yamlls',
|
||||
@@ -263,20 +137,14 @@ return {
|
||||
'gopls',
|
||||
'clangd',
|
||||
'texlab',
|
||||
'ts_ls',
|
||||
'vtsls',
|
||||
-- 'denols',
|
||||
-- 'eslint',
|
||||
-- 'vale_ls',
|
||||
'terraformls',
|
||||
'helm_ls',
|
||||
'bashls'
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
-- vim.notify(
|
||||
-- 'Mason LSP setup ' .. server_name,
|
||||
-- vim.log.levels.DEBUG
|
||||
-- )
|
||||
require('lspconfig')[server_name].setup {}
|
||||
end,
|
||||
['yamlls'] = function()
|
||||
@@ -322,9 +190,6 @@ return {
|
||||
},
|
||||
}
|
||||
end,
|
||||
-- ['pylyzer'] = function() end, -- disable
|
||||
-- ['vale_ls'] = function() end, -- disable
|
||||
-- ['rust_analyzer'] = function() end, -- use rustaceanvim instead
|
||||
['dockerls'] = function()
|
||||
require('lspconfig').dockerls.setup {
|
||||
settings = {
|
||||
@@ -430,6 +295,7 @@ return {
|
||||
telemetry = { enable = false },
|
||||
diagnostics = {
|
||||
unusedLocalExclude = { '_*' },
|
||||
globals = { 'vim' }
|
||||
},
|
||||
format = { enable = false },
|
||||
hint = {
|
||||
@@ -440,396 +306,9 @@ return {
|
||||
},
|
||||
}
|
||||
end,
|
||||
-- ['denols'] = function()
|
||||
-- require('lspconfig').denols.setup {
|
||||
-- autostart = false,
|
||||
-- root_dir = require('lspconfig.util').root_pattern(
|
||||
-- 'deno.json',
|
||||
-- 'deno.jsonc'
|
||||
-- ),
|
||||
-- filetypes = {
|
||||
-- 'javascript',
|
||||
-- 'javascriptreact',
|
||||
-- 'javascript.jsx',
|
||||
-- 'typescript',
|
||||
-- 'typescriptreact',
|
||||
-- 'typescript.tsx',
|
||||
-- 'yaml',
|
||||
-- 'json',
|
||||
-- 'markdown',
|
||||
-- 'html',
|
||||
-- 'css',
|
||||
-- },
|
||||
-- init_options = {
|
||||
-- enable = true,
|
||||
-- lint = true,
|
||||
-- unstable = true,
|
||||
-- importMap = './import_map.json',
|
||||
-- },
|
||||
-- single_file_support = false,
|
||||
-- }
|
||||
-- end,
|
||||
['texlab'] = function()
|
||||
require('lspconfig').texlab.setup {
|
||||
settings = {
|
||||
texlab = {
|
||||
auxDirectory = '.',
|
||||
bibtexFormatter = 'texlab',
|
||||
build = {
|
||||
args = {
|
||||
'-pdflua',
|
||||
'-shell-escape',
|
||||
'-interaction=nonstopmode',
|
||||
'-synctex=1',
|
||||
'-pv',
|
||||
'%f',
|
||||
},
|
||||
executable = 'latexmk',
|
||||
forwardSearchAfter = false,
|
||||
onSave = false,
|
||||
},
|
||||
chktex = {
|
||||
onEdit = false,
|
||||
onOpenAndSave = false,
|
||||
},
|
||||
diagnosticsDelay = 300,
|
||||
formatterLineLength = 80,
|
||||
forwardSearch = {
|
||||
args = {},
|
||||
},
|
||||
latexFormatter = 'latexindent',
|
||||
latexindent = {
|
||||
modifyLineBreaks = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'antosha417/nvim-lsp-file-operations',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'zbirenbaum/neodim',
|
||||
event = { 'BufReadPost', 'BufNewFile' },
|
||||
opts = {
|
||||
alpha = 0.70,
|
||||
blend_color = '#000000',
|
||||
update_in_insert = {
|
||||
enable = false,
|
||||
delay = 100,
|
||||
},
|
||||
hide = {
|
||||
virtual_text = false,
|
||||
signs = false,
|
||||
underline = true,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = au,
|
||||
desc = 'LSP dim unused',
|
||||
callback = function()
|
||||
require('neodim').setup(opts)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
dependencies = {
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
'stylua',
|
||||
'ruff',
|
||||
-- 'dprint',
|
||||
'isort',
|
||||
'black',
|
||||
'prettierd',
|
||||
'shfmt',
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
python = function(bufnr)
|
||||
if
|
||||
require('conform').get_formatter_info(
|
||||
'ruff_format',
|
||||
bufnr
|
||||
).available
|
||||
then
|
||||
return { 'ruff_fix', 'ruff_format' }
|
||||
else
|
||||
return { 'isort', 'black' }
|
||||
end
|
||||
end,
|
||||
json = { 'dprint' },
|
||||
jsonc = { 'dprint' },
|
||||
markdown = { 'dprint', 'injected' },
|
||||
-- javascript = { 'dprint' },
|
||||
-- javascriptreact = { 'dprint' },
|
||||
-- typescript = { 'dprint' },
|
||||
-- typescriptreact = { 'dprint' },
|
||||
toml = { 'dprint' },
|
||||
dockerfile = { 'dprint' },
|
||||
css = { 'dprint' },
|
||||
html = { 'dprint' },
|
||||
htmldjango = { 'dprint' },
|
||||
yaml = { 'dprint' },
|
||||
graphql = { { 'prettierd', 'prettier' } },
|
||||
sh = { 'shfmt' },
|
||||
http = {
|
||||
'injected',
|
||||
-- 'trim_newlines', -- FIXME: breaks injected
|
||||
'trim_whitespace',
|
||||
},
|
||||
['_'] = { 'trim_newlines', 'trim_whitespace' },
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable with a global or buffer-local variable
|
||||
if
|
||||
vim.g.disable_autoformat
|
||||
or vim.b[bufnr].disable_autoformat
|
||||
then
|
||||
return
|
||||
end
|
||||
return {
|
||||
timeout_ms = 5000, -- HACK: high because dprint needs to download WASM plugins on first run
|
||||
lsp_fallback = true,
|
||||
}
|
||||
end,
|
||||
log_level = vim.log.levels.TRACE,
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_user_command('Format', function()
|
||||
require('conform').format()
|
||||
end, { desc = 'Format buffer using conform' })
|
||||
|
||||
vim.api.nvim_create_user_command('FormatDisable', function(args)
|
||||
if args.bang then
|
||||
-- FormatDisable! will disable formatting just for this buffer
|
||||
---@diagnostic disable-next-line: inject-field
|
||||
vim.b.disable_autoformat = true
|
||||
else
|
||||
vim.g.disable_autoformat = true
|
||||
end
|
||||
end, {
|
||||
desc = 'Disable autoformat-on-save',
|
||||
bang = true,
|
||||
})
|
||||
vim.api.nvim_create_user_command('FormatEnable', function()
|
||||
---@diagnostic disable-next-line: inject-field
|
||||
vim.b.disable_autoformat = false
|
||||
vim.g.disable_autoformat = false
|
||||
end, {
|
||||
desc = 'Re-enable autoformat-on-save',
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = au,
|
||||
desc = 'LSP formatexpr',
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
vim.api.nvim_set_option_value(
|
||||
'formatexpr',
|
||||
'v:lua.require\'conform\'.formatexpr()',
|
||||
{ buf = bufnr }
|
||||
)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
config = function(_, opts)
|
||||
local conform = require 'conform'
|
||||
conform.setup(opts)
|
||||
|
||||
conform.formatters.stylua = {
|
||||
require_cwd = true,
|
||||
}
|
||||
-- conform.formatters.ruff_fix = {
|
||||
-- prepend_args = { '--respect-gitignore' },
|
||||
-- }
|
||||
-- conform.formatters.ruff_format = {
|
||||
-- prepend_args = { '--silent', '--respect-gitignore' },
|
||||
-- }
|
||||
conform.formatters.shfmt = {
|
||||
prepend_args = { '-i', '4', '-ci' },
|
||||
}
|
||||
conform.formatters.dprint = {
|
||||
prepend_args = function(self, ctx)
|
||||
if not self:cwd(ctx) then
|
||||
vim.notify 'falling back to global dprint config'
|
||||
return {
|
||||
'--config',
|
||||
vim.fn.expand '~/.config/dprint.jsonc',
|
||||
}
|
||||
end
|
||||
end,
|
||||
}
|
||||
conform.formatters.dprint_injected = vim.tbl_deep_extend(
|
||||
'force',
|
||||
require 'conform.formatters.dprint',
|
||||
conform.formatters.dprint,
|
||||
{
|
||||
args = function(self, ctx)
|
||||
local extension = vim.fn.fnamemodify(ctx.filename, ':e')
|
||||
local ret = vim.list_extend(
|
||||
{ 'fmt', '--stdin', extension },
|
||||
self:prepend_args(ctx)
|
||||
)
|
||||
return ret
|
||||
end,
|
||||
}
|
||||
)
|
||||
conform.formatters.injected = {
|
||||
options = {
|
||||
ignore_errors = false,
|
||||
lang_to_formatters = {
|
||||
json = { 'dprint_injected' },
|
||||
python = { 'black' }, -- FIXME: ruff_format deletes content
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- TODO: custom formatters
|
||||
conform.formatters.blackd = {
|
||||
command = 'blackd-client',
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'joechrisellis/lsp-format-modifications.nvim',
|
||||
lazy = true,
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
init = function()
|
||||
vim.api.nvim_create_user_command('FormatModified', function()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local clients = vim.lsp.get_clients {
|
||||
bufnr = bufnr,
|
||||
method = require('vim.lsp.protocol').Methods.textDocument_rangeFormatting,
|
||||
}
|
||||
|
||||
if #clients == 0 then
|
||||
vim.notify '[LSP] Format request failed, no matching language servers.'
|
||||
end
|
||||
|
||||
for _, client in pairs(clients) do
|
||||
require('lsp-format-modifications').format_modifications(
|
||||
client,
|
||||
bufnr
|
||||
)
|
||||
end
|
||||
end, {})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
ft = 'rust',
|
||||
opts = function()
|
||||
vim.g.rustaceanvim = {
|
||||
server = {
|
||||
cmd = function()
|
||||
local mason_registry = require 'mason-registry'
|
||||
local ra_binary = mason_registry.is_installed 'rust-analyzer'
|
||||
and mason_registry
|
||||
.get_package('rust-analyzer')
|
||||
:get_install_path() .. '/rust-analyzer'
|
||||
or 'rust-analyzer'
|
||||
return { ra_binary }
|
||||
end,
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'folke/trouble.nvim',
|
||||
cmd = 'Trouble',
|
||||
keys = {
|
||||
{
|
||||
'<leader>xx',
|
||||
function()
|
||||
require('trouble').toggle()
|
||||
end,
|
||||
},
|
||||
{
|
||||
'<leader>xw',
|
||||
function()
|
||||
require('trouble').toggle { mode = 'diagnostics' }
|
||||
end,
|
||||
},
|
||||
{
|
||||
'<leader>xb',
|
||||
function()
|
||||
require('trouble').toggle {
|
||||
mode = 'diagnostics',
|
||||
filter = { buf = 0 },
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'<leader>xq',
|
||||
function()
|
||||
require('trouble').toggle { mode = 'quickfix' }
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
fold_open = '', -- ▾
|
||||
fold_closed = '', -- ▸
|
||||
indent_lines = false,
|
||||
padding = false,
|
||||
signs = {
|
||||
error = '',
|
||||
warning = '',
|
||||
hint = '',
|
||||
information = '',
|
||||
other = '', --
|
||||
},
|
||||
action_keys = { jump = { '<cr>' }, toggle_fold = { '<tab>' } },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('trouble').setup(opts)
|
||||
vim.api.nvim_set_hl(0, 'TroubleText', { link = 'CursorLineNr' })
|
||||
|
||||
vim.api.nvim_create_autocmd('QuitPre', {
|
||||
callback = function()
|
||||
local invalid_wins = {}
|
||||
local wins = vim.api.nvim_list_wins()
|
||||
for _, w in ipairs(wins) do
|
||||
local bufname = vim.api.nvim_buf_get_name(
|
||||
vim.api.nvim_win_get_buf(w)
|
||||
)
|
||||
if
|
||||
bufname:match 'Trouble' ~= nil
|
||||
or vim.api.nvim_win_get_config(w).relative ~= '' -- floating window
|
||||
then
|
||||
table.insert(invalid_wins, w)
|
||||
end
|
||||
end
|
||||
if #invalid_wins == #wins - 1 then
|
||||
-- Should quit, so we close all invalid windows.
|
||||
for _, w in ipairs(invalid_wins) do
|
||||
vim.api.nvim_win_close(w, true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
desc = 'Close Trouble if last window',
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
95
nvim/.config/nvim/lua/plugins/snippets.lua
Normal file
95
nvim/.config/nvim/lua/plugins/snippets.lua
Normal file
@@ -0,0 +1,95 @@
|
||||
return {
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
lazy = true,
|
||||
build = 'make install_jsregexp',
|
||||
keys = {
|
||||
{
|
||||
'<C-j>',
|
||||
function()
|
||||
local luasnip = require 'luasnip'
|
||||
if luasnip.jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
end
|
||||
end,
|
||||
mode = { 'i', 's' },
|
||||
desc = 'jump to next snippet',
|
||||
},
|
||||
{
|
||||
'<C-k>',
|
||||
function()
|
||||
local luasnip = require 'luasnip'
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end,
|
||||
mode = { 'i', 's' },
|
||||
desc = 'jump to previous snippet',
|
||||
},
|
||||
{
|
||||
'<C-e>',
|
||||
function()
|
||||
local luasnip = require 'luasnip'
|
||||
if luasnip.choice_active() then
|
||||
luasnip.change_choice(1)
|
||||
end
|
||||
end,
|
||||
mode = { 'i', 's' },
|
||||
desc = 'cycle through snippet choice node',
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
config = function()
|
||||
local ls = require 'luasnip'
|
||||
local types = require 'luasnip.util.types'
|
||||
|
||||
vim.api.nvim_set_hl(
|
||||
0,
|
||||
'LuasnipChoiceNodePassive',
|
||||
{ italic = true }
|
||||
)
|
||||
vim.api.nvim_set_hl(0, 'LuasnipChoiceNodeActive', { bold = true })
|
||||
|
||||
ls.config.set_config {
|
||||
keep_roots = true,
|
||||
link_roots = true,
|
||||
link_children = true,
|
||||
region_check_events = 'CursorMoved,CursorHold,InsertEnter',
|
||||
delete_check_events = 'InsertLeave',
|
||||
ext_opts = {
|
||||
[types.choiceNode] = {
|
||||
active = {
|
||||
virt_text = { { '', 'Operator' } }, --
|
||||
hl_mode = 'combine',
|
||||
},
|
||||
},
|
||||
[types.insertNode] = {
|
||||
active = {
|
||||
virt_text = { { '', 'Type' } }, --
|
||||
hl_mode = 'combine',
|
||||
},
|
||||
},
|
||||
},
|
||||
enable_autosnippets = true,
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'LuasnipSnippetsAdded',
|
||||
callback = function()
|
||||
print 'snippets loaded'
|
||||
end,
|
||||
})
|
||||
|
||||
require('luasnip.loaders.from_lua').lazy_load {
|
||||
paths = { './snippets' },
|
||||
}
|
||||
end,
|
||||
dependencies = {
|
||||
'rafamadriz/friendly-snippets',
|
||||
config = function()
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
end,
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
3
nvim/.config/nvim/lua/plugins/tpope.lua
Normal file
3
nvim/.config/nvim/lua/plugins/tpope.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
return {
|
||||
'tpope/vim-surround'
|
||||
}
|
||||
@@ -2,7 +2,7 @@ return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function ()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
require('nvim-treesitter.configs').setup({
|
||||
-- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ensure_installed = { 'bash', 'c', 'cpp', 'c_sharp', 'clojure', 'cmake', 'comment', 'commonlisp',
|
||||
'css', 'dockerfile', 'elixir', 'erlang', 'fish', 'go', 'html', 'http', 'java',
|
||||
@@ -23,7 +23,7 @@ return {
|
||||
extended_mode = false,
|
||||
max_file_lines = nil,
|
||||
},
|
||||
indent = { enable = false },
|
||||
indent = { enable = true },
|
||||
autopairs = { enable = true },
|
||||
autotag = { enable = true },
|
||||
incremental_selection = { enable = true },
|
||||
@@ -55,6 +55,6 @@ return {
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user