Skip to content

Commit 98ea49a

Browse files
committed
updated to 0.11
1 parent d98548a commit 98ea49a

File tree

4 files changed

+118
-121
lines changed

4 files changed

+118
-121
lines changed

after/plugin/lsp-config.lua

Lines changed: 94 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,32 @@
1-
-- [[ Configure LSP ]]
2-
local lsp = require 'lsp-zero'
3-
4-
lsp.preset 'recommended'
5-
6-
lsp.ensure_installed {
7-
'rust_analyzer',
8-
-- Python
9-
-- 'mypy',
10-
-- 'black',
11-
-- 'isort',
12-
-- 'ruff_lsp',
13-
'pyright',
14-
-- Java Stuffs
15-
'jdtls',
16-
-- 'google-java-format',
17-
-- Golang
18-
-- 'gofumpt',
19-
-- 'goimports-reviser',
20-
-- 'golines',
21-
'gopls',
22-
'templ',
23-
'htmx',
24-
-- Typescript
25-
-- 'prettier',
26-
-- 'prettierd',
27-
-- 'tsserver',
28-
-- Others
29-
'tailwindcss',
30-
}
1+
require('mason').setup()
2+
require('mason-lspconfig').setup()
313

32-
local capabilities = vim.lsp.protocol.make_client_capabilities()
33-
capabilities.textDocument.foldingRange = {
34-
dynamicRegistration = false,
35-
lineFoldingOnly = true,
36-
}
4+
vim.lsp.enable 'rust_analyzer'
5+
vim.lsp.enable 'pyright'
376

38-
-- Fix Undefined global 'vim'
39-
lsp.nvim_workspace()
40-
41-
local cmp = require 'cmp'
42-
local cmp_select = { behavior = cmp.SelectBehavior.Select }
43-
local cmp_mappings = lsp.defaults.cmp_mappings {
44-
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
45-
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
46-
['<C-y>'] = cmp.mapping.confirm { select = true },
47-
['<C-Space>'] = cmp.mapping.complete(),
48-
}
7+
vim.lsp.enable 'jdtls'
498

50-
cmp_mappings['<Tab>'] = nil
51-
cmp_mappings['<S-Tab>'] = nil
9+
vim.lsp.enable 'lua_ls'
5210

53-
lsp.setup_nvim_cmp {
54-
mapping = cmp_mappings,
55-
}
11+
vim.lsp.enable 'gopls'
12+
vim.lsp.enable 'templ'
13+
vim.lsp.enable 'htmx'
5614

57-
lsp.set_preferences {
58-
suggest_lsp_servers = false,
59-
sign_icons = {
60-
error = '⛔️',
61-
warn = '⚠️',
62-
hint = '🧐',
63-
info = 'I',
64-
},
65-
}
15+
vim.lsp.enable 'jsonls'
16+
vim.lsp.enable 'html'
6617

67-
local function on_attach(client, bufnr)
68-
local opts = { buffer = bufnr, remap = false }
18+
vim.lsp.enable 'ts_ls'
19+
vim.lsp.enable 'eslint'
6920

