Neovim LSP stuff

This commit is contained in:
2025-05-21 19:13:17 +03:00
parent 0f4558597e
commit 43eabcc17e
15 changed files with 237 additions and 252 deletions

View File

@ -38,9 +38,9 @@ end
abbr s -f __ssh_kitten
function __multidot --description 'Use .... instead of ../../../'
string repeat -n (math (string length -- $argv) - 1) ../
echo -ns (string repeat -n (math (string length -- $argv) - 1) ../) %
end
abbr multidot -r '\.\.\.+$' -p anywhere -f __multidot
abbr multidot -r '\.\.\.+$' -p anywhere --set-cursor -f __multidot
function __multicd; echo cd (__multidot $argv); end
abbr multicd -r '^\.\.+$' -f __multicd
abbr multicd -r '^\.\.+$' --set-cursor -f __multicd

4
.config/gf2_config.ini Normal file
View File

@ -0,0 +1,4 @@
[ui]
scale=1.5
font_size_code=20
font_size_interface=17

View File

@ -39,18 +39,18 @@ column_meters_0=AllCPUs2 CPU
column_meter_modes_0=1 1
column_meters_1=DateTime Uptime LoadAverage Tasks Battery DiskIO NetworkIO Memory Swap
column_meter_modes_1=2 2 2 2 2 2 2 1 1
tree_view=1
tree_view=0
sort_key=47
tree_sort_key=47
tree_sort_key=49
sort_direction=-1
tree_sort_direction=-1
tree_view_always_by_pid=0
all_branches_collapsed=0
screen:Main=PID USER PRIORITY NICE M_VIRT M_SHARE M_RESIDENT STATE NLWP PROCESSOR PERCENT_CPU PERCENT_MEM TIME Command
.sort_key=PERCENT_MEM
.tree_sort_key=PERCENT_MEM
.tree_sort_key=TIME
.tree_view_always_by_pid=0
.tree_view=1
.tree_view=0
.sort_direction=-1
.tree_sort_direction=-1
.all_branches_collapsed=0

View File

@ -0,0 +1,19 @@
vim.lsp.config('harper_ls', {
settings = { -- https://writewithharper.com/docs/integrations/neovim
["harper-ls"] = {
isolateEnglish = true, -- highly experimental
fileDictPath = vim.fn.stdpath("config") .. "/spell/spell/",
userDictPath = vim.fn.stdpath("config") .. "/spell/en.utf-8.add",
codeActions = {
forceStable = true -- preserve the order of actions
},
diagnosticSeverity = "information" -- "hint", "information", "warning", "error"
-- markdown = { ignore_link_title = true }
-- linters = { -- turned off by default
-- spelled_numbers = false, wrong_quotes = false, linking_verbs = false,
-- boring_words = false, use_genitive = false, plural_conjugate = false,
-- no_oxford_comma = false,
-- }
}
},
})

View File

@ -0,0 +1,7 @@
vim.lsp.config('lua_ls', {
settings = {
Lua = {
diagnostics = { globals = { "vim" } }
}
}
})

View File

@ -0,0 +1,42 @@
vim.lsp.config('rust_analyzer', {
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
-- Add clippy lints for Rust.
checkOnSave = true,
check = {
-- allFeatures = true,
command = "clippy",
extraArgs = {
"--",
"--no-deps", -- run Clippy only on the given crate
-- Deny, Warn, Allow, Forbid
"-Wclippy::correctness", -- code that is outright wrong or useless
"-Wclippy::complexity", -- code that does something simple but in a complex way
"-Wclippy::suspicious", -- code that is most likely wrong or useless
"-Wclippy::style", -- code that should be written in a more idiomatic way
"-Wclippy::perf", -- code that can be written to run faster
"-Wclippy::pedantic", -- lints which are rather strict or have occasional false positives
"-Wclippy::nursery", -- new lints that are still under development
"-Wclippy::cargo", -- lints for the cargo manifest
-- Use in production
"-Aclippy::restriction", -- lints which prevent the use of language and library features
-- Other
"-Aclippy::must_use_candidate", -- must_use is rather annoing
},
},
procMacro = {
enable = true,
-- ignored = {
-- ["async-trait"] = { "async_trait" },
-- ["napi-derive"] = { "napi" },
-- ["async-recursion"] = { "async_recursion" },
-- },
},
},
}
})

View File

@ -0,0 +1,14 @@
-- https://myriad-dreamin.github.io/tinymist//frontend/neovim.html
vim.lsp.config('tinymist', {
settings = {
formatterPrintWidth = 100, -- can't stand 120
formatterMode = "typstyle", -- or typstfmt
-- exportPdf = "onDocumentHasTitle", -- default: never
semanticTokens = "enable"
},
single_file_support = true,
-- root_dir = function(_, bufnr)
-- return vim.fs.root(bufnr, { ".git" }) or vim.fn.expand "%:p:h"
-- end,
})

