diff options
-rw-r--r-- | README | 86 |
1 files changed, 86 insertions, 0 deletions
@@ -0,0 +1,86 @@ +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_buf_set_keymap(buf, "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) + 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 |