diff options
| -rw-r--r-- | README.md | 51 | ||||
| -rw-r--r-- | init.lua | 1 | ||||
| -rw-r--r-- | lua/lsp/efm-general-ls.lua | 78 | ||||
| -rw-r--r-- | lua/lsp/init.lua | 45 | ||||
| -rw-r--r-- | lua/lsp/js-ts-ls.lua | 7 | ||||
| -rw-r--r-- | lua/nv-galaxyline/init.lua | 2 | ||||
| -rw-r--r-- | lua/nv-nvim-autopairs/init.lua | 1 | ||||
| -rw-r--r-- | lua/nv-treesitter/init.lua | 30 | ||||
| -rw-r--r-- | lua/plugins.lua | 1 | 
9 files changed, 123 insertions, 93 deletions
| @@ -26,20 +26,24 @@ sudo rm -r neovim  ## VSCode support -After installing the Neovim extension in VSCode +After installing the [Neovim extension](https://github.com/asvetliakov/vscode-neovim) in VSCode + +I recommend using this alongside the VSCode which-key extension + +Along with some of my config files you can find in utils/vscode_config  Point the nvim path to your `nvim` binary -Point your `init.vim` path to: +Point your `init.lua` path to:  ```vim -$HOME/.config/nvim/lua/nv-vscode/init.vim +$HOME/.config/nvim/lua/nv-vscode/init.lua  ```  or if you are using this config alongside your own:  ```vim -$HOME/.config/nvim/lua/nv-vscode/init.vim +$HOME/.config/nvim/lua/nv-vscode/init.lua  ```  ## efm server is slow on close @@ -50,6 +54,44 @@ Install the latest with:  go get github.com/mattn/efm-langserver@HEAD  ``` +## Useful Programs + +``` +ranger +ueberzug +fd +ripgrep +jq +fzf +lazygit +lazydocker +ncdu +``` + +**Python** + +``` +pyright +flake8 +yapf +``` + +**Lua** + +``` +ninja +lua-format +sumneko-lua +``` + +## Vim Gists + +To use vim-gists you will need to configure the following: + +``` +git config --global github.user <username> +``` +  ## TODO  **HIGH PRIORITY** @@ -62,6 +104,7 @@ go get github.com/mattn/efm-langserver@HEAD  - for vsnip :h vim-vsnip, also figure out what integr does  **LOW PRIORITY** +- add utf8 line col and spaces (maybe blame)  - potentially switch to dashboard  - make java code actions prettier  - figure out how to customize java formatting @@ -1,6 +1,7 @@  if vim.g.vscode then    vim.cmd('source ~/.config/nvim/vimscript/nv-vscode/init.vim')    require('settings') +  require('nv-quickscope')  else    -- General mappings    require('plugins') diff --git a/lua/lsp/efm-general-ls.lua b/lua/lsp/efm-general-ls.lua index 53327415..d771d898 100644 --- a/lua/lsp/efm-general-ls.lua +++ b/lua/lsp/efm-general-ls.lua @@ -1,25 +1,40 @@  -- Example configuations here: https://github.com/mattn/efm-langserver +-- python +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} +-- lua +local luaFormat = { +    formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=120", +    formatStdin = true +} +-- JavaScript/React/TypeScript +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 +} +  require"lspconfig".efm.setup { -    init_options = {documentFormatting = true}, -    filetypes = {"lua", "python"}, +    -- init_options = {initializationOptions}, +    init_options = {documentFormatting = true, codeAction = false}, +    filetypes = {"lua", "python", "javascriptreact", "javascript"},      settings = {          rootMarkers = {".git/"},          languages = { -            lua = { -                { -                    formatCommand = "lua-format -i --no-keep-simple-function-one-line --column-limit=100", -                    formatStdin = true -                } -            }, -            python = { -                { -                    LintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -", -                    lintStdin = true, -                    lintFormats = {"%f:%l:%c: %m"}, -                    formatCommand = "yapf --quiet", -                    formatStdin = true -                } -            } +            lua = {luaFormat}, +            python = {isort, yapf}, +            javascriptreact = {prettier, eslint}, +            javascript = {prettier, eslint}          }      }  } @@ -28,32 +43,3 @@ require"lspconfig".efm.setup {  -- TODO also shellcheck and shell formatting  -- 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 --- { ---   lintCommand = "eslint_d -f unix --stdin --stdin-filename ${INPUT}", ---   lintIgnoreExitCode = true, ---   lintStdin = true, ---   lintFormats = {"%f:%l:%c: %m"}, --- } - - --- local eslint = { ---   lintCommand = './node_modules/.bin/eslint -f compact --stdin', ---   lintStdin = true, ---   lintFormats = {'%f: line %l, col %c, %trror - %m', '%f: line %l, col %c, %tarning - %m'}, ---   lintIgnoreExitCode = true, ---   formatCommand = './node_modules/.bin/prettier-eslint --stdin --single-quote --print-width 120', ---   formatStdin = true, --- } --- --- nvim_lsp.efm.setup({ ---     init_options = { documentFormatting = true }, ---     root_dir = nvim_lsp.util.root_pattern('.git/'), ---     filetypes = {'javascript', 'javascriptreact'}, ---     settings = { ---       rootMarkers = {'.git/'}, ---       languages = { ---         javascript = {eslint}, ---         javascriptreact = {eslint}, ---       } ---     } --- }) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 12ce36a1..9a1bb511 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -1,24 +1,12 @@  -- 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("LspDiagnosticsSignInformation", { -    texthl = "LspDiagnosticsSignInformation", -    text = "", -    numhl = "LspDiagnosticsSignInformation" -}) -vim.fn.sign_define("LspDiagnosticsSignHint", { -    texthl = "LspDiagnosticsSignHint", -    text = "", -    numhl = "LspDiagnosticsSignHint" -}) +vim.fn.sign_define("LspDiagnosticsSignError", +                   {texthl = "LspDiagnosticsSignError", text = "", numhl = "LspDiagnosticsSignError"}) +vim.fn.sign_define("LspDiagnosticsSignWarning", +                   {texthl = "LspDiagnosticsSignWarning", text = "", numhl = "LspDiagnosticsSignWarning"}) +vim.fn.sign_define("LspDiagnosticsSignInformation", +                   {texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation"}) +vim.fn.sign_define("LspDiagnosticsSignHint", +                   {texthl = "LspDiagnosticsSignHint", text = "", numhl = "LspDiagnosticsSignHint"})  vim.cmd('nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>')  vim.cmd('nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>') @@ -42,10 +30,7 @@ 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 lsp_config = {} - -function lsp_config.common_on_attach(client, bufnr) - +local function documentHighlight(client, bufnr)      -- Set autocommands conditional on server_capabilities      if client.resolved_capabilities.document_highlight then          vim.api.nvim_exec([[ @@ -58,7 +43,19 @@ function lsp_config.common_on_attach(client, bufnr)          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 diff --git a/lua/lsp/js-ts-ls.lua b/lua/lsp/js-ts-ls.lua index 0c4a02e3..a0bd7a88 100644 --- a/lua/lsp/js-ts-ls.lua +++ b/lua/lsp/js-ts-ls.lua @@ -7,4 +7,9 @@  -- require'completion'.on_attach(client)  -- require'illuminate'.on_attach(client)  -- end -require'lspconfig'.tsserver.setup {on_attach = require'lsp'.common_on_attach} +require'lspconfig'.tsserver.setup { +    on_attach = require'lsp'.tsserver_on_attach, +    -- This makes sure tsserver is not used for formatting (I prefer prettier) +    -- on_attach = require'lsp'.common_on_attach, +    settings = {documentFormatting = false} +} diff --git a/lua/nv-galaxyline/init.lua b/lua/nv-galaxyline/init.lua index ed9c9e53..c5943e6c 100644 --- a/lua/nv-galaxyline/init.lua +++ b/lua/nv-galaxyline/init.lua @@ -55,6 +55,8 @@ gls.left[1] = {          highlight = {colors.red, colors.bg, 'bold'}      }  } +print(vim.fn.getbufvar(0,'ts')) +vim.fn.getbufvar(0,'ts')  gls.left[2] = {      GitIcon = { diff --git a/lua/nv-nvim-autopairs/init.lua b/lua/nv-nvim-autopairs/init.lua index 6810a774..a4212b1e 100644 --- a/lua/nv-nvim-autopairs/init.lua +++ b/lua/nv-nvim-autopairs/init.lua @@ -7,6 +7,7 @@ local pairs_map = {      ['['] = ']',      ['{'] = '}',      ['`'] = '`', +    ['```'] = '```',  }  local disable_filetype = { "TelescopePrompt" }  local break_line_filetype = nil -- mean all file type diff --git a/lua/nv-treesitter/init.lua b/lua/nv-treesitter/init.lua index c7cd25d4..886dcad8 100644 --- a/lua/nv-treesitter/init.lua +++ b/lua/nv-treesitter/init.lua @@ -1,21 +1,15 @@  require'nvim-treesitter.configs'.setup { -  ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages -  highlight = { -    enable = true,              -- false will disable the whole extension -  }, -  playground = { -    enable = true, -    disable = {}, -    updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code -    persist_queries = false -- Whether the query persists across vim sessions -  }, -  rainbow = { -    enable = false -  }, -  refactor = { -      highlight_definitions = { -        enable = false -      } -   } +    ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages +    highlight = { +        enable = true -- false will disable the whole extension +    }, +    playground = { +        enable = true, +        disable = {}, +        updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code +        persist_queries = false -- Whether the query persists across vim sessions +    }, +    rainbow = {enable = false}, +    -- refactor = {highlight_definitions = {enable = true}}  } diff --git a/lua/plugins.lua b/lua/plugins.lua index a528903f..c62867c5 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -48,6 +48,7 @@ return require('packer').startup(function(use)      -- Treesitter      use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} +    use 'nvim-treesitter/nvim-treesitter-refactor'      use 'nvim-treesitter/playground'      use 'p00f/nvim-ts-rainbow' | 