View File

@ -0,0 +1,8 @@
vim.lsp.config('yamlls', {
settings = {
yaml = {
format = { enable = true },
schemaStore = { enable = true },
}
}
})

View File

@ -1,22 +1,22 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
"LuaSnip": { "branch": "master", "commit": "c1851d5c519611dfc451b6582961b2602e0af89b" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"cyberdream.nvim": { "branch": "main", "commit": "4aa7c64b0b18a542d6587632efa93c3bea469979" },
"friendly-snippets": { "branch": "main", "commit": "fc8f183479a472df60aa86f00e295462f2308178" },
"gitsigns.nvim": { "branch": "main", "commit": "9cd665f46ab7af2e49d140d328b8e72ea1cf511b" },
"cyberdream.nvim": { "branch": "main", "commit": "8407e80415aebd6b052773d751dda7cd9cfc6835" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gitsigns.nvim": { "branch": "main", "commit": "39e0d1cd44eafed5f30c372e377ab1cb1781ec9f" },
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" },
"mason.nvim": { "branch": "main", "commit": "888d6ee499d8089a3a4be4309d239d6be1c1e6c0" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-lspconfig": { "branch": "master", "commit": "2e3f389aa06c7b7c29600ec2e67ee64c332077eb" },
"nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ed373482db797bbf71bdff37a15c7555a84dce47" },
"nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" },
"onedark.nvim": { "branch": "master", "commit": "0e5512d1bebd1f08954710086f87a5caa173a924" },
"nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" },
"nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "b0debd5c424969b4baeabdc8f54db3036c691732" },
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
"onedark.nvim": { "branch": "master", "commit": "11de4da47f3e69cb70c3ae9816bd8af166cbe121" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },

View File

@ -1,30 +1,16 @@
local lspconfig = require "lspconfig"
-- local lspconfig = require "lspconfig"
vim.diagnostic.config {
underline = true,
virtual_text = {
spacing = 4,
source = "if_many",
severity = { min = vim.diagnostic.severity.WARN },
},
-- virtual_lines = true,
severity_sort = true,
update_in_insert = false,
signs = { text = { "", "!", "󰙎", "󱠃" } }, -- E, W, I, H
float = { source = "if_many", border = vim.g.border_bleed },
}
lspconfig.util.default_config = vim.tbl_deep_extend("force", lspconfig.util.default_config, {
handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = vim.g.border_bleed, max_width = 80
}),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = vim.g.border_bleed, max_width = 80
})
},
capabilities = pcall(require, "cmp_nvim_lsp") and
package.loaded.cmp_nvim_lsp.default_capabilities() or nil
})
require("lspconfig.ui.windows").default_options.border = vim.g.border -- :LspInfo
-- lspconfig.util.default_config = vim.tbl_deep_extend("force", lspconfig.util.default_config, {
-- handlers = {
-- ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
-- border = vim.g.border_bleed, max_width = 80
-- }),
-- ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
-- border = vim.g.border_bleed, max_width = 80
-- })
-- },
-- capabilities = pcall(require, "cmp_nvim_lsp") and
-- package.loaded.cmp_nvim_lsp.default_capabilities() or nil
-- })
--
-- require("lspconfig.ui.windows").default_options.border = vim.g.border -- :LspInfo

View File

