diff options
Diffstat (limited to '.config/nvim/plugin-settings')
-rw-r--r-- | .config/nvim/plugin-settings/Comment.lua | 3 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/fzf.vim | 1 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/indent-blankline.lua | 35 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/lspconfig.lua | 94 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/luasnip.lua | 32 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/netrw.nvim.lua | 1 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/nnn.nvim.lua | 18 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/null-ls.lua | 8 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/nvim-cmp.lua | 56 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/nvim-miniyank.vim | 10 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/nvim-tree.lua | 19 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/nvim-treesitter.lua | 13 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/nvim-ts-autotag.lua | 8 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/orgmode.lua | 7 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/vim-airline.vim | 1 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/vim-better-whitespace.vim | 4 | ||||
-rw-r--r-- | .config/nvim/plugin-settings/vimtex.vim | 7 |
17 files changed, 317 insertions, 0 deletions
diff --git a/.config/nvim/plugin-settings/Comment.lua b/.config/nvim/plugin-settings/Comment.lua new file mode 100644 index 0000000..d063eac --- /dev/null +++ b/.config/nvim/plugin-settings/Comment.lua @@ -0,0 +1,3 @@ +require('Comment').setup({ + ignore = '^$' +}) diff --git a/.config/nvim/plugin-settings/fzf.vim b/.config/nvim/plugin-settings/fzf.vim new file mode 100644 index 0000000..c8eb64e --- /dev/null +++ b/.config/nvim/plugin-settings/fzf.vim @@ -0,0 +1 @@ +let g:fzf_command_prefix = 'Fzf' diff --git a/.config/nvim/plugin-settings/indent-blankline.lua b/.config/nvim/plugin-settings/indent-blankline.lua new file mode 100644 index 0000000..a0f1096 --- /dev/null +++ b/.config/nvim/plugin-settings/indent-blankline.lua @@ -0,0 +1,35 @@ +vim.api.nvim_set_hl(0, "IblScope", { ctermfg = "Gray" }) +vim.api.nvim_set_hl(0, "IblWhitespace", { ctermfg = "DarkGray" }) +vim.api.nvim_set_hl(0, "RainbowRed", { ctermfg = "Red" }) +vim.api.nvim_set_hl(0, "RainbowYellow", { ctermfg = "Yellow" }) +vim.api.nvim_set_hl(0, "RainbowBlue", { ctermfg = "Blue" }) +vim.api.nvim_set_hl(0, "RainbowGreen", { ctermfg = "Green" }) +vim.api.nvim_set_hl(0, "RainbowMagenta", { ctermfg = "Magenta" }) +vim.api.nvim_set_hl(0, "RainbowCyan", { ctermfg = "Cyan" }) + +local highlight = { + "RainbowRed", + "RainbowYellow", + "RainbowBlue", + "RainbowGreen", + "RainbowMagenta", + "RainbowCyan", +} + +require("ibl").setup { + indent = { + char = "›", + highlight = highlight, + }, +} + +vim.opt.list = true +vim.opt.listchars = { + tab = "» ⇥", + lead = "·", + trail = "␣", + nbsp = "⍽", + extends = "❯", + precedes = "❮", + eol = "↴", +} diff --git a/.config/nvim/plugin-settings/lspconfig.lua b/.config/nvim/plugin-settings/lspconfig.lua new file mode 100644 index 0000000..150db34 --- /dev/null +++ b/.config/nvim/plugin-settings/lspconfig.lua @@ -0,0 +1,94 @@ +local lspconfig = require("lspconfig") + +-- Mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +local opts = { noremap = true, silent = true } +vim.keymap.set("n", "<space>e", vim.diagnostic.open_float, opts) +vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) +vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) +vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, opts) +-- See `:help vim.lsp.*` for documentation on any of the below functions +vim.keymap.set("n", "<leader>D", vim.lsp.buf.declaration, opts) +vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, opts) +vim.keymap.set("n", "<leader>k", vim.lsp.buf.hover, opts) +vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) +vim.keymap.set("n", "<space>sh", vim.lsp.buf.signature_help, opts) +vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts) +vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts) +vim.keymap.set("n", "<space>wl", function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) +end, opts) +vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts) +vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts) +vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts) +vim.keymap.set("n", "<space>gr", vim.lsp.buf.references, opts) +vim.keymap.set("n", "<space>f", function() + vim.lsp.buf.format({ async = true }) +end, opts) + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +local on_attach = function(_, bufnr) + vim.api.nvim_set_option_value( -- Enable completion triggered by <c-x><c-o> + "omnifunc", + "v:lua.vim.lsp.omnifunc", + { buf = bufnr } + ) +end + +-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. +local capabilities = require("cmp_nvim_lsp").default_capabilities() + +local simple_servers = { + "bashls", + "clangd", + "cssls", + "emmet_language_server", + "jedi_language_server", + "jsonls", + "remark_ls", + "texlab", + "vimls", + "yamlls", +} +for _, lsp in ipairs(simple_servers) do + lspconfig[lsp].setup({ capabilities = capabilities, on_attach = on_attach }) +end + +require("lspconfig").lua_ls.setup({ + on_init = function(client) + if client.workspace_folders then + local path = client.workspace_folders[1].name + if + vim.uv.fs_stat(path .. "/.luarc.json") + or vim.uv.fs_stat(path .. "/.luarc.jsonc") + then + return + end + end + + client.config.settings.Lua = + vim.tbl_deep_extend("force", client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + -- Depending on the usage, you might want to add additional paths here. + -- "${3rd}/luv/library" + -- "${3rd}/busted/library", + }, + -- or pull in all of 'runtimepath'. NOTE: this is a lot slower + -- library = vim.api.nvim_get_runtime_file("", true) + }, + }) + end, + settings = { + Lua = {}, + }, +}) diff --git a/.config/nvim/plugin-settings/luasnip.lua b/.config/nvim/plugin-settings/luasnip.lua new file mode 100644 index 0000000..c8cd578 --- /dev/null +++ b/.config/nvim/plugin-settings/luasnip.lua @@ -0,0 +1,32 @@ +local luasnip = require("luasnip") + +require("luasnip.loaders.from_vscode").lazy_load() + +local opts = { noremap = true, silent = true } + +vim.keymap.set("i", "<C-l>", function() + luasnip.expand() +end, opts) +vim.keymap.set("s", "<C-l>", function() + luasnip.expand() +end, opts) +vim.keymap.set("i", "<C-k>", function() + if luasnip.jumpable(1) then + luasnip.jump(1) + end +end, opts) +vim.keymap.set("s", "<C-k>", function() + if luasnip.jumpable(1) then + luasnip.jump(1) + end +end, opts) +vim.keymap.set("i", "<C-j>", function() + if luasnip.jumpable(-1) then + luasnip.jump(-1) + end +end, opts) +vim.keymap.set("s", "<C-j>", function() + if luasnip.jumpable(-1) then + luasnip.jump(-1) + end +end, opts) diff --git a/.config/nvim/plugin-settings/netrw.nvim.lua b/.config/nvim/plugin-settings/netrw.nvim.lua new file mode 100644 index 0000000..ff07d03 --- /dev/null +++ b/.config/nvim/plugin-settings/netrw.nvim.lua @@ -0,0 +1 @@ +require("netrw").setup({}) diff --git a/.config/nvim/plugin-settings/nnn.nvim.lua b/.config/nvim/plugin-settings/nnn.nvim.lua new file mode 100644 index 0000000..dbdf7b2 --- /dev/null +++ b/.config/nvim/plugin-settings/nnn.nvim.lua @@ -0,0 +1,18 @@ +local builtin = require("nnn").builtin +require("nnn").setup({ + explorer = { + cmd = "n3", -- command overrride (-F1 flag is implied, -a flag is invalid!) + }, + picker = { + cmd = "n3 -a -Pp", -- command override (-p flag is implied) + }, + mappings = { + { "<C-t>", builtin.open_in_tab }, -- open file(s) in tab + { "<C-s>", builtin.open_in_split }, -- open file(s) in split + { "<C-v>", builtin.open_in_vsplit }, -- open file(s) in vertical split + { "<C-p>", builtin.open_in_preview }, -- open file in preview split keeping nnn focused + { "<C-y>", builtin.copy_to_clipboard }, -- copy file(s) to clipboard + { "<C-w>", builtin.cd_to_path }, -- cd to file directory + { "<C-e>", builtin.populate_cmdline }, -- populate cmdline (:) with file(s) + }, +}) diff --git a/.config/nvim/plugin-settings/null-ls.lua b/.config/nvim/plugin-settings/null-ls.lua new file mode 100644 index 0000000..4895ee3 --- /dev/null +++ b/.config/nvim/plugin-settings/null-ls.lua @@ -0,0 +1,8 @@ +local null_ls = require("null-ls") + +null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.diagnostics.markdownlint, + }, +}) diff --git a/.config/nvim/plugin-settings/nvim-cmp.lua b/.config/nvim/plugin-settings/nvim-cmp.lua new file mode 100644 index 0000000..defc39e --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-cmp.lua @@ -0,0 +1,56 @@ +local cmp = require("cmp") +local luasnip = require("luasnip") + +cmp.setup({ + enabled = true, + snippet = { + expand = function(args) -- REQUIRED - you must specify a snippet engine + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = cmp.mapping.preset.insert({ + ["<C-b>"] = cmp.mapping.scroll_docs(-4), + ["<C-f>"] = cmp.mapping.scroll_docs(4), + ["<C-Space>"] = cmp.mapping.complete(), + ["<C-e>"] = cmp.mapping.abort(), + ["<C-n>"] = cmp.mapping.select_next_item(), + ["<C-p>"] = cmp.mapping.select_prev_item(), + ["<C-l>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + ["<C-k>"] = cmp.mapping(function() + if luasnip.jumpable(1) then + luasnip.jump(1) + end + end, { "i", "s" }), + ["<C-j>"] = cmp.mapping(function() + if luasnip.jumpable(-1) then + luasnip.jump(-1) + end + end, { "i", "s" }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "nvim_lua" }, + }, { + { name = "buffer" }, + { name = "path" }, + }), +}) + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), +}) diff --git a/.config/nvim/plugin-settings/nvim-miniyank.vim b/.config/nvim/plugin-settings/nvim-miniyank.vim new file mode 100644 index 0000000..a6469f9 --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-miniyank.vim @@ -0,0 +1,10 @@ +nmap <c-n> <plug>(miniyank-cycle) +nmap <c-p> <plug>(miniyank-cycleback) +map p <plug>(miniyank-autoput) +map P <plug>(miniyank-autoPut) +map <leader>p <Plug>(miniyank-startput) +map <leader>P <Plug>(miniyank-startPut) +map <Leader>yc <Plug>(miniyank-tochar) +map <Leader>yl <Plug>(miniyank-toline) +map <Leader>yb <Plug>(miniyank-toblock) +let g:miniyank_filename = stdpath("cache")."/.miniyank.mpack" diff --git a/.config/nvim/plugin-settings/nvim-tree.lua b/.config/nvim/plugin-settings/nvim-tree.lua new file mode 100644 index 0000000..a8dcd46 --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-tree.lua @@ -0,0 +1,19 @@ +local function my_on_attach(bufnr) + local api = require "nvim-tree.api" + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set('n', '<C-t>', api.tree.change_root_to_parent, opts('Up')) + vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) +end + +-- pass to setup along with your other options +require("nvim-tree").setup { + on_attach = my_on_attach, +} diff --git a/.config/nvim/plugin-settings/nvim-treesitter.lua b/.config/nvim/plugin-settings/nvim-treesitter.lua new file mode 100644 index 0000000..4afe91e --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-treesitter.lua @@ -0,0 +1,13 @@ +require("nvim-treesitter.configs").setup({ + -- A list of parser names, or "all" (the four listed parsers should always be installed) + ensure_installed = { "c", "lua", "vim" }, + ignore_install = { "org" }, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + }, +}) diff --git a/.config/nvim/plugin-settings/nvim-ts-autotag.lua b/.config/nvim/plugin-settings/nvim-ts-autotag.lua new file mode 100644 index 0000000..92c7ea3 --- /dev/null +++ b/.config/nvim/plugin-settings/nvim-ts-autotag.lua @@ -0,0 +1,8 @@ +require('nvim-ts-autotag').setup({ + opts = { + -- Defaults + enable_close = true, -- Auto close tags + enable_rename = true, -- Auto rename pairs of tags + enable_close_on_slash = false -- Auto close on trailing </ + }, +}) diff --git a/.config/nvim/plugin-settings/orgmode.lua b/.config/nvim/plugin-settings/orgmode.lua new file mode 100644 index 0000000..7f7428e --- /dev/null +++ b/.config/nvim/plugin-settings/orgmode.lua @@ -0,0 +1,7 @@ +local xdg_data = os.getenv("XDG_DATA_HOME") or "~/.local/share" +local orgmode_files = xdg_data .. "/orgmode" + +require('orgmode').setup({ + org_agenda_files = {orgmode_files .. '/**/*'}, + org_default_notes_file = orgmode_files .. 'default.org', +}) diff --git a/.config/nvim/plugin-settings/vim-airline.vim b/.config/nvim/plugin-settings/vim-airline.vim new file mode 100644 index 0000000..b4145dd --- /dev/null +++ b/.config/nvim/plugin-settings/vim-airline.vim @@ -0,0 +1 @@ +let g:airline_powerline_fonts = 1 diff --git a/.config/nvim/plugin-settings/vim-better-whitespace.vim b/.config/nvim/plugin-settings/vim-better-whitespace.vim new file mode 100644 index 0000000..51203ba --- /dev/null +++ b/.config/nvim/plugin-settings/vim-better-whitespace.vim @@ -0,0 +1,4 @@ +let g:better_whitespace_enabled=1 +let g:strip_whitespace_on_save=1 +let g:strip_whitelines_at_eof=1 +let g:strip_only_modified_lines=1 diff --git a/.config/nvim/plugin-settings/vimtex.vim b/.config/nvim/plugin-settings/vimtex.vim new file mode 100644 index 0000000..f90494b --- /dev/null +++ b/.config/nvim/plugin-settings/vimtex.vim @@ -0,0 +1,7 @@ +let g:tex_flavor = 'latex' +let g:vimtex_view_method='zathura' +let g:vimtex_compiler_progname='nvr' +let g:vimtex_quickfix_mode = 0 +"let g:tex_conceal = '' +"let g:tex_syntax_conceal_default = 0 +"let g:vimtex_quickfix_autoclose_after_keystrokes = 1 |