diff options
| author | Max Christian Pohle | 2024-08-29 14:54:43 +0200 |
|---|---|---|
| committer | Max Christian Pohle | 2024-08-29 14:54:43 +0200 |
| commit | 7172c36d4508510ad844fcbea1bd3bc496da809e (patch) | |
| tree | 9a94b4ff19c19e96f7faf9810a59a18b8e08e364 | |
| parent | 35ba5a3b68e334ea8dc2760536d16f50f2868faa (diff) | |
| download | vim-7172c36d4508510ad844fcbea1bd3bc496da809e.tar.bz2 vim-7172c36d4508510ad844fcbea1bd3bc496da809e.zip | |
improved config by splitting it.
| -rw-r--r-- | init.lua | 185 | ||||
| -rw-r--r-- | lua/plugins/cmp.lua | 11 | ||||
| -rw-r--r-- | lua/plugins/colorscheme.lua | 6 | ||||
| -rw-r--r-- | lua/plugins/fzf.lua | 4 | ||||
| -rw-r--r-- | lua/plugins/orgmode.lua | 17 | ||||
| -rw-r--r-- | lua/plugins/telescope.lua | 4 |
6 files changed, 119 insertions, 108 deletions
| @@ -13,33 +13,22 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then | |||
| 13 | }) | 13 | }) |
| 14 | end | 14 | end |
| 15 | vim.opt.rtp:prepend(lazypath) | 15 | vim.opt.rtp:prepend(lazypath) |
| 16 | |||
| 16 | require("lazy").setup({ | 17 | require("lazy").setup({ |
| 17 | 'junegunn/fzf', | 18 | spec = { |
| 18 | 'junegunn/fzf.vim', | 19 | { import = "plugins", }, |
| 19 | 'nvim-tree/nvim-web-devicons', | 20 | 'nvim-tree/nvim-web-devicons', |
| 20 | 'lewis6991/gitsigns.nvim', | 21 | 'lewis6991/gitsigns.nvim', |
| 21 | 'folke/neodev.nvim', | 22 | 'folke/neodev.nvim', |
| 22 | 'neovim/nvim-lspconfig', | ||
| 23 | 'hrsh7th/cmp-nvim-lsp', | ||
| 24 | 'hrsh7th/cmp-buffer', | ||
| 25 | 'hrsh7th/cmp-path', | ||
| 26 | 'hrsh7th/cmp-cmdline', | ||
| 27 | 'hrsh7th/nvim-cmp', | ||
| 28 | 'hrsh7th/vim-vsnip', | ||
| 29 | 'octaltree/cmp-look', | ||
| 30 | 'L3MON4D3/LuaSnip', | ||
| 31 | 'saadparwaiz1/cmp_luasnip', | ||
| 32 | 'RRethy/base16-nvim', | ||
| 33 | -- treesitter is experimental and breaks indentation on xml, html with `=` | 23 | -- treesitter is experimental and breaks indentation on xml, html with `=` |
| 34 | -- 'nvim-treesitter/nvim-treesitter', | 24 | 'nvim-treesitter/nvim-treesitter', |
| 35 | 'nvim-lua/popup.nvim', | 25 | 'nvim-lua/popup.nvim', |
| 36 | 'nvim-lua/plenary.nvim', | 26 | 'nvim-lua/plenary.nvim', |
| 37 | 'nvim-telescope/telescope.nvim', | ||
| 38 | 'nvim-telescope/telescope-media-files.nvim', | ||
| 39 | 'coderonline/vim-fancy-line', | 27 | 'coderonline/vim-fancy-line', |
| 40 | 'coderonline/vim-recently-used', | 28 | 'coderonline/vim-recently-used', |
| 41 | 'norcalli/nvim-colorizer.lua', | 29 | 'norcalli/nvim-colorizer.lua', |
| 42 | 'folke/trouble.nvim', | 30 | 'folke/trouble.nvim', |
| 31 | } | ||
| 43 | }) | 32 | }) |
| 44 | 33 | ||
| 45 | -------------------------------------------------------------------------------- | 34 | -------------------------------------------------------------------------------- |
| @@ -47,7 +36,7 @@ require("lazy").setup({ | |||
| 47 | -------------------------------------------------------------------------------- | 36 | -------------------------------------------------------------------------------- |
| 48 | local configdir = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":p:h") | 37 | local configdir = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":p:h") |
| 49 | vim.cmd('source ' .. configdir .. '/vimrc') | 38 | vim.cmd('source ' .. configdir .. '/vimrc') |
| 50 | vim.cmd.colorscheme "base16-rebecca" | 39 | -- vim.cmd.colorscheme "base16-rebecca" |
| 51 | -- vim.cmd.colorscheme "base16-katy" | 40 | -- vim.cmd.colorscheme "base16-katy" |
| 52 | 41 | ||
| 53 | vim.opt.encoding = 'utf-8' | 42 | vim.opt.encoding = 'utf-8' |
| @@ -184,102 +173,82 @@ cmp.setup({ | |||
| 184 | }) | 173 | }) |
| 185 | }) | 174 | }) |
| 186 | 175 | ||
| 187 | -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). | ||
| 188 | cmp.setup.cmdline({ '/', '?' }, { | ||
| 189 | mapping = cmp.mapping.preset.cmdline({ | ||
| 190 | ['<Down>'] = { c = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }) }, | ||
| 191 | ['<Up>'] = { c = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) }, | ||
| 192 | }), | ||
| 193 | sources = {{ name = 'buffer' }} | ||
| 194 | }) | ||
| 195 | |||
| 196 | -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). | ||
| 197 | cmp.setup.cmdline(':', { | ||
| 198 | mapping = cmp.mapping.preset.cmdline({ | ||
| 199 | ['<Down>'] = { c = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }) }, | ||
| 200 | ['<Up>'] = { c = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) }, | ||
| 201 | }), | ||
| 202 | sources = cmp.config.sources( | ||
| 203 | {{ name = 'path' }}, | ||
| 204 | {{ name = 'cmdline' }} | ||
| 205 | ), | ||
| 206 | matching = { | ||
| 207 | disallow_symbol_nonprefix_matching = false, | ||
| 208 | disallow_partial_matching = false, | ||
| 209 | disallow_fullfuzzy_matching = false, | ||
| 210 | disallow_fuzzy_matching = false, | ||
| 211 | disallow_partial_fuzzy_matching = false, | ||
| 212 | disallow_prefix_unmatching = false, | ||
| 213 | } | ||
| 214 | }) | ||
| 215 | |||
| 216 | -- Set up lspconfig. | 176 | -- Set up lspconfig. |
| 217 | local capabilities = require('cmp_nvim_lsp').default_capabilities() | 177 | local cmp_nvim_lsp = require "cmp_nvim_lsp" |
| 178 | |||
| 179 | require("lspconfig").clangd.setup { | ||
| 180 | on_attach = on_attach, | ||
| 181 | capabilities = cmp_nvim_lsp.default_capabilities(), | ||
| 182 | cmd = { | ||
| 183 | "clangd", | ||
| 184 | "--offset-encoding=utf-16", | ||
| 185 | }, | ||
| 186 | } | ||
| 187 | -- local capabilities = require('cmp_nvim_lsp').default_capabilities() | ||
| 218 | 188 | ||
| 219 | -- # Language Servers | 189 | -- # Language Servers |
| 220 | -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md | 190 | -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md |
| 221 | 191 | ||
| 222 | -- C/C++ | clang | 192 | -- C/C++ | clang |
| 223 | require('lspconfig')['bitbake_language_server'].setup{capabilities = capabilities} | 193 | -- require('lspconfig')['bitbake_language_server'].setup{} |
| 224 | require('lspconfig')['clangd'].setup{capabilities = capabilities} | 194 | -- require('lspconfig')['clangd'].setup{} |
| 225 | -- lua (but not init.lua entirely, hence why neodev) | 195 | -- -- lua (but not init.lua entirely, hence why neodev) |
| 226 | require('lspconfig')['lua_ls'].setup { capabilities = capabilities } | 196 | -- require('lspconfig')['lua_ls'].setup { } |
| 227 | -- require('lspconfig')['java_language_server'].setup{ cmd = { "/usr/share/java/java-language-server/lang_server_linux.sh" }, root_dir = function () return vim.fn.getcwd() end } | 197 | -- -- require('lspconfig')['java_language_server'].setup{ cmd = { "/usr/share/java/java-language-server/lang_server_linux.sh" }, root_dir = function () return vim.fn.getcwd() end } |
| 228 | require'lspconfig'.jdtls.setup{} | 198 | -- require'lspconfig'.jdtls.setup{} |
| 229 | -- bash | bash-language-server | 199 | -- -- bash | bash-language-server |
| 230 | require('lspconfig')['bashls'].setup{capabilities = capabilities} | 200 | -- require('lspconfig')['bashls'].setup{} |
| 231 | -- ccs | vscode-css-languageserver | 201 | -- -- ccs | vscode-css-languageserver |
| 232 | require('lspconfig')['cssls'].setup{capabilities = capabilities} | 202 | -- require('lspconfig')['cssls'].setup{} |
| 233 | -- rust | rust-analyzer | 203 | -- -- rust | rust-analyzer |
| 234 | require('lspconfig')['rust_analyzer'].setup{capabilities = capabilities} | 204 | -- require('lspconfig')['rust_analyzer'].setup{} |
| 235 | -- javascript | eslint | 205 | -- -- javascript | eslint |
| 236 | require('lspconfig')['eslint'].setup{capabilities = capabilities} | 206 | -- require('lspconfig')['eslint'].setup{} |
| 237 | -- javascript | typescript-language-server | 207 | -- -- javascript | typescript-language-server |
| 238 | require('lspconfig')['tsserver'].setup{capabilities = capabilities} | 208 | -- require('lspconfig')['tsserver'].setup{} |
| 239 | -- vimscript | vim-language-server | 209 | -- -- vimscript | vim-language-server |
| 240 | require('lspconfig')['vimls'].setup{capabilities = capabilities} | 210 | -- require('lspconfig')['vimls'].setup{} |
| 241 | -- html | 211 | -- -- html |
| 242 | require('lspconfig')['html'].setup{capabilities = capabilities} | 212 | -- require('lspconfig')['html'].setup{} |
| 243 | -- jsonls | 213 | -- -- jsonls |
| 244 | require('lspconfig')['jsonls'].setup{capabilities = capabilities} | 214 | -- require('lspconfig')['jsonls'].setup{} |
| 245 | -- C/C++ | clang | 215 | -- -- C/C++ | clang |
| 246 | require('lspconfig')['clangd'].setup{capabilities = capabilities} | 216 | -- require('lspconfig')['clangd'].setup{} |
| 247 | -- bash | bash-language-server | 217 | -- -- bash | bash-language-server |
| 248 | require('lspconfig')['bashls'].setup{capabilities = capabilities} | 218 | -- require('lspconfig')['bashls'].setup{} |
| 249 | -- ccs | vscode-css-languageserver | 219 | -- -- ccs | vscode-css-languageserver |
| 250 | require('lspconfig')['cssls'].setup{capabilities = capabilities} | 220 | -- require('lspconfig')['cssls'].setup{} |
| 251 | -- rust | rust-analyzer | 221 | -- -- rust | rust-analyzer |
| 252 | require('lspconfig')['rust_analyzer'].setup{capabilities = capabilities} | 222 | -- require('lspconfig')['rust_analyzer'].setup{} |
| 253 | -- javascript | eslint | 223 | -- -- javascript | eslint |
| 254 | require('lspconfig')['eslint'].setup{capabilities = capabilities} | 224 | -- require('lspconfig')['eslint'].setup{} |
| 255 | -- javascript | typescript-language-server | 225 | -- -- javascript | typescript-language-server |
| 256 | require('lspconfig')['tsserver'].setup{capabilities = capabilities} | 226 | -- require('lspconfig')['tsserver'].setup{} |
| 257 | -- vimscript | vim-language-server | 227 | -- -- vimscript | vim-language-server |
| 258 | require('lspconfig')['vimls'].setup{capabilities = capabilities} | 228 | -- require('lspconfig')['vimls'].setup{} |
| 259 | -- configure html server | 229 | -- -- configure html server |
| 260 | require('lspconfig')["html"].setup({ | 230 | -- require('lspconfig')["html"].setup({ |
| 261 | capabilities = capabilities, | 231 | -- -- on_attach = on_attach, |
| 262 | -- on_attach = on_attach, | 232 | -- init_options = { |
| 263 | init_options = { | 233 | -- configurationSection = { "html", "css", "javascript" }, |
| 264 | configurationSection = { "html", "css", "javascript" }, | 234 | -- embeddedLanguages = { |
| 265 | embeddedLanguages = { | 235 | -- css = true, |
| 266 | css = true, | 236 | -- javascript = true, |
| 267 | javascript = true, | 237 | -- }, |
| 268 | }, | 238 | -- provideFormatter = true, |
| 269 | provideFormatter = true, | 239 | -- }, |
| 270 | }, | 240 | -- }) |
| 271 | }) | 241 | -- require('lspconfig')['pylsp'].setup{ |
| 272 | require('lspconfig')['pylsp'].setup{ | 242 | -- settings = { |
| 273 | settings = { | 243 | -- pylsp = { |
| 274 | pylsp = { | 244 | -- plugins = { |
| 275 | plugins = { | 245 | -- pycodestyle = { |
| 276 | pycodestyle = { | 246 | -- ignore = {'W391'}, |
| 277 | ignore = {'W391'}, | 247 | -- maxLineLength = 100 |
| 278 | maxLineLength = 100 | 248 | -- } |
| 279 | } | 249 | -- } |
| 280 | } | 250 | -- } |
| 281 | } | 251 | -- } |
| 282 | } | 252 | -- } |
| 283 | } | ||
| 284 | 253 | ||
| 285 | -- vim: tabstop=2 shiftwidth=2 softtabstop=2 | 254 | -- vim: tabstop=2 shiftwidth=2 softtabstop=2 |
diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..fed96e4 --- /dev/null +++ b/lua/plugins/cmp.lua | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | return { | ||
| 2 | 'neovim/nvim-lspconfig', | ||
| 3 | 'hrsh7th/cmp-nvim-lsp', | ||
| 4 | 'hrsh7th/cmp-buffer', | ||
| 5 | 'hrsh7th/cmp-path', | ||
| 6 | 'hrsh7th/nvim-cmp', | ||
| 7 | 'hrsh7th/vim-vsnip', | ||
| 8 | 'L3MON4D3/LuaSnip', | ||
| 9 | 'octaltree/cmp-look', | ||
| 10 | 'saadparwaiz1/cmp_luasnip', | ||
| 11 | } | ||
diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..a73b1e8 --- /dev/null +++ b/lua/plugins/colorscheme.lua | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | return { | ||
| 2 | 'RRethy/base16-nvim', | ||
| 3 | config = function() | ||
| 4 | vim.cmd.colorscheme "base16-rebecca" | ||
| 5 | end, | ||
| 6 | } | ||
diff --git a/lua/plugins/fzf.lua b/lua/plugins/fzf.lua new file mode 100644 index 0000000..f3fc76b --- /dev/null +++ b/lua/plugins/fzf.lua | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | return { | ||
| 2 | 'junegunn/fzf', | ||
| 3 | 'junegunn/fzf.vim', | ||
| 4 | } | ||
diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua new file mode 100644 index 0000000..fe09f3e --- /dev/null +++ b/lua/plugins/orgmode.lua | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | return { | ||
| 2 | 'nvim-orgmode/orgmode', | ||
| 3 | event = 'VeryLazy', | ||
| 4 | ft = { 'org' }, | ||
| 5 | config = function() | ||
| 6 | -- Setup orgmode | ||
| 7 | require('orgmode').setup({ | ||
| 8 | org_agenda_files = '~/orgfiles/**/*', | ||
| 9 | org_default_notes_file = '~/orgfiles/refile.org', | ||
| 10 | }) | ||
| 11 | require('cmp').setup({ | ||
| 12 | sources = { | ||
| 13 | { name = 'orgmode' } | ||
| 14 | } | ||
| 15 | }) | ||
| 16 | end, | ||
| 17 | } | ||
diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..ed65c3f --- /dev/null +++ b/lua/plugins/telescope.lua | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | return { | ||
| 2 | 'nvim-telescope/telescope.nvim', | ||
| 3 | 'nvim-telescope/telescope-media-files.nvim', | ||
| 4 | } | ||
