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
|
Want the same editor setup as me and don't want to jump through the admittedly
terribly annoying setup hoops that really shouldn't be necessary?
Windows:
cd /D "%LocalAppData%\nvim"
md pack
cd pack
git clone https://git.mikes.software/nvim-mike mike
Unix:
cd "~/.config/nvim"
mkdir pack
cd pack
git clone https://git.mikes.software/nvim-mike mike
*Also make sure you have fzf on your path!*
In your init.vim, try some of these options on for size:
```
set tgc
color monochrome
set ff=unix ffs=unix,dos
set sw=4 ts=4 noet tw=80 cc=80
set spr sb
set pb=12 winbl=12
set fcs=eob:\ list lcs=tab:\│\ ,trail:⎵
" on windows, prevents hanging! on unix, get rid of this.
nmap <C-z> <Nop>
let g:mapleader = " "
set mouse=a
function s:InitLSP()
lua <<EOF
local cmp = require "cmp"
local cmp_lsp = require "cmp_nvim_lsp"
local lspconfig = require "lspconfig"
cmp.setup {
sources = {
{name = "nvim_lsp"}
},
mapping = cmp.mapping.preset.insert()
}
local caps = vim.lsp.protocol.make_client_capabilities()
caps = cmp_lsp.update_capabilities(caps)
local opts = {noremap = true, silent = true}
local function nn(from, to) vim.api.nvim_set_keymap("n", from, to, opts) end
nn("<Leader>e", "<cmd>lua vim.diagnostic.open_float()<CR>")
nn("[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
nn("]d", "<cmd>lua vim.diagnostic.goto_next()<CR>")
local function onattach(client, buf)
local function nn(from, to)
vim.api.nvim_buf_set_keymap(buf, "n", from, to, opts)
end
nn("gD", "<cmd>lua vim.lsp.buf.declaration()<CR>")
nn("gd", "<cmd>lua vim.lsp.buf.definition()<CR>")
nn("<Leader>K", "<cmd>lua vim.lsp.buf.hover()<CR>")
nn("gi", "<cmd>lua vim.lsp.buf.implementation()<CR>")
nn("<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>")
nn("<Leader>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>")
nn("<Leader>r", "<cmd>lua vim.lsp.buf.rename()<CR>")
nn("<Leader>A", "<cmd>lua vim.lsp.buf.code_action()<CR>")
nn("<Leader>R", "<cmd>lua vim.lsp.buf.references()<CR>")
nn("<Leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>")
end
local servers = {"clangd"} -- add others here if you use them!
for _, lsp in pairs(servers) do
lspconfig[lsp].setup {
capabilities = caps,
on_attach = onattach,
flags = {debounce_text_changes = 500}
}
end
EOF
endfunction
au VimEnter * call s:InitLSP()
```
NOTE: the above more-or-less roughly reflects my settings at the time of
bothering to write this README. You may wish to change them, and I may have also
changed them since. 'Sjust an example!
vi: sw=4 ts=4 noet tw=80 cc=80
|