-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
53 lines (50 loc) · 2.37 KB
/
init.lua
File metadata and controls
53 lines (50 loc) · 2.37 KB
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
require("config.lazy")
local EditorGroup = vim.api.nvim_create_augroup('EditorGroup', {})
vim.api.nvim_create_autocmd('LspAttach', {
group = EditorGroup,
callback = function(e)
local opts = { buffer = e.buf }
vim.keymap.set("n", "gD", function() vim.lsp.buf.declaration() end, opts)
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "gi", function() vim.lsp.buf.implementation() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrf", function() vim.lsp.buf.format() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
end
})
local PreWriteGroup = vim.api.nvim_create_augroup('PreWriteGroup', {})
vim.api.nvim_create_autocmd('BufWritePre', {
group = PreWriteGroup,
callback = function()
vim.lsp.buf.format({ async = false })
end
})
if vim.fn.has("wsl") == 1 then
if vim.fn.executable("wl-copy") == 0 then
print("Seems like you are under wsl, but do not have wl-copy, this integration won't work")
else
vim.g.clipboard = {
name = 'wl-clipboard (wsl)',
copy = {
["+"] = 'wl-copy --foreground --type text/plain',
["*"] = 'wl-copy --foreground --primary --type text/plain',
},
paste = {
["+"] = (function()
return vim.fn.systemlist('wl-psate --no-newline|sed -e "s/\r$//"', { '' }, 1)
end),
["*"] = (function()
return vim.fn.systemlist('wl-psate --primary --no-newline|sed -e "s/\r$//"', { '' }, 1)
end),
},
cache_enabled = true,
}
end
end