@ -74,3 +74,17 @@ o.fillchars = {
-- CUSTOM
vim.g.border = "single" -- :h nvim_open_win
vim.g.border_bleed = { "🭽", "", "🭾", "", "🭿", "", "🭼", "" } -- full-bleed
vim.diagnostic.config {
underline = true,
virtual_text = {
spacing = 4,
source = "if_many",
severity = { min = vim.diagnostic.severity.WARN },
},
-- virtual_lines = true,
severity_sort = true,
update_in_insert = false,
signs = { text = { "", "!", "󰙎", "󱠃" } }, -- E, W, I, H
float = { source = "if_many", border = vim.g.border_bleed },
}

View File

@ -1,16 +1,30 @@
local M = {
"williamboman/mason-lspconfig.nvim",
event = "BufReadPre",
return {
"mason-org/mason-lspconfig.nvim",
-- event = "BufReadPre",
event = "User LazyFile",
dependencies = { -- load those first
"mason.nvim",
{
"mason-org/mason.nvim",
opts = {
ui = {
height = 0.8,
border = vim.g.border,
icons = {
package_pending = "󱦳",
package_installed = "",
package_uninstalled = ""
}
}
}
},
-- {
"neovim/nvim-lspconfig",
config = function() require "configs.lspconfig" end
}
}
}
-- config = function() require "configs.lspconfig" end
-- }
},
M.opts = {
opts = {
automatic_enable = true,
ensure_installed = {
"lua_ls",
"bashls",
@ -28,117 +42,6 @@ M.opts = {
-- "taplo", -- toml
-- "jsonls",
-- "ruff_lsp", -- Python
},
handlers = { -- automatic server setup
function(server_name) -- default handler
package.loaded.lspconfig[server_name].setup {}
end
}
}
M.opts.handlers.lua_ls = function()
package.loaded.lspconfig.lua_ls.setup {
settings = {
Lua = {
diagnostics = { globals = { "vim" } }
}
}
}
end
M.opts.handlers.harper_ls = function()
package.loaded.lspconfig.harper_ls.setup {
settings = { -- https://writewithharper.com/docs/integrations/neovim
["harper-ls"] = {
isolateEnglish = true, -- highly experimental
fileDictPath = vim.fn.stdpath("config") .. "/spell/spell/",
userDictPath = vim.fn.stdpath("config") .. "/spell/en.utf-8.add",
codeActions = {
forceStable = true -- preserve the order of actions
},
diagnosticSeverity = "information" -- "hint", "information", "warning", "error"
-- markdown = { ignore_link_title = true }
-- linters = { -- turned off by default
-- spelled_numbers = false, wrong_quotes = false, linking_verbs = false,
-- boring_words = false, use_genitive = false, plural_conjugate = false,
-- no_oxford_comma = false,
-- }
}
},
}
end
-- https://myriad-dreamin.github.io/tinymist//frontend/neovim.html
M.opts.handlers.tinymist = function()
package.loaded.lspconfig.tinymist.setup {
settings = {
formatterPrintWidth = 100, -- can't stand 120
formatterMode = "typstyle", -- or typstfmt
-- exportPdf = "onDocumentHasTitle", -- default: never
semanticTokens = "enable"
},
single_file_support = true,
root_dir = function(_, bufnr)
return vim.fs.root(bufnr, { ".git" }) or vim.fn.expand "%:p:h"
end,
}
end
M.opts.handlers.yamlls = function()
package.loaded.lspconfig.yamlls.setup {
settings = {
yaml = {
format = { enable = true },
schemaStore = { enable = true },
}
}
}
end
M.opts.handlers.rust_analyzer = function() -- TODO
package.loaded.lspconfig.rust_analyzer.setup {
settings = {
["rust-analyzer"] = {
cargo = {
allFeatures = true,
loadOutDirsFromCheck = true,
runBuildScripts = true,
},
-- Add clippy lints for Rust.
checkOnSave = true,
check = {
-- allFeatures = true,
command = "clippy",
extraArgs = {
"--",
"--no-deps", -- run Clippy only on the given crate
-- Deny, Warn, Allow, Forbid
"-Wclippy::correctness", -- code that is outright wrong or useless
"-Wclippy::complexity", -- code that does something simple but in a complex way
"-Wclippy::suspicious", -- code that is most likely wrong or useless
"-Wclippy::style", -- code that should be written in a more idiomatic way
"-Wclippy::perf", -- code that can be written to run faster
"-Wclippy::pedantic", -- lints which are rather strict or have occasional false positives
"-Wclippy::nursery", -- new lints that are still under development
"-Wclippy::cargo", -- lints for the cargo manifest
-- Use in production
"-Aclippy::restriction", -- lints which prevent the use of language and library features
-- Other
"-Aclippy::must_use_candidate", -- must_use is rather annoing
},
},
procMacro = {
enable = true,
-- ignored = {
-- ["async-trait"] = { "async_trait" },
-- ["napi-derive"] = { "napi" },
-- ["async-recursion"] = { "async_recursion" },
-- },
},
},
}
}
end
return M

View File

@ -1,14 +0,0 @@
return {
"williamboman/mason.nvim",
opts = {
ui = {
height = 0.8,
border = vim.g.border,
icons = {
package_pending = "󱦳",
package_installed = "",
package_uninstalled = ""
}
}
}
}

View File

@ -2,5 +2,5 @@ return {
"dstein64/vim-startuptime",
cmd = "StartupTime", -- lazy-load on a command
keys = { { "<Leader>us", "<Cmd>StartupTime<CR>", desc = "StartupTime" } },
init = function() vim.g.startuptime_tries = 25 end
init = function() vim.g.startuptime_tries = 10 end
}

2
.gitignore vendored
View File

@ -34,6 +34,7 @@
!.config/nvim/
.config/nvim/*
!.config/nvim/lua/
!.config/nvim/after
!.config/nvim/README.md
!.config/nvim/lazy-lock.json
@ -42,6 +43,7 @@
!.config/mako/
!.config/kitty/
!.config/waybar/
!.config/gf2_config.ini
# Media
!.config/mpv/