diff options
author | aktersnurra <grydholm@kth.se> | 2021-04-19 21:45:03 +0200 |
---|---|---|
committer | aktersnurra <grydholm@kth.se> | 2021-04-19 21:45:03 +0200 |
commit | 69347ce034f8966579e72dc969ec808363fdfaeb (patch) | |
tree | 3be9e1b1547a0871826b6112a0d88406572b02ba /.config/nvim | |
parent | 23b895222a16925d39d04d45dedbedec9db0c752 (diff) |
Add missing files of nvim conf
Diffstat (limited to '.config/nvim')
-rw-r--r-- | .config/nvim/language-settings.lua | 30 | ||||
-rw-r--r-- | .config/nvim/lua/_autocommands/init.lua | 54 | ||||
-rw-r--r-- | .config/nvim/lua/_barbar/init.lua | 3 | ||||
-rw-r--r-- | .config/nvim/lua/_dashboard/init.lua | 32 | ||||
-rw-r--r-- | .config/nvim/lua/_emmet/init.lua | 16 | ||||
-rw-r--r-- | .config/nvim/lua/_lspinstall/init.lua | 27 | ||||
-rw-r--r-- | .config/nvim/lua/globals.lua | 61 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/bash-ls.lua | 6 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/clangd.lua | 13 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/docker-ls.lua | 6 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/emmet-ls.lua | 19 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/init.lua | 103 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/json-ls.lua | 16 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/lua-ls.lua | 27 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/python-ls.lua | 14 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/rust-ls.lua | 4 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/vim-ls.lua | 5 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/yaml-ls.lua | 5 | ||||
-rw-r--r-- | .config/nvim/vim-script/functions.vim | 42 |
19 files changed, 483 insertions, 0 deletions
diff --git a/.config/nvim/language-settings.lua b/.config/nvim/language-settings.lua new file mode 100644 index 0000000..36a5d05 --- /dev/null +++ b/.config/nvim/language-settings.lua @@ -0,0 +1,30 @@ +-- general +O.auto_complete = true +O.colorscheme = 'lunar' +O.auto_close_tree = 0 +O.wrap_lines = false + +O.clang.diagnostics.virtual_text = false +O.clang.diagnostics.signs = false +O.clang.diagnostics.underline = false + +-- python +O.python.formatter = 'black' +O.python.linter = 'flake8' +O.python.isort = true +O.python.autoformat = true +O.python.diagnostics.virtual_text = true +O.python.diagnostics.signs = true +O.python.diagnostics.underline = true + +-- lua +O.lua.formatter = 'lua-format' +O.lua.autoformat = false + +-- javascript +O.tsserver.formatter = 'prettier' +O.tsserver.linter = nil +O.tsserver.autoformat = true + +-- json +O.json.autoformat = true diff --git a/.config/nvim/lua/_autocommands/init.lua b/.config/nvim/lua/_autocommands/init.lua new file mode 100644 index 0000000..a94cb0f --- /dev/null +++ b/.config/nvim/lua/_autocommands/init.lua @@ -0,0 +1,54 @@ +local utils = require('_utils') + +local auto_formatters = { } + +local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end + +local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +if O.tsserver.autoformat then + table.insert(auto_formatters, javascript_autoformat) + table.insert(auto_formatters, javascriptreact_autoformat) +end + +local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +if O.lua.autoformat then table.insert(auto_formatters, lua_format) end + +local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'} +if O.json.autoformat then table.insert(auto_formatters, json_format) end + +utils.define_augroups({ + _general_settings = { + {'TextYankPost','*', 'lua require(\'vim.highlight\').on_yank({higroup = \'Search\', timeout = 200})'}, + {'BufWinEnter', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, + {'BufRead', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, + {'BufNewFile', '*', 'setlocal formatoptions-=c formatoptions-=r formatoptions-=o'}, + {'VimLeavePre', '*', 'set title set titleold='} + + -- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'}, + -- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'}, + }, + _dashboard = { + -- seems to be nobuflisted that makes my stuff disapear will do more testing + { + 'FileType', 'dashboard', + 'setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell nolist nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ' + }, {'FileType', 'dashboard', 'set showtabline=0 | autocmd BufLeave <buffer> set showtabline=2'} + }, + _markdown = {{'FileType', 'markdown', 'setlocal wrap'}, {'FileType', 'markdown', 'setlocal spell'}}, + _solidity = { + {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, {'BufRead', '*.sol', 'setlocal filetype=solidity'}, + {'BufNewFile', '*.sol', 'setlocal filetype=solidity'} + }, + _gemini = { + {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'}, + {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'} + }, + _buffer_bindings = { + {'FileType', 'dashboard', 'nnoremap <silent> <buffer> q :q<CR>'}, + {'FileType', 'lspinfo', 'nnoremap <silent> <buffer> q :q<CR>'}, + {'FileType', 'floaterm', 'nnoremap <silent> <buffer> q :q<CR>'}, + }, + _auto_formatters = auto_formatters +}) diff --git a/.config/nvim/lua/_barbar/init.lua b/.config/nvim/lua/_barbar/init.lua new file mode 100644 index 0000000..49c1206 --- /dev/null +++ b/.config/nvim/lua/_barbar/init.lua @@ -0,0 +1,3 @@ +vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '<S-x>', ':BufferClose<CR>', { noremap = true, silent = true }) diff --git a/.config/nvim/lua/_dashboard/init.lua b/.config/nvim/lua/_dashboard/init.lua new file mode 100644 index 0000000..409bc2a --- /dev/null +++ b/.config/nvim/lua/_dashboard/init.lua @@ -0,0 +1,32 @@ +vim.g.dashboard_custom_header = { + ' ##############..... ############## ', + ' ##############......############## ', + ' ##########..........########## ', + ' ##########........########## ', + ' ##########.......########## ', + ' ##########.....##########.. ', + ' ##########....##########..... ', + ' ..##########..##########......... ', + ' ....##########.#########............. ', + ' ..################JJJ............ ', + ' ################............. ', + ' ##############.JJJ.JJJJJJJJJJ ', + ' ############...JJ...JJ..JJ JJ ', + ' ##########....JJ...JJ..JJ JJ ', + ' ########......JJJ..JJJ JJJ JJJ ', + ' ###### ......... ', + ' ..... ', + ' . ', +} + + +vim.g.dashboard_default_executive = 'telescope' + +vim.g.dashboard_custom_section = { + a = {description = {' Find File '}, command = 'Telescope find_files'}, + b = {description = {' Recently Used Files'}, command = 'Telescope oldfiles'}, + c = {description = {' Load Last Session '}, command = 'SessionLoad'}, + d = {description = {' Find Word '}, command = 'Telescope live_grep'}, + e = {description = {' Settings '}, command = ':e ~/.config/nvim/language-settings.lua'} +} + diff --git a/.config/nvim/lua/_emmet/init.lua b/.config/nvim/lua/_emmet/init.lua new file mode 100644 index 0000000..9eafbf6 --- /dev/null +++ b/.config/nvim/lua/_emmet/init.lua @@ -0,0 +1,16 @@ +vim.g.user_emmet_mode='inv' +vim.g.user_emmet_expandabbr_key = '<C-y>,' +vim.g.user_emmet_expandword_key = '<C-y>;' +vim.g.user_emmet_update_tag = '<C-y>u' +vim.g.user_emmet_balancetaginward_key = '<C-y>d' +vim.g.user_emmet_balancetagoutward_key = '<C-y>D' +vim.g.user_emmet_next_key = '<C-y>n' +vim.g.user_emmet_prev_key = '<C-y>N' +vim.g.user_emmet_imagesize_key = '<C-y>i' +vim.g.user_emmet_togglecomment_key = '<C-y>/' +vim.g.user_emmet_splitjointag_key = '<C-y>j' +vim.g.user_emmet_removetag_key = '<C-y>k' +vim.g.user_emmet_anchorizeurl_key = '<C-y>a' +vim.g.user_emmet_anchorizesummary_key = '<C-y>A' +vim.g.user_emmet_mergelines_key = '<C-y>m' +vim.g.user_emmet_codepretty_key = '<C-y>c' diff --git a/.config/nvim/lua/_lspinstall/init.lua b/.config/nvim/lua/_lspinstall/init.lua new file mode 100644 index 0000000..34a9fe6 --- /dev/null +++ b/.config/nvim/lua/_lspinstall/init.lua @@ -0,0 +1,27 @@ +-- 1. get the config for this server from nvim-lspconfig and adjust the cmd path. +-- relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us! +local config = require'lspconfig'.jdtls.document_config +require'lspconfig/configs'.jdtls = nil -- important, unset the loaded config again +-- config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server" + +-- 2. extend the config with an install_script and (optionally) uninstall_script +require'lspinstall/servers'.jdtls = vim.tbl_extend('error', config, { + -- lspinstall will automatically create/delete the install directory for every server + install_script = [[ + git clone https://github.com/eclipse/eclipse.jdt.ls.git + cd eclipse.jdt.ls + ./mvnw clean verify + ]], + uninstall_script = nil -- can be omitted +}) + +require'lspinstall/servers'.kotlin = vim.tbl_extend('error', config, { + install_script = [[ + git clone https://github.com/fwcd/kotlin-language-server.git language-server + cd language-server + ./gradlew :server:installDist + ]], + uninstall_script = nil -- can be omitted +}) + +require'lspinstall'.setup() diff --git a/.config/nvim/lua/globals.lua b/.config/nvim/lua/globals.lua new file mode 100644 index 0000000..a0f291c --- /dev/null +++ b/.config/nvim/lua/globals.lua @@ -0,0 +1,61 @@ +O = { + auto_close_tree = 0, + auto_complete = true, + colorscheme = 'lunar', + hidden_files = true, + wrap_lines = false, + number = true, + relative_number = true, + shell = 'bash', + + -- @usage pass a table with your desired languages + treesitter = { + ensure_installed = "all", + ignore_install = {"haskell"}, + highlight = {enabled = true}, + playground = {enabled = true}, + rainbow = {enabled = false} + }, + database = {save_location = '~/.config/nvim_db', auto_execute = 1}, + python = { + linter = 'flake8', + formatter = 'black', + autoformat = false, + isort = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + dart = {sdk_path = '/usr/lib/dart/bin/snapshots/analysis_server.dart.snapshot'}, + lua = { + -- @usage can be 'lua-format' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + sh = { + -- @usage can be 'shellcheck' + linter = '', + -- @usage can be 'shfmt' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + tsserver = { + -- @usage can be 'eslint' + linter = '', + -- @usage can be 'prettier' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + json = { + -- @usage can be 'prettier' + formatter = '', + autoformat = false, + diagnostics = {virtual_text = true, signs = true, underline = true} + }, + tailwindls = {filetypes = {'html', 'css', 'scss', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact'}}, + clang = {diagnostics = {virtual_text = true, signs = true, underline = true}}, +} + +DATA_PATH = vim.fn.stdpath('data') +CACHE_PATH = vim.fn.stdpath('cache') diff --git a/.config/nvim/lua/lsp/bash-ls.lua b/.config/nvim/lua/lsp/bash-ls.lua new file mode 100644 index 0000000..7b430a6 --- /dev/null +++ b/.config/nvim/lua/lsp/bash-ls.lua @@ -0,0 +1,6 @@ +-- npm i -g bash-language-server +require'lspconfig'.bashls.setup { + cmd = {DATA_PATH .. "/lspinstall/bash/node_modules/.bin/bash-language-server", "start"}, + on_attach = require'lsp'.common_on_attach, + filetypes = { "sh", "zsh" } +} diff --git a/.config/nvim/lua/lsp/clangd.lua b/.config/nvim/lua/lsp/clangd.lua new file mode 100644 index 0000000..dbbda08 --- /dev/null +++ b/.config/nvim/lua/lsp/clangd.lua @@ -0,0 +1,13 @@ +require'lspconfig'.clangd.setup { + cmd = {DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd"}, + on_attach = require'lsp'.common_on_attach, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = O.clang.diagnostics.virtual_text, + signs = O.clang.diagnostics.signs, + underline = O.clang.diagnostics.underline, + update_in_insert = true + + }) + } +} diff --git a/.config/nvim/lua/lsp/docker-ls.lua b/.config/nvim/lua/lsp/docker-ls.lua new file mode 100644 index 0000000..b477a23 --- /dev/null +++ b/.config/nvim/lua/lsp/docker-ls.lua @@ -0,0 +1,6 @@ +-- npm install -g dockerfile-language-server-nodejs +require'lspconfig'.dockerls.setup { + cmd = {DATA_PATH .. "/lspinstall/dockerfile/node_modules/.bin/docker-langserver", "--stdio"}, + on_attach = require'lsp'.common_on_attach, + root_dir = vim.loop.cwd +} diff --git a/.config/nvim/lua/lsp/emmet-ls.lua b/.config/nvim/lua/lsp/emmet-ls.lua new file mode 100644 index 0000000..6531ccf --- /dev/null +++ b/.config/nvim/lua/lsp/emmet-ls.lua @@ -0,0 +1,19 @@ +local nvim_lsp = require'lspconfig' +local configs = require'lspconfig/configs' +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + +configs.emmet_ls = { + default_config = { + cmd = {'emmet-ls', '--stdio'}; + filetypes = {'html', 'css'}; + root_dir = function() + return vim.loop.cwd() + end; + settings = {}; + }; +} + +nvim_lsp.emmet_ls.setup{ + -- on_attach = on_attach; +} diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua new file mode 100644 index 0000000..4488b52 --- /dev/null +++ b/.config/nvim/lua/lsp/init.lua @@ -0,0 +1,103 @@ +-- TODO figure out why this don't work +vim.fn.sign_define( + "LspDiagnosticsSignError", + {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"} +) +vim.fn.sign_define( + "LspDiagnosticsSignWarning", + {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"} +) +vim.fn.sign_define( + "LspDiagnosticsSignHint", + {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"} +) +vim.fn.sign_define( + "LspDiagnosticsSignInformation", + {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"} +) + +vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>") +vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>") +vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>") +vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>") +vim.cmd("nnoremap <silent> ca :Lspsaga code_action<CR>") +vim.cmd("nnoremap <silent> K :Lspsaga hoer_doc<CR>") +-- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>') +vim.cmd("nnoremap <silent> <C-p> :Lspsaga diagnostic_jump_prev<CR>") +vim.cmd("nnoremap <silent> <C-n> :Lspsaga diagnostic_jump_next<CR>") +-- scroll down hover doc or scroll in definition preview +vim.cmd("nnoremap <silent> <C-f> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(1)<CR>") +-- scroll up hover doc +vim.cmd("nnoremap <silent> <C-b> <cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1)<CR>") +vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') + +-- symbols for autocomplete +vim.lsp.protocol.CompletionItemKind = { + " (Text) ", + " (Method)", + " (Function)", + " (Constructor)", + " ﴲ (Field)", + "[] (Variable)", + " (Class)", + " ﰮ (Interface)", + " (Module)", + " 襁 (Property)", + " (Unit)", + " (Value)", + " 練 (Enum)", + " (Keyword)", + " (Snippet)", + " (Color)", + " (File)", + " (Reference)", + " (Folder)", + " (EnumMember)", + " ﲀ (Constant)", + " ﳤ (Struct)", + " (Event)", + " (Operator)", + " (TypeParameter)" +} + +--[[ " autoformat +autocmd BufWritePre *.js lua vim.lsp.buf.formatting_sync(nil, 100) +autocmd BufWritePre *.jsx lua vim.lsp.buf.formatting_sync(nil, 100) +autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 100) ]] +-- Java +-- autocmd FileType java nnoremap ca <Cmd>lua require('jdtls').code_action()<CR> + +local function documentHighlight(client, bufnr) + -- Set autocommands conditional on server_capabilities + if client.resolved_capabilities.document_highlight then + vim.api.nvim_exec( + [[ + hi LspReferenceRead cterm=bold ctermbg=red guibg=#464646 + hi LspReferenceText cterm=bold ctermbg=red guibg=#464646 + hi LspReferenceWrite cterm=bold ctermbg=red guibg=#464646 + augroup lsp_document_highlight + autocmd! * <buffer> + autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() + autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references() + augroup END + ]], + false + ) + end +end +local lsp_config = {} + +function lsp_config.common_on_attach(client, bufnr) + documentHighlight(client, bufnr) +end + +function lsp_config.tsserver_on_attach(client, bufnr) + lsp_config.common_on_attach(client, bufnr) + client.resolved_capabilities.document_formatting = false +end + +-- Use a loop to conveniently both setup defined servers +-- and map buffer local keybindings when the language server attaches +-- local servers = {"pyright", "tsserver"} +-- for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup {on_attach = on_attach} end +return lsp_configv diff --git a/.config/nvim/lua/lsp/json-ls.lua b/.config/nvim/lua/lsp/json-ls.lua new file mode 100644 index 0000000..952673a --- /dev/null +++ b/.config/nvim/lua/lsp/json-ls.lua @@ -0,0 +1,16 @@ +-- npm install -g vscode-json-languageserver +require'lspconfig'.jsonls.setup { + cmd = { + "node", DATA_PATH .. "/lspinstall/json/vscode-json/json-language-features/server/dist/node/jsonServerMain.js", + "--stdio" + }, + on_attach = require'lsp'.common_on_attach, + + commands = { + Format = { + function() + vim.lsp.buf.range_formatting({}, {0, 0}, {vim.fn.line("$"), 0}) + end + } + } +} diff --git a/.config/nvim/lua/lsp/lua-ls.lua b/.config/nvim/lua/lsp/lua-ls.lua new file mode 100644 index 0000000..d640bc4 --- /dev/null +++ b/.config/nvim/lua/lsp/lua-ls.lua @@ -0,0 +1,27 @@ +-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone) +local sumneko_root_path = DATA_PATH .. "/lspinstall/lua" +local sumneko_binary = sumneko_root_path .. "/sumneko-lua-language-server" + +require'lspconfig'.sumneko_lua.setup { + cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, + on_attach = require'lsp'.common_on_attach, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = 'LuaJIT', + -- Setup your lua path + path = vim.split(package.path, ';') + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = {'vim'} + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand($VIMRUNTIME/lua/vim/lsp')] = true}, + maxPreload = 10000 + } + } + } +} diff --git a/.config/nvim/lua/lsp/python-ls.lua b/.config/nvim/lua/lsp/python-ls.lua new file mode 100644 index 0000000..8cc8b22 --- /dev/null +++ b/.config/nvim/lua/lsp/python-ls.lua @@ -0,0 +1,14 @@ +-- npm i -g pyright +require'lspconfig'.pyright.setup { + cmd = {DATA_PATH .. "/lspinstall/python/node_modules/.bin/pyright-langserver", "--stdio"}, + on_attach = require'lsp'.common_on_attach, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + virtual_text = O.python.diagnostics.virtual_text, + signs = O.python.diagnostics.signs, + underline = O.python.diagnostics.underline, + update_in_insert = true + + }) + } +} diff --git a/.config/nvim/lua/lsp/rust-ls.lua b/.config/nvim/lua/lsp/rust-ls.lua new file mode 100644 index 0000000..896c693 --- /dev/null +++ b/.config/nvim/lua/lsp/rust-ls.lua @@ -0,0 +1,4 @@ +require'lspconfig'.rust_analyzer.setup{ + cmd = {DATA_PATH .. "/lspinstall/rust/rust-analyzer"}, + on_attach = require'lsp'.common_on_attach +} diff --git a/.config/nvim/lua/lsp/vim-ls.lua b/.config/nvim/lua/lsp/vim-ls.lua new file mode 100644 index 0000000..39beb11 --- /dev/null +++ b/.config/nvim/lua/lsp/vim-ls.lua @@ -0,0 +1,5 @@ +-- npm install -g vim-language-server +require'lspconfig'.vimls.setup { + cmd = {DATA_PATH .. "/lspinstall/vim/node_modules/.bin/vim-language-server", "--stdio"}, + on_attach = require'lsp'.common_on_attach +} diff --git a/.config/nvim/lua/lsp/yaml-ls.lua b/.config/nvim/lua/lsp/yaml-ls.lua new file mode 100644 index 0000000..3fbc41e --- /dev/null +++ b/.config/nvim/lua/lsp/yaml-ls.lua @@ -0,0 +1,5 @@ +-- npm install -g yaml-language-server +require'lspconfig'.yamlls.setup{ + cmd = {DATA_PATH .. "/lspinstall/yaml/node_modules/.bin/yaml-language-server", "--stdio"}, + on_attach = require'lsp'.common_on_attach, +} diff --git a/.config/nvim/vim-script/functions.vim b/.config/nvim/vim-script/functions.vim new file mode 100644 index 0000000..4739846 --- /dev/null +++ b/.config/nvim/vim-script/functions.vim @@ -0,0 +1,42 @@ +command! LspCodeAction lua require '_utils'.code_action() +command! LspDeclaration lua require '_utils'.declaration() +command! LspDefinition lua require '_utils'.definition() +command! LspDocumentSymbol lua require '_utils'.document_symbol() +command! LspFormatting lua require '_utils'.formatting() +command! LspFormattingSync lua require '_utils'.formatting_sync() +command! LspHover lua require '_utils'.hover() +command! LspImplementation lua require '_utils'.implementation() +command! LspRangeCodeAction lua require '_utils'.range_code_action() +command! LspRangeFormatting lua require '_utils'.range_formatting() +command! LspReferences lua require '_utils'.references() +command! LspRename lua require '_utils'.rename() +command! LspTypeDefinition lua require '_utils'.type_definition() +command! LspWorkspaceSymbol lua require '_utils'.workspace_symbol() +command! LspGotoNext lua require '_utils'.goto_next() +command! LspGotoPrev lua require '_utils'.goto_prev() +command! LspShowLineDianostics lua require '_utils'.show_line_diagnostics() +command! NextHunk lua require '_utils'.next_hunk() +command! PrevHunk lua require '_utils'.prev_hunk() +command! StageHunk lua require '_utils'.stage_hunk() +command! UndoStageHunk lua require '_utils'.undo_stage_hunk() +command! ResetHunk lua require '_utils'.reset_hunk() +command! ResetBuffer lua require '_utils'.reset_buffer() +command! PreviewHunk lua require '_utils'.preview_hunk() +command! BlameLine lua require '_utils'.blame_line() +command! W noa w + +" Debugging +command! DebugToggleBreakpoint lua require'dap'.toggle_breakpoint() +command! DebugStart lua require'dap'.continue() +command! DebugContinue lua require'dap'.continue() +command! DebugStepOver lua require'dap'.step_over() +command! DebugStepOut lua require'dap'.step_out() +command! DebugStepInto lua require'dap'.step_into() +command! DebugToggleRepl lua require'dap'.repl.toggle() +command! DebugGetSession lua require'dap'.session() + +autocmd! User GoyoEnter lua require('gitsigns').toggle_signs() +autocmd! User GoyoLeave lua require('gitsigns').toggle_signs() + +autocmd User GoyoEnter set laststatus=0 +autocmd User GoyoLeave set laststatus=2 |