70-
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
71-
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
72-
vim.keymap.set('n', '<leader>vws', vim.lsp.buf.workspace_symbol, opts)
73-
vim.keymap.set('n', '<leader>vd', vim.diagnostic.open_float, opts)
74-
vim.keymap.set('n', '[d', vim.diagnostic.goto_next, opts)
75-
vim.keymap.set('n', ']d', vim.diagnostic.goto_prev, opts)
76-
vim.keymap.set('n', '<leader>dd', vim.diagnostic.setloclist, opts)
77-
vim.keymap.set('n', '<leader>do', vim.diagnostic.open_float, opts)
78-
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
79-
vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, opts)
80-
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts)
81-
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
82-
vim.keymap.set('n', '<leader>lf', function()
83-
require('conform').format()
84-
end, { buffer = bufnr, desc = 'Format Buffer' })
85-
vim.keymap.set('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, opts)
86-
vim.keymap.set('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, opts)
87-
vim.keymap.set('n', '<leader>wl', function()
88-
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
89-
end, opts)
90-
end
91-
92-
lsp.on_attach(on_attach)
93-
lsp.setup()
21+
vim.lsp.enable 'tailwindcss'
9422

95-
vim.diagnostic.config {
96-
virtual_text = true,
23+
local capabilities = vim.lsp.protocol.make_client_capabilities()
24+
capabilities.textDocument.foldingRange = {
25+
dynamicRegistration = false,
26+
lineFoldingOnly = true,
9727
}
9828

99-
local function on_attach(client, bufnr)
29+
local function on_attach(bufnr)
10030
local opts = { buffer = bufnr, remap = false }
10131

10232
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
@@ -121,14 +51,79 @@ local function on_attach(client, bufnr)
12151
end, opts)
12252
end
12353

124-
lsp.on_attach(on_attach)
125-
lsp.setup()
126-
127-
vim.diagnostic.config {
128-
virtual_text = true,
129-
}
54+
vim.api.nvim_create_autocmd('LspAttach', {
55+
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
56+
callback = function(ev)
57+
on_attach(ev.buf)
58+
-- local map = function(keys, func, desc)
59+
-- vim.keymap.set('n', keys, func, { buffer = ev.buf, desc = 'Lsp: ' .. desc })
60+
-- end
61+
62+
-- local tele = require 'telescope.builtin'
63+
-- map('gd', tele.lsp_definitions, 'Goto Definition')
64+
-- map('gr', tele.lsp_references, 'Goto References')
65+
--
66+
-- map('K', vim.lsp.buf.hover, 'hover')
67+
--
68+
-- map('n', '<leader>vws', vim.lsp.buf.workspace_symbol, 'Workspace Symbols')
69+
--
70+
-- map('n', '<leader>vd', vim.diagnostic.open_float, 'View Diagnostic')
71+
--
72+
-- map('n', '[d', vim.diagnostic.goto_next, 'Goto Next Diagnostic')
73+
-- map('n', ']d', vim.diagnostic.goto_prev, 'Goto Preview Diagnostic')
74+
-- map('n', '<leader>dd', vim.diagnostic.setloclist, 'List Diagnostics')
75+
-- map('n', '<leader>do', vim.diagnostic.open_float, 'List All Diagnostics')
76+
-- map('n', '<leader>ca', vim.lsp.buf.code_action, 'Code Action')
77+
--
78+
-- map('<leader>fs', tele.lsp_document_symbols, 'Doc Symbols')
79+
-- map('<leader>fS', tele.lsp_dynamic_workspace_symbols, 'Dynamic Symbols')
80+
-- map('<leader>ft', tele.lsp_type_definitions, 'Goto Type')
81+
-- map('<leader>fi', tele.lsp_implementations, 'Goto Impl')
82+
--
83+
-- map('n', '<leader>rn', vim.lsp.buf.rename, 'Rename')
84+
-- map('n', '<leader>lf', function()
85+
-- require('conform').format()
86+
-- end, 'Format Buffer')
87+
--
88+
-- map('n', '<leader>wa', vim.lsp.buf.add_workspace_folder, 'Add WorkSpace')
89+
-- map('n', '<leader>wr', vim.lsp.buf.remove_workspace_folder, 'Remove WorkSpace')
90+
-- map('n', '<leader>wl', function()
91+
-- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
92+
-- end, 'List Work Spaces')
93+
end,
94+
})
95+
-- vim.lsp.on_attach(on_attach)
96+
-- vim.lsp.setup()
97+
--
98+
-- vim.diagnostic.config {
99+
-- virtual_text = true,
100+
-- }
130101

131-
return {
132-
capabilities = capabilities,
133-
on_attach = on_attach,
134-
}
102+
-- Fix Undefined global 'vim'
103+
-- vim.lsp.nvim_workspace()
104+
105+
-- local cmp = require 'cmp'
106+
-- local cmp_select = { behavior = cmp.SelectBehavior.Select }
107+
-- local cmp_mappings = vim.lsp.defaults.cmp_mappings {
108+
-- ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
109+
-- ['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
110+
-- ['<C-y>'] = cmp.mapping.confirm { select = true },
111+
-- ['<C-Space>'] = cmp.mapping.complete(),
112+
-- }
113+
114+
-- cmp_mappings['<Tab>'] = nil
115+
-- cmp_mappings['<S-Tab>'] = nil
116+
117+
-- vim.lsp.setup_nvim_cmp {
118+
-- mapping = cmp_mappings,
119+
-- }
120+
121+
-- vim.lsp.set_preferences {
122+
-- suggest_lsp_servers = false,
123+
-- sign_icons = {
124+
-- error = '⛔️',
125+
-- warn = '⚠️',
126+
-- hint = '🧐',
127+
-- info = 'I',
128+
-- },
129+
-- }

after/plugin/mason.lua

Lines changed: 0 additions & 1 deletion
This file was deleted.

lazy-lock.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" },
44
"catppuccin": { "branch": "main", "commit": "387b4b19568cbda82c1d6def9ded31fd6ae7fb99" },
55
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
6+
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
67
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
78
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
89
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
10+
"cmp-vsnip": { "branch": "main", "commit": "989a8a73c44e926199bfd05fa7a516d51f2d2752" },
911
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
1012
"conform.nvim": { "branch": "master", "commit": "6feb2f28f9a9385e401857b21eeac3c1b66dd628" },
1113
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
@@ -15,7 +17,6 @@
1517
"image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" },
1618
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
1719
"lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" },
18-
"lsp-zero.nvim": { "branch": "v1.x", "commit": "a7c18ecde0b4462bcd84f363723ff633f2c9a198" },
1920
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
2021
"lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" },
2122
"lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" },
@@ -56,5 +57,6 @@
5657
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
5758
"vim-rhubarb": { "branch": "master", "commit": "386daa2e9d98e23e27ad089afcbe5c5a903e488d" },
5859
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
60+
"vim-vsnip": { "branch": "master", "commit": "0a4b8419e44f47c57eec4c90df17567ad4b1b36e" },
5961
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
6062
}

