Skip to content

Commit b481396

Browse files
committed
disablinc_lsp_autostart
1 parent ff2fb2d commit b481396

9 files changed

Lines changed: 117 additions & 95 deletions

File tree

lua/lsp/handlers.lua

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
11
local M = {}
22
local border = { "", "", "", "", "", "", "", "" }
33
local signature_cfg = {
4-
bind = true, -- This is mandatory, otherwise border config won't get registered.
5-
-- If you want to hook lspsaga or other signature handler, pls set to false
6-
doc_lines = 2, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
7-
-- set to 0 if you DO NOT want any API comments be shown
8-
-- This setting only take effect in insert mode, it does not affect signature help in normal
9-
-- mode, 10 by default
4+
bind = true, -- This is mandatory, otherwise border config won't get registered.
5+
-- If you want to hook lspsaga or other signature handler, pls set to false
6+
doc_lines = 2, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
7+
-- set to 0 if you DO NOT want any API comments be shown
8+
-- This setting only take effect in insert mode, it does not affect signature help in normal
9+
-- mode, 10 by default
1010

11-
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
12-
hint_enable = false, -- virtual hint enable
13-
hint_prefix = "🐼 ", -- Panda for parameter
14-
hint_scheme = "String",
15-
use_lspsaga = false, -- set to true if you want to use lspsaga popup
16-
hi_parameter = "Search", -- how your parameter will be highlight
17-
max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down
18-
-- to view the hiding contents
19-
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
20-
handler_opts = {
21-
border = "single", -- double, single, shadow, none
22-
},
23-
-- deprecate !!
24-
-- decorator = {"`", "`"} -- this is no longer needed as nvim give me a handler and it allow me to highlight active parameter in floating_window
11+
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
12+
hint_enable = false, -- virtual hint enable
13+
hint_prefix = "🐼 ", -- Panda for parameter
14+
hint_scheme = "String",
15+
use_lspsaga = false, -- set to true if you want to use lspsaga popup
16+
hi_parameter = "Search", -- how your parameter will be highlight
17+
max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down
18+
-- to view the hiding contents
19+
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
20+
handler_opts = {
21+
border = "single", -- double, single, shadow, none
22+
},
23+
-- deprecate !!
24+
-- decorator = {"`", "`"} -- this is no longer needed as nvim give me a handler and it allow me to highlight active parameter in floating_window
2525
}
2626

27-
2827
local function set_signature_helper(client, bufnr)
29-
local shp = client.server_capabilities.signatureHelpProvider
30-
if shp == true or (type(shp) == "table" and next(shp) ~= nil) then
31-
require("lsp_signature").on_attach(signature_cfg, bufnr)
32-
end
28+
local shp = client.server_capabilities.signatureHelpProvider
29+
if shp == true or (type(shp) == "table" and next(shp) ~= nil) then
30+
require("lsp_signature").on_attach(signature_cfg, bufnr)
31+
end
3332
end
3433

3534
local function set_hover_border(client)
36-
local hp = client.server_capabilities.hoverProvider
37-
if hp == true or (type(hp) == "table" and next(hp) ~= nil) then
38-
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
39-
end
35+
local hp = client.server_capabilities.hoverProvider
36+
if hp == true or (type(hp) == "table" and next(hp) ~= nil) then
37+
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
38+
end
4039
end
4140

4241
M.on_attach = function(client, bufnr)
43-
set_signature_helper(client, bufnr)
44-
set_hover_border(client)
42+
set_signature_helper(client, bufnr)
43+
set_hover_border(client)
4544
end
4645

4746
M.capabilities = require("cmp_nvim_lsp").default_capabilities()
4847
-- M.capabilities = require('coq').lsp_ensure_capabilities()
48+
-- M.capabilities = require("blink.cmp").get_lsp_capabilities()
49+
4950
return M

lua/lsp/init.lua

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ local capabilities = require("lsp.handlers").capabilities
22

33
-- local _lspconfig, lspconfig = pcall(require, "lspconfig")
44
local lspconfig = vim.lsp.config
5+
56
if lspconfig then
67
-- Python
78
lspconfig("pyright", {
8-
autostart = false,
99
capabilities = capabilities,
1010
filetypes = { "python" },
1111
})
1212

