From 0c9a6f387b00048767be9aca234fb8019521cad3 Mon Sep 17 00:00:00 2001 From: tiyn Date: Thu, 28 Sep 2023 06:18:15 +0200 Subject: [PATCH] nvim: split plugins into multiple files --- .config/nvim/init.lua | 25 +- .config/nvim/lazy-lock.json | 5 +- .config/nvim/lua/keymap.lua | 23 +- .config/nvim/lua/loadplugins.lua | 654 +----------------- .config/nvim/lua/plugins/comment.lua | 7 + .config/nvim/lua/plugins/diffview.lua | 7 + .config/nvim/lua/plugins/fterm.lua | 7 + .config/nvim/lua/plugins/gitsigns.lua | 7 + .config/nvim/lua/plugins/indent-blankline.lua | 11 + .config/nvim/lua/plugins/knap.lua | 17 + .config/nvim/lua/plugins/lsp_signature.lua | 14 + .config/nvim/lua/plugins/lualine.lua | 68 ++ .config/nvim/lua/plugins/markdown-preview.lua | 16 + .config/nvim/lua/plugins/mason.lua | 32 + .config/nvim/lua/plugins/nvim-autopairs.lua | 7 + .config/nvim/lua/plugins/nvim-cmp.lua | 84 +++ .config/nvim/lua/plugins/nvim-colorizer.lua | 29 + .config/nvim/lua/plugins/nvim-lspconfig.lua | 71 ++ .config/nvim/lua/plugins/nvim-scrollbar.lua | 59 ++ .config/nvim/lua/plugins/nvim-surround.lua | 9 + .config/nvim/lua/plugins/nvim-tree.lua | 30 + .config/nvim/lua/plugins/nvim-treesitter.lua | 36 + .config/nvim/lua/plugins/nvim-ufo.lua | 20 + .config/nvim/lua/plugins/renamer.lua | 8 + .config/nvim/lua/plugins/spelunker.lua | 12 + .config/nvim/lua/plugins/tccs.lua | 13 + .config/nvim/lua/plugins/telescope.lua | 9 + .config/nvim/lua/plugins/tidy.lua | 9 + .config/nvim/lua/plugins/todo-comments.lua | 22 + .config/nvim/lua/plugins/trouble.lua | 13 + .config/nvim/lua/plugins/vim-markdown.lua | 10 + .config/nvim/lua/plugins/vim-renamer.lua | 10 + .config/nvim/lua/plugins/wilder.lua | 46 ++ 33 files changed, 724 insertions(+), 666 deletions(-) create mode 100644 .config/nvim/lua/plugins/comment.lua create mode 100644 .config/nvim/lua/plugins/diffview.lua create mode 100644 .config/nvim/lua/plugins/fterm.lua create mode 100644 .config/nvim/lua/plugins/gitsigns.lua create mode 100644 .config/nvim/lua/plugins/indent-blankline.lua create mode 100644 .config/nvim/lua/plugins/knap.lua create mode 100644 .config/nvim/lua/plugins/lsp_signature.lua create mode 100644 .config/nvim/lua/plugins/lualine.lua create mode 100644 .config/nvim/lua/plugins/markdown-preview.lua create mode 100644 .config/nvim/lua/plugins/mason.lua create mode 100644 .config/nvim/lua/plugins/nvim-autopairs.lua create mode 100644 .config/nvim/lua/plugins/nvim-cmp.lua create mode 100644 .config/nvim/lua/plugins/nvim-colorizer.lua create mode 100644 .config/nvim/lua/plugins/nvim-lspconfig.lua create mode 100644 .config/nvim/lua/plugins/nvim-scrollbar.lua create mode 100644 .config/nvim/lua/plugins/nvim-surround.lua create mode 100644 .config/nvim/lua/plugins/nvim-tree.lua create mode 100644 .config/nvim/lua/plugins/nvim-treesitter.lua create mode 100644 .config/nvim/lua/plugins/nvim-ufo.lua create mode 100644 .config/nvim/lua/plugins/renamer.lua create mode 100644 .config/nvim/lua/plugins/spelunker.lua create mode 100644 .config/nvim/lua/plugins/tccs.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua create mode 100644 .config/nvim/lua/plugins/tidy.lua create mode 100644 .config/nvim/lua/plugins/todo-comments.lua create mode 100644 .config/nvim/lua/plugins/trouble.lua create mode 100644 .config/nvim/lua/plugins/vim-markdown.lua create mode 100644 .config/nvim/lua/plugins/vim-renamer.lua create mode 100644 .config/nvim/lua/plugins/wilder.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index c71fe69..233d80b 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -23,6 +23,7 @@ vim.o.splitright = true -- disable case sensitive matching vim.o.ignorecase = true +vim.o.smartcase = true -- enable nocompatible mode vim.o.nocompatible = true @@ -44,16 +45,31 @@ vim.o.relativenumber = true vim.o.ttyfast = true vim.o.lazyredraw = true --- textEdit might fail without hidden +-- decrease update time +vim.o.updatetime = 250 +vim.o.timeout = true +vim.o.timeoutlen = 300 + +-- enable break indent +vim.o.breakindent = true + +-- textedit might fail without hidden vim.o.hidden = true -- disable backupfiles vim.o.nobackup = true vim.o.nowritebackup = true --- Set completeopt to have a better completion experience +-- set completeopt to have a better completion experience vim.o.completeopt = 'menuone,noselect' +-- set completion option for command mode +vim.o.wildmode = 'longest:full,full' + +-- minimum number of lines around the cursor +vim.o.scrolloff = 10 +vim.o.sidescrolloff = 8 + -- always show the signcolumn vim.o.signcolumn = "yes" @@ -69,6 +85,7 @@ vim.g.python3_host_prog = '/usr/bin/python3' vim.o.foldcolumn = '0' vim.o.foldlevel = 99 vim.o.foldlevelstart = 99 +vim.o.foldexpr = 'expr' vim.o.foldenable = true vim.o.conceallevel = 0 vim.g.markdown_folding = 1 @@ -90,10 +107,14 @@ vim.filetype.add({ md = 'markdown', nim = 'nim', py = 'python', + sage = 'python', tex = 'tex', } }) +-- set mapleader for hotkeys +vim.g.mapleader = "," + -- load general mapped keys require('style') diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 6426a19..f916404 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,16 +1,15 @@ { - "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "diffview.nvim": { "branch": "main", "commit": "7e5a85c186027cab1e825d018f07c350177077fc" }, + "fterm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, "fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" }, "git-blame.nvim": { "branch": "master", "commit": "41e22dc843c6821a410db57be0b7025154f9d8ec" }, "gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" }, - "headlines.nvim": { "branch": "master", "commit": "74a083a3c32a08be24f7dfcc6f448ecf47857f46" }, "indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" }, "knap": { "branch": "main", "commit": "503010f541696e99ed5c62f658620e546cebf8b0" }, "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, diff --git a/.config/nvim/lua/keymap.lua b/.config/nvim/lua/keymap.lua index d4f94fc..dd5c353 100644 --- a/.config/nvim/lua/keymap.lua +++ b/.config/nvim/lua/keymap.lua @@ -1,7 +1,5 @@ --- set mapleader for hotkeys -vim.g.mapleader = "," - -- unmap unwanted commands +vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) vim.keymap.set({ 'n', 'i' }, '', '', { noremap = true }) vim.keymap.set('i', '', '', { noremap = true }) vim.keymap.set('i', '', '', { noremap = true }) @@ -27,11 +25,19 @@ vim.keymap.set('n', 'c', ':w! | !compiler %', { noremap = true -- save file as sudo on files that require root permission vim.keymap.set('c', 'w!!', 'execute "silent! write !sudo tee % >/dev/null" edit!', { noremap = true }) --- alias for replacing -vim.keymap.set('n', 'ss', ':%s//gI', { noremap = true }) - --- irc compatibility for interactivity -vim.keymap.set('n', 'is', ':.w >> indd', { noremap = true }) +-- easy substitution for whole file and line, visual mode +vim.keymap.set('n', 'ss', ':%s/\\<\\>//g', { noremap = true }) +vim.keymap.set({ 'n', 'v' }, 'sl', ':s//g', { noremap = true }) +vim.keymap.set('n', 'sa', ':%s//g', { noremap = true }) + +-- highlighting yanked regions +local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, +}) -- SmiteshP/nvim-navbuddy vim.keymap.set('n', '', ':Navbuddy', {}) @@ -41,7 +47,6 @@ vim.keymap.set('n', '', ':NvimTreeToggle toggle', {}) -- numtostr/fterm.nvim vim.keymap.set({ 'n', 't' }, 't', require("FTerm").toggle, { noremap = true }) - local lazygit = require("FTerm"):new({ cmd = 'lazygit', }) diff --git a/.config/nvim/lua/loadplugins.lua b/.config/nvim/lua/loadplugins.lua index 6313c74..7738aa7 100644 --- a/.config/nvim/lua/loadplugins.lua +++ b/.config/nvim/lua/loadplugins.lua @@ -13,658 +13,8 @@ end vim.opt.rtp:prepend(lazypath) return require("lazy").setup({ - -- colorscheme - { - 'tiyn/tccs.nvim', - lazy = false, - priority = 1000, - config = function() - require('tccs').setup({ - require('tccs').load() - }) - end - }, - - -- display git status per line - { - 'lewis6991/gitsigns.nvim', - opts = {} - }, - - -- show indentation lines - { - 'lukas-reineke/indent-blankline.nvim', - event = "BufReadPre", - opts = { - show_current_context = true, - show_current_context_start = true - } - }, - - -- statusline - { - 'nvim-lualine/lualine.nvim', - dependencies = { - { - 'nvim-tree/nvim-web-devicons', - lazy = true - }, - { - 'f-person/git-blame.nvim', - config = function() - vim.g.gitblame_display_virtual_text = 0 - end - }, - { 'tiyn/tccs.nvim' }, - }, - config = function() - require('lualine').setup({ - options = { - globalstatus = true, - symbols = { - error = Error_sign, - warn = Warn_sign, - hint = Hint_sign, - info = Info_sign - }, - theme = 'tccs', - component_separators = { left = '', right = '' }, - section_separators = { left = '', right = '' } - }, - sections = { - lualine_b = { - { - require('gitblame').get_current_blame_text, - cond = require('gitblame').is_blame_text_available - } - }, - lualine_c = {}, - lualine_x = { - 'encoding', - 'fileformat', - { - 'filetype', - icon_only = true - } - }, - lualine_y = { - { - 'filename', - file_status = true, - newfile_status = true, - path = 1, - shorting_target = 50, - symbols = { - modified = Lualine_signs["modified"], - readonly = Lualine_signs["readonly"], - unnamed = Lualine_signs["unnamed"], - newfile = Lualine_signs["newfile"], - } - } - }, - lualine_z = { 'progress', 'location' }, - } - }) - end - }, - - -- show function signature while typing - { - 'ray-x/lsp_signature.nvim', - opts = { - bind = true, - handler_opts = { - border = "none" - }, - hint_prefix = Hint_sign, - hint_scheme = "DiagnosticSignHint" - } - }, - - -- preview for markdown filetypes - { - "iamcco/markdown-preview.nvim", - ft = { 'markdown' }, - build = "cd app && yarn install", - config = function() - vim.cmd([[ - function OpenMarkdownPreview (url) - execute "silent ! firefox --kiosk --new-window " . a:url - endfunction - ]]) - vim.g.mkdp_browserfunc = "OpenMarkdownPreview" - end - }, - - -- automatic closing of brackets - { - 'windwp/nvim-autopairs', - opts = {} - }, - - -- lang server installations - { - 'williamboman/mason.nvim', - dependencies = { - { - 'jose-elias-alvarez/null-ls.nvim', - config = function() - require("null-ls").setup({ - sources = { - require("null-ls").builtins.formatting.black, - require("null-ls").builtins.formatting.mdformat - } - }) - end - }, - { - 'jay-babu/mason-null-ls.nvim', - opts = { - automatic_installation = true, - ensure_installed = { "black", "mdformat" } - } - }, - - }, - opts = { - ui = { - icons = Install_signs - } - } - }, - - -- lang server management - { - 'williamboman/mason-lspconfig.nvim', - dependencies = { - 'neovim/nvim-lspconfig', - { - 'hrsh7th/cmp-nvim-lsp', - config = function() - Capabilities = require("cmp_nvim_lsp").default_capabilities() - Capabilities.textDocument.foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true - } - end - }, - -- navigation menu - { - 'SmiteshP/nvim-navbuddy', - config = function() - local navbuddy = require("nvim-navbuddy") - Attach_func = function(client, bufnr) - navbuddy.attach(client, bufnr) - end - end, - dependencies = { - 'SmiteshP/nvim-navic', - 'MunifTanjim/nui.nvim' - } - }, - }, - config = function() - require("mason-lspconfig").setup({ - automatic_setup = true, - ensure_installed = { - "bashls", - "lua_ls", - "marksman", - "nimls", - "pylsp", - "texlab" - } - }) - local servers = { - lua_ls = { - Lua = { - diagnostics = { - globals = { 'vim' } - }, - telemetry = { enable = false }, - }, - } - } - local default = { __index = function() return {} end } - setmetatable(servers, default) - require("mason-lspconfig").setup_handlers({ - function(server_name) - require('lspconfig')[server_name].setup({ - on_attach = Attach_func, - capabilities = Capabilities, - flags = { - debounce_text_changes = 150 - }, - settings = servers[server_name] - }) - end - }) - end - }, - - -- autocompletion and its sources and snippets - { - 'hrsh7th/nvim-cmp', - dependencies = { - 'nvim-lua/plenary.nvim', - 'onsails/lspkind-nvim', - -- cmp sources - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'lukas-reineke/cmp-under-comparator', - -- luasnip - { - 'l3mon4d3/luasnip', - config = function() - require("luasnip.loaders.from_snipmate") - end, - dependencies = { 'saadparwaiz1/cmp_luasnip' } - }, - }, - config = function() - local cmp = require("cmp") - cmp.setup { - sorting = { - comparators = { - cmp.config.compare.offset, - cmp.config.compare.exact, - cmp.config.compare.score, - require "cmp-under-comparator".under, - cmp.config.compare.kind, - cmp.config.compare.sort_text, - cmp.config.compare.length, - cmp.config.compare.order - }, - }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end - }, - mapping = { - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif require("luasnip").jumpable(-1) then - require("luasnip").jump(-1) - else - fallback() - end - end, { "i", "s" }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif require("luasnip").expand_or_jumpable() then - require("luasnip").expand_or_jump() - else - fallback() - end - end, { "i", "s" }), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true - } - }, - sources = { - { name = 'nvim_lsp' }, - { name = 'path' }, - { name = 'buffer' }, - { name = 'luasnip' } - }, - formatting = { - format = require("lspkind").cmp_format({ - mode = "symbol_text", - preset = "codicons", - maxwidth = 50, - menu = Menu_signs, - symbol_map = Lsp_signs - }) - } - } - end - }, - - -- showing color of hex values, etc - { - 'nvchad/nvim-colorizer.lua', - opts = { - filetypes = { - '*', - '!markdown' - }, - user_default_options = { - RGB = true, - RRGGBB = true, - RRGGBBAA = true, - AARRGGBB = true, - rgb_fn = true, - hsl_fn = true, - css_fn = true, - mode = "virtualtext", - virtualtext = " ", - }, - -- all the sub-options of filetypes apply to buftypes - buftypes = { - "*", - "!prompt", - "!popup" - }, - } - }, - - -- fileexplorer on the side - { - "nvim-tree/nvim-tree.lua", - cmd = "NvimTreeToggle", - dependencies = { - { - "nvim-tree/nvim-web-devicons", - lazy = true - }, - }, - opts = { - sort_by = "case_sensitive", - view = { - width = 30, - }, - filters = { - dotfiles = true, - }, - renderer = { - group_empty = true, - icons = { - glyphs = { - git = Git_signs - }, - }, - } - } - }, - - -- better language highlighting by improved parsing - { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - dependencies = { - -- automatically close html-tags - 'windwp/nvim-ts-autotag', - -- color brackets - 'p00f/nvim-ts-rainbow', - }, - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "bash", - "css", - "html", - "markdown", - "markdown_inline", - "latex", - "python", - "lua", - }, - highlight = { enable = true }, - autotag = { enable = true }, - rainbow = { - enable = true, - extended_mode = true, - max_file_lines = nil, - -- colors = {}, - -- termcolors = {} - } - }) - end - }, - - -- folding improvements - { - 'kevinhwang91/nvim-ufo', - dependencies = { 'kevinhwang91/promise-async' }, - config = function() - require('ufo').setup() - vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { '*' }, - callback = function() require("ufo").closeAllFolds() end - }) - vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, - { - pattern = { '*' }, - callback = function() require("ufo").openAllFolds() end - }) - end - }, - - -- fuzzy finder - { - 'nvim-telescope/telescope.nvim', - version = '0.1.2', - dependencies = { 'nvim-lua/plenary.nvim' }, - opts = {} - }, - - -- clean up white spaces and empty lines before writing - { - "mcauley-penney/tidy.nvim", - opts = { - filetype_exclude = {} - } - }, - - -- todo symbols and highlighting - { - 'folke/todo-comments.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, - opts = { - keywords = { - ERRO = { icon = Error_sign, color = "error" }, - WARN = { icon = Warn_sign, color = "warning" }, - HACK = { icon = Hack_sign, color = "warning" }, - HINT = { icon = Hint_sign, color = "hint" }, - TODO = { icon = Todo_sign, color = "info" }, - INFO = { icon = Info_sign, color = "hint", alt = { "NOTE" } }, - PERF = { icon = Perfect_sign, color = "default" }, - TEST = { icon = Test_sign, color = "test" } - }, - colors = { - default = { "Operator" } - } - } - }, - - -- additional quote/parantheses funtions - { - 'kylechui/nvim-surround', - version = "*", - event = "VeryLazy", - opts = {} - }, - - -- commenting improvements - { - 'numToStr/Comment.nvim', - opts = {} - }, - - -- latex asynchronous pdf rendering - { - 'frabjous/knap', - ft = { 'tex' }, - config = function() - vim.g.knap_settings = { - texoutputext = "pdf", - textopdf = "pdflatex -synctex=1 -halt-on-error -interaction=batchmode %docroot%", - textopdfviewerlaunch = - "zathura --synctex-editor-command 'nvim --headless -es --cmd \"lua require('\"'\"'knaphelper'\"'\"').relayjump('\"'\"'%servername%'\"'\"','\"'\"'%{input}'\"'\"',%{line},0)\"' %outputfile%", - textopdfviewerrefresh = "none", - textopdfforwardjump = "zathura --synctex-forward=%line%:%column%:%srcfile% %outputfile%" - } - end - }, - - -- improved wild menu - { - 'gelguy/wilder.nvim', - dependencies = { - { - "nvim-tree/nvim-web-devicons", - lazy = true - }, - 'roxma/nvim-yarp', - 'roxma/vim-hug-neovim-rpc', - 'romgrk/fzy-lua-native' - }, - config = function() - local wilder = require('wilder') - wilder.setup({ - modes = { ':', '/', '?' }, - accept_key = '', - reject_key = '' - }) - wilder.set_option('renderer', wilder.popupmenu_renderer({ - highlighter = wilder.basic_highlighter(), - left = { ' ', wilder.popupmenu_devicons() }, - right = { ' ', wilder.popupmenu_scrollbar() }, - })) - wilder.set_option('pipeline', { - wilder.branch( - wilder.python_file_finder_pipeline({ - file_command = { 'find', '.', '-type', 'f', '-printf', '%P\n' }, - dir_command = { 'find', '.', '-type', 'd', '-printf', '%P\n' }, - filters = { 'fuzzy_filter', 'difflib_sorter' }, - }), - wilder.cmdline_pipeline({ - language = 'python', - fuzzy = 2, - }), - wilder.python_search_pipeline({ - pattern = wilder.python_fuzzy_pattern(), - sorter = wilder.python_difflib_sorter(), - engine = 're', - }) - ), - }) - end, - }, - - -- scrollbar with git and diagnostics support for easier navigation - { - 'petertriho/nvim-scrollbar', - dependencies = { - 'kevinhwang91/nvim-hlslens', - 'lewis6991/gitsigns.nvim' - }, - config = function() - require("scrollbar").setup({ - marks = { - Cursor = { - highlight = "Normal" - }, - Search = { - highlight = "Special" - }, - Error = { - highlight = "DiagnosticSignError" - }, - Warn = { - highlight = "DiagnosticSignWarn" - }, - Info = { - highlight = "DiagnosticSignInfo" - }, - Hint = { - highlight = "DiagnosticSignHint" - }, - Misc = { - highlight = "Special" - }, - GitAdd = { - highlight = "GitGutterAdd" - }, - GitChange = { - highlight = "GitGutterChange" - }, - GitDelete = { - highlight = "GitGutterDelete" - } - }, - excluded_filetypes = { - "cmp_docs", - "cmp_menu", - "noice", - "prompt", - "TelescopePrompt", - "NvimTree", - "Navbuddy", - "FTerm", - "", - }, - }) - require("scrollbar.handlers.search").setup() - require("scrollbar.handlers.gitsigns").setup() - end - }, - - -- floating terminal to toggle - { - 'numToStr/FTerm.nvim', - opts = {} - }, - - -- side by side git diffs for merge conflicts - { - 'sindrets/diffview.nvim', - opts = {} - }, - - -- list of errors - { - 'folke/trouble.nvim', - dependencies = { - { - 'nvim-tree/nvim-web-devicons', - lazy = true - } - }, - opts = {} - }, - - -- improve spelling check for coding to feature camelcase, etc - { - 'kamykn/spelunker.vim', - dependencies = { 'kamykn/popup-menu.nvim' }, - config = function() - vim.o.nospell = true - vim.g.enable_spelunker_vim = 0 - vim.g.spelunker_disable_acronym_checking = 1 - end - }, - - -- improved gui for renaming - { - 'filipdutescu/renamer.nvim', - dependencies = { 'nvim-lua/plenary.nvim' }, - opts = {} - }, - - -- rename files in buffer - { - 'qpkorr/vim-renamer', - priority = 100, - config = function() - require('renamer') - end - }, - - -- markdown improvements - { - 'preservim/vim-markdown', - ft = { 'markdown' }, - dependencies = { 'godlygeek/tabular' }, - config = function() - end - }, + -- import plugins from the plugins directory + { import = 'plugins' }, }, -- lazy.nvim configuration { diff --git a/.config/nvim/lua/plugins/comment.lua b/.config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..6faf6d9 --- /dev/null +++ b/.config/nvim/lua/plugins/comment.lua @@ -0,0 +1,7 @@ +return { + -- commenting improvements + { + 'numtostr/comment.nvim', + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua new file mode 100644 index 0000000..2b13f56 --- /dev/null +++ b/.config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,7 @@ +return { + -- side by side git diffs for merge conflicts + { + 'sindrets/diffview.nvim', + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/fterm.lua b/.config/nvim/lua/plugins/fterm.lua new file mode 100644 index 0000000..bd52167 --- /dev/null +++ b/.config/nvim/lua/plugins/fterm.lua @@ -0,0 +1,7 @@ +return { + -- floating terminal to toggle + { + 'numtostr/fterm.nvim', + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..cf0bffd --- /dev/null +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,7 @@ +return { + -- display git status per line + { + 'lewis6991/gitsigns.nvim', + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/indent-blankline.lua b/.config/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..ae76007 --- /dev/null +++ b/.config/nvim/lua/plugins/indent-blankline.lua @@ -0,0 +1,11 @@ +return { + -- show indentation lines + { + 'lukas-reineke/indent-blankline.nvim', + event = "BufReadPre", + opts = { + show_current_context = true, + show_current_context_start = true + } + } +} diff --git a/.config/nvim/lua/plugins/knap.lua b/.config/nvim/lua/plugins/knap.lua new file mode 100644 index 0000000..b889912 --- /dev/null +++ b/.config/nvim/lua/plugins/knap.lua @@ -0,0 +1,17 @@ +return { + -- latex asynchronous pdf rendering + { + 'frabjous/knap', + ft = { 'tex' }, + config = function() + vim.g.knap_settings = { + texoutputext = "pdf", + textopdf = "pdflatex -synctex=1 -halt-on-error -interaction=batchmode %docroot%", + textopdfviewerlaunch = + "zathura --synctex-editor-command 'nvim --headless -es --cmd \"lua require('\"'\"'knaphelper'\"'\"').relayjump('\"'\"'%servername%'\"'\"','\"'\"'%{input}'\"'\"',%{line},0)\"' %outputfile%", + textopdfviewerrefresh = "none", + textopdfforwardjump = "zathura --synctex-forward=%line%:%column%:%srcfile% %outputfile%" + } + end + } +} diff --git a/.config/nvim/lua/plugins/lsp_signature.lua b/.config/nvim/lua/plugins/lsp_signature.lua new file mode 100644 index 0000000..3089532 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp_signature.lua @@ -0,0 +1,14 @@ +return { + -- show function signature while typing + { + 'ray-x/lsp_signature.nvim', + opts = { + bind = true, + handler_opts = { + border = "none" + }, + hint_prefix = Hint_sign, + hint_scheme = "DiagnosticSignHint" + } + } +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..c6ccff0 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,68 @@ +return { + -- statusline + { + 'nvim-lualine/lualine.nvim', + dependencies = { + { + 'nvim-tree/nvim-web-devicons', + lazy = true + }, + { + 'f-person/git-blame.nvim', + config = function() + vim.g.gitblame_display_virtual_text = 0 + end + }, + { 'tiyn/tccs.nvim' }, + }, + config = function() + require('lualine').setup({ + options = { + globalstatus = true, + symbols = { + error = Error_sign, + warn = Warn_sign, + hint = Hint_sign, + info = Info_sign + }, + theme = 'tccs', + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' } + }, + sections = { + lualine_b = { + { + require('gitblame').get_current_blame_text, + cond = require('gitblame').is_blame_text_available + } + }, + lualine_c = {}, + lualine_x = { + 'encoding', + 'fileformat', + { + 'filetype', + icon_only = true + } + }, + lualine_y = { + { + 'filename', + file_status = true, + newfile_status = true, + path = 1, + shorting_target = 50, + symbols = { + modified = Lualine_signs["modified"], + readonly = Lualine_signs["readonly"], + unnamed = Lualine_signs["unnamed"], + newfile = Lualine_signs["newfile"], + } + } + }, + lualine_z = { 'progress', 'location' }, + } + }) + end + } +} diff --git a/.config/nvim/lua/plugins/markdown-preview.lua b/.config/nvim/lua/plugins/markdown-preview.lua new file mode 100644 index 0000000..f47623f --- /dev/null +++ b/.config/nvim/lua/plugins/markdown-preview.lua @@ -0,0 +1,16 @@ +return { + -- preview for markdown filetypes + { + "iamcco/markdown-preview.nvim", + ft = { 'markdown' }, + build = "cd app && yarn install", + config = function() + vim.cmd([[ + function OpenMarkdownPreview (url) + execute "silent ! firefox --kiosk --new-window " . a:url + endfunction + ]]) + vim.g.mkdp_browserfunc = "OpenMarkdownPreview" + end + } +} diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..3f93ea6 --- /dev/null +++ b/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,32 @@ +return { + -- lang server installations + { + 'williamboman/mason.nvim', + dependencies = { + { + 'jose-elias-alvarez/null-ls.nvim', + config = function() + require("null-ls").setup({ + sources = { + require("null-ls").builtins.formatting.black, + require("null-ls").builtins.formatting.mdformat + } + }) + end + }, + { + 'jay-babu/mason-null-ls.nvim', + opts = { + automatic_installation = true, + ensure_installed = { "black", "mdformat" } + } + }, + + }, + opts = { + ui = { + icons = Install_signs + } + } + } +} diff --git a/.config/nvim/lua/plugins/nvim-autopairs.lua b/.config/nvim/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..483083d --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,7 @@ +return { + -- automatic closing of brackets + { + 'windwp/nvim-autopairs', + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..b40d8ef --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -0,0 +1,84 @@ +return { + -- autocompletion and its sources and snippets + { + 'hrsh7th/nvim-cmp', + dependencies = { + 'nvim-lua/plenary.nvim', + 'onsails/lspkind-nvim', + -- cmp sources + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'lukas-reineke/cmp-under-comparator', + -- luasnip + { + 'l3mon4d3/luasnip', + config = function() + require("luasnip.loaders.from_snipmate") + end, + dependencies = { 'saadparwaiz1/cmp_luasnip' } + }, + }, + config = function() + local cmp = require("cmp") + cmp.setup { + sorting = { + comparators = { + cmp.config.compare.offset, + cmp.config.compare.exact, + cmp.config.compare.score, + require "cmp-under-comparator".under, + cmp.config.compare.kind, + cmp.config.compare.sort_text, + cmp.config.compare.length, + cmp.config.compare.order + }, + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end + }, + mapping = { + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + require("luasnip").jump(-1) + else + fallback() + end + end, { "i", "s" }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + require("luasnip").expand_or_jump() + else + fallback() + end + end, { "i", "s" }), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true + } + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'path' }, + { name = 'buffer' }, + { name = 'luasnip' } + }, + formatting = { + format = require("lspkind").cmp_format({ + mode = "symbol_text", + preset = "codicons", + maxwidth = 50, + menu = Menu_signs, + symbol_map = Lsp_signs + }) + } + } + end + } +} diff --git a/.config/nvim/lua/plugins/nvim-colorizer.lua b/.config/nvim/lua/plugins/nvim-colorizer.lua new file mode 100644 index 0000000..1b9559e --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-colorizer.lua @@ -0,0 +1,29 @@ +return { + -- showing color of hex values, etc + { + 'nvchad/nvim-colorizer.lua', + opts = { + filetypes = { + '*', + '!markdown' + }, + user_default_options = { + RGB = true, + RRGGBB = true, + RRGGBBAA = true, + AARRGGBB = true, + rgb_fn = true, + hsl_fn = true, + css_fn = true, + mode = "virtualtext", + virtualtext = " ", + }, + -- all the sub-options of filetypes apply to buftypes + buftypes = { + "*", + "!prompt", + "!popup" + }, + } + } +} diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..f4148bd --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,71 @@ +return { + -- lang server management + { + 'neovim/nvim-lspconfig', + dependencies = { + 'williamboman/mason-lspconfig.nvim', + { + 'hrsh7th/cmp-nvim-lsp', + config = function() + Capabilities = require("cmp_nvim_lsp").default_capabilities() + Capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } + end + }, + -- navigation menu + { + 'SmiteshP/nvim-navbuddy', + config = function() + local navbuddy = require("nvim-navbuddy") + Attach_func = function(client, bufnr) + navbuddy.attach(client, bufnr) + end + end, + dependencies = { + 'neovim/nvim-lspconfig', + 'SmiteshP/nvim-navic', + 'MunifTanjim/nui.nvim' + } + }, + }, + config = function() + require("mason-lspconfig").setup({ + automatic_setup = true, + ensure_installed = { + "bashls", + "lua_ls", + "marksman", + "nimls", + "pylsp", + "texlab" + } + }) + local servers = { + lua_ls = { + Lua = { + diagnostics = { + globals = { 'vim' } + }, + telemetry = { enable = false }, + }, + } + } + local default = { __index = function() return {} end } + setmetatable(servers, default) + require("mason-lspconfig").setup_handlers({ + function(server_name) + require('lspconfig')[server_name].setup({ + on_attach = Attach_func, + capabilities = Capabilities, + flags = { + debounce_text_changes = 150 + }, + settings = servers[server_name] + }) + end + }) + end + } +} diff --git a/.config/nvim/lua/plugins/nvim-scrollbar.lua b/.config/nvim/lua/plugins/nvim-scrollbar.lua new file mode 100644 index 0000000..b633901 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-scrollbar.lua @@ -0,0 +1,59 @@ +return { + -- scrollbar with git and diagnostics support for easier navigation + { + 'petertriho/nvim-scrollbar', + dependencies = { + 'kevinhwang91/nvim-hlslens', + 'lewis6991/gitsigns.nvim' + }, + config = function() + require("scrollbar").setup({ + marks = { + Cursor = { + highlight = "Normal" + }, + Search = { + highlight = "Special" + }, + Error = { + highlight = "DiagnosticSignError" + }, + Warn = { + highlight = "DiagnosticSignWarn" + }, + Info = { + highlight = "DiagnosticSignInfo" + }, + Hint = { + highlight = "DiagnosticSignHint" + }, + Misc = { + highlight = "Special" + }, + GitAdd = { + highlight = "GitGutterAdd" + }, + GitChange = { + highlight = "GitGutterChange" + }, + GitDelete = { + highlight = "GitGutterDelete" + } + }, + excluded_filetypes = { + "cmp_docs", + "cmp_menu", + "noice", + "prompt", + "TelescopePrompt", + "NvimTree", + "Navbuddy", + "FTerm", + "", + }, + }) + require("scrollbar.handlers.search").setup() + require("scrollbar.handlers.gitsigns").setup() + end + } +} diff --git a/.config/nvim/lua/plugins/nvim-surround.lua b/.config/nvim/lua/plugins/nvim-surround.lua new file mode 100644 index 0000000..a900f9e --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-surround.lua @@ -0,0 +1,9 @@ +return { + -- additional quote/parantheses funtions + { + 'kylechui/nvim-surround', + version = "*", + event = "VeryLazy", + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..1d7ea96 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-tree.lua @@ -0,0 +1,30 @@ +return { + -- fileexplorer on the side + { + "nvim-tree/nvim-tree.lua", + cmd = "NvimTreeToggle", + dependencies = { + { + "nvim-tree/nvim-web-devicons", + lazy = true + }, + }, + opts = { + sort_by = "case_sensitive", + view = { + width = 30, + }, + filters = { + dotfiles = true, + }, + renderer = { + group_empty = true, + icons = { + glyphs = { + git = Git_signs + }, + }, + } + } + } +} diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..646efee --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,36 @@ +return { + -- better language highlighting by improved parsing + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + dependencies = { + -- automatically close html-tags + 'windwp/nvim-ts-autotag', + -- color brackets + 'p00f/nvim-ts-rainbow', + }, + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { + "bash", + "css", + "html", + "markdown", + "markdown_inline", + "latex", + "python", + "lua", + }, + highlight = { enable = true }, + autotag = { enable = true }, + rainbow = { + enable = true, + extended_mode = true, + max_file_lines = nil, + -- colors = {}, + -- termcolors = {} + } + }) + end + } +} diff --git a/.config/nvim/lua/plugins/nvim-ufo.lua b/.config/nvim/lua/plugins/nvim-ufo.lua new file mode 100644 index 0000000..5cdb466 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-ufo.lua @@ -0,0 +1,20 @@ +return { + -- folding improvements + { + 'kevinhwang91/nvim-ufo', + dependencies = { 'kevinhwang91/promise-async' }, + config = function() + require('ufo').setup() + vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, + { + pattern = { '*' }, + callback = function() require("ufo").closeAllFolds() end + }) + vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' }, + { + pattern = { '*' }, + callback = function() require("ufo").openAllFolds() end + }) + end + } +} diff --git a/.config/nvim/lua/plugins/renamer.lua b/.config/nvim/lua/plugins/renamer.lua new file mode 100644 index 0000000..3f53957 --- /dev/null +++ b/.config/nvim/lua/plugins/renamer.lua @@ -0,0 +1,8 @@ +return { + -- improved gui for renaming + { + 'filipdutescu/renamer.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/spelunker.lua b/.config/nvim/lua/plugins/spelunker.lua new file mode 100644 index 0000000..2945f01 --- /dev/null +++ b/.config/nvim/lua/plugins/spelunker.lua @@ -0,0 +1,12 @@ +return { + -- improve spelling check for coding to feature camelcase, etc + { + 'kamykn/spelunker.vim', + dependencies = { 'kamykn/popup-menu.nvim' }, + config = function() + vim.o.nospell = true + vim.g.enable_spelunker_vim = 0 + vim.g.spelunker_disable_acronym_checking = 1 + end + } +} diff --git a/.config/nvim/lua/plugins/tccs.lua b/.config/nvim/lua/plugins/tccs.lua new file mode 100644 index 0000000..06b7373 --- /dev/null +++ b/.config/nvim/lua/plugins/tccs.lua @@ -0,0 +1,13 @@ +return { + -- colorscheme + { + 'tiyn/tccs.nvim', + lazy = false, + priority = 1000, + config = function() + require('tccs').setup({ + require('tccs').load() + }) + end + } +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..8382353 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,9 @@ +return { + -- fuzzy finder + { + 'nvim-telescope/telescope.nvim', + version = '0.1.2', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/tidy.lua b/.config/nvim/lua/plugins/tidy.lua new file mode 100644 index 0000000..e785dce --- /dev/null +++ b/.config/nvim/lua/plugins/tidy.lua @@ -0,0 +1,9 @@ +return { + -- clean up white spaces and empty lines before writing + { + "mcauley-penney/tidy.nvim", + opts = { + filetype_exclude = {} + } + } +} diff --git a/.config/nvim/lua/plugins/todo-comments.lua b/.config/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..e2b5942 --- /dev/null +++ b/.config/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,22 @@ +return { + -- todo symbols and highlighting + { + 'folke/todo-comments.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + keywords = { + ERRO = { icon = Error_sign, color = "error" }, + WARN = { icon = Warn_sign, color = "warning" }, + HACK = { icon = Hack_sign, color = "warning" }, + HINT = { icon = Hint_sign, color = "hint" }, + TODO = { icon = Todo_sign, color = "info" }, + INFO = { icon = Info_sign, color = "hint", alt = { "NOTE" } }, + PERF = { icon = Perfect_sign, color = "default" }, + TEST = { icon = Test_sign, color = "test" } + }, + colors = { + default = { "Operator" } + } + } + } +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..894469a --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,13 @@ +return { + -- list of errors + { + 'folke/trouble.nvim', + dependencies = { + { + 'nvim-tree/nvim-web-devicons', + lazy = true + } + }, + opts = {} + } +} diff --git a/.config/nvim/lua/plugins/vim-markdown.lua b/.config/nvim/lua/plugins/vim-markdown.lua new file mode 100644 index 0000000..8748c52 --- /dev/null +++ b/.config/nvim/lua/plugins/vim-markdown.lua @@ -0,0 +1,10 @@ +return { + -- markdown improvements + { + 'preservim/vim-markdown', + ft = { 'markdown' }, + dependencies = { 'godlygeek/tabular' }, + config = function() + end + } +} diff --git a/.config/nvim/lua/plugins/vim-renamer.lua b/.config/nvim/lua/plugins/vim-renamer.lua new file mode 100644 index 0000000..bd63f98 --- /dev/null +++ b/.config/nvim/lua/plugins/vim-renamer.lua @@ -0,0 +1,10 @@ +return { + -- rename files in buffer + { + 'qpkorr/vim-renamer', + priority = 100, + config = function() + require('renamer') + end + } +} diff --git a/.config/nvim/lua/plugins/wilder.lua b/.config/nvim/lua/plugins/wilder.lua new file mode 100644 index 0000000..b7482b8 --- /dev/null +++ b/.config/nvim/lua/plugins/wilder.lua @@ -0,0 +1,46 @@ +return { + -- improved wild menu + { + 'gelguy/wilder.nvim', + dependencies = { + { + "nvim-tree/nvim-web-devicons", + lazy = true + }, + 'roxma/nvim-yarp', + 'roxma/vim-hug-neovim-rpc', + 'romgrk/fzy-lua-native' + }, + config = function() + local wilder = require('wilder') + wilder.setup({ + modes = { ':', '/', '?' }, + accept_key = '', + reject_key = '' + }) + wilder.set_option('renderer', wilder.popupmenu_renderer({ + highlighter = wilder.basic_highlighter(), + left = { ' ', wilder.popupmenu_devicons() }, + right = { ' ', wilder.popupmenu_scrollbar() }, + })) + wilder.set_option('pipeline', { + wilder.branch( + wilder.python_file_finder_pipeline({ + file_command = { 'find', '.', '-type', 'f', '-printf', '%P\n' }, + dir_command = { 'find', '.', '-type', 'd', '-printf', '%P\n' }, + filters = { 'fuzzy_filter', 'difflib_sorter' }, + }), + wilder.cmdline_pipeline({ + language = 'python', + fuzzy = 2, + }), + wilder.python_search_pipeline({ + pattern = wilder.python_fuzzy_pattern(), + sorter = wilder.python_difflib_sorter(), + engine = 're', + }) + ), + }) + end, + } +}