lua/plugins/lsp.lua

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
return {
2-
'VonHeikemen/lsp-zero.nvim',
3-
branch = 'v1.x',
4-
dependencies = {
5-
-- LSP Support
6-
{ 'neovim/nvim-lspconfig' },
7-
{ 'williamboman/mason.nvim' },
8-
{ 'williamboman/mason-lspconfig.nvim' },
2+
'neovim/nvim-lspconfig',
3+
dependencies = {
4+
-- LSP Support
5+
{ 'williamboman/mason.nvim' },
6+
{ 'williamboman/mason-lspconfig.nvim' },
97

10-
-- Autocompletion
11-
{ 'hrsh7th/nvim-cmp' },
12-
{ 'hrsh7th/cmp-buffer' },
13-
{ 'hrsh7th/cmp-path' },
14-
{ 'saadparwaiz1/cmp_luasnip' },
15-
{ 'hrsh7th/cmp-nvim-lsp' },
16-
{ 'hrsh7th/cmp-nvim-lua' },
8+
-- Autocompletion
9+
{ 'hrsh7th/nvim-cmp' },
10+
{ 'hrsh7th/cmp-buffer' },
11+
{ 'hrsh7th/cmp-path' },
12+
{ 'saadparwaiz1/cmp_luasnip' },
13+
{ 'hrsh7th/cmp-nvim-lsp' },
14+
{ 'hrsh7th/cmp-nvim-lua' },
15+
{ 'hrsh7th/cmp-cmdline' },
16+
{ 'hrsh7th/cmp-vsnip' },
17+
{ 'hrsh7th/vim-vsnip' },
1718

18-
-- Snippets
19-
{ 'L3MON4D3/LuaSnip' },
19+
-- Snippets
20+
{ 'L3MON4D3/LuaSnip' },
2021

21-
{ 'rafamadriz/friendly-snippets' },
22-
},
23-
-- Use the lazy option to lazy-load the plugin on events or commands
24-
lazy = true,
22+
{ 'rafamadriz/friendly-snippets' },
23+
},
24+
-- Use the lazy option to lazy-load the plugin on events or commands
25+
lazy = true,
2526
}

0 commit comments

Comments
 (0)