1313
-- LUA
1414
lspconfig("lua_ls", {
15-
autostart = false,
1615
settings = {
1716
Lua = {
1817
runtime = {
@@ -66,19 +65,16 @@ if lspconfig then
6665

6766
-- Clangd (C++)
6867
lspconfig("clangd", {
69-
autostart = false,
7068
capabilities = capabilities,
7169
})
7270

7371
-- Bash
7472
lspconfig("bashls", {
75-
autostart = true,
7673
capabilities = capabilities,
7774
})
7875

7976
-- Javascript/Typescript
8077
lspconfig("eslint", {
81-
autostart = true,
8278
capabilities = capabilities,
8379
settings = {
8480
packageManager = "npm",
@@ -93,108 +89,90 @@ if lspconfig then
9389

9490
-- HTML
9591
lspconfig("html", {
96-
autostart = true,
9792
capabilities = capabilities,
9893
})
9994

10095
-- CSS
10196
lspconfig("cssls", {
102-
autostart = true,
10397
capabilities = capabilities,
10498
})
10599

106100
-- Dockerfile
107101
lspconfig("dockerls", {
108-
autostart = true,
109102
capabilities = capabilities,
110103
})
111104

112105
-- Docker compose
113106
lspconfig("docker_compose_language_service", {
114-
autostart = true,
115107
capabilities = capabilities,
116108
})
117109
-- XML
118110
lspconfig("lemminx", {
119-
autostart = true,
120111
capabilities = capabilities,
121112
})
122113

123114
-- VUE
124115
lspconfig("vuels", {
125-
autostart = false,
126116
capabilities = capabilities,
127117
})
128118

129119
-- YAMLs
130120
lspconfig("yamlls", {
131-
autostart = true,
132121
capabilities = capabilities,
133122
})
134123

135124
-- CMake Language Server
136125
lspconfig("cmake", {
137-
autostart = false,
138126
capabilities = capabilities,
139127
})
140128

141129
-- Elixir Language Server
142130
lspconfig("elixirls", {
143-
autostart = false,
144131
capabilities = capabilities,
145132
})
146133

147134
-- -- Go Language Server
148135
-- lspconfig("gopls",{
149-
-- autostart = false,
150136
-- capabilities = capabilities,
151137
-- })
152138

153139
-- Gradle Language Server
154140
lspconfig("gradle_ls", {
155-
autostart = false,
156141
capabilities = capabilities,
157142
})
158143

159144
-- -- Groovy Language Server
160145
-- lspconfig("groovyls",{
161-
-- autostart = false,
162146
-- capabilities = capabilities,
163147
-- })
164148

165149
-- Json Language Server
166150
lspconfig("jsonls", {
167-
autostart = true,
168151
capabilities = capabilities,
169152
})
170153

171154
-- Kotlin LS
172155
lspconfig("kotlin_language_server", {
173-
autostart = false,
174156
capabilities = capabilities,
175157
})
176158

177159
-- Make Language Server
178160
lspconfig("autotools_ls", {
179-
autostart = true,
180161
capabilities = capabilities,
181162
})
182163

183164
-- Powershell Language Server
184165
lspconfig("powershell_es", {
185-
autostart = false,
186166
capabilities = capabilities,
187167
})
188168

189169
-- SQL Language Server
190170
lspconfig("sqlls", {
191-
autostart = false,
192171
capabilities = capabilities,
193172
})
194173

195174
-- Terraform Language Server
196175
lspconfig("terraformls", {
197-
autostart = false,
198176
capabilities = capabilities,
199177
})
200178
end

lua/mappings.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,23 +178,25 @@ wk.add({
178178
{ "<leader>gh", "<cmd>Gitsigns preview_hunk<cr>", desc = "[GIT] Preview hunk" },
179179

180180
-- Display modes
181-
{ "<leader>m", group = "[Display Modes]" },
182-
{ "<leader>mz", "<cmd>ZenMode<cr>", desc = "[MODE] Toggle zen mode" },
181+
{ "<leader>z", group = "[Display Modes]" },
182+
{ "<leader>zz", "<cmd>ZenMode<cr>", desc = "[MODE] Toggle zen mode" },
183183

184184
})
185185

186186
-- INSERT MODE MAPPINGS
187187
wk.add({
188188
mode = { "i" },
189189
{ "jk", "<Esc>", desc = "Normal mode switch" },
190+
{ "<a-s>", "<Del>", desc = "Handy DEL on insert mode" },
191+
{ "<a-c>", '<ESC>"_ciw', desc = "Change word" },
192+
{ "<a-s-c>", '<ESC><cmd>lua require("various-textobjs").subword(true)<cr>"_c', desc = "Change subword" },
193+
{ "<a-z>", '<ESC><cmd>lua require("various-textobjs").anyQuote("inner")<cr>"_c', desc = "Change within any kind of quotes" },
194+
{ "<a-x>", '<ESC><cmd>lua require("various-textobjs").anyBracket("inner")<cr>"_c', desc = "Change within any kind of bracket (),[],{}" },
195+
{ "<a-w>", "<C-o>w", desc = "Move to next word" },
190196
{ "<a-b>", "<C-o>b", desc = "Move to previous word" },
191-
{ "<a-c>", '<C-o>"_ciw', desc = "Change word" },
192-
{ "<a-d>", '<C-o>"_diw', desc = "Delete word" },
193197
{ "<a-e>", "<ESC>ea", desc = "Move to end of word" },
194198
{ "<a-j>", "<ESC>:m .+1<cr>==gi", desc = "[MOVE] Move block down" },
195199
{ "<a-k>", "<ESC>:m .-2<cr>==gi", desc = "[MOVE] Move block up" },
196-
{ "<a-s>", "<Del>", desc = "Handy DEL on insert mode" },
197-
{ "<a-w>", "<C-o>w", desc = "Move to next word" },
198200
})
199201

200202
-- VISUAL MODE MAPPINGS

lua/plugins/configs/bigfile.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ return {
22
"LunarVim/bigfile.nvim",
33
config = function()
44
require("bigfile").setup({
5-
filesize = 4, -- size of the file in MiB, the plugin round file sizes to the closest MiB
5+
filesize = 2, -- size of the file in MiB, the plugin round file sizes to the closest MiB
66
pattern = { "*" }, -- autocmd pattern or function see <### Overriding the detection of big files>
77
features = { -- features to disable
88
"indent_blankline",
@@ -12,7 +12,7 @@ return {
1212
"syntax",
1313
"matchparen",
1414
"vimopts",
15-
-- "filetype",
15+
"filetype",
1616
},
1717
})
1818
end,

lua/plugins/configs/blink.lua

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
return {
2+
"saghen/blink.cmp",
3+
-- optional: provides snippets for the snippet source
4+
dependencies = {
5+
"rafamadriz/friendly-snippets",
6+
-- { "L3MON4D3/LuaSnip", version = "v2.*" },
7+
},
8+
9+
-- use a release tag to download pre-built binaries
10+
version = "1.*",
11+
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
12+
-- build = 'cargo build --release',
13+
-- If you use nix, you can build from source using latest nightly rust with:
14+
-- build = 'nix run .#build-plugin',
15+
16+
---@module 'blink.cmp'
17+
---@type blink.cmp.Config
18+
opts = {
19+
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
20+
-- 'super-tab' for mappings similar to vscode (tab to accept)
21+
-- 'enter' for enter to accept
22+
-- 'none' for no mappings
23+
--
24+
-- All presets have the following mappings:
25+
-- C-space: Open menu or open docs if already open
26+
-- C-n/C-p or Up/Down: Select next/previous item
27+
-- C-e: Hide menu
28+
-- C-k: Toggle signature help (if signature.enabled = true)
29+
--
30+
-- See :h blink-cmp-config-keymap for defining your own keymap
31+
keymap = { preset = "enter" },
32+
33+
appearance = {
34+
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
35+
-- Adjusts spacing to ensure icons are aligned
36+
nerd_font_variant = "mono",
37+
},
38+
39+
-- (Default) Only show the documentation popup when manually triggered
40+
completion = { documentation = { auto_show = false } },
41+
42+
-- snippets = { preset = "luasnip" },
43+
44+
-- Default list of enabled providers defined so that you can extend it
45+
-- elsewhere in your config, without redefining it, due to `opts_extend`
46+
sources = {
47+
default = { "lsp", "path", "snippets", "buffer" },
48+
-- default = { "snippets" },
49+
},
50+
51+
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
52+
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
53+
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
54+
--
55+
-- See the fuzzy documentation for more information
56+
fuzzy = { implementation = "prefer_rust_with_warning" },
57+
},
58+
opts_extend = { "sources.default" },
59+
}

lua/plugins/configs/cmp.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ return {
1111
"hrsh7th/cmp-nvim-lsp-document-symbol",
1212
"L3MON4D3/LuaSnip",
1313
"saadparwaiz1/cmp_luasnip",
14+
"rafamadriz/friendly-snippets",
1415
"lukas-reineke/cmp-under-comparator", -- Better sort completion items starting with underscore (Python)
1516
},
1617
config = function()
@@ -102,11 +103,11 @@ return {
102103
["<C-f>"] = cmp.mapping.scroll_docs(4),
103104
["<C-Space>"] = cmp.mapping.complete(),
104105
["<C-q>"] = cmp.mapping.abort(),
105-
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
106-
["<CR>"] = cmp.mapping.confirm({ select = true, }),
106+
-- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
107+
["<CR>"] = cmp.mapping.confirm({ select = true }),
107108
}),
108109
sources = {
109-
{ name = "path" },
110+
{ name = "path" },
110111
{ name = "nvim_lsp" },
111112
{ name = "nvim_lua" },
112113
{ name = "luasnip" },

lua/plugins/configs/mason.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ return {
99
"mason-org/mason-lspconfig.nvim",
1010
config = function()
1111
require("mason-lspconfig").setup({
12+
automatic_enable = false,
1213
ensure_installed = {
1314
"pyright",
14-
"lemminx",
15+
-- "lemminx",
1516
"html",
1617
"tsp_server",
1718
"eslint",

0 commit comments

Comments
 (0)