aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-23 15:58:07 +0900
committernsfisis <nsfisis@gmail.com>2026-02-23 15:59:24 +0900
commit9d774906860bea4105a054095d843d8d656b569e (patch)
tree5e4cf9e40b501a99e55d9d35b6d69fc166eacf6e
parentbf63936430497e843a26888924095ccb6747b0b9 (diff)
downloaddotfiles-9d774906860bea4105a054095d843d8d656b569e.tar.gz
dotfiles-9d774906860bea4105a054095d843d8d656b569e.tar.zst
dotfiles-9d774906860bea4105a054095d843d8d656b569e.zip
nvim/lsp: update LSP settings for Nvim 0.11 changes
-rw-r--r--.config/nvim/after/lsp/efm.lua32
-rw-r--r--.config/nvim/lazy-lock.json8
-rw-r--r--.config/nvim/lua/init/01-options.lua2
-rw-r--r--.config/nvim/lua/init/04-mappings.lua5
-rw-r--r--.config/nvim/lua/vimrc/lsp.lua47
-rw-r--r--.config/nvim/lua/vimrc/plugins.lua84
6 files changed, 85 insertions, 93 deletions
diff --git a/.config/nvim/after/lsp/efm.lua b/.config/nvim/after/lsp/efm.lua
new file mode 100644
index 0000000..c8952da
--- /dev/null
+++ b/.config/nvim/after/lsp/efm.lua
@@ -0,0 +1,32 @@
+local biome_conf = {
+ rootMarkers = { 'biome.json' },
+ formatCommand = 'node_modules/.bin/biome format --stdin-file-path "${INPUT}"',
+ formatStdin = true,
+}
+
+return {
+ cmd = { 'efm-langserver' },
+ filetypes = {
+ 'json',
+ 'javascript', 'javascriptreact', 'javascript.jsx',
+ 'typescript', 'typescriptreact', 'typescript.jsx',
+ },
+ root_markers = { '.git' },
+ init_options = { documentFormatting = true },
+ settings = {
+ languages = {
+ json = {
+ {
+ formatCommand = 'reparojson -q',
+ formatStdin = true,
+ },
+ },
+ javascript = { biome_conf },
+ javascriptreact = { biome_conf },
+ ['javascript.jsx'] = { biome_conf },
+ typescript = { biome_conf },
+ typescriptreact = { biome_conf },
+ ['typescript.jsx'] = { biome_conf },
+ },
+ },
+}
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
index e34be16..aa50940 100644
--- a/.config/nvim/lazy-lock.json
+++ b/.config/nvim/lazy-lock.json
@@ -7,16 +7,16 @@
"foldCC.vim": { "branch": "master", "commit": "344335d27349b837d33dc7757de0cb7930ac33ae" },
"hop.nvim": { "branch": "master", "commit": "707049feaca9ae65abb3696eff9aefc7879e66aa" },
"iceberg.vim": { "branch": "master", "commit": "23835d5ed696436f716cbfdb56a93a7850fe3b18" },
- "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
+ "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
- "nvim-lspconfig": { "branch": "master", "commit": "463b16bd6a347a129367a7fd00ebcdd9442d9a96" },
- "nvim-treesitter": { "branch": "main", "commit": "4d9466677a5ceadef104eaa0fe08d60d91c4e9a7" },
+ "nvim-lspconfig": { "branch": "master", "commit": "5a855bcfec7973767a1a472335684bbd71d2fa2b" },
+ "nvim-treesitter": { "branch": "main", "commit": "dc42c209f3820bdfaae0956f15de29689aa6b451" },
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
"skkeleton": { "branch": "main", "commit": "158ae753bc5099ab12537c23152926c42b1f7c3a" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
- "telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" },
+ "telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
"textobj-wiw": { "branch": "master", "commit": "8f89ed3797adb181332b8a9c80a9311c56184047" },
"vim-altr": { "branch": "master", "commit": "fba055cf3b83a1ada5b05d694fbefd024aa93289" },
"vim-asterisk": { "branch": "master", "commit": "77e97061d6691637a034258cc415d98670698459" },
diff --git a/.config/nvim/lua/init/01-options.lua b/.config/nvim/lua/init/01-options.lua
index f706ece..20255cc 100644
--- a/.config/nvim/lua/init/01-options.lua
+++ b/.config/nvim/lua/init/01-options.lua
@@ -88,7 +88,7 @@ end
O.undofile = true
O.textwidth = 0
-OPT.completeopt:remove('preview')
+OPT.completeopt:append('fuzzy')
O.pumheight = 10
OPT.matchpairs:append('<:>')
O.joinspaces = false
diff --git a/.config/nvim/lua/init/04-mappings.lua b/.config/nvim/lua/init/04-mappings.lua
index ce13b32..a2a31c3 100644
--- a/.config/nvim/lua/init/04-mappings.lua
+++ b/.config/nvim/lua/init/04-mappings.lua
@@ -496,11 +496,6 @@ K.set('!', 'jk', '<ESC>', { remap=true })
K.set('n', '<C-c>', ':<C-u>nohlsearch<CR>', { silent=true })
--- "remap" flag is needed because [<Space> and ]<Space> are implemented by Lua functions.
-K.set('n', 'go', ']<Space>', { remap = true })
-K.set('n', 'gO', '[<Space>', { remap = true })
-
-
K.set('n', '<Space>w', '<Cmd>update<CR>')
K.set('n', 'Z', '<Cmd>wqall<CR>', { nowait = true })
diff --git a/.config/nvim/lua/vimrc/lsp.lua b/.config/nvim/lua/vimrc/lsp.lua
new file mode 100644
index 0000000..e2932a7
--- /dev/null
+++ b/.config/nvim/lua/vimrc/lsp.lua
@@ -0,0 +1,47 @@
+local is_deno_repo = vim.fs.root(0, { 'deno.json', 'deno.jsonc' }) ~= nil
+
+local servers = { 'gopls', 'phpactor', 'zls', 'efm' }
+if is_deno_repo then
+ table.insert(servers, 'denols')
+else
+ table.insert(servers, 'ts_ls')
+end
+
+vim.lsp.enable(servers)
+
+vim.api.nvim_create_autocmd('LspAttach', {
+ group = vim.api.nvim_create_augroup('UserLspConfig', {}),
+ callback = function(e)
+ local client = assert(vim.lsp.get_client_by_id(e.data.client_id))
+
+ if client:supports_method('textDocument/completion') then
+ vim.lsp.completion.enable(true, client.id, e.buf, { autotrigger = true })
+ end
+
+ if client:supports_method('textDocument/formatting') then
+ vim.keymap.set('n', '<space>f', function()
+ vim.lsp.buf.format({
+ bufnr = e.buf,
+ id = client.id,
+ async = true,
+ filter = function(client) return client.name ~= "ts_ls" end,
+ })
+ end, { buffer = e.buf })
+
+ if not client:supports_method('textDocument/willSaveWaitUntil') then
+ vim.api.nvim_create_autocmd('BufWritePre', {
+ group = vim.api.nvim_create_augroup('UserLspConfig', { clear = false }),
+ buffer = e.buf,
+ callback = function()
+ vim.lsp.buf.format({
+ bufnr = e.buf,
+ id = client.id,
+ timeout_ms = 5000,
+ filter = function(client) return client.name ~= "ts_ls" end,
+ })
+ end
+ })
+ end
+ end
+ end,
+})
diff --git a/.config/nvim/lua/vimrc/plugins.lua b/.config/nvim/lua/vimrc/plugins.lua
index ca78f87..bddf281 100644
--- a/.config/nvim/lua/vimrc/plugins.lua
+++ b/.config/nvim/lua/vimrc/plugins.lua
@@ -611,89 +611,7 @@ return {
{
'neovim/nvim-lspconfig',
config = function()
- local lspconfig = require('lspconfig')
-
- -- TODO
- -- Enable denols xor ts_ls.
- local is_deno_repo
- if vim.fn.executable('deno') == 1 then
- is_deno_repo = vim.fs.root(0, {"deno.json", "deno.jsonc"}) ~= nil
- else
- is_deno_repo = false
- end
-
- if vim.fn.executable('typescript-language-server') == 1 then
- if not is_deno_repo then
- lspconfig.ts_ls.setup({})
- end
- end
- if vim.fn.executable('deno') == 1 then
- if is_deno_repo then
- lspconfig.denols.setup({})
- end
- end
- if vim.fn.executable('gopls') == 1 then
- lspconfig.gopls.setup({})
- end
- if vim.fn.executable('phpactor') == 1 then
- lspconfig.phpactor.setup({})
- end
- if vim.fn.executable('zls') == 1 then
- lspconfig.zls.setup({})
- end
- if vim.fn.executable('efm-langserver') == 1 then
- local biome_conf = {
- rootMarkers = {"biome.json"},
- formatCommand = 'node_modules/.bin/biome format --stdin-file-path "${INPUT}"',
- formatStdin = true,
- }
- lspconfig.efm.setup({
- init_options = { documentFormatting = true },
- settings = {
- rootMarkers = {".git/"},
- languages = {
- json = {
- {
- formatCommand = "reparojson -q",
- formatStdin = true,
- },
- },
- javascript = {biome_conf},
- javascriptreact = {biome_conf},
- ["javascript.jsx"] = {biome_conf},
- typescript = {biome_conf},
- typescriptreact = {biome_conf},
- ["typescript.jsx"] = {biome_conf},
- },
- }
- })
- end
-
- vim.api.nvim_create_autocmd('LspAttach', {
- group = vim.api.nvim_create_augroup('UserLspConfig', {}),
- callback = function(e)
- vim.bo[e.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
-
- local opts = { buffer = e.buf }
- vim.keymap.set('n', '<space>f', function()
- vim.lsp.buf.format({
- async = true,
- filter = function(client) return client.name ~= "ts_ls" end,
- })
- end, opts)
-
- vim.api.nvim_create_autocmd('BufWritePre', {
- buffer = e.buf,
- callback = function()
- vim.lsp.buf.format({
- async = false,
- timeout_ms = 5000,
- filter = function(client) return client.name ~= "ts_ls" end,
- })
- end
- })
- end,
- })
+ require('vimrc.lsp')
end,
},
}