-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.lua
227 lines (197 loc) · 8.49 KB
/
config.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny
vim.opt.list = true
vim.opt.listchars:append "space:⋅"
vim.wo.wrap = true
vim.wo.linebreak = true
vim.opt.relativenumber = false
-- Restore last session
vim.api.nvim_create_autocmd("VimEnter", {
group = vim.api.nvim_create_augroup("restore_session", { clear = true }),
callback = function()
if vim.fn.getcwd() ~= vim.env.HOME then
require("persistence").load()
end
end,
nested = true,
})
lvim.builtin.terminal.open_mapping = "<c-t>"
lvim.plugins = {
{
"folke/persistence.nvim",
event = "BufReadPre", -- this will only start session saving when an actual file was opened
config = function()
require("persistence").setup {
dir = vim.fn.expand(vim.fn.stdpath "config" .. "/session/"),
options = { "buffers", "curdir", "tabpages", "winsize" },
}
end,
},
{"ray-x/lsp_signature.nvim"},
{"lvimuser/lsp-inlayhints.nvim"},
{
"nvim-telescope/telescope-live-grep-args.nvim",
config = function()
require("telescope").load_extension("live_grep_args") end
},
{'lewis6991/gitsigns.nvim',
config = function()
require'gitsigns'.setup {
current_line_blame = true
}
end},
{'HiPhish/nvim-ts-rainbow2', config =
function()
require('nvim-treesitter.configs').setup {
rainbow = {
enable = true,
-- list of languages you want to disable the plugin for
disable = { 'jsx', 'cpp' },
-- Which query to use for finding delimiters
query = 'rainbow-parens',
-- Highlight the entire buffer all at once
strategy = require('ts-rainbow').strategy.global,
}
}
end
},
{'filipdutescu/renamer.nvim', config = function()
require('renamer').setup {}
end
},
}
local default_inline_config = {
inlay_hints = {
parameter_hints = {
show = true,
prefix = "<- ",
separator = ", ",
remove_colon_start = false,
remove_colon_end = true,
},
type_hints = {
-- type and other hints
show = true,
prefix = "",
separator = ", ",
remove_colon_start = false,
remove_colon_end = false,
},
only_current_line = false,
-- separator between types and parameter hints. Note that type hints are
-- shown before parameter
labels_separator = " ",
-- whether to align to the length of the longest line in the file
max_len_align = false,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- highlight group
highlight = "LspInlayHint",
-- virt_text priority
priority = 0,
},
enabled_at_startup = true,
debug_mode = false,
}
require("lsp-inlayhints").setup(default_inline_config)
vim.api.nvim_create_augroup("LspAttach_inlayhints", {})
vim.api.nvim_create_autocmd("LspAttach", {
group = "LspAttach_inlayhints",
callback = function(args)
if not (args.data and args.data.client_id) then
return
end
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)
require("lsp-inlayhints").on_attach(client, bufnr)
end,
})
-- lvim.builtin.which_key.mappings["S"]= {
-- name = "Session",
-- c = { "<cmd>lua require('persistence').load()<cr>", "Restore last session for current dir" },
-- l = { "<cmd>lua require('persistence').load({ last = true })<cr>", "Restore last session" },
-- Q = { "<cmd>lua require('persistence').stop()<cr>", "Quit without saving session" },
-- }
local cfg = {
debug = false, -- set to true to enable debug logging
log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on
-- default is ~/.cache/nvim/lsp_signature.log
verbose = false, -- show debug line number
bind = true, -- This is mandatory, otherwise border config won't get registered.
-- If you want to hook lspsaga or other signature handler, pls set to false
doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
-- set to 0 if you DO NOT want any API comments be shown
-- This setting only take effect in insert mode, it does not affect signature help in normal
-- mode, 10 by default
max_height = 12, -- max height of signature floating_window
max_width = 80, -- max_width of signature floating_window
noice = false, -- set to true if you using noice to render markdown
wrap = true, -- allow doc/signature text wrap inside floating_window, useful if your lsp return doc/sig is too long
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note:
-- will set to true when fully tested, set to false will use whichever side has more space
-- this setting will be helpful if you do not want the PUM and floating win overlap
floating_window_off_x = 1, -- adjust float windows x position.
-- can be either a number or function
floating_window_off_y = 0, -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines
-- can be either number or function, see examples
close_timeout = 4000, -- close floating window after ms when laster parameter is entered
fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters
hint_enable = true, -- virtual hint enable
hint_prefix = "🐼 ", -- Panda for parameter, NOTE: for the terminal not support emoji, might crash
hint_scheme = "String",
hint_inline = function() return false end, -- should the hint be inline(nvim 0.10 only)? default false
hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight
handler_opts = {
border = "rounded" -- double, rounded, single, shadow, none, or a table of borders
},
always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58
auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil.
extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom
padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc
transparency = nil, -- disabled by default, allow floating win transparent value 1~100
shadow_blend = 36, -- if you using shadow as border use this set the opacity
shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315'
timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency
toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
toggle_key_flip_floatwin_setting = false, -- true: toggle float setting after toggle key pressed
select_signature_key = nil, -- cycle to next signature, e.g. '<M-n>' function overloading
move_cursor_key = nil, -- imap, use nvim_set_current_win to move cursor between current win and floating
}
-- recommended:
require'lsp_signature'.setup(cfg) -- no need to specify bufnr if you don't use toggle_key
vim.opt.timeoutlen = 250
local function open_nvim_tree()
require("nvim-tree.api").tree.open()
end
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
-- focus file instead of NvimTree
vim.api.nvim_create_autocmd("VimEnter", { command = "wincmd l"})
vim.o.autoread = true
--au FocusGained * :checktime
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
command = "checktime",
})
--Remap
vim.api.nvim_set_keymap('i', '<F2>', '<cmd>lua require("renamer").rename()<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>rn', '<cmd>lua require("renamer").rename()<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('v', '<leader>rn', '<cmd>lua require("renamer").rename()<cr>', { noremap = true, silent = true })
-- add `custom_elements_ls` to `skipped_servers` list
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "custom_elements_ls" })
-- telescope size
lvim.builtin.telescope.defaults.layout_config.width = 0.7
lvim.builtin.telescope.defaults.layout_config.height = 0.7
lvim.builtin.telescope.defaults.layout_strategy = 'horizontal'
lvim.builtin.telescope.defaults.vimgrep_arguments = {
'rg',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--smart-case',
'-F',
}