diff options
| author | Max Christian Pohle | 2024-09-01 02:00:46 +0200 |
|---|---|---|
| committer | Max Christian Pohle | 2024-09-01 02:00:46 +0200 |
| commit | fe0e677564995c25119beb8238234c24ef6e592c (patch) | |
| tree | e33fef58ae6a906ae89382c82ebcb541e3f3a997 | |
| parent | 7172c36d4508510ad844fcbea1bd3bc496da809e (diff) | |
| download | vim-fe0e677564995c25119beb8238234c24ef6e592c.tar.bz2 vim-fe0e677564995c25119beb8238234c24ef6e592c.zip | |
refactored the entire config
| -rw-r--r-- | init.lua | 242 | ||||
| -rw-r--r-- | lua/plugins/cmp.lua | 166 | ||||
| -rw-r--r-- | lua/plugins/colorizer.lua | 6 | ||||
| -rw-r--r-- | lua/plugins/devicons.lua | 11 | ||||
| -rw-r--r-- | lua/plugins/gitsigns.lua | 6 | ||||
| -rw-r--r-- | lua/plugins/orgmode.lua | 6 | ||||
| -rw-r--r-- | lua/plugins/popup.lua | 5 | ||||
| -rw-r--r-- | lua/plugins/telescope.lua | 13 | ||||
| -rw-r--r-- | lua/plugins/treesitter.lua | 20 | ||||
| -rw-r--r-- | vimrc | 10 |
10 files changed, 257 insertions, 228 deletions
| @@ -1,59 +1,46 @@ | |||
| 1 | -------------------------------------------------------------------------------- | 1 | -------------------------------------------------------------------------------- |
| 2 | -- lazy plugin manager | 2 | -- vim options, first sourced from vimrc, then appended by Neovim specific stuff |
| 3 | -------------------------------------------------------------------------------- | ||
| 4 | local configdir = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":p:h") | ||
| 5 | vim.cmd('source ' .. configdir .. '/vimrc') | ||
| 6 | |||
| 7 | vim.opt.encoding='utf-8' | ||
| 8 | vim.opt.inccommand = "nosplit" -- Neovim only: preview substitute and such things in real time | ||
| 9 | vim.opt.shadafile = configdir .. "/shada.file" | ||
| 10 | |||
| 11 | -------------------------------------------------------------------------------- | ||
| 12 | -- Bootstrap lazy.nvim | ||
| 3 | -------------------------------------------------------------------------------- | 13 | -------------------------------------------------------------------------------- |
| 4 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" | 14 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" |
| 5 | if not (vim.uv or vim.loop).fs_stat(lazypath) then | 15 | if not (vim.uv or vim.loop).fs_stat(lazypath) then |
| 6 | vim.fn.system({ | 16 | local lazyrepo = "https://github.com/folke/lazy.nvim.git" |
| 7 | "git", | 17 | local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) |
| 8 | "clone", | 18 | if vim.v.shell_error ~= 0 then |
| 9 | "--filter = blob:none", | 19 | vim.api.nvim_echo({ |
| 10 | "https://github.com/folke/lazy.nvim.git", | 20 | { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, |
| 11 | "--branch = stable", -- latest stable release | 21 | { out, "WarningMsg" }, |
| 12 | lazypath, | 22 | { "\nPress any key to exit..." }, |
| 13 | }) | 23 | }, true, {}) |
| 24 | vim.fn.getchar() | ||
| 25 | os.exit(1) | ||
| 26 | end | ||
| 14 | end | 27 | end |
| 15 | vim.opt.rtp:prepend(lazypath) | 28 | vim.opt.rtp:prepend(lazypath) |
| 16 | 29 | ||
| 17 | require("lazy").setup({ | 30 | require("lazy").setup({ |
| 18 | spec = { | 31 | spec = { |
| 19 | { import = "plugins", }, | 32 | { import = "plugins", }, |
| 20 | 'nvim-tree/nvim-web-devicons', | ||
| 21 | 'lewis6991/gitsigns.nvim', | ||
| 22 | 'folke/neodev.nvim', | ||
| 23 | -- treesitter is experimental and breaks indentation on xml, html with `=` | ||
| 24 | 'nvim-treesitter/nvim-treesitter', | ||
| 25 | 'nvim-lua/popup.nvim', | ||
| 26 | 'nvim-lua/plenary.nvim', | ||
| 27 | 'coderonline/vim-fancy-line', | 33 | 'coderonline/vim-fancy-line', |
| 28 | 'coderonline/vim-recently-used', | 34 | 'coderonline/vim-recently-used', |
| 29 | 'norcalli/nvim-colorizer.lua', | ||
| 30 | 'folke/trouble.nvim', | ||
| 31 | } | 35 | } |
| 32 | }) | 36 | }) |
| 33 | 37 | ||
| 34 | -------------------------------------------------------------------------------- | ||
| 35 | -- vim options, first sourced from vimrc, then appended by Neovim specific stuff | ||
| 36 | -------------------------------------------------------------------------------- | ||
| 37 | local configdir = vim.fn.fnamemodify(vim.fn.expand("$MYVIMRC"), ":p:h") | ||
| 38 | vim.cmd('source ' .. configdir .. '/vimrc') | ||
| 39 | -- vim.cmd.colorscheme "base16-rebecca" | ||
| 40 | -- vim.cmd.colorscheme "base16-katy" | ||
| 41 | |||
| 42 | vim.opt.encoding = 'utf-8' | ||
| 43 | vim.opt.number = true | ||
| 44 | vim.opt.number = true | ||
| 45 | vim.opt.shiftwidth = 2 | ||
| 46 | vim.opt.tabstop = 2 | ||
| 47 | vim.opt.softtabstop = 2 | ||
| 48 | vim.opt.inccommand = "nosplit" -- Neovim only: preview substitute and such things in real time | ||
| 49 | vim.opt.termguicolors = true | ||
| 50 | vim.opt.shadafile = configdir .. "/shada.file" | ||
| 51 | |||
| 52 | -- Restore cursor position | 38 | -- Restore cursor position |
| 53 | vim.api.nvim_create_autocmd({ "BufReadPost" }, { | 39 | vim.api.nvim_create_autocmd({ "BufReadPost" }, { |
| 54 | callback = function() vim.cmd('silent! normal! g`"zv') end | 40 | callback = function() vim.cmd('silent! normal! g`"zv') end |
| 55 | }) | 41 | }) |
| 56 | 42 | ||
| 43 | -- LSP says 'fix available', but there is no such command? Let us fix that: | ||
| 57 | vim.api.nvim_create_user_command( | 44 | vim.api.nvim_create_user_command( |
| 58 | 'LspFix', | 45 | 'LspFix', |
| 59 | function() | 46 | function() |
| @@ -61,13 +48,21 @@ vim.api.nvim_create_user_command( | |||
| 61 | end, {} | 48 | end, {} |
| 62 | ) | 49 | ) |
| 63 | 50 | ||
| 51 | -- speaking of lsp, lets enable logging (TODO: remove if you remove | ||
| 52 | -- `lua/cmp.lua`, but why would you?) | ||
| 53 | vim.g.lsp_log_verbose = 1 | ||
| 54 | vim.g.lsp_log_file = configdir .. ('/vim-lsp.log') | ||
| 55 | vim.lsp.set_log_level 'error' | ||
| 56 | if vim.fn.has 'nvim-0.5.1' == 1 then | ||
| 57 | require('vim.lsp.log').set_format_func(vim.inspect) | ||
| 58 | end | ||
| 59 | |||
| 60 | -- If you need scoop for some dependencies on Windows machines this may come | ||
| 61 | -- handy: | ||
| 64 | if vim.fn.has("win32") then | 62 | if vim.fn.has("win32") then |
| 65 | vim.opt.rtp:append(vim.fn.expand("$HOME\\scoop\\shims")) | 63 | vim.opt.rtp:append(vim.fn.expand("$HOME\\scoop\\shims")) |
| 66 | end | 64 | end |
| 67 | 65 | ||
| 68 | vim.g.lsp_log_verbose = 1 | ||
| 69 | vim.g.lsp_log_file = configdir .. ('/vim-lsp.log') | ||
| 70 | |||
| 71 | if vim.g.neovide then | 66 | if vim.g.neovide then |
| 72 | vim.guifont = "monospace:h11:b" | 67 | vim.guifont = "monospace:h11:b" |
| 73 | vim.g.neovide_cursor_animation_length = 0.03 | 68 | vim.g.neovide_cursor_animation_length = 0.03 |
| @@ -82,173 +77,4 @@ if vim.g.neovide then | |||
| 82 | vim.g.neovide_scale_factor = 1.0 | 77 | vim.g.neovide_scale_factor = 1.0 |
| 83 | end | 78 | end |
| 84 | 79 | ||
| 85 | -------------------------------------------------------------------------------- | ||
| 86 | -- plugin setup and options | ||
| 87 | -------------------------------------------------------------------------------- | ||
| 88 | -- require'nvim-treesitter.configs'.setup { | ||
| 89 | -- -- A list of parser names, or "all" (the five listed parsers should always be installed) | ||
| 90 | -- ensure_installed = { "c", "lua", "vim", "vimdoc", "query" }, | ||
| 91 | -- modules = {}, | ||
| 92 | -- -- Install parsers synchronously (only applied to `ensure_installed`) | ||
| 93 | -- sync_install = false, | ||
| 94 | -- -- Automatically install missing parsers when entering buffer | ||
| 95 | -- -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally | ||
| 96 | -- auto_install = true, | ||
| 97 | -- ignore_install = { "javascript" }, | ||
| 98 | -- highlight = { | ||
| 99 | -- enable = true, | ||
| 100 | -- -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to | ||
| 101 | -- -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is | ||
| 102 | -- -- the name of the parser) | ||
| 103 | -- -- list of language that will be disabled | ||
| 104 | -- disable = function(_, buf) | ||
| 105 | -- local max_filesize = 100 * 1024 -- 100 KB | ||
| 106 | -- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) | ||
| 107 | -- if ok and stats and stats.size > max_filesize then | ||
| 108 | -- return true | ||
| 109 | -- end | ||
| 110 | -- end, | ||
| 111 | -- -- Setting this to true will run `:h syntax` and tree-sitter at the same time. | ||
| 112 | -- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). | ||
| 113 | -- -- Using this option may slow down your editor, and you may see some duplicate highlights. | ||
| 114 | -- -- Instead of true it can also be a list of languages | ||
| 115 | -- additional_vim_regex_highlighting = false, | ||
| 116 | -- }, | ||
| 117 | -- } | ||
| 118 | |||
| 119 | -- vim.wo.foldtext = 'v:lua.vim.treesitter.foldtext()' -- not available yet in my installation | ||
| 120 | vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' | ||
| 121 | vim.wo.foldlevel = 1 | ||
| 122 | |||
| 123 | require('telescope').load_extension('media_files') | ||
| 124 | |||
| 125 | vim.lsp.set_log_level 'error' | ||
| 126 | if vim.fn.has 'nvim-0.5.1' == 1 then | ||
| 127 | require('vim.lsp.log').set_format_func(vim.inspect) | ||
| 128 | end | ||
| 129 | require'nvim-web-devicons'.setup { | ||
| 130 | color_icons = true; | ||
| 131 | default = true; | ||
| 132 | strict = true; | ||
| 133 | } | ||
| 134 | require('colorizer').setup() | ||
| 135 | require('gitsigns').setup() | ||
| 136 | require('trouble').setup() | ||
| 137 | require('neodev').setup() | ||
| 138 | |||
| 139 | local builtin = require('telescope.builtin') | ||
| 140 | vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) | ||
| 141 | vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) | ||
| 142 | vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) | ||
| 143 | vim.keymap.set('n', '<leader>fh', builtin.help_tags, {}) | ||
| 144 | |||
| 145 | vim.keymap.set({"i", "s"}, "<leader><Tab>", function() require('luasnip').jump(1) end, {silent = true}) | ||
| 146 | vim.keymap.set({"i", "s"}, "<leader><S-Tab>", function() require('luasnip').jump(-1) end, {silent = true}) | ||
| 147 | |||
| 148 | local cmp = require'cmp' | ||
| 149 | cmp.setup({ | ||
| 150 | snippet = { | ||
| 151 | -- REQUIRED - you must specify a snippet engine | ||
| 152 | expand = function(args) | ||
| 153 | require('luasnip').lsp_expand(args.body) -- For `luasnip` users. | ||
| 154 | -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) | ||
| 155 | end, | ||
| 156 | }, | ||
| 157 | window = { | ||
| 158 | completion = cmp.config.window.bordered(), | ||
| 159 | documentation = cmp.config.window.bordered(), | ||
| 160 | }, | ||
| 161 | mapping = cmp.mapping.preset.insert({ | ||
| 162 | ['<C-b>'] = cmp.mapping.scroll_docs(-4), | ||
| 163 | ['<C-f>'] = cmp.mapping.scroll_docs(4), | ||
| 164 | ['<C-Space>'] = cmp.mapping.complete(), | ||
| 165 | ['<C-e>'] = cmp.mapping.abort(), | ||
| 166 | ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. | ||
| 167 | }), | ||
| 168 | sources = cmp.config.sources({ | ||
| 169 | { name = 'nvim_lsp' }, | ||
| 170 | { name = 'luasnip' }, -- For luasnip users. | ||
| 171 | }, { | ||
| 172 | { name = 'buffer' }, | ||
| 173 | }) | ||
| 174 | }) | ||
| 175 | |||
| 176 | -- Set up lspconfig. | ||
| 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() | ||
| 188 | |||
| 189 | -- # Language Servers | ||
| 190 | -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md | ||
| 191 | |||
| 192 | -- C/C++ | clang | ||
| 193 | -- require('lspconfig')['bitbake_language_server'].setup{} | ||
| 194 | -- require('lspconfig')['clangd'].setup{} | ||
| 195 | -- -- lua (but not init.lua entirely, hence why neodev) | ||
| 196 | -- require('lspconfig')['lua_ls'].setup { } | ||
| 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 } | ||
| 198 | -- require'lspconfig'.jdtls.setup{} | ||
| 199 | -- -- bash | bash-language-server | ||
| 200 | -- require('lspconfig')['bashls'].setup{} | ||
| 201 | -- -- ccs | vscode-css-languageserver | ||
| 202 | -- require('lspconfig')['cssls'].setup{} | ||
| 203 | -- -- rust | rust-analyzer | ||
| 204 | -- require('lspconfig')['rust_analyzer'].setup{} | ||
| 205 | -- -- javascript | eslint | ||
| 206 | -- require('lspconfig')['eslint'].setup{} | ||
| 207 | -- -- javascript | typescript-language-server | ||
| 208 | -- require('lspconfig')['tsserver'].setup{} | ||
| 209 | -- -- vimscript | vim-language-server | ||
| 210 | -- require('lspconfig')['vimls'].setup{} | ||
| 211 | -- -- html | ||
| 212 | -- require('lspconfig')['html'].setup{} | ||
| 213 | -- -- jsonls | ||
| 214 | -- require('lspconfig')['jsonls'].setup{} | ||
| 215 | -- -- C/C++ | clang | ||
| 216 | -- require('lspconfig')['clangd'].setup{} | ||
| 217 | -- -- bash | bash-language-server | ||
| 218 | -- require('lspconfig')['bashls'].setup{} | ||
| 219 | -- -- ccs | vscode-css-languageserver | ||
| 220 | -- require('lspconfig')['cssls'].setup{} | ||
| 221 | -- -- rust | rust-analyzer | ||
| 222 | -- require('lspconfig')['rust_analyzer'].setup{} | ||
| 223 | -- -- javascript | eslint | ||
| 224 | -- require('lspconfig')['eslint'].setup{} | ||
| 225 | -- -- javascript | typescript-language-server | ||
| 226 | -- require('lspconfig')['tsserver'].setup{} | ||
| 227 | -- -- vimscript | vim-language-server | ||
| 228 | -- require('lspconfig')['vimls'].setup{} | ||
| 229 | -- -- configure html server | ||
| 230 | -- require('lspconfig')["html"].setup({ | ||
| 231 | -- -- on_attach = on_attach, | ||
| 232 | -- init_options = { | ||
| 233 | -- configurationSection = { "html", "css", "javascript" }, | ||
| 234 | -- embeddedLanguages = { | ||
| 235 | -- css = true, | ||
| 236 | -- javascript = true, | ||
| 237 | -- }, | ||
| 238 | -- provideFormatter = true, | ||
| 239 | -- }, | ||
| 240 | -- }) | ||
| 241 | -- require('lspconfig')['pylsp'].setup{ | ||
| 242 | -- settings = { | ||
| 243 | -- pylsp = { | ||
| 244 | -- plugins = { | ||
| 245 | -- pycodestyle = { | ||
| 246 | -- ignore = {'W391'}, | ||
| 247 | -- maxLineLength = 100 | ||
| 248 | -- } | ||
| 249 | -- } | ||
| 250 | -- } | ||
| 251 | -- } | ||
| 252 | -- } | ||
| 253 | |||
| 254 | -- vim: tabstop=2 shiftwidth=2 softtabstop=2 | 80 | -- vim: tabstop=2 shiftwidth=2 softtabstop=2 |
diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index fed96e4..f4766db 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua | |||
| @@ -1,11 +1,159 @@ | |||
| 1 | return { | 1 | return { |
| 2 | 'neovim/nvim-lspconfig', | 2 | { |
| 3 | 'hrsh7th/cmp-nvim-lsp', | 3 | 'hrsh7th/nvim-cmp', |
| 4 | 'hrsh7th/cmp-buffer', | 4 | dependencies = { |
| 5 | 'hrsh7th/cmp-path', | 5 | 'nvim-lua/popup.nvim', |
| 6 | 'hrsh7th/nvim-cmp', | 6 | 'nvim-lua/plenary.nvim', |
| 7 | 'hrsh7th/vim-vsnip', | 7 | 'saadparwaiz1/cmp_luasnip', |
| 8 | 'L3MON4D3/LuaSnip', | 8 | "hrsh7th/cmp-emoji", |
| 9 | 'octaltree/cmp-look', | 9 | 'hrsh7th/cmp-nvim-lsp', |
| 10 | 'saadparwaiz1/cmp_luasnip', | 10 | 'hrsh7th/cmp-buffer', |
| 11 | 'hrsh7th/cmp-path', | ||
| 12 | 'hrsh7th/vim-vsnip', | ||
| 13 | 'octaltree/cmp-look', | ||
| 14 | 'folke/trouble.nvim', | ||
| 15 | 'folke/lazydev.nvim', | ||
| 16 | { | ||
| 17 | 'L3MON4D3/LuaSnip', | ||
| 18 | config = function() | ||
| 19 | vim.keymap.set( | ||
| 20 | {"i", "s"}, | ||
| 21 | "<leader><Tab>", | ||
| 22 | function() require('luasnip').jump(1) end, | ||
| 23 | {silent = true} | ||
| 24 | ) | ||
| 25 | vim.keymap.set( | ||
| 26 | {"i", "s"}, | ||
| 27 | "<leader><S-Tab>", | ||
| 28 | function() require('luasnip').jump(-1) end, | ||
| 29 | {silent = true} | ||
| 30 | ) | ||
| 31 | end, | ||
| 32 | }, | ||
| 33 | }, | ||
| 34 | |||
| 35 | config = function() | ||
| 36 | require('trouble').setup() | ||
| 37 | require('lazydev').setup() | ||
| 38 | |||
| 39 | local cmp = require'cmp' | ||
| 40 | cmp.setup({ | ||
| 41 | snippet = { | ||
| 42 | -- REQUIRED - you must specify a snippet engine | ||
| 43 | expand = function(args) | ||
| 44 | require('luasnip').lsp_expand(args.body) -- For `luasnip` users. | ||
| 45 | -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) | ||
| 46 | end, | ||
| 47 | }, | ||
| 48 | window = { | ||
| 49 | completion = cmp.config.window.bordered(), | ||
| 50 | documentation = cmp.config.window.bordered(), | ||
| 51 | }, | ||
| 52 | mapping = cmp.mapping.preset.insert({ | ||
| 53 | ['<C-b>'] = cmp.mapping.scroll_docs(-4), | ||
| 54 | ['<C-f>'] = cmp.mapping.scroll_docs(4), | ||
| 55 | ['<C-Space>'] = cmp.mapping.complete(), | ||
| 56 | ['<C-e>'] = cmp.mapping.abort(), | ||
| 57 | ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. | ||
| 58 | }), | ||
| 59 | sources = cmp.config.sources({ | ||
| 60 | { name = 'nvim_lsp' }, | ||
| 61 | { name = 'luasnip' }, -- For luasnip users. | ||
| 62 | }, { | ||
| 63 | { name = 'buffer' }, | ||
| 64 | }) | ||
| 65 | }) | ||
| 66 | end | ||
| 67 | }, | ||
| 68 | { | ||
| 69 | 'neovim/nvim-lspconfig', | ||
| 70 | dependencies = { | ||
| 71 | { "folke/neodev.nvim" } | ||
| 72 | }, | ||
| 73 | config = function() | ||
| 74 | -- Set up lspconfig. | ||
| 75 | local keymap = vim.keymap | ||
| 76 | local on_attach = function(client, bufnr) | ||
| 77 | local opts = { noremap = true, silent = true, buffer = bufnr } | ||
| 78 | keymap.set("n", "gf", "<cmd>Lspsaga lsp_finder<CR>", opts) -- show definition, references | ||
| 79 | keymap.set("n", "gD", "<Cmd>Lspsaga goto_definition<CR>", opts) -- got to declaration | ||
| 80 | keymap.set("n", "gd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window | ||
| 81 | keymap.set("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) -- go to implementation | ||
| 82 | keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions | ||
| 83 | keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename | ||
| 84 | keymap.set("n", "<leader>D", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show diagnostics for line | ||
| 85 | keymap.set("n", "<leader>d", "<cmd>Lspsaga show_cursor_diagnostics<CR>", opts) -- show diagnostics for cursor | ||
| 86 | keymap.set("n", "[d", "<cmd>Lspsaga diagnostic_jump_prev<CR>", opts) -- jump to previous diagnostic in buffer | ||
| 87 | keymap.set("n", "]d", "<cmd>Lspsaga diagnostic_jump_next<CR>", opts) -- jump to next diagnostic in buffer | ||
| 88 | keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor | ||
| 89 | keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side | ||
| 90 | keymap.set("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) | ||
| 91 | vim.keymap.set("n", "<C-n>", ":cnext<CR>") | ||
| 92 | vim.keymap.set("n", "<C-p>", ":cprev<CR>") | ||
| 93 | end | ||
| 94 | |||
| 95 | local capabilities = require("cmp_nvim_lsp").default_capabilities() | ||
| 96 | |||
| 97 | -- # Language Servers | ||
| 98 | -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md | ||
| 99 | for _,server in ipairs({ | ||
| 100 | 'bitbake_language_server', | ||
| 101 | "clangd", -- C/C++ | clang | ||
| 102 | "tsserver", -- javascript | typescript-language-server | ||
| 103 | "lua_ls", -- lua (but not init.lua entirely, hence why neodev) | ||
| 104 | "jdtls", | ||
| 105 | "html", | ||
| 106 | "cssls", -- ccs | vscode-css-languageserver | ||
| 107 | "rust_analyzer", -- rust | rust-analyzer | ||
| 108 | "eslint", -- javascript | eslint | ||
| 109 | 'vimls', -- vimscript | vim-language-server | ||
| 110 | 'html', -- html | ||
| 111 | 'jsonls', -- jsonls | ||
| 112 | "pyright", -- python | ||
| 113 | "bashls", -- bash | bash-language-server | ||
| 114 | "gopls", | ||
| 115 | "emmet_ls", | ||
| 116 | "marksman"}) do | ||
| 117 | require("lspconfig")[server].setup({ | ||
| 118 | capabilities = capabilities, | ||
| 119 | on_attach = on_attach | ||
| 120 | }) | ||
| 121 | end | ||
| 122 | |||
| 123 | -- # specialized config for some LSPs which have non-ideal defaults | ||
| 124 | -- | ||
| 125 | -- 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 } | ||
| 126 | -- configure html server | ||
| 127 | require('lspconfig')["html"].setup({ | ||
| 128 | init_options = { | ||
| 129 | configurationSection = { "html", "css", "javascript" }, | ||
| 130 | embeddedLanguages = { | ||
| 131 | css = true, | ||
| 132 | javascript = true, | ||
| 133 | }, | ||
| 134 | provideFormatter = true, | ||
| 135 | }, | ||
| 136 | }) | ||
| 137 | require('lspconfig')['pylsp'].setup{ | ||
| 138 | settings = { | ||
| 139 | pylsp = { | ||
| 140 | plugins = { | ||
| 141 | pycodestyle = { | ||
| 142 | ignore = {'W391'}, | ||
| 143 | maxLineLength = 100 | ||
| 144 | } | ||
| 145 | } | ||
| 146 | } | ||
| 147 | } | ||
| 148 | } | ||
| 149 | require("lspconfig").clangd.setup { | ||
| 150 | on_attach = on_attach, | ||
| 151 | capabilities = capabilities, | ||
| 152 | cmd = { | ||
| 153 | "clangd", | ||
| 154 | "--offset-encoding=utf-16", | ||
| 155 | }, | ||
| 156 | } | ||
| 157 | end | ||
| 158 | } | ||
| 11 | } | 159 | } |
diff --git a/lua/plugins/colorizer.lua b/lua/plugins/colorizer.lua new file mode 100644 index 0000000..416f2d1 --- /dev/null +++ b/lua/plugins/colorizer.lua | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | return { | ||
| 2 | 'norcalli/nvim-colorizer.lua', | ||
| 3 | config = function() | ||
| 4 | require('colorizer').setup() | ||
| 5 | end, | ||
| 6 | } | ||
diff --git a/lua/plugins/devicons.lua b/lua/plugins/devicons.lua new file mode 100644 index 0000000..9e69c5f --- /dev/null +++ b/lua/plugins/devicons.lua | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | |||
| 2 | return { | ||
| 3 | 'nvim-tree/nvim-web-devicons', | ||
| 4 | config = function() | ||
| 5 | require'nvim-web-devicons'.setup { | ||
| 6 | color_icons = true; | ||
| 7 | default = true; | ||
| 8 | strict = true; | ||
| 9 | } | ||
| 10 | end, | ||
| 11 | } | ||
diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..d88bf68 --- /dev/null +++ b/lua/plugins/gitsigns.lua | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | return { | ||
| 2 | 'lewis6991/gitsigns.nvim', | ||
| 3 | config = function() | ||
| 4 | require('gitsigns').setup() | ||
| 5 | end, | ||
| 6 | } | ||
diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua index fe09f3e..a9d6ea0 100644 --- a/lua/plugins/orgmode.lua +++ b/lua/plugins/orgmode.lua | |||
| @@ -3,15 +3,9 @@ return { | |||
| 3 | event = 'VeryLazy', | 3 | event = 'VeryLazy', |
| 4 | ft = { 'org' }, | 4 | ft = { 'org' }, |
| 5 | config = function() | 5 | config = function() |
| 6 | -- Setup orgmode | ||
| 7 | require('orgmode').setup({ | 6 | require('orgmode').setup({ |
| 8 | org_agenda_files = '~/orgfiles/**/*', | 7 | org_agenda_files = '~/orgfiles/**/*', |
| 9 | org_default_notes_file = '~/orgfiles/refile.org', | 8 | org_default_notes_file = '~/orgfiles/refile.org', |
| 10 | }) | 9 | }) |
| 11 | require('cmp').setup({ | ||
| 12 | sources = { | ||
| 13 | { name = 'orgmode' } | ||
| 14 | } | ||
| 15 | }) | ||
| 16 | end, | 10 | end, |
| 17 | } | 11 | } |
diff --git a/lua/plugins/popup.lua b/lua/plugins/popup.lua new file mode 100644 index 0000000..0ff2e3a --- /dev/null +++ b/lua/plugins/popup.lua | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | return { | ||
| 2 | 'nvim-lua/plenary.nvim', | ||
| 3 | 'nvim-lua/popup.nvim', | ||
| 4 | } | ||
| 5 | |||
diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index ed65c3f..fee09df 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua | |||
| @@ -1,4 +1,15 @@ | |||
| 1 | return { | 1 | return { |
| 2 | 'nvim-telescope/telescope.nvim', | 2 | 'nvim-telescope/telescope.nvim', |
| 3 | 'nvim-telescope/telescope-media-files.nvim', | 3 | dependencies = { |
| 4 | 'nvim-telescope/telescope-media-files.nvim' | ||
| 5 | }, | ||
| 6 | config = function() | ||
| 7 | require('telescope').load_extension('media_files') | ||
| 8 | |||
| 9 | local builtin = require('telescope.builtin') | ||
| 10 | vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) | ||
| 11 | vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) | ||
| 12 | vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) | ||
| 13 | vim.keymap.set('n', '<leader>fh', builtin.help_tags, {}) | ||
| 14 | end, | ||
| 4 | } | 15 | } |
diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..9673f63 --- /dev/null +++ b/lua/plugins/treesitter.lua | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | return { | ||
| 2 | -- treesitter is experimental and breaks indentation on xml, html with `=` | ||
| 3 | -- treesitter is optional for orgmode, but without it syntax highlighting in | ||
| 4 | -- org files is broken | ||
| 5 | 'nvim-treesitter/nvim-treesitter', | ||
| 6 | config = function() | ||
| 7 | require'nvim-treesitter.configs'.setup { | ||
| 8 | ensure_installed = {"c", "html", "css", "javascript", "org"}, | ||
| 9 | sync_install = false, | ||
| 10 | auto_install = true, | ||
| 11 | ignore_install = {}, | ||
| 12 | disable = { }, | ||
| 13 | modules = { "all" }, | ||
| 14 | highlight = { | ||
| 15 | enable = true, | ||
| 16 | } | ||
| 17 | } | ||
| 18 | end | ||
| 19 | } | ||
| 20 | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | "======================================================================================================================= | 1 | "======================================================================================================================= |
| 2 | " GENERAL | 2 | " GENERAL |
| 3 | "======================================================================================================================= | 3 | "======================================================================================================================= |
| 4 | set termguicolors | ||
| 4 | 5 | ||
| 5 | filetype on | 6 | filetype on |
| 6 | filetype plugin on | 7 | filetype plugin on |
| @@ -24,9 +25,10 @@ set hlsearch incsearch | " highlight pattern while entering i | |||
| 24 | " set cindent cinoptions+=(0 | " indents at the level of parentheses -- if desired | 25 | " set cindent cinoptions+=(0 | " indents at the level of parentheses -- if desired |
| 25 | set expandtab | " replace tabs with spaces | 26 | set expandtab | " replace tabs with spaces |
| 26 | set textwidth=0 | " should be set file type specific, colorcolumns is there to assist anyways | 27 | set textwidth=0 | " should be set file type specific, colorcolumns is there to assist anyways |
| 27 | set tabstop=4 | 28 | |
| 28 | set shiftwidth=4 | 29 | set tabstop=2 | " I am sorry, but 2 is simply better |
| 29 | set softtabstop=4 | 30 | set shiftwidth=2 | " . |
| 31 | set softtabstop=2 | " . | ||
| 30 | 32 | ||
| 31 | "======================================================================================================================= | 33 | "======================================================================================================================= |
| 32 | " PATH -- where to search for includes (e.g. `gf` or `:find`) | 34 | " PATH -- where to search for includes (e.g. `gf` or `:find`) |
| @@ -386,4 +388,4 @@ augroup END | |||
| 386 | 388 | ||
| 387 | "======================================================================================================================= | 389 | "======================================================================================================================= |
| 388 | " v modeline, do not chnage v | 390 | " v modeline, do not chnage v |
| 389 | " vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:,\<,\>,\-,\& number | 391 | " vim: noai:ts=2:sw=2:sts=2 iskeyword+=\:\<,\>,\-,\& number |
