diff options
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/ftplugin/c.vim | 1 | ||||
| -rw-r--r-- | nvim/plugins.vim | 124 |
2 files changed, 111 insertions, 14 deletions
diff --git a/nvim/ftplugin/c.vim b/nvim/ftplugin/c.vim index fd45dbd..3fc55eb 100644 --- a/nvim/ftplugin/c.vim +++ b/nvim/ftplugin/c.vim | |||
| @@ -2,6 +2,7 @@ setlocal cinoptions=:0,p0,t0 | |||
| 2 | setlocal cinwords=if,else,while,do,for,switch,case | 2 | setlocal cinwords=if,else,while,do,for,switch,case |
| 3 | setlocal formatoptions=tcqr | 3 | setlocal formatoptions=tcqr |
| 4 | setlocal cindent | 4 | setlocal cindent |
| 5 | setlocal indentexpr=nvim_treesitter#indent() | ||
| 5 | 6 | ||
| 6 | setlocal foldenable | 7 | setlocal foldenable |
| 7 | setlocal foldmethod=expr | 8 | setlocal foldmethod=expr |
diff --git a/nvim/plugins.vim b/nvim/plugins.vim index 6c84a23..4e8d45c 100644 --- a/nvim/plugins.vim +++ b/nvim/plugins.vim | |||
| @@ -18,6 +18,12 @@ call plug#begin() | |||
| 18 | Plug 'neovim/nvim-lspconfig' | 18 | Plug 'neovim/nvim-lspconfig' |
| 19 | Plug 'windwp/nvim-autopairs' | 19 | Plug 'windwp/nvim-autopairs' |
| 20 | Plug 'windwp/nvim-ts-autotag' | 20 | Plug 'windwp/nvim-ts-autotag' |
| 21 | |||
| 22 | Plug 'hrsh7th/cmp-nvim-lsp' | ||
| 23 | Plug 'hrsh7th/cmp-buffer' | ||
| 24 | Plug 'hrsh7th/cmp-path' | ||
| 25 | Plug 'hrsh7th/cmp-cmdline' | ||
| 26 | Plug 'hrsh7th/nvim-cmp' | ||
| 21 | call plug#end() | 27 | call plug#end() |
| 22 | 28 | ||
| 23 | " EMMET | 29 | " EMMET |
| @@ -55,7 +61,7 @@ let g:AutoPairsPrefix='<M-P>' | |||
| 55 | " Treesitter | 61 | " Treesitter |
| 56 | lua << EOF | 62 | lua << EOF |
| 57 | require'nvim-treesitter.configs'.setup { | 63 | require'nvim-treesitter.configs'.setup { |
| 58 | ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "typescript" }, | 64 | ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "typescript", "python" }, |
| 59 | sync_install = false, | 65 | sync_install = false, |
| 60 | auto_install = false, | 66 | auto_install = false, |
| 61 | highlight = { | 67 | highlight = { |
| @@ -77,28 +83,118 @@ EOF | |||
| 77 | " LSP | 83 | " LSP |
| 78 | lua << EOF | 84 | lua << EOF |
| 79 | local lspconfig = require'lspconfig' | 85 | local lspconfig = require'lspconfig' |
| 80 | lspconfig.clangd.setup { | 86 | |
| 87 | lspconfig.clangd.setup{ | ||
| 81 | cmd = { 'clangd15' } | 88 | cmd = { 'clangd15' } |
| 82 | } | 89 | } |
| 83 | lspconfig.lua_ls.setup {} | 90 | |
| 84 | lspconfig.pyright.setup {} | 91 | lspconfig.lua_ls.setup { |
| 85 | lspconfig.pylsp.setup{ | 92 | settings = { |
| 93 | Lua = { | ||
| 94 | runtime = { | ||
| 95 | -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) | ||
| 96 | version = 'LuaJIT', | ||
| 97 | }, | ||
| 98 | diagnostics = { | ||
| 99 | -- Get the language server to recognize the `vim` global | ||
| 100 | globals = {'vim'}, | ||
| 101 | }, | ||
| 102 | workspace = { | ||
| 103 | -- Make the server aware of Neovim runtime files | ||
| 104 | library = vim.api.nvim_get_runtime_file("", true), | ||
| 105 | }, | ||
| 106 | -- Do not send telemetry data containing a randomized but unique identifier | ||
| 107 | telemetry = { | ||
| 108 | enable = false, | ||
| 109 | }, | ||
| 110 | }, | ||
| 111 | }, | ||
| 112 | } | ||
| 113 | |||
| 114 | lspconfig.pyright.setup{ | ||
| 86 | settings = { | 115 | settings = { |
| 87 | pylsp = { | 116 | python = { |
| 88 | plugins = { | 117 | analysis = { |
| 89 | pycodestyle = { | 118 | autoSearchPaths = true, |
| 90 | ignore = {'W391'}, | 119 | diagnosticMode = "workspace", |
| 91 | maxLineLength = 100 | 120 | useLibraryCodeForTypes = true |
| 92 | } | ||
| 93 | } | 121 | } |
| 94 | } | 122 | } |
| 95 | } | 123 | } |
| 96 | } | 124 | } |
| 97 | lspconfig.tsserver.setup {} | 125 | |
| 98 | lspconfig.vimls.setup {} | 126 | lspconfig.tsserver.setup{} |
| 99 | lspconfig.rust_analyzer.setup { | 127 | |
| 128 | lspconfig.vimls.setup{} | ||
| 129 | |||
| 130 | lspconfig.rust_analyzer.setup{ | ||
| 100 | settings = { | 131 | settings = { |
| 101 | ['rust-analyzer'] = {}, | 132 | ['rust-analyzer'] = {}, |
| 102 | }, | 133 | }, |
| 103 | } | 134 | } |
| 104 | EOF | 135 | EOF |
| 136 | |||
| 137 | " Completion | ||
| 138 | lua <<EOF | ||
| 139 | -- Set up nvim-cmp. | ||
| 140 | local cmp = require'cmp' | ||
| 141 | |||
| 142 | cmp.setup({ | ||
| 143 | snippet = { | ||
| 144 | -- REQUIRED - you must specify a snippet engine | ||
| 145 | expand = function(args) | ||
| 146 | -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. | ||
| 147 | -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users. | ||
| 148 | -- require('snippy').expand_snippet(args.body) -- For `snippy` users. | ||
| 149 | -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. | ||
| 150 | end, | ||
| 151 | }, | ||
| 152 | window = { | ||
| 153 | -- completion = cmp.config.window.bordered(), | ||
| 154 | -- documentation = cmp.config.window.bordered(), | ||
| 155 | }, | ||
| 156 | mapping = cmp.mapping.preset.insert({ | ||
| 157 | ['<C-b>'] = cmp.mapping.scroll_docs(-4), | ||
| 158 | ['<C-f>'] = cmp.mapping.scroll_docs(4), | ||
| 159 | ['<C-Space>'] = cmp.mapping.complete(), | ||
| 160 | ['<C-e>'] = cmp.mapping.abort(), | ||
| 161 | ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. | ||
| 162 | }), | ||
| 163 | sources = cmp.config.sources({ | ||
| 164 | { name = 'nvim_lsp' }, | ||
| 165 | -- { name = 'vsnip' }, -- For vsnip users. | ||
| 166 | -- { name = 'luasnip' }, -- For luasnip users. | ||
| 167 | -- { name = 'ultisnips' }, -- For ultisnips users. | ||
| 168 | -- { name = 'snippy' }, -- For snippy users. | ||
| 169 | }, { | ||
| 170 | { name = 'buffer' }, | ||
| 171 | }) | ||
| 172 | }) | ||
| 173 | |||
| 174 | -- Set configuration for specific filetype. | ||
| 175 | --cmp.setup.filetype('gitcommit', { | ||
| 176 | -- sources = cmp.config.sources({ | ||
| 177 | -- { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). | ||
| 178 | -- }, { | ||
| 179 | -- { name = 'buffer' }, | ||
| 180 | -- }) | ||
| 181 | --}) | ||
| 182 | |||
| 183 | -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). | ||
| 184 | --cmp.setup.cmdline({ '/', '?' }, { | ||
| 185 | -- mapping = cmp.mapping.preset.cmdline(), | ||
| 186 | -- sources = { | ||
| 187 | -- { name = 'buffer' } | ||
| 188 | -- } | ||
| 189 | --}) | ||
| 190 | |||
| 191 | -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). | ||
| 192 | --cmp.setup.cmdline(':', { | ||
| 193 | -- mapping = cmp.mapping.preset.cmdline(), | ||
| 194 | -- sources = cmp.config.sources({ | ||
| 195 | -- { name = 'path' } | ||
| 196 | -- }, { | ||
| 197 | -- { name = 'cmdline' } | ||
| 198 | -- }) | ||
| 199 | --}) | ||
| 200 | EOF | ||
