diff options
Diffstat (limited to '.config/nvim/lua')
-rw-r--r-- | .config/nvim/lua/_bufferline/init.lua | 28 | ||||
-rw-r--r-- | .config/nvim/lua/_comment/init.lua | 4 | ||||
-rw-r--r-- | .config/nvim/lua/_floaterm/init.lua | 13 | ||||
-rw-r--r-- | .config/nvim/lua/_galaxyline/init.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/efm-general-ls.lua | 117 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/init.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/latex-ls.lua | 4 | ||||
-rw-r--r-- | .config/nvim/lua/lsp/lua-ls.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/plugins.lua | 26 |
9 files changed, 139 insertions, 59 deletions
diff --git a/.config/nvim/lua/_bufferline/init.lua b/.config/nvim/lua/_bufferline/init.lua deleted file mode 100644 index c3bd69a..0000000 --- a/.config/nvim/lua/_bufferline/init.lua +++ /dev/null @@ -1,28 +0,0 @@ -require'bufferline'.setup{ - options = { - view = "default", - numbers = "none", - number_style = "superscript", - mappings = false, - buffer_close_icon= '', - modified_icon = '●', - close_icon = '', - left_trunc_marker = '', - right_trunc_marker = '', - max_name_length = 18, - max_prefix_length = 15, -- prefix used when a buffer is deduplicated - tab_size = 18, - diagnostics = "nvim_lsp", - show_buffer_close_icons = false, - show_tab_indicators = true, - persist_buffer_sort = true, -- whether or not custom sorted buffers should persist - -- can also be a table containing 2 custom separators - -- [focused and unfocused]. eg: { '|', '|' } - separator_style = "thin", - enforce_regular_tabs = false, - always_show_bufferline = true, - sort_by = 'relative_directory' - } -} -vim.api.nvim_set_keymap('n', '<TAB>', ':BufferLineCycleNext<CR>', { noremap = true, silent = true }) -vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferLineCyclePrev<CR>', { noremap = true, silent = true }) diff --git a/.config/nvim/lua/_comment/init.lua b/.config/nvim/lua/_comment/init.lua index df79438..8d2ad52 100644 --- a/.config/nvim/lua/_comment/init.lua +++ b/.config/nvim/lua/_comment/init.lua @@ -1,3 +1,3 @@ require('nvim_comment').setup() -vim.api.nvim_set_keymap("n", "<leader>/", ":CommentToggle<CR>", {noremap=true, silent = true}) -vim.api.nvim_set_keymap("v", "<leader>/", ":CommentToggle<CR>", {noremap=true, silent = true}) +vim.api.nvim_set_keymap("n", "gc", ":CommentToggle<CR>", {noremap=true, silent = true}) +vim.api.nvim_set_keymap("v", "gc", ":CommentToggle<CR>", {noremap=true, silent = true}) diff --git a/.config/nvim/lua/_floaterm/init.lua b/.config/nvim/lua/_floaterm/init.lua deleted file mode 100644 index 633df35..0000000 --- a/.config/nvim/lua/_floaterm/init.lua +++ /dev/null @@ -1,13 +0,0 @@ --- Floaterm -vim.g.floaterm_keymap_toggle = '<F1>' -vim.g.floaterm_keymap_next = '<F2>' -vim.g.floaterm_keymap_prev = '<F3>' -vim.g.floaterm_keymap_new = '<F4>' -vim.g.floaterm_title='' - -vim.g.floaterm_gitcommit='floaterm' -vim.g.floaterm_autoinsert=1 -vim.g.floaterm_width=0.8 -vim.g.floaterm_height=0.8 -vim.g.floaterm_wintitle=0 -vim.g.floaterm_autoclose=1 diff --git a/.config/nvim/lua/_galaxyline/init.lua b/.config/nvim/lua/_galaxyline/init.lua index f9ac859..b4a6a20 100644 --- a/.config/nvim/lua/_galaxyline/init.lua +++ b/.config/nvim/lua/_galaxyline/init.lua @@ -3,7 +3,7 @@ local gl = require('galaxyline') -- local colors = require('galaxyline.theme').default local colors = { -- bg = '#2E2E2E', - bg = '#292D38', + bg = '#232731', yellow = '#DCDCAA', dark_yellow = '#D7BA7D', cyan = '#4EC9B0', diff --git a/.config/nvim/lua/lsp/efm-general-ls.lua b/.config/nvim/lua/lsp/efm-general-ls.lua new file mode 100644 index 0000000..16f3037 --- /dev/null +++ b/.config/nvim/lua/lsp/efm-general-ls.lua @@ -0,0 +1,117 @@ +-- Example configuations here: https://github.com/mattn/efm-langserver +-- TODO this file needs to be refactored eache lang should be it's own file +-- python +local python_arguments = {} + +-- TODO replace with path argument +local flake8 = { + LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -", + lintStdin = true, + lintFormats = {"%f:%l:%c: %m"} +} + +local isort = {formatCommand = "isort --quiet -", formatStdin = true} + +local yapf = {formatCommand = "yapf --quiet", formatStdin = true} +local black = {formatCommand = "black --quiet -", formatStdin = true} + +if O.python.linter == 'flake8' then table.insert(python_arguments, flake8) end + +if O.python.isort then table.insert(python_arguments, isort) end + +if O.python.formatter == 'yapf' then + table.insert(python_arguments, yapf) +elseif O.python.formatter == 'black' then + table.insert(python_arguments, black) +end + +-- lua +local lua_arguments = {} + +local luaFormat = { + formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=120", + formatStdin = true +} + +local lua_fmt = { + formatCommand = "luafmt --indent-count 2 --line-width 120 --stdin", + formatStdin = true +} + +if O.lua.formatter == 'lua-format' then + table.insert(lua_arguments, luaFormat) +elseif O.lua.formatter == 'lua-fmt' then + table.insert(lua_arguments, lua_fmt) +end + +-- sh +local sh_arguments = {} + +local shfmt = {formatCommand = 'shfmt -ci -s -bn', formatStdin = true} + +local shellcheck = { + LintCommand = 'shellcheck -f gcc -x', + lintFormats = {'%f:%l:%c: %trror: %m', '%f:%l:%c: %tarning: %m', '%f:%l:%c: %tote: %m'} +} + +if O.sh.formatter == 'shfmt' then table.insert(sh_arguments, shfmt) end + +if O.sh.linter == 'shellcheck' then table.insert(sh_arguments, shellcheck) end + +-- tsserver/web javascript react, vue, json, html, css, yaml +local prettier = {formatCommand = "prettier --stdin-filepath ${INPUT}", formatStdin = true} +-- You can look for project scope Prettier and Eslint with e.g. vim.fn.glob("node_modules/.bin/prettier") etc. If it is not found revert to global Prettier where needed. +-- local prettier = {formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", formatStdin = true} + +local eslint = { + lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}", + lintIgnoreExitCode = true, + lintStdin = true, + lintFormats = {"%f:%l:%c: %m"}, + formatCommand = "./node_modules/.bin/eslint --fix-to-stdout --stdin --stdin-filename=${INPUT}", + formatStdin = true +} + +local tsserver_args = {} + +if O.tsserver.formatter == 'prettier' then table.insert(tsserver_args, prettier) end + +if O.tsserver.linter == 'eslint' then table.insert(tsserver_args, eslint) end + +-- local markdownlint = { +-- -- TODO default to global lintrc +-- -- lintcommand = 'markdownlint -s -c ./markdownlintrc', +-- lintCommand = 'markdownlint -s', +-- lintStdin = true, +-- lintFormats = {'%f:%l %m', '%f:%l:%c %m', '%f: %l: %m'} +-- } + +local markdownPandocFormat = {formatCommand = 'pandoc -f markdown -t gfm -sp --tab-stop=2', formatStdin = true} + +require"lspconfig".efm.setup { + -- init_options = {initializationOptions}, + cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, + init_options = {documentFormatting = true, codeAction = false}, + filetypes = {"lua", "python", "javascriptreact", "javascript", "sh", "html", "css", "json", "yaml", "markdown"}, + settings = { + rootMarkers = {".git/"}, + languages = { + python = python_arguments, + lua = lua_arguments, + sh = sh_arguments, + javascript = tsserver_args, + javascriptreact = tsserver_args, + html = {prettier}, + css = {prettier}, + json = {prettier}, + yaml = {prettier}, + markdown = {markdownPandocFormat} + -- javascriptreact = {prettier, eslint}, + -- javascript = {prettier, eslint}, + -- markdown = {markdownPandocFormat, markdownlint}, + } + } +} + +-- Also find way to toggle format on save +-- maybe this will help: https://superuser.com/questions/439078/how-to-disable-autocmd-or-augroup-in-vim diff --git a/.config/nvim/lua/lsp/init.lua b/.config/nvim/lua/lsp/init.lua index 4488b52..b07858b 100644 --- a/.config/nvim/lua/lsp/init.lua +++ b/.config/nvim/lua/lsp/init.lua @@ -100,4 +100,4 @@ end -- 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 +return lsp_config diff --git a/.config/nvim/lua/lsp/latex-ls.lua b/.config/nvim/lua/lsp/latex-ls.lua new file mode 100644 index 0000000..179c143 --- /dev/null +++ b/.config/nvim/lua/lsp/latex-ls.lua @@ -0,0 +1,4 @@ +require'lspconfig'.texlab.setup{ + cmd = {DATA_PATH .. "/lspinstall/latex/texlab"}, + on_attach = require'lsp'.common_on_attach +} diff --git a/.config/nvim/lua/lsp/lua-ls.lua b/.config/nvim/lua/lsp/lua-ls.lua index d640bc4..775eb92 100644 --- a/.config/nvim/lua/lsp/lua-ls.lua +++ b/.config/nvim/lua/lsp/lua-ls.lua @@ -19,7 +19,7 @@ require'lspconfig'.sumneko_lua.setup { }, workspace = { -- Make the server aware of Neovim runtime files - library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand($VIMRUNTIME/lua/vim/lsp')] = true}, + library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true}, maxPreload = 10000 } } diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 4ff26c7..6335c26 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -91,19 +91,19 @@ return require("packer").startup( use 'gennaro-tedesco/nvim-peekup' -- General Plugins - use 'turbio/bracey.vim' - use 'unblevable/quick-scope' - use 'airblade/vim-rooter' - use 'moll/vim-bbye' - use 'alvan/vim-closetag' - use 'voldikss/vim-floaterm' - use 'AndrewRadev/tagalong.vim' - use 'bfredl/nvim-miniyank' - use 'andymass/vim-matchup' - use 'phaazon/hop.nvim' - use 'junegunn/goyo.vim' - use 'vimwiki/vimwiki' - use {'heavenshell/vim-pydocstring', run = 'make install'} + -- use 'turbio/bracey.vim' + -- use 'unblevable/quick-scope' + -- use 'airblade/vim-rooter' + -- use 'moll/vim-bbye' + -- use 'alvan/vim-closetag' + -- use 'voldikss/vim-floaterm' + -- use 'AndrewRadev/tagalong.vim' + -- use 'bfredl/nvim-miniyank' + -- use 'andymass/vim-matchup' + -- use 'phaazon/hop.nvim' + -- use 'junegunn/goyo.vim' + -- use 'vimwiki/vimwiki' + -- use {'heavenshell/vim-pydocstring', run = 'make install'} require_plugin("nvim-lspconfig") require_plugin("lspsaga.nvim") |