From 3709c38c6d39ea9c9bb8d90f31a111e174efe76a Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Wed, 14 Aug 2024 13:16:37 +0545 Subject: [PATCH 1/4] update --- lua/preferences.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/preferences.lua b/lua/preferences.lua index cf2c71a..76ecd5b 100644 --- a/lua/preferences.lua +++ b/lua/preferences.lua @@ -48,6 +48,7 @@ opt.backup = false -- creates a backup file opt.autowrite = true opt.autoindent = true opt.ai = true +opt.termguicolors =true -- Fix markdown indentation settings vim.g.markdown_recommended_style = 0 From d93e3880674dfaa46d0a6dc9c4513571aa4d15b3 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Wed, 14 Aug 2024 14:40:31 +0545 Subject: [PATCH 2/4] update --- lazy-lock.json | 8 ++-- lua/keymaps.lua | 6 +-- lua/plugins.lua | 21 +-------- lua/plugins/barbar.lua | 10 ---- lua/plugins/bufferline.lua | 33 +++++++++++++ lua/plugins/codeium.lua | 15 +++--- lua/plugins/completions.lua | 37 +++++++++++---- lua/plugins/dashboard.lua | 60 ------------------------ lua/plugins/inc-rename.lua | 6 +++ lua/plugins/lspconfig.lua | 38 --------------- lua/plugins/lualine.lua | 51 +++----------------- lua/plugins/markdown.lua | 14 ++++++ lua/plugins/mason.lua | 54 ++++++++++++++++++++++ lua/plugins/nerdy.lua | 9 ++++ lua/plugins/none-ls.lua | 82 +++++++++++++++++++++++++++------ lua/plugins/notify.lua | 1 - lua/plugins/nvim-treesitter.lua | 39 +++++++++++----- 17 files changed, 261 insertions(+), 223 deletions(-) delete mode 100644 lua/plugins/barbar.lua create mode 100644 lua/plugins/bufferline.lua delete mode 100644 lua/plugins/dashboard.lua create mode 100644 lua/plugins/inc-rename.lua create mode 100644 lua/plugins/markdown.lua create mode 100644 lua/plugins/mason.lua create mode 100644 lua/plugins/nerdy.lua diff --git a/lazy-lock.json b/lazy-lock.json index f935e75..26da048 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,22 +2,24 @@ "LuaSnip": { "branch": "master", "commit": "b84eeb3641b08324287587b426ec974b888390d9" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "alpha-nvim": { "branch": "main", "commit": "355fbb81a59637a8963cf5847074f8c44dbef11f" }, - "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" }, + "bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "codeium.vim": { "branch": "main", "commit": "0b74f274b82c00eaad4b5b5cd8b2e76f872d19f1" }, "dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" }, "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, - "github-preview.nvim": { "branch": "main", "commit": "b1f286a0c2c5bfcc0fea467decbb73e657428065" }, - "gitsigns.nvim": { "branch": "main", "commit": "562dc47189ad3c8696dbf460d38603a74d544849" }, + "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "f2acd4a21db1ca0a12559e7a9f7cdace3bdbfb09" }, + "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, + "nerdy.nvim": { "branch": "main", "commit": "b467d6609b78d6a5f1e12cbc08fcc1ac87af20f5" }, "none-ls.nvim": { "branch": "main", "commit": "cfa65d86e21eeb60544d5e823f6db43941322a53" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, "nvim": { "branch": "main", "commit": "18bab5ec4c782cdf7d7525dbe89c60bfa02fc195" }, diff --git a/lua/keymaps.lua b/lua/keymaps.lua index dcf6554..f3eb5ba 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -17,9 +17,9 @@ end) vim.keymap.set('n', 'ft', vim.lsp.buf.format, {}) -- buffer -vim.keymap.set('n', '', ':BufferNext') -vim.keymap.set('n', '', ':BufferPrevious') -vim.keymap.set('n', 'q', ':BufferClose') +vim.keymap.set("n", "", ":BufferLineCycleNext") +vim.keymap.set("n", "", ":BufferLineCyclePrev") +vim.keymap.set("n", "q", ":BufferLinePickClose") -- comment vim.keymap.set('n', '/', 'gcc', { remap = true }) diff --git a/lua/plugins.lua b/lua/plugins.lua index 0658aee..a564707 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -1,20 +1 @@ -return { - -- Markdown Preview - { - 'wallpants/github-preview.nvim', - cmd = { 'GithubPreviewToggle' }, - keys = { 'mpt' }, - opts = { - -- config goes here - }, - config = function(_, opts) - local gpreview = require('github-preview') - gpreview.setup(opts) - - local fns = gpreview.fns - vim.keymap.set('n', 'mpt', fns.toggle) - vim.keymap.set('n', 'mps', fns.single_file_toggle) - vim.keymap.set('n', 'mpd', fns.details_tags_toggle) - end, - }, -} +return {} diff --git a/lua/plugins/barbar.lua b/lua/plugins/barbar.lua deleted file mode 100644 index 7737d97..0000000 --- a/lua/plugins/barbar.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - 'romgrk/barbar.nvim', - dependencies = { - 'nvim-tree/nvim-web-devicons', - 'lewis6991/gitsigns.nvim', - }, - config = function() - require('barbar').setup() - end, -} diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua new file mode 100644 index 0000000..39568fd --- /dev/null +++ b/lua/plugins/bufferline.lua @@ -0,0 +1,33 @@ +return { + 'akinsho/bufferline.nvim', + event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, + version = '*', + dependencies = 'nvim-tree/nvim-web-devicons', + opts = { + options = { + debug = { logging = true }, + mode = 'buffers', + indicator = { icon = '▍', style = 'none' }, + sort_by = 'insert_after_current', + move_wraps_at_ends = true, + right_mouse_command = 'vert sbuffer %d', + show_close_icon = false, + show_buffer_close_icons = false, + diagnostics = 'nvim_lsp', + diagnostics_indicator = function(count, level) + local icon = level:match('error') and ' ' or ' ' + return ' ' .. icon .. count + end, + diagnostics_update_in_insert = false, + hover = { enabled = true, reveal = { 'close' } }, + offsets = { + { + filetype = 'neo-tree', + text = ' File Explorer', + highlight = 'Directory', + separator = false, + }, + }, + }, + }, +} diff --git a/lua/plugins/codeium.lua b/lua/plugins/codeium.lua index 0a490b9..a83d9d6 100644 --- a/lua/plugins/codeium.lua +++ b/lua/plugins/codeium.lua @@ -3,22 +3,21 @@ return { event = 'InsertEnter', cmd = 'Codeium', build = 'Codeium Auth:', - dependencies = { - 'nvim-lua/plenary.nvim', - 'hrsh7th/nvim-cmp', - }, config = function() - vim.keymap.set('i', '', function() + vim.keymap.set('i', '', function() return vim.fn['codeium#Accept']() end, { expr = true, silent = true }) - vim.keymap.set('i', '', function() + vim.keymap.set("n", "c", function() + return vim.fn["codeium#Chat"]() + end, { desc = "Chat with IA (Codeium)" }) + vim.keymap.set('i', '', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true, silent = true }) - vim.keymap.set('i', '', function() + vim.keymap.set('i', '', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true, silent = true }) - vim.keymap.set('i', '', function() + vim.keymap.set('i', '', function() return vim.fn['codeium#Clear']() end, { expr = true, silent = true }) end, diff --git a/lua/plugins/completions.lua b/lua/plugins/completions.lua index d2af186..e1f1a4e 100644 --- a/lua/plugins/completions.lua +++ b/lua/plugins/completions.lua @@ -33,7 +33,30 @@ return { [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require('luasnip').expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require('luasnip').jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, @@ -44,15 +67,11 @@ return { }), formatting = { format = lspkind.cmp_format({ - mode = 'symbol', -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - -- can also be a function to dynamically calculate max width such as - -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, - ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) - show_labelDetails = true, -- show labelDetails in menu. Disabled by default + mode = 'symbol', + maxwidth = 50, + ellipsis_char = '...', + show_labelDetails = true, - -- The function below will be called before any actual modifications from lspkind - -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) before = function(entry, vim_item) return vim_item end, diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua deleted file mode 100644 index 054e1fe..0000000 --- a/lua/plugins/dashboard.lua +++ /dev/null @@ -1,60 +0,0 @@ -return { - 'nvimdev/dashboard-nvim', - dependencies = { - 'nvim-tree/nvim-web-devicons', - }, - event = 'VimEnter', - config = function() - require('dashboard').setup({ - theme = 'hyper', - disable_move = false, - shortcut_type = 'letter', - change_to_vcs_root = true, - hide = { - statusline = true, - tabline = false, - winbar = false, - }, - config = { - header = { - '', - - ' ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ', - ' ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ', - ' ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ', - ' ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ', - ' ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ', - ' ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ', - '', - }, - weak_header = { - enable = false, - append = { ' Learn, Make, Explore! ' }, - }, - packages = { enable = true }, - project = { enable = true, limit = 8 }, - mru = { limit = 8 }, - shortcut ={ - { - desc = ' Recent files', - group = 'Label', - action = 'Telescope oldfiles', - key = 'r', - }, - { - desc = ' Find file', - group = 'Label', - action = 'Telescope find_files', - key = 'f', - }, - { - desc = ' Find text', - group = 'Label', - action = 'Telescope live_grep', - key = 't', - }, - }, - }, - }) - end, -} diff --git a/lua/plugins/inc-rename.lua b/lua/plugins/inc-rename.lua new file mode 100644 index 0000000..49c2ac0 --- /dev/null +++ b/lua/plugins/inc-rename.lua @@ -0,0 +1,6 @@ +return { + "smjonas/inc-rename.nvim", + config = function() + require("inc_rename").setup() + end, +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index eac5a41..90060d0 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -1,42 +1,4 @@ return { - { - 'williamboman/mason.nvim', - cmd = 'Mason', - dependencies = { - 'williamboman/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', - }, - config = function() - require('mason').setup() - require('mason-lspconfig').setup({ - ensure_installed = { - 'lua_ls', - 'clangd', - 'pylsp', - 'bashls', - 'jsonls', - 'vimls', - 'jdtls', - 'html', - 'cssls', - 'tailwindcss', - 'tsserver', - }, - }) - - require('mason-tool-installer').setup({ - ensure_installed = { - 'prettier', - 'stylua', - 'clang-format', - 'black', - 'gdformat', - 'djhtml', - }, - }) - end, - }, - { 'neovim/nvim-lspconfig', event = { 'BufReadPre', 'BufNewFile' }, diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index fcf8a75..7e5e51b 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -1,46 +1,7 @@ -return { - 'nvim-lualine/lualine.nvim', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - require('lualine').setup({ - options = { - icons_enabled = true, - theme = 'auto', - component_separators = { left = '', right = '' }, - section_separators = { left = '', right = '' }, - disabled_filetypes = { - statusline = {}, - winbar = {}, - }, - ignore_focus = {}, - always_divide_middle = true, - globalstatus = false, - refresh = { - statusline = 1000, - tabline = 1000, - winbar = 1000, - }, - }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch', 'diff', 'diagnostics' }, - lualine_c = { 'filename' }, - lualine_x = { 'encoding', 'fileformat', 'filetype' }, - lualine_y = { 'progress' }, - lualine_z = { 'location' }, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { 'filename' }, - lualine_x = { 'location' }, - lualine_y = {}, - lualine_z = {}, - }, - tabline = {}, - winbar = {}, - inactive_winbar = {}, - extensions = {}, - }) - end, + return { + "nvim-lualine/lualine.nvim", + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + require("lualine").setup() + end, } diff --git a/lua/plugins/markdown.lua b/lua/plugins/markdown.lua new file mode 100644 index 0000000..019b87d --- /dev/null +++ b/lua/plugins/markdown.lua @@ -0,0 +1,14 @@ +return { + { + 'iamcco/markdown-preview.nvim', + build = 'cd app && yarn install', + ft = { 'markdown' }, + keys = { + { + 'mp', + 'MarkdownPreviewToggle', + { desc = 'toggle markdown preview', noremap = true }, + }, + }, + }, +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..aae1854 --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,54 @@ +return { + 'williamboman/mason.nvim', + cmd = { 'Mason', 'MasonInstall', 'MasonInstallAll', 'MasonUpdate' }, + dependencies = { + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + }, + config = function() + local mason = require('mason') + local mason_lspconfig = require('mason-lspconfig') + local mason_tool_installer = require('mason-tool-installer') + + -- enable mason and configure icons + mason.setup({ + ui = { + border = 'rounded', + icons = { + package_installed = '✓', + package_pending = '➜', + package_uninstalled = '✗', + }, + }, + }) + + mason_lspconfig.setup({ + -- list of servers for mason to install + ensure_installed = { + 'tsserver', + 'html', + 'cssls', + 'tailwindcss', + 'lua_ls', + 'pyright', + 'jdtls', + 'bashls', + 'jsonls', + 'clangd', + }, + }) + + mason_tool_installer.setup({ + ensure_installed = { + 'prettier', -- prettier formatter + 'biome', -- js formatter + 'stylua', -- lua formatter + 'black', -- python formatter + 'clang-format', -- c/c++ formatter + 'luacheck', + 'pylint', + 'eslint_d', + }, + }) + end, +} diff --git a/lua/plugins/nerdy.lua b/lua/plugins/nerdy.lua new file mode 100644 index 0000000..e61830c --- /dev/null +++ b/lua/plugins/nerdy.lua @@ -0,0 +1,9 @@ +return { + "2kabhishek/nerdy.nvim", + dependencies = { + "stevearc/dressing.nvim", + "nvim-telescope/telescope.nvim", + }, + cmd = "Nerdy", + vim.keymap.set("n", "si", "Nerdy", opts), --> nerd icons +} diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua index a5396e2..06e028b 100644 --- a/lua/plugins/none-ls.lua +++ b/lua/plugins/none-ls.lua @@ -1,18 +1,70 @@ return { - 'nvimtools/none-ls.nvim', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local null_ls = require('null-ls') + 'nvimtools/none-ls.nvim', -- configure formatters & linters + event = { 'CursorHold', 'CursorHoldI' }, + dependencies = { + 'jay-babu/mason-null-ls.nvim', + }, + config = function() + local mason_null_ls = require('mason-null-ls') - null_ls.setup({ - sources = { - null_ls.builtins.formatting.stylua, - null_ls.builtins.formatting.prettier, - null_ls.builtins.formatting.clang_format, - null_ls.builtins.formatting.black, - null_ls.builtins.formatting.gdformat, - null_ls.builtins.formatting.djhtml, - }, - }) - end, + local null_ls = require('null-ls') + + local null_ls_utils = require('null-ls.utils') + + mason_null_ls.setup({ + ensure_installed = { + 'prettier', -- prettier formatter + 'biome', -- js formatter + 'clang-format', -- c/c++ formatter + 'stylua', -- lua formatter + 'black', -- python formatter + 'pylint', -- python linter + -- "eslint_d", -- js linter + }, + }) + + -- for conciseness + local formatting = null_ls.builtins.formatting -- to setup formatters + local diagnostics = null_ls.builtins.diagnostics -- to setup linters + + -- to setup format on save + local augroup = vim.api.nvim_create_augroup('LspFormatting', {}) + + -- configure null_ls + null_ls.setup({ + root_dir = null_ls_utils.root_pattern('.null-ls-root', 'Makefile', '.git', 'package.json'), + sources = { + formatting.prettier, -- js/ts formatter + formatting.stylua, -- lua formatter + formatting.isort, + formatting.black, + formatting.clang_format, + diagnostics.pylint, + -- diagnostics.eslint_d.with({ -- js/ts linter + -- condition = function(utils) + -- return utils.root_has_file({ ".eslintrc.js", ".eslintrc.cjs" }) -- only enable if root has .eslintrc.js or .eslintrc.cjs + -- end, + -- }), + }, + -- configure format on save + on_attach = function(current_client, bufnr) + if current_client.supports_method('textDocument/formatting') then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd('BufWritePre', { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.format({ + filter = function(client) + -- only use null-ls for formatting instead of lsp server + return client.name == 'null-ls' + end, + bufnr = bufnr, + }) + end, + }) + end + end, + }) + end, } diff --git a/lua/plugins/notify.lua b/lua/plugins/notify.lua index d7b98ee..74fb19a 100644 --- a/lua/plugins/notify.lua +++ b/lua/plugins/notify.lua @@ -1,6 +1,5 @@ return { 'rcarriga/nvim-notify', - event = 'VeryLazy', config = function() vim.notify = require('notify') diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua index 6238aad..5ad35e5 100644 --- a/lua/plugins/nvim-treesitter.lua +++ b/lua/plugins/nvim-treesitter.lua @@ -1,18 +1,35 @@ return { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', dependencies = { 'windwp/nvim-ts-autotag', }, event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local configs = require("nvim-treesitter.configs") + config = function() + local configs = require('nvim-treesitter.configs') - configs.setup({ - ensure_installed = { "c", "lua", "vim", "vimdoc", "python", "cpp", "html", "css", "javascript", "typescript", "json", "php", "gdscript", 'markdown', 'markdown_inline', 'bash','java' }, - sync_install = true, - highlight = { enable = true }, - indent = { enable = true }, - }) - end, + configs.setup({ + ensure_installed = { + 'c', + 'lua', + 'vim', + 'vimdoc', + 'python', + 'cpp', + 'html', + 'css', + 'javascript', + 'typescript', + 'json', + 'php', + 'markdown', + 'markdown_inline', + 'bash', + 'java', + }, + sync_install = true, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, } From c9d290595f853ba3253795e821830c0d72c0edfa Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 15 Aug 2024 19:28:13 +0545 Subject: [PATCH 3/4] huge updates --- init.lua | 31 +---- lazy-lock.json | 31 +++-- lua/config/autocmd.lua | 95 +++++++++++++++ lua/config/icons.lua | 158 ++++++++++++++++++++++++ lua/config/keymaps.lua | 84 +++++++++++++ lua/config/lazy.lua | 77 ++++++++++++ lua/config/options.lua | 59 +++++++++ lua/{ => config}/remaps.lua | 97 ++++++++------- lua/keymaps.lua | 80 ------------- lua/plugins.lua | 1 - lua/plugins/alpha.lua | 80 ++++++------- lua/plugins/auto-pairs.lua | 15 ++- lua/plugins/buff_delete.lua | 9 ++ lua/plugins/bufferline.lua | 4 + lua/plugins/colorschemes.lua | 47 ++++---- lua/plugins/comment.lua | 10 ++ lua/plugins/completions.lua | 159 +++++++++++------------- lua/plugins/database.lua | 54 +++++++++ lua/plugins/dbee.lua | 32 ----- lua/plugins/inc-rename.lua | 6 - lua/plugins/lualine.lua | 206 +++++++++++++++++++++++++++++++- lua/plugins/mason.lua | 1 + lua/plugins/navigator.lua | 7 ++ lua/plugins/neo-tree.lua | 18 +-- lua/plugins/nerdy.lua | 14 +-- lua/plugins/noice.lua | 32 +++++ lua/plugins/notify.lua | 43 ++++--- lua/plugins/nvim-surround.lua | 7 -- lua/plugins/nvim-treesitter.lua | 119 +++++++++++++----- lua/plugins/oil.lua | 40 ------- lua/plugins/presistence.lua | 28 +++++ lua/plugins/refactoring.lua | 32 ----- lua/plugins/surround.lua | 15 +++ lua/plugins/telescope.lua | 150 +++++++++++++++++++---- lua/plugins/terminal.lua | 4 + lua/plugins/wilder.lua | 3 - lua/preferences.lua | 62 ---------- 37 files changed, 1309 insertions(+), 601 deletions(-) create mode 100644 lua/config/autocmd.lua create mode 100644 lua/config/icons.lua create mode 100644 lua/config/keymaps.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/options.lua rename lua/{ => config}/remaps.lua (70%) delete mode 100644 lua/keymaps.lua delete mode 100644 lua/plugins.lua create mode 100644 lua/plugins/buff_delete.lua create mode 100644 lua/plugins/comment.lua create mode 100644 lua/plugins/database.lua delete mode 100644 lua/plugins/dbee.lua delete mode 100644 lua/plugins/inc-rename.lua create mode 100644 lua/plugins/noice.lua delete mode 100644 lua/plugins/nvim-surround.lua delete mode 100644 lua/plugins/oil.lua create mode 100644 lua/plugins/presistence.lua delete mode 100644 lua/plugins/refactoring.lua create mode 100644 lua/plugins/surround.lua delete mode 100644 lua/preferences.lua diff --git a/init.lua b/init.lua index 7ca9ad2..8f59cb0 100644 --- a/init.lua +++ b/init.lua @@ -1,27 +1,4 @@ -require('preferences') -require('keymaps') -require('remaps') - -local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = 'https://github.com/folke/lazy.nvim.git' - local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, - { out, 'WarningMsg' }, - { '\nPress any key to exit...' }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - -require('lazy').setup({ - spec = { - { import = 'plugins' }, - }, -}) - -vim.cmd('colorscheme onedark') +require('config.keymaps') +require('config.options') +require('config.lazy') +require('config.autocmd') diff --git a/lazy-lock.json b/lazy-lock.json index 26da048..fc3134e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,42 +2,49 @@ "LuaSnip": { "branch": "master", "commit": "b84eeb3641b08324287587b426ec974b888390d9" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "alpha-nvim": { "branch": "main", "commit": "355fbb81a59637a8963cf5847074f8c44dbef11f" }, + "bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" }, "bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "codeium.vim": { "branch": "main", "commit": "0b74f274b82c00eaad4b5b5cd8b2e76f872d19f1" }, "dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" }, "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, - "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "f2acd4a21db1ca0a12559e7a9f7cdace3bdbfb09" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "3ed90180e70a6a50cd37ce7ecc3693bcdaa7b290" }, "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.comment": { "branch": "main", "commit": "03c13e37318bdb18481311c0ac1adc9ed731caf1" }, + "mini.surround": { "branch": "main", "commit": "57caca9525cec0ea771a67326b0ee637d056078a" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, "nerdy.nvim": { "branch": "main", "commit": "b467d6609b78d6a5f1e12cbc08fcc1ac87af20f5" }, "none-ls.nvim": { "branch": "main", "commit": "cfa65d86e21eeb60544d5e823f6db43941322a53" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, - "nvim": { "branch": "main", "commit": "18bab5ec4c782cdf7d7525dbe89c60bfa02fc195" }, + "nvim-autopairs": { "branch": "master", "commit": "48ca9aaee733911424646cb1605f27bc01dedbe3" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, - "nvim-dbee": { "branch": "master", "commit": "21d2cc0844a16262bb6ea93ab3d0a0f20bd87853" }, - "nvim-lspconfig": { "branch": "master", "commit": "a67bc39aaa4f1e13212c5022a561120846eaef27" }, + "nvim-lspconfig": { "branch": "master", "commit": "037ea0901ce9a28cfcaa36302618f06d2e164fbf" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, - "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, - "nvim-treesitter": { "branch": "master", "commit": "047ce49ccf9a2dce22e1cf3843bef3b5682a8144" }, - "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, + "nvim-treesitter": { "branch": "master", "commit": "bfb50de9cb0673a3bff620d881f690fb7e0d1328" }, + "nvim-treesitter-context": { "branch": "master", "commit": "0f3332788e0bd37716fbd25f39120dcfd557c90f" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "ced6375723b20616282f9f6a1018a63ae19b106a" }, + "nvim-ts-autotag": { "branch": "main", "commit": "0cb76eea80e9c73b88880f0ca78fbd04c5bdcac7" }, "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, - "oil.nvim": { "branch": "master", "commit": "fcca212c2e966fc3dec1d4baf888e670631d25d1" }, "onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" }, + "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, - "refactoring.nvim": { "branch": "master", "commit": "c406fc5fb4d7ba5fce7b668637075fad6e75e9f8" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, - "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" }, "termim.nvim": { "branch": "main", "commit": "58344167abb97bcef9bf720a762ea653a94e9daa" }, - "ultimate-autopair.nvim": { "branch": "v0.6", "commit": "1420fb9e07b1d80cc6d87e7d90827fb2c1109cb3" }, + "vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" }, + "vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" }, + "vim-dadbod-ui": { "branch": "master", "commit": "0f51d8de368c8c6220973e8acd156d17da746f4c" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } } diff --git a/lua/config/autocmd.lua b/lua/config/autocmd.lua new file mode 100644 index 0000000..d968dae --- /dev/null +++ b/lua/config/autocmd.lua @@ -0,0 +1,95 @@ +-- don't auto comment new line +vim.api.nvim_create_autocmd('BufEnter', { command = [[set formatoptions-=cro]] }) + +-- to make border as same as neovim ColorScheme +vim.api.nvim_create_autocmd({ 'UIEnter', 'ColorScheme' }, { + callback = function() + local normal = vim.api.nvim_get_hl(0, { name = 'Normal' }) + if not normal.bg then + return + end + io.write(string.format('\027Ptmux;\027\027]11;#%06x\007\027\\', normal.bg)) + io.write(string.format('\027]11;#%06x\027\\', normal.bg)) + end, +}) + +vim.api.nvim_create_autocmd('UILeave', { + callback = function() + io.write('\027Ptmux;\027\027]111;\007\027\\') + io.write('\027]111\027\\') + end, +}) + +-- Highlight on yank +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, +}) + +-- go to last loc when opening a buffer +-- this mean that when you open a file, you will be at the last position +vim.api.nvim_create_autocmd('BufReadPost', { + callback = function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local lcount = vim.api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) + +-- auto close brackets +vim.api.nvim_create_autocmd('FileType', { pattern = 'man', command = [[nnoremap q :quit]] }) + +-- show cursor line only in active window +local cursorGrp = vim.api.nvim_create_augroup('CursorLine', { clear = true }) +vim.api.nvim_create_autocmd({ 'InsertLeave', 'WinEnter' }, { + pattern = '*', + command = 'set cursorline', + group = cursorGrp, +}) +vim.api.nvim_create_autocmd( + { 'InsertEnter', 'WinLeave' }, + { pattern = '*', command = 'set nocursorline', group = cursorGrp } +) + +-- Enable spell checking for certain file types +vim.api.nvim_create_autocmd( + { 'BufRead', 'BufNewFile' }, + -- { pattern = { "*.txt", "*.md", "*.tex" }, command = [[setlocal spell setlocal spelllang=en,de]] } + { + pattern = { '*.txt', '*.md', '*.tex' }, + callback = function() + vim.opt.spell = true + vim.opt.spelllang = 'en,de' + end, + } +) + +-- close some filetypes with +vim.api.nvim_create_autocmd('FileType', { + group = vim.api.nvim_create_augroup('close_with_q', { clear = true }), + pattern = { + 'PlenaryTestPopup', + 'help', + 'lspinfo', + 'man', + 'notify', + 'qf', + 'spectre_panel', + 'startuptime', + 'tsplayground', + 'neotest-output', + 'checkhealth', + 'neotest-summary', + 'neotest-output-panel', + }, + callback = function(event) + vim.bo[event.buf].buflisted = false + vim.keymap.set('n', 'q', 'close', { buffer = event.buf, silent = true }) + end, +}) + +-- resize neovim split when terminal is resized +vim.api.nvim_command('autocmd VimResized * wincmd =') diff --git a/lua/config/icons.lua b/lua/config/icons.lua new file mode 100644 index 0000000..406c11c --- /dev/null +++ b/lua/config/icons.lua @@ -0,0 +1,158 @@ +return { + kind = { + Array = '', + Boolean = '', + Class = '', + Color = '', + Constant = '', + Constructor = '', + Enum = '', + EnumMember = '', + Event = '', + Field = '', + File = '', + Folder = '󰉋', + Function = '', + Interface = '', + Key = '', + Keyword = '', + Method = '', + -- Module = " ", + Module = '', + Namespace = '', + Null = '󰟢', + Number = '', + Object = '', + Operator = '', + Package = '', + Property = '', + Reference = '', + Snippet = '', + String = '', + Struct = '', + Text = '', + TypeParameter = '', + Unit = '', + Value = '', + Variable = '', + }, + git = { + LineAdded = '', + LineModified = '', + LineRemoved = '', + FileDeleted = '', + FileIgnored = '◌', + FileRenamed = '', + FileStaged = 'S', + FileUnmerged = '', + FileUnstaged = '', + FileUntracked = 'U', + Diff = '', + Repo = '', + Octoface = '', + Copilot = '', + Branch = '', + }, + ui = { + ArrowCircleDown = '', + ArrowCircleLeft = '', + ArrowCircleRight = '', + ArrowCircleUp = '', + BoldArrowDown = '', + BoldArrowLeft = '', + BoldArrowRight = '', + BoldArrowUp = '', + BoldClose = '', + BoldDividerLeft = '', + BoldDividerRight = '', + BoldLineLeft = '▎', + BoldLineMiddle = '┃', + BoldLineDashedMiddle = '┋', + BookMark = '', + BoxChecked = '', + Bug = '', + Stacks = '', + Scopes = '', + Watches = '󰂥', + DebugConsole = '', + Calendar = '', + Check = '', + ChevronRight = '', + ChevronShortDown = '', + ChevronShortLeft = '', + ChevronShortRight = '', + ChevronShortUp = '', + Circle = '', + Close = '󰅖', + CloudDownload = '', + Code = '', + Comment = '', + Dashboard = '', + DividerLeft = '', + DividerRight = '', + DoubleChevronRight = '»', + Ellipsis = '', + EmptyFolder = '', + EmptyFolderOpen = '', + File = '', + FileSymlink = '', + Files = '', + FindFile = '󰈞', + FindText = '󰊄', + Fire = '', + Folder = '󰉋', + FolderOpen = '', + FolderSymlink = '', + Forward = '', + Gear = '', + History = '', + Lightbulb = '', + LineLeft = '▏', + LineMiddle = '│', + List = '', + Lock = '', + NewFile = '', + Note = '', + Package = '', + Pencil = '󰏫', + Plus = '', + Project = '', + Search = '', + SignIn = '', + SignOut = '', + Tab = '󰌒', + Table = '', + Target = '󰀘', + Telescope = '', + Text = '', + Tree = '', + Triangle = '󰐊', + TriangleShortArrowDown = '', + TriangleShortArrowLeft = '', + TriangleShortArrowRight = '', + TriangleShortArrowUp = '', + }, + diagnostics = { + BoldError = '', + Error = '', + BoldWarning = '', + Warn = '', + BoldInformation = '', + Info = '', + BoldQuestion = '', + Question = '', + BoldHint = '', + Hint = '󰌶', + Debug = '', + Trace = '✎', + }, + misc = { + Robot = '󰚩', + Squirrel = '', + Tag = '', + Watch = '', + Smiley = '', + Package = '', + CircuitBoard = '', + }, +} diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..8975fd4 --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,84 @@ +local opts = { noremap = true, silent = true } + +-- Increment / Decrement +vim.keymap.set('n', '+', '') +vim.keymap.set('n', '-', '') + +-- Select all +vim.keymap.set('n', '', 'ggG') + +-- Replace currently selected text with default register without yanking it +vim.keymap.set('x', 'p', '"_dP') + +-- Delete without yanking +vim.keymap.set('n', 'd', '"_d') +vim.keymap.set('v', 'd', '"_d') + +-- Clear highlights on search when pressing in normal mode +vim.keymap.set('n', '', 'nohlsearch') + +-- Resize window using arrow keys +vim.keymap.set('n', '', 'resize +2', { desc = 'Increase Window Height' }) +vim.keymap.set('n', '', 'resize -2', { desc = 'Decrease Window Height' }) +vim.keymap.set('n', '', 'vertical resize -2', { desc = 'Decrease Window Width' }) +vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Increase Window Width' }) + +-- Visual vim.keymap.sets +vim.keymap.set('v', 'r', '"hy:%s/h//g') -- Replace all instances of highlighted words +vim.keymap.set('v', '', ':sort') -- Sort highlighted text in visual mode with Control+S +vim.keymap.set('v', 'K', ":m '>-2gv=gv") -- Move current line up +vim.keymap.set('v', 'J', ":m '>+1gv=gv") -- Move current line down + +--utility vim.keymap.setpings +vim.keymap.set('n', 'n', 'nzzzv') -- keep the cursor centered when doing 'n' +vim.keymap.set('n', 'N', 'Nzzzv') -- keep the cursor centered when doing 'N' +vim.keymap.set('n', 'J', 'mzJ`z', { desc = 'Join line without moving the cursor' }) +vim.keymap.set('n', 'cn', '*``cgn', { desc = 'Change next match by pressing dot (.)' }) +vim.keymap.set('n', 'cN', '*``cgN', { desc = 'Change previous match by pressing dot (.)' }) +vim.keymap.set('n', 'vp', '`[v`]', { desc = 'Select pasted text' }) +vim.keymap.set('n', '', 'zz', { desc = 'Scroll down' }) +vim.keymap.set('n', '', 'zz', { desc = 'Scroll up' }) + +vim.keymap.set({ 'n', 'v' }, 'y', '"+y', { desc = 'Copy to system clipboard' }) +vim.keymap.set({ 'n', 'v' }, 'p', '"+p', { desc = 'Paste from system clipboard' }) + +vim.keymap.set({ 'i' }, '', '', { desc = 'Move cursor to right' }) +vim.keymap.set({ 'i' }, '', '', { desc = 'Move cursor to right' }) + +-- Better window management +vim.keymap.set('n', 'hs', ':split', opts) +vim.keymap.set('n', 'vs', ':vsplit', opts) +vim.keymap.set('n', '', 'h', { desc = 'Move to left split' }) +vim.keymap.set('n', '', 'j', { desc = 'Move to below split' }) +vim.keymap.set('n', '', 'k', { desc = 'Move to above split' }) +vim.keymap.set('n', '', 'l', { desc = 'Move to right split' }) +vim.keymap.set('n', '', 'resize -2', { desc = 'Resize split up' }) +vim.keymap.set('n', '', 'resize +2', { desc = 'Resize split down' }) +vim.keymap.set('n', '', 'vertical resize -2', { desc = 'Resize split left' }) +vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Resize split right' }) + +-- Stay in indent mode +vim.keymap.set('v', '<', '', '>gv', { desc = '(V) Indent to right' }) + +-- insert semicolon in the end +-- vim.keymap.set('i', '', 'miA;`ii', { desc = 'insert semicolon in the end' }) + +-- Change text without putting it into the vim register, +vim.keymap.set({ 'n', 'x' }, 'c', '"_c', { desc = 'Change without yanking' }) +vim.keymap.set({ 'n', 'x' }, 'C', '"_C', { desc = 'Change without yanking' }) +vim.keymap.set({ 'n', 'x' }, 'cc', '"_cc', { desc = 'Change without yanking' }) +vim.keymap.set({ 'n', 'x' }, 'x', '"_x', { desc = 'delete without yanking' }) + +-- Better escape using jk in insert and terminal mode +vim.keymap.set('i', 'jk', '') +vim.keymap.set('i', 'kj', '') +vim.keymap.set('i', 'jj', '') + +-- Terminal Mappings +vim.keymap.set('t', 'jk', '') +vim.keymap.set('t', 'kj', '') +vim.keymap.set('t', '', '') + +-- save file +vim.keymap.set({ 'i', 'v', 'n', 's' }, '', 'wa', { desc = 'Save all file' }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..480406d --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,77 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' +---@diagnostic disable-next-line: undefined-field +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, + { out, 'WarningMsg' }, + { '\nPress any key to exit...' }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +require('lazy').setup({ + spec = { + { import = 'plugins' }, + -- { import = 'plugins.themes' }, + }, + install = { + missing = true, + colorscheme = { 'onedark' }, + }, + checker = { + enabled = true, + notify = false, + }, + change_detection = { + enabled = true, + notify = false, + }, + ui = { + icons = { + ft = '', + lazy = '󰂠 ', + loaded = '', + not_loaded = '', + }, + }, + performance = { + rtp = { + disabled_plugins = { + '2html_plugin', + 'tohtml', + 'getscript', + 'getscriptPlugin', + 'gzip', + 'logipat', + 'netrw', + 'netrwPlugin', + 'netrwSettings', + 'netrwFileHandlers', + 'matchit', + 'tar', + 'tarPlugin', + 'rrhelper', + 'spellfile_plugin', + 'vimball', + 'vimballPlugin', + 'zip', + 'zipPlugin', + 'tutor', + 'rplugin', + 'syntax', + 'synmenu', + 'optwin', + 'compiler', + 'bugreport', + 'ftplugin', + }, + }, + }, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..90bed82 --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,59 @@ +--Remap space as leader key +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +vim.opt.backup = false -- creates a backup file +vim.opt.clipboard = 'unnamedplus' -- allows neovim to access the system clipboard +vim.opt.cmdheight = 0 -- more space in the neovim command line for displaying messages +vim.opt.completeopt = { 'menuone', 'noselect' } -- mostly just for cmp +vim.opt.conceallevel = 0 -- so that `` is visible in markdown files +-- vim.opt.fileencoding = "utf-8" -- the encoding written to a file +vim.opt.hlsearch = true -- highlight all matches on previous search pattern +vim.opt.ignorecase = true -- ignore case in search patterns +vim.opt.mouse = 'a' -- allow the mouse to be used in neovim +vim.opt.pumheight = 10 -- pop up menu height +vim.opt.pumblend = 10 +vim.opt.showmode = false -- we don't need to see things like -- INSERT -- anymore +vim.opt.showtabline = 2 -- always show tabs +vim.opt.smartcase = true -- smart case +vim.opt.smartindent = true -- make indenting smarter again +vim.opt.splitbelow = true -- force all horizontal splits to go below current window +vim.opt.splitright = true -- force all vertical splits to go to the right of current window +vim.opt.swapfile = false -- creates a swapfile +vim.opt.termguicolors = true -- set term gui colors (most terminals support this) +vim.opt.timeoutlen = 1000 -- time to wait for a mapped sequence to complete (in milliseconds) +vim.opt.undofile = true -- enable persistent undo +vim.opt.updatetime = 100 -- faster completion (4000ms default) +vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited +vim.opt.expandtab = true -- convert tabs to spaces +vim.opt.shiftwidth = 2 -- the number of spaces inserted for each indentation +vim.opt.tabstop = 2 -- insert 2 spaces for a tab +vim.opt.cursorline = false -- highlight the current line +vim.opt.cursorlineopt = 'number' +vim.opt.number = true -- set numbered lines +vim.opt.laststatus = 0 --disable native statusline +vim.opt.showcmd = false +vim.opt.ruler = false +vim.opt.relativenumber = true -- set relative numbered lines +vim.opt.numberwidth = 4 -- set number column width to 2 {default 4} +vim.opt.signcolumn = 'yes' -- always show the sign column, otherwise it would shift the text each time +vim.opt.wrap = false -- display lines as one long line +vim.opt.scrolloff = 0 +vim.opt.sidescrolloff = 8 +vim.opt.guifont = 'monospace:h17' -- the font used in graphical neovim applications +vim.opt.title = true +vim.opt.titlelen = 0 -- do not shorten title +vim.opt.inccommand = 'split' -- split below for to show replaces +vim.opt.virtualedit = 'block' +vim.opt.fillchars = vim.opt.fillchars + 'eob: ' +vim.opt.fillchars:append({ + stl = ' ', +}) + +vim.opt.shortmess:append('c') + +vim.cmd('set whichwrap+=<,>,[,],h,l') +vim.cmd([[set iskeyword+=-]]) + +vim.g.netrw_banner = 0 +vim.g.netrw_mouse = 2 diff --git a/lua/remaps.lua b/lua/config/remaps.lua similarity index 70% rename from lua/remaps.lua rename to lua/config/remaps.lua index 68300da..c1ef226 100644 --- a/lua/remaps.lua +++ b/lua/config/remaps.lua @@ -210,69 +210,74 @@ map('i', 'kj', '') map('i', 'jj', '') -- Terminal Mappings -map("t", "jk", "") -map("t", "kj", "") -map("t", "", "") +map('t', 'jk', '') +map('t', 'kj', '') +map('t', '', '') -- Move with shift-arrows -map("n", "", "", { - desc = "Move window to the left" +map('n', '', '', { + desc = 'Move window to the left', }) -map("n", "", "", { - desc = "Move window down" +map('n', '', '', { + desc = 'Move window down', }) -map("n", "", "", { - desc = "Move window up" +map('n', '', '', { + desc = 'Move window up', }) -map("n", "", "", { - desc = "Move window to the right" +map('n', '', '', { + desc = 'Move window to the right', }) -- Search -map({ - "n", - "x" -}, "gw", "*N", { - desc = "Search word under cursor" -}) +map( + { + 'n', + 'x', + }, + 'gw', + '*N', + { + desc = 'Search word under cursor', + } +) -- Some cool remaps -map("n", "n", "nzzzv") -map("n", "N", "Nzzzv") -map("n", "J", "mzJ`z") -map("n", "}", "}zzzv") -map("n", "{", "{zzzv") -map("n", "g,", "g,zvzz") -map("n", "g;", "g;zvzz") -map("n", "", "zz") -map("n", "", "zz") -map("n", "^", "g^") -map("n", "0", "g0") +map('n', 'n', 'nzzzv') +map('n', 'N', 'Nzzzv') +map('n', 'J', 'mzJ`z') +map('n', '}', '}zzzv') +map('n', '{', '{zzzv') +map('n', 'g,', 'g,zvzz') +map('n', 'g;', 'g;zvzz') +map('n', '', 'zz') +map('n', '', 'zz') +map('n', '^', 'g^') +map('n', '0', 'g0') -- Do not include white space characters when using $ in visual mode, -map("x", "$", "g_") +map('x', '$', 'g_') -- Always use very magic mode for searching -map("n", "/", [[/\v]]) +map('n', '/', [[/\v]]) -- Add undo break-points -map("i", "?", "?u") -map("i", "!", "!u") -map("i", ",", ",u") -map("i", ".", ".u") -map("i", ";", ";u") +map('i', '?', '?u') +map('i', '!', '!u') +map('i', ',', ',u') +map('i', '.', '.u') +map('i', ';', ';u') -- compromised backward search when comma is being used as localleader -map("n", "", ",") +map('n', '', ',') -- Better up/down -map({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -map({ "n", "x" }, "", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) -map({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -map({ "n", "x" }, "", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +map({ 'n', 'x' }, 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +map({ 'n', 'x' }, '', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) +map({ 'n', 'x' }, 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +map({ 'n', 'x' }, '', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -- Move text up and down -map("n", "", "m .+1==", { desc = "Move Down" }) -map("n", "", "m .-2==", { desc = "Move Up" }) -map("i", "", "m .+1==gi", { desc = "Move Down" }) -map("i", "", "m .-2==gi", { desc = "Move Up" }) -map("v", "", ":m '>+1gv=gv", { desc = "Move Down" }) -map("v", "", ":m '<-4gv=gv", { desc = "Move Up" }) +map('n', '', 'm .+1==', { desc = 'Move Down' }) +map('n', '', 'm .-2==', { desc = 'Move Up' }) +map('i', '', 'm .+1==gi', { desc = 'Move Down' }) +map('i', '', 'm .-2==gi', { desc = 'Move Up' }) +map('v', '', ":m '>+1gv=gv", { desc = 'Move Down' }) +map('v', '', ":m '<-4gv=gv", { desc = 'Move Up' }) diff --git a/lua/keymaps.lua b/lua/keymaps.lua deleted file mode 100644 index f3eb5ba..0000000 --- a/lua/keymaps.lua +++ /dev/null @@ -1,80 +0,0 @@ --- File Explorer -vim.keymap.set('n', 'n', ':Neotree filesystem reveal left toggle') - --- Telescope -vim.keymap.set('n', 'ff', ':Telescope find_files') -vim.keymap.set('n', 'tc', ':Telescope colorscheme') -vim.keymap.set('n', 'of', ':Telescope oldfiles') -vim.keymap.set('n', 'tl', ':Telescope live_grep') -vim.keymap.set('n', 'km', ':Telescope keymaps') -vim.keymap.set('n', 'tf', function() - require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown({ - previewer = false, - })) -end) - --- formatter -vim.keymap.set('n', 'ft', vim.lsp.buf.format, {}) - --- buffer -vim.keymap.set("n", "", ":BufferLineCycleNext") -vim.keymap.set("n", "", ":BufferLineCyclePrev") -vim.keymap.set("n", "q", ":BufferLinePickClose") - --- comment -vim.keymap.set('n', '/', 'gcc', { remap = true }) - --- terminal -vim.keymap.set('n', 'tv', ':Vterm') -- Vertical terminal -vim.keymap.set('n', 'th', ':Sterm') -- Horizontal terminal -vim.keymap.set('n', 'tf', ':Fterm') -- Floating terminal - --- File Explorer -vim.keymap.set('n', 'e', function() - require('oil').toggle_float() -end) - --- Primeagen Refactoring --- vim.keymap.set("x", "re", ":Refactor extract ") --- vim.keymap.set("x", "rf", ":Refactor extract_to_file ") --- vim.keymap.set("x", "rv", ":Refactor extract_var ") --- vim.keymap.set({ "n", "x" }, "ri", ":Refactor inline_var") --- vim.keymap.set( "n", "rI", ":Refactor inline_func") --- vim.keymap.set("n", "rb", ":Refactor extract_block") --- vim.keymap.set("n", "rbf", ":Refactor extract_block_to_file") - - --- Clear search, diff update and redraw -vim.keymap.set({ 'i', 'n' }, '', 'noh', { desc = 'Escape and clear hlsearch' }) - --- Navigator -vim.keymap.set('n', '', 'NavigatorLeft', { desc = 'Move Left' }) -vim.keymap.set('n', '', 'NavigatorDown', { desc = 'Move Down' }) -vim.keymap.set('n', '', 'NavigatorUp', { desc = 'Move Up' }) -vim.keymap.set('n', '', 'NavigatorRight', { desc = 'Move Right' }) -vim.keymap.set('n', '', 'NavigatorPrevious', { desc = 'Previous Panel' }) - --- Move with shift-arrows -vim.keymap.set('n', '', '', { - desc = 'Move window to the left', -}) -vim.keymap.set('n', '', '', { - desc = 'Move window down', -}) -vim.keymap.set('n', '', '', { - desc = 'Move window up', -}) -vim.keymap.set('n', '', '', { - desc = 'Move window to the right', -}) - --- Resize window using arrow keys -vim.keymap.set('n', '', 'resize +2', { desc = 'Increase Window Height' }) -vim.keymap.set('n', '', 'resize -2', { desc = 'Decrease Window Height' }) -vim.keymap.set('n', '', 'vertical resize -2', { desc = 'Decrease Window Width' }) -vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Increase Window Width' }) - --- clear notification -vim.keymap.set('n', 'mu', function() - require('notify').dismiss({ silent = true, pending = true }) -end, { desc = 'Dismiss All Notifications' }) diff --git a/lua/plugins.lua b/lua/plugins.lua deleted file mode 100644 index a564707..0000000 --- a/lua/plugins.lua +++ /dev/null @@ -1 +0,0 @@ -return {} diff --git a/lua/plugins/alpha.lua b/lua/plugins/alpha.lua index 8e3e534..10261b6 100644 --- a/lua/plugins/alpha.lua +++ b/lua/plugins/alpha.lua @@ -1,11 +1,9 @@ ---- @type LazyPluginSpec return { - "goolord/alpha-nvim", - event = "VimEnter", - dependencies = { "nvim-tree/nvim-web-devicons" }, + 'goolord/alpha-nvim', + event = 'VimEnter', opts = function() - local dashboard = require("alpha.themes.dashboard") - require("alpha.term") + local dashboard = require('alpha.themes.dashboard') + require('alpha.term') local arttoggle = false local logo = { @@ -21,23 +19,23 @@ return { local art = { -- { name, width, height } - { "tohru", 62, 17 }, + { 'tohru', 62, 17 }, } if arttoggle == true then dashboard.opts.opts.noautocmd = true dashboard.section.terminal.opts.redraw = true - local path = vim.fn.stdpath("config") .. "/assets/" + local path = vim.fn.stdpath('config') .. '/assets/' -- local random = math.random(1, #art) local currentart = art[1] - dashboard.section.terminal.command = "cat " .. path .. currentart[1] + dashboard.section.terminal.command = 'cat ' .. path .. currentart[1] dashboard.section.terminal.width = currentart[2] dashboard.section.terminal.height = currentart[3] dashboard.opts.layout = { dashboard.section.terminal, - { type = "padding", val = 2 }, + { type = 'padding', val = 2 }, dashboard.section.buttons, dashboard.section.footer, } @@ -45,55 +43,57 @@ return { dashboard.section.header.val = logo end dashboard.section.buttons.val = { - dashboard.button("ff", " " .. " Find files", ":Telescope find_files "), - dashboard.button("of", " " .. " Recent files", ":Telescope oldfiles "), - dashboard.button("l", "󰒲 " .. " Lazy", ":Lazy "), - dashboard.button("q", " " .. " Quit", ":q "), + dashboard.button('n', ' ' .. ' New File', 'ene'), + dashboard.button('spc e', ' ' .. ' File Tree', ':Neotree toggle left'), + dashboard.button('f', ' ' .. ' Find files', ':Telescope find_files '), + dashboard.button('o', ' ' .. ' Recent files', ':Telescope oldfiles '), + dashboard.button('l', '󰒲 ' .. ' Lazy', ':Lazy '), + dashboard.button('q', ' ' .. ' Quit', ':q '), } for _, button in ipairs(dashboard.section.buttons.val) do - button.opts.hl = "AlphaButtons" - button.opts.hl_shortcut = "AlphaShortcut" + button.opts.hl = 'AlphaButtons' + button.opts.hl_shortcut = 'AlphaShortcut' end - dashboard.section.header.opts.hl = "Function" - dashboard.section.buttons.opts.hl = "Identifier" - dashboard.section.footer.opts.hl = "Function" + dashboard.section.header.opts.hl = 'Function' + dashboard.section.buttons.opts.hl = 'Identifier' + dashboard.section.footer.opts.hl = 'Function' dashboard.opts.layout[1].val = 4 return dashboard end, config = function(_, dashboard) - if vim.o.filetype == "lazy" then + if vim.o.filetype == 'lazy' then vim.cmd.close() - vim.api.nvim_create_autocmd("User", { - pattern = "AlphaReady", + vim.api.nvim_create_autocmd('User', { + pattern = 'AlphaReady', callback = function() - require("lazy").show() + require('lazy').show() end, }) end - require("alpha").setup(dashboard.opts) - vim.api.nvim_create_autocmd("User", { - pattern = "LazyVimStarted", + require('alpha').setup(dashboard.opts) + vim.api.nvim_create_autocmd('User', { + pattern = 'LazyVimStarted', callback = function() local v = vim.version() - local dev = "" - if v.prerelease == "dev" then - dev = "-dev+" .. v.build + local dev = '' + if v.prerelease == 'dev' then + dev = '-dev+' .. v.build else - dev = "" + dev = '' end - local version = v.major .. "." .. v.minor .. "." .. v.patch .. dev - local stats = require("lazy").stats() - local plugins_count = stats.loaded .. "/" .. stats.count + local version = v.major .. '.' .. v.minor .. '.' .. v.patch .. dev + local stats = require('lazy').stats() + local plugins_count = stats.loaded .. '/' .. stats.count local ms = math.floor(stats.startuptime + 0.5) - local time = vim.fn.strftime("%H:%M:%S") - local date = vim.fn.strftime("%d.%m.%Y") - local line1 = " " .. plugins_count .. " plugins loaded in " .. ms .. "ms" - local line2 = "󰃭 " .. date .. "  " .. time - local line3 = " " .. version + local time = vim.fn.strftime('%H:%M:%S') + local date = vim.fn.strftime('%d.%m.%Y') + local line1 = ' ' .. plugins_count .. ' plugins loaded in ' .. ms .. 'ms' + local line2 = '󰃭 ' .. date .. '  ' .. time + local line3 = ' ' .. version local line1_width = vim.fn.strdisplaywidth(line1) - local line2Padded = string.rep(" ", (line1_width - vim.fn.strdisplaywidth(line2)) / 2) .. line2 - local line3Padded = string.rep(" ", (line1_width - vim.fn.strdisplaywidth(line3)) / 2) .. line3 + local line2Padded = string.rep(' ', (line1_width - vim.fn.strdisplaywidth(line2)) / 2) .. line2 + local line3Padded = string.rep(' ', (line1_width - vim.fn.strdisplaywidth(line3)) / 2) .. line3 dashboard.section.footer.val = { line1, diff --git a/lua/plugins/auto-pairs.lua b/lua/plugins/auto-pairs.lua index 4a30ea8..6f12acf 100644 --- a/lua/plugins/auto-pairs.lua +++ b/lua/plugins/auto-pairs.lua @@ -1,6 +1,13 @@ +-- autopairing of (){}[] etc return { - 'altermo/ultimate-autopair.nvim', - event = { 'InsertEnter', 'CmdlineEnter' }, - branch = 'v0.6', - opts = {}, + 'windwp/nvim-autopairs', + event = 'InsertEnter', + config = function(_, opts) + require('nvim-autopairs').setup(opts) + + -- setup cmp for autopairs + -- If you want insert `(` after select function or method item + local cmp_autopairs = require('nvim-autopairs.completion.cmp') + require('cmp').event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end, } diff --git a/lua/plugins/buff_delete.lua b/lua/plugins/buff_delete.lua new file mode 100644 index 0000000..cdcd544 --- /dev/null +++ b/lua/plugins/buff_delete.lua @@ -0,0 +1,9 @@ +return { + 'famiu/bufdelete.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + init = function() + vim.keymap.set('n', 'q', function() + require('bufdelete').bufdelete(0, false) + end, { silent = true, desc = 'Quit Buffer' }) + end, +} diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua index 39568fd..1d182c5 100644 --- a/lua/plugins/bufferline.lua +++ b/lua/plugins/bufferline.lua @@ -3,6 +3,10 @@ return { event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, version = '*', dependencies = 'nvim-tree/nvim-web-devicons', + keys = { + { '', 'BufferLineCycleNext', desc = 'Next Buffer' }, + { '', 'BufferLineCyclePrev', desc = 'Previous Buffer' }, + }, opts = { options = { debug = { logging = true }, diff --git a/lua/plugins/colorschemes.lua b/lua/plugins/colorschemes.lua index 93ea128..493c372 100644 --- a/lua/plugins/colorschemes.lua +++ b/lua/plugins/colorschemes.lua @@ -1,27 +1,30 @@ return { - 'navarasu/onedark.nvim', + 'navarasu/onedark.nvim', lazy = false, - config = function() - require('onedark').setup({ - style = 'deep', - transparent = true, - term_colors = false, - ending_tildes = false, - cmp_itemkind_reverse = false, - -- toggle_style_key = 'ot', - -- toggle_style_list = { 'dark', 'darker', 'cool', 'warm', 'warmer', 'deep', 'light' }, + priority = 1000, + config = function() + local onedark = require('onedark') + onedark.setup({ + style = 'deep', + transparent = true, + term_colors = false, + ending_tildes = false, + cmp_itemkind_reverse = false, + -- toggle_style_key = 'ot', + -- toggle_style_list = { 'dark', 'darker', 'cool', 'warm', 'warmer', 'deep', 'light' }, - -- Options are italic, bold, underline, none and combos 'italic,bold' - code_style = { - comments = 'italic', - keywords = 'none', - functions = 'none', - strings = 'none', - variables = 'none', - }, + -- Options are italic, bold, underline, none and combos 'italic,bold' + code_style = { + comments = 'italic', + keywords = 'none', + functions = 'none', + strings = 'none', + variables = 'none', + }, - lualine = { transparent = true }, - diagnostics = { darker = true, undercurl = true, background = false }, - }) - end, + lualine = { transparent = true }, + diagnostics = { darker = true, undercurl = true, background = false }, + }) + onedark.load() + end, } diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua new file mode 100644 index 0000000..ab11a7d --- /dev/null +++ b/lua/plugins/comment.lua @@ -0,0 +1,10 @@ +return { + { + 'echasnovski/mini.comment', + version = false, + event = { 'BufReadPost', 'BufNewFile' }, + config = function() + require('mini.comment').setup() + end, + }, +} diff --git a/lua/plugins/completions.lua b/lua/plugins/completions.lua index e1f1a4e..af3cb2c 100644 --- a/lua/plugins/completions.lua +++ b/lua/plugins/completions.lua @@ -1,100 +1,85 @@ +-- configure autocomplete return { - { + 'hrsh7th/nvim-cmp', + event = { 'InsertEnter', 'CmdlineEnter' }, + dependencies = { + -- autocomplete plugins + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-nvim-lua', + 'saadparwaiz1/cmp_luasnip', + -- "hrsh7th/cmp-nvim-lsp-signature-help", + -- "hrsh7th/cmp-calc", + + -- vscode like icons to autocomplete list + 'onsails/lspkind.nvim', + -- snippet plugin + { 'L3MON4D3/LuaSnip', event = { 'BufReadPost', 'BufNewFile' } }, + { 'rafamadriz/friendly-snippets', event = { 'BufReadPost', 'BufNewFile' } }, }, - { - 'hrsh7th/nvim-cmp', + config = function() + local cmp = require('cmp') + local luasnip = require('luasnip') + require('luasnip/loaders/from_vscode').lazy_load() - dependencies = { - 'saadparwaiz1/cmp_luasnip', - 'hrsh7th/cmp-cmdline', - 'L3MON4D3/LuaSnip', - 'rafamadriz/friendly-snippets', - 'onsails/lspkind.nvim', - }, - event = 'InsertEnter', - config = function() - local cmp = require('cmp') - local lspkind = require('lspkind') + cmp.setup({ + completion = { + keyword_length = 1, + completeopt = 'menu,menuone', + }, + formatting = { + fields = { 'kind', 'abbr', 'menu' }, + format = function(entry, vim_item) + local kind = require('lspkind').cmp_format({ mode = 'symbol_text', maxwidth = 50 })(entry, vim_item) + local strings = vim.split(kind.kind, '%s', { trimempty = true }) + kind.kind = ' ' .. (strings[1] or '') .. ' ' + kind.menu = ' (' .. (strings[2] or '') .. ')' - cmp.setup({ - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. - require('luasnip.loaders.from_vscode').lazy_load() - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif require('luasnip').expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif require('luasnip').jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), + return kind + end, + }, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), -- show completion suggestions + [''] = cmp.mapping.abort(), -- close completion window + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Insert, + select = true, }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'luasnip' }, -- For luasnip users. - { name = 'codeium' }, - }, { - { name = 'buffer' }, - }), - formatting = { - format = lspkind.cmp_format({ - mode = 'symbol', - maxwidth = 50, - ellipsis_char = '...', - show_labelDetails = true, - - before = function(entry, vim_item) - return vim_item - end, - }), + }, + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'cmdline' }, }, - }) + }), 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' }, - }), - matching = { disallow_symbol_nonprefix_matching = false }, - }) - end, - }, + }), + -- sources for autocompletion + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- snippets + { name = 'buffer' }, -- text within current buffer + { name = 'path' }, -- file system paths + { name = 'codeium' }, -- AI for autocompletion + -- { name = "nvim_lsp_signature_help" }, + -- { name = "calc" }, --for maths calculations + }, + }) + end, } diff --git a/lua/plugins/database.lua b/lua/plugins/database.lua new file mode 100644 index 0000000..6eda8a5 --- /dev/null +++ b/lua/plugins/database.lua @@ -0,0 +1,54 @@ +return { + { + 'tpope/vim-dadbod', + dependencies = { + 'kristijanhusak/vim-dadbod-ui', + 'kristijanhusak/vim-dadbod-completion', + }, + keys = { + { 'du', ':DBUIToggle', desc = 'Toggle DB UI' }, + { 'db', ':DBUIFindBuffer', desc = 'DB Find buffer' }, + { + 'dr', + ':DBUIRenameBuffer', + desc = 'DB Rename buffer', + }, + { 'dl', ':DBUILastQueryInfo', desc = 'DB Last query' }, + }, + config = function() + local function db_completion() + require('plugins.completion.cmp').setup.buffer({ + sources = { { name = 'vim-dadbod-completion' } }, + }) + end + + vim.g.db_ui_save_location = vim.fn.stdpath('config') .. require('plenary.path').path.sep .. 'db_ui' + + vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'sql', + }, + command = [[setlocal omnifunc=vim_dadbod_completion#omni]], + }) + + vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'sql', + 'mysql', + 'plsql', + }, + callback = function() + vim.schedule(db_completion) + end, + }) + end, + cmd = { + 'DBUIToggle', + 'DBUI', + 'DBUIAddConnection', + 'DBUIFindBuffer', + 'DBUIRenameBuffer', + 'DBUILastQueryInfo', + }, + }, +} diff --git a/lua/plugins/dbee.lua b/lua/plugins/dbee.lua deleted file mode 100644 index ebda5f1..0000000 --- a/lua/plugins/dbee.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - 'kndndrj/nvim-dbee', - dependencies = { - 'MunifTanjim/nui.nvim', - }, - build = function() - -- "curl", "wget", "bitsadmin", "go" - require('dbee').install(curl) - end, - cmd = 'DBToggle', - enabled = false, - - config = function() - require('dbee').setup({ - sources = { - require('dbee.sources').EnvSource:new('NVIM_DB'), - -- require("dbee.sources").MemorySource:new({ - -- { - -- name = "dbname", - -- type = "postgres", - -- url = "postgres://pguser:pguser@localhost:5602/dbname?sslmode=disable" - -- }, - -- }), - -- require("dbee.sources").FileSource:new(vim.fn.stdpath("cache") .. "/dbee/config.json"), - }, - }) - - vim.api.nvim_create_user_command('DBToggle', function() - require('dbee').toggle() - end, {}) - end, -} diff --git a/lua/plugins/inc-rename.lua b/lua/plugins/inc-rename.lua deleted file mode 100644 index 49c2ac0..0000000 --- a/lua/plugins/inc-rename.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - "smjonas/inc-rename.nvim", - config = function() - require("inc_rename").setup() - end, -} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 7e5e51b..6236d6e 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -1,7 +1,201 @@ - return { - "nvim-lualine/lualine.nvim", - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - require("lualine").setup() - end, +return { + 'nvim-lualine/lualine.nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, + config = function() + local lualine = require('lualine') + + -- Color table for highlights + local colors = { + bg = 'none', + fg = '#bbc2cf', + yellow = '#ECBE7B', + cyan = '#008080', + darkblue = '#081633', + green = '#98be65', + orange = '#FF8800', + violet = '#a9a1e1', + magenta = '#c678dd', + blue = '#51afef', + red = '#ec5f67', + } + + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand('%:p:h') + local gitdir = vim.fn.finddir('.git', filepath .. ';') + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + -- Config + local config = { + options = { + -- Disable sections and component separators + component_separators = '', + section_separators = '', + theme = { + -- We are going to use lualine_c an lualine_x as left and + -- right section. Both are highlighted by c theme . So we + -- are just setting default looks o statusline + normal = { c = { fg = colors.fg, bg = colors.bg } }, + inactive = { c = { fg = colors.fg, bg = colors.bg } }, + }, + }, + sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + } + + -- Inserts a component in lualine_c at left section + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + -- Inserts a component in lualine_x at right section + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + ins_left({ + function() + return '▊' + end, + color = { fg = colors.blue }, -- Sets highlighting of component + padding = { left = 0, right = 1 }, -- We don't need space before this + }) + + ins_left({ + -- mode component + function() + return '' + end, + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.red, + i = colors.green, + v = colors.blue, + ['␖'] = colors.blue, + V = colors.blue, + c = colors.magenta, + no = colors.red, + s = colors.orange, + S = colors.orange, + ['␓'] = colors.orange, + ic = colors.yellow, + R = colors.violet, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { right = 1 }, + }) + + ins_left({ + 'filename', + cond = conditions.buffer_not_empty, + color = { fg = colors.magenta, gui = 'bold' }, + }) + + ins_left({ + 'diagnostics', + sources = { 'nvim_diagnostic' }, + symbols = { error = ' ', warn = ' ', info = ' ' }, + diagnostics_color = { + error = { fg = colors.red }, + warn = { fg = colors.yellow }, + info = { fg = colors.cyan }, + }, + }) + + -- Insert mid section. You can make any number of sections in neovim :) + -- for lualine it's any number greater then 2 + ins_left({ + function() + return '%=' + end, + }) + + ins_left({ + -- Lsp server name . + function() + local msg = 'No Active Lsp' + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local clients = vim.lsp.get_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = ' LSP:', + color = { fg = '#ffffff', gui = 'bold' }, + }) + + ins_right({ + 'diff', + -- Is it me or the symbol for modified us really weird + symbols = { added = ' ', modified = ' ', removed = ' ' }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, + }) + + ins_right({ + 'branch', + icon = '', + color = { fg = colors.violet, gui = 'bold' }, + }) + + ins_right({ + function() + return '▊' + end, + color = { fg = colors.blue }, + padding = { left = 1 }, + }) + + -- Now don't forget to initialize lualine + lualine.setup(config) + end, } diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua index aae1854..2e6f906 100644 --- a/lua/plugins/mason.lua +++ b/lua/plugins/mason.lua @@ -44,6 +44,7 @@ return { 'biome', -- js formatter 'stylua', -- lua formatter 'black', -- python formatter + 'isort', -- python formatter 'clang-format', -- c/c++ formatter 'luacheck', 'pylint', diff --git a/lua/plugins/navigator.lua b/lua/plugins/navigator.lua index 3404937..90c8b0c 100644 --- a/lua/plugins/navigator.lua +++ b/lua/plugins/navigator.lua @@ -1,5 +1,12 @@ return { 'numToStr/Navigator.nvim', + keys = { + { '', 'NavigatorLeft' }, + { '', 'NavigatorDown' }, + { '', 'NavigatorUp' }, + { '', 'NavigatorRight' }, + { '', 'NavigatorPrevious' }, + }, config = function() require('Navigator').setup() end, diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 2f59b44..51d655a 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -1,9 +1,13 @@ return { - 'nvim-neo-tree/neo-tree.nvim', - branch = 'v3.x', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', - 'MunifTanjim/nui.nvim', - }, + 'nvim-neo-tree/neo-tree.nvim', + branch = 'v3.x', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + 'MunifTanjim/nui.nvim', + }, + keys = { + -- { 'ee', ':Neotree toggle float', silent = true, desc = 'Float File Explorer' }, + { 'e', ':Neotree toggle left', silent = true, desc = 'Left File Explorer' }, + }, } diff --git a/lua/plugins/nerdy.lua b/lua/plugins/nerdy.lua index e61830c..0a946d5 100644 --- a/lua/plugins/nerdy.lua +++ b/lua/plugins/nerdy.lua @@ -1,9 +1,9 @@ return { - "2kabhishek/nerdy.nvim", - dependencies = { - "stevearc/dressing.nvim", - "nvim-telescope/telescope.nvim", - }, - cmd = "Nerdy", - vim.keymap.set("n", "si", "Nerdy", opts), --> nerd icons + '2kabhishek/nerdy.nvim', + dependencies = { + 'stevearc/dressing.nvim', + 'nvim-telescope/telescope.nvim', + }, + cmd = 'Nerdy', + vim.keymap.set('n', 'si', 'Nerdy'), --> nerd icons } diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua new file mode 100644 index 0000000..5f04b0d --- /dev/null +++ b/lua/plugins/noice.lua @@ -0,0 +1,32 @@ +return { + 'folke/noice.nvim', + event = 'VeryLazy', + enabled = false, + dependencies = { + 'MunifTanjim/nui.nvim', + 'rcarriga/nvim-notify', + }, + config = function() + require('noice').setup({ + cmdline = { + format = { + cmdline = { pattern = '^:', icon = ' ', lang = 'vim' }, + filter = { pattern = '^:%s*!', icon = ' ', lang = 'bash' }, + lua = { pattern = { '^:%s*lua%s+', '^:%s*lua%s*=%s*', '^:%s*=%s*' }, icon = ' ', lang = 'lua' }, + help = { pattern = '^:%s*he?l?p?%s+', icon = ' ' }, + search_down = { kind = 'search', pattern = '^/', icon = ' ', lang = 'regex' }, + search_up = { kind = 'search', pattern = '^%?', icon = ' ', lang = 'regex' }, + input = { view = 'cmdline_input', icon = ' ' }, + }, + }, + lsp = { + signature = { + enabled = false, + }, + }, + presets = { + command_palette = true, + }, + }) + end, +} diff --git a/lua/plugins/notify.lua b/lua/plugins/notify.lua index 74fb19a..00a6fe0 100644 --- a/lua/plugins/notify.lua +++ b/lua/plugins/notify.lua @@ -1,25 +1,22 @@ return { - 'rcarriga/nvim-notify', - config = function() - vim.notify = require('notify') - - require('notify')('Welcome Back!') - require('notify').setup({ - background_colour = 'Normal', - fps = 30, - icons = { - DEBUG = ' ', - ERROR = ' ', - INFO = ' ', - TRACE = '✎', - WARN = ' ', - }, - level = 2, - minimum_width = 40, - maximum_width = 40, - render = 'wrapped-compact', - stages = 'slide', - timeout = 2000, - }) - end, + 'rcarriga/nvim-notify', + event = 'VeryLazy', + keys = { + { + 'un', + function() + require('notify').dismiss({ silent = true, pending = true }) + end, + desc = 'Dismiss All Notifications', + }, + }, + opts = { + level = 2, + minimum_width = 50, + stages = 'fade', + timeout = 3000, + top_down = true, + render = 'compact', + background_colour = '#000000', + }, } diff --git a/lua/plugins/nvim-surround.lua b/lua/plugins/nvim-surround.lua deleted file mode 100644 index 29a6fa6..0000000 --- a/lua/plugins/nvim-surround.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - "kylechui/nvim-surround", - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - require("nvim-surround").setup() - end, -} diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua index 5ad35e5..1394f02 100644 --- a/lua/plugins/nvim-treesitter.lua +++ b/lua/plugins/nvim-treesitter.lua @@ -1,35 +1,90 @@ return { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - dependencies = { - 'windwp/nvim-ts-autotag', + -- Syntax highlightings + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + event = { 'BufReadPost', 'BufNewFile' }, + cmd = { 'TSInstall', 'TSBufEnable', 'TSBufDisable', 'TSModuleInfo' }, + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + 'windwp/nvim-ts-autotag', + }, + config = function() + require('nvim-ts-autotag').setup() + require('nvim-treesitter.configs').setup({ + highlight = { + enable = true, + }, + indent = { + enable = true, + }, + ensure_installed = { + 'vim', + 'vimdoc', + 'markdown', + 'markdown_inline', + 'bash', + 'c', + 'cpp', + 'java', + 'javascript', + 'typescript', + 'tsx', + 'json', + 'toml', + 'html', + 'css', + 'scss', + 'lua', + 'python', + }, + auto_install = true, + playground = { + enable = true, + disable = {}, + }, + textobjects = { + select = { + enable = true, + -- Automatically jump forward to textobj, similar to targets.vim + lookahead = true, + keymaps = { + ['af'] = { query = '@function.outer', desc = 'Select outer part of a function region' }, + ['if'] = { query = '@function.inner', desc = 'Select inner part of a function region' }, + ['ac'] = { query = '@class.outer', desc = 'Select outer part of a class region' }, + ['ic'] = { query = '@class.inner', desc = 'Select inner part of a class region' }, + }, + }, + swap = { + enable = true, + swap_next = { + ['xp'] = { query = '@parameter.inner', desc = 'Swap parameter with the next one' }, + }, + swap_previous = { + ['xP'] = { + query = '@parameter.inner', + desc = 'Swap parameter with the previous one', + }, + }, + }, + }, + }) + end, + }, + { + 'nvim-treesitter/nvim-treesitter-context', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + config = function() + require('treesitter-context').setup({ enable = false }) + end, + cmd = 'TSContextToggle', + init = function() + vim.keymap.set('n', '[c', function() + require('treesitter-context').go_to_context() + end, { silent = true, desc = 'Go to TS context' }) + vim.keymap.set('n', 'tc', function() + require('treesitter-context').toggle() + end, { silent = true, desc = 'Toggle TS Context' }) + end, }, - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - local configs = require('nvim-treesitter.configs') - - configs.setup({ - ensure_installed = { - 'c', - 'lua', - 'vim', - 'vimdoc', - 'python', - 'cpp', - 'html', - 'css', - 'javascript', - 'typescript', - 'json', - 'php', - 'markdown', - 'markdown_inline', - 'bash', - 'java', - }, - sync_install = true, - highlight = { enable = true }, - indent = { enable = true }, - }) - end, } diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua deleted file mode 100644 index 1c12961..0000000 --- a/lua/plugins/oil.lua +++ /dev/null @@ -1,40 +0,0 @@ -vim.api.nvim_create_autocmd('FileType', { - pattern = 'oil', - callback = function() - vim.opt_local.colorcolumn = '' - end, -}) - -return { - { - 'stevearc/oil.nvim', - opts = {}, - -- Optional dependencies - dependencies = { 'nvim-tree/nvim-web-devicons' }, - config = function() - require('oil').setup({ - use_default_keymaps = false, - keymaps = { - ['g?'] = 'actions.show_help', - [''] = 'actions.select', - [''] = 'actions.select_split', - [''] = 'actions.select_vsplit', -- this is used to navigate left - [''] = 'actions.select_tab', - [''] = 'actions.preview', - [''] = 'actions.close', - [''] = 'actions.refresh', - ['-'] = 'actions.parent', - ['_'] = 'actions.open_cwd', - ['`'] = 'actions.cd', - ['~'] = 'actions.tcd', - ['gs'] = 'actions.change_sort', - ['gx'] = 'actions.open_external', - ['g.'] = 'actions.toggle_hidden', - }, - view_options = { - show_hidden = false, - }, - }) - end, - }, -} diff --git a/lua/plugins/presistence.lua b/lua/plugins/presistence.lua new file mode 100644 index 0000000..0766a45 --- /dev/null +++ b/lua/plugins/presistence.lua @@ -0,0 +1,28 @@ +return { + 'folke/persistence.nvim', + event = 'BufReadPre', + opts = { options = vim.opt.sessionoptions:get() }, + keys = { + { + 'ss', + function() + require('persistence').load() + end, + desc = 'Restore Session', + }, + { + 'sl', + function() + require('persistence').load({ last = true }) + end, + desc = 'Restore Last Session', + }, + { + 'sd', + function() + require('persistence').stop() + end, + desc = "Don't Save Current Session", + }, + }, +} diff --git a/lua/plugins/refactoring.lua b/lua/plugins/refactoring.lua deleted file mode 100644 index e46a8d6..0000000 --- a/lua/plugins/refactoring.lua +++ /dev/null @@ -1,32 +0,0 @@ -return { - 'ThePrimeagen/refactoring.nvim', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-treesitter/nvim-treesitter', - }, - config = function() - require('refactoring').setup({ - prompt_func_return_type = { - go = false, - java = false, - cpp = false, - c = false, - h = false, - hpp = false, - cxx = false, - }, - prompt_func_param_type = { - go = false, - java = false, - - cpp = false, - c = false, - h = false, - hpp = false, - cxx = false, - }, - printf_statements = {}, - print_var_statements = {}, - }) - end, -} diff --git a/lua/plugins/surround.lua b/lua/plugins/surround.lua new file mode 100644 index 0000000..988bb5e --- /dev/null +++ b/lua/plugins/surround.lua @@ -0,0 +1,15 @@ +return { + 'echasnovski/mini.surround', + event = { 'BufReadPre', 'BufNewFile', 'BufWritePre' }, + opts = { + mappings = { + add = 'gsa', -- Add surrounding in Normal and Visual modes + delete = 'gsd', -- Delete surrounding + find = 'gsf', -- Find surrounding (to the right) + find_left = 'gsF', -- Find surrounding (to the left) + highlight = 'gsh', -- Highlight surrounding + replace = 'gsr', -- Replace surrounding + update_n_lines = 'gsn', -- Update `n_lines` + }, + }, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 1527a6e..22f051a 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,30 +1,130 @@ return { - 'nvim-telescope/telescope.nvim', - tag = '0.1.8', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-telescope/telescope-fzf-native.nvim', - build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build', - cond = vim.fn.executable('cmake') == 1, - }, - - config = function() - require('telescope').setup({ - pickers = { - colorscheme = { - enable_preview = true, - }, + { + 'nvim-telescope/telescope.nvim', + cmd = 'Telescope', + version = false, + dependencies = { + { 'nvim-lua/plenary.nvim' }, + { 'nvim-tree/nvim-web-devicons' }, + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'zig' }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + }, + keys = { + { + 'ff', + function() + require('telescope.builtin').find_files() + end, + desc = 'Find File (CWD)', }, - - defaults = { - layout_config = { - horizontal = { - preview_cutoff = 0, + { + 'fh', + function() + require('telescope.builtin').help_tags() + end, + desc = 'Find Help', + }, + { + 'fH', + function() + require('telescope.builtin').highlights() + end, + desc = 'Find highlight groups', + }, + { + 'fM', + function() + require('telescope.builtin').man_pages() + end, + desc = 'Map Pages', + }, + { + 'of', + function() + require('telescope.builtin').oldfiles() + end, + desc = 'Open Recent File', + }, + { + 'tl', + function() + require('telescope.builtin').live_grep() + end, + desc = 'Live Grep', + }, + { + 'tw', + function() + require('telescope.builtin').grep_string() + end, + desc = 'Grep String', + }, + { + 'km', + function() + require('telescope.builtin').keymaps() + end, + desc = 'Keymaps', + }, + { + 'tC', + function() + require('telescope.builtin').commands() + end, + desc = 'Commands', + }, + { + '', + function() + require('telescope.builtin').buffers() + end, + desc = 'Buffers', + }, + { + 'td', + function() + require('telescope.builtin').diagnostics() + end, + desc = 'diagnostics', + }, + { + 'cc', + function() + require('telescope.builtin').colorscheme({ enable_preview = true }) + end, + desc = 'Colorscheme with preview', + }, + }, + config = function() + local telescope = require('telescope') + telescope.setup({ + file_ignore_patterns = { '%.git/.' }, + defaults = { + preview = { + treesitter = false, }, }, - }, - }) - -- Enable telescope fzf native, if installed - pcall(require('telescope').load_extension, 'fzf') - end, + -- picker = { + -- colorscheme = { + -- enable_preview = true, + -- }, + -- }, + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = 'smart_case', -- or "ignore_case" or "respect_case" + }, + }, + borderchars = { + prompt = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }, + results = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, + }, + }) + telescope.load_extension('ui-select') + -- telescope.load_extension("refactoring") + telescope.load_extension('notify') + end, + }, } diff --git a/lua/plugins/terminal.lua b/lua/plugins/terminal.lua index 9c72417..6308ac0 100644 --- a/lua/plugins/terminal.lua +++ b/lua/plugins/terminal.lua @@ -1,4 +1,8 @@ return { '2kabhishek/termim.nvim', cmd = { 'Fterm', 'FTerm', 'Sterm', 'STerm', 'Vterm', 'VTerm' }, + keys = { + { 'tv', 'Vterm' }, -- Vertical terminal + { 'th', 'Sterm' }, -- Horizontal terminal + }, } diff --git a/lua/plugins/wilder.lua b/lua/plugins/wilder.lua index 07aed5e..bd6a825 100644 --- a/lua/plugins/wilder.lua +++ b/lua/plugins/wilder.lua @@ -6,9 +6,6 @@ return { '/', '?', }, - dependencies = { - 'catppuccin/nvim', - }, config = function() local wilder = require('wilder') diff --git a/lua/preferences.lua b/lua/preferences.lua deleted file mode 100644 index 76ecd5b..0000000 --- a/lua/preferences.lua +++ /dev/null @@ -1,62 +0,0 @@ --- This file is automatically loaded by plugins.core -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - -local opt = vim.opt -opt.number = true -opt.relativenumber = true -opt.expandtab = false -opt.tabstop = 6 -opt.shiftwidth = 6 -opt.wrap = false - --- netrw file explorer settings -vim.g.netrw_winsize = 20 -vim.g.netrw_banner = 0 -vim.g.netrw_liststyle = 1 - -opt.cursorline = true -- Enable highlighting of the current line -opt.expandtab = true -- Use spaces instead of tabs -opt.breakindent = true -opt.clipboard = 'unnamedplus' -- allows neovim to access the system clipboard -opt.cmdheight = 1 -- more space in the neovim command line for displaying messages -opt.conceallevel = 0 -- so that `` is visible in markdown files -opt.hlsearch = true -- highlight all matches on previous search pattern -opt.ignorecase = true -- ignore case in search patterns -opt.inccommand = 'split' -- preview incremental substitute -opt.mouse = 'a' -- allow the mouse to be used in neovim -opt.numberwidth = 4 -- set number column width to 2 {default 4} -opt.scrolloff = 10 -opt.shiftround = true -- round indent -opt.shiftwidth = 4 -- the number of spaces inserted for each indentation -opt.showcmd = false -opt.showmode = false -- we don't need to see things like -- INSERT -- anymore -opt.showtabline = 0 -- always show tabs -opt.signcolumn = 'yes' -- always show the sign column, otherwise it would shift the text each timeout -opt.smartcase = true -- smart case -opt.smartindent = true -- make indenting smarter again -opt.smarttab = true -opt.splitbelow = true -- force all horizontal splits to go below current window -opt.splitright = true -- force all vertical splits to go right of the current window -opt.swapfile = false -- creastes a swapfile -opt.tabstop = 4 -- insert 2 spaces for a tab -opt.undofile = true -- enable persistent undofile -opt.undolevels = 10000 -opt.updatetime = 50 -- faster completion (4000ms default) -opt.writebackup = false -- donot edit backups -opt.backup = false -- creates a backup file -opt.autowrite = true -opt.autoindent = true -opt.ai = true -opt.termguicolors =true - --- Fix markdown indentation settings -vim.g.markdown_recommended_style = 0 - -vim.opt.path:append({ '**' }) -vim.opt.shortmess:append({ W = true, I = true, c = true }) - --- hides `~` at the end of buffer -vim.cmd([[set fillchars+=eob:\ ]]) - -vim.cmd([[autocmd FileType * set formatoptions-=ro]]) From a2b0f73e33d7b99a5d85c91257ea76814673da28 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Fri, 16 Aug 2024 02:51:57 +0545 Subject: [PATCH 4/4] lol huge updates --- lazy-lock.json | 49 ++++++- lua/config/diagnostics.lua | 73 +++++++++++ lua/config/keymaps.lua | 32 +++-- lua/config/lazy.lua | 1 - lua/plugins/alpha.lua | 2 +- lua/plugins/auto-pairs.lua | 1 + lua/plugins/barbecue.lua | 40 ++++++ lua/plugins/bufferline.lua | 37 ------ lua/plugins/cokeline.lua | 82 ++++++++++++ lua/plugins/colorschemes.lua | 30 ----- lua/plugins/comment.lua | 10 -- lua/plugins/completions.lua | 9 +- lua/plugins/dressing.lua | 31 +---- lua/plugins/eagle.lua | 7 + lua/plugins/flash.lua | 14 ++ lua/plugins/flatten.lua | 10 ++ lua/plugins/hlargs.lua | 3 + lua/plugins/icon-picker.lua | 9 ++ lua/plugins/inc-rename.lua | 6 + lua/plugins/indent.lua | 10 ++ lua/plugins/lazydev.lua | 13 ++ lua/plugins/lspconfig.lua | 197 ++++++++++++++++++++++++----- lua/plugins/lspsaga.lua | 41 ++++++ lua/plugins/lualine.lua | 37 ++++-- lua/plugins/luasnip.lua | 19 +++ lua/plugins/mason.lua | 3 +- lua/plugins/mini.lua | 39 ++++++ lua/plugins/modes.lua | 32 +++++ lua/plugins/moonlfy.lua | 12 ++ lua/plugins/navbuddy.lua | 27 ++++ lua/plugins/neo-tree.lua | 4 +- lua/plugins/neoscroll.lua | 28 ++++ lua/plugins/neotest.lua | 73 +++++++++++ lua/plugins/nerdy.lua | 9 -- lua/plugins/noice.lua | 114 +++++++++++++---- lua/plugins/none-ls.lua | 2 +- lua/plugins/nui.lua | 1 + lua/plugins/numb.lua | 12 ++ lua/plugins/nvim-dap.lua | 32 +++++ lua/plugins/plenary.lua | 1 + lua/plugins/rainbow-delimiters.lua | 31 +++++ lua/plugins/screenkey.lua | 28 ++++ lua/plugins/spectre.lua | 10 ++ lua/plugins/statuscol.lua | 22 ++++ lua/plugins/surround.lua | 15 --- lua/plugins/telescope.lua | 55 +++++--- lua/plugins/terminal.lua | 51 +++++++- lua/plugins/transparent.lua | 55 ++++++++ lua/plugins/trouble.lua | 48 +++++++ lua/plugins/undotree.lua | 6 + lua/plugins/vim-maximizer.lua | 7 + lua/plugins/wakatime.lua | 4 + lua/plugins/which-key.lua | 16 +++ lua/plugins/wilder.lua | 39 ------ lua/plugins/zenmode.lua | 10 ++ 55 files changed, 1259 insertions(+), 290 deletions(-) create mode 100644 lua/config/diagnostics.lua create mode 100644 lua/plugins/barbecue.lua delete mode 100644 lua/plugins/bufferline.lua create mode 100644 lua/plugins/cokeline.lua delete mode 100644 lua/plugins/colorschemes.lua delete mode 100644 lua/plugins/comment.lua create mode 100644 lua/plugins/eagle.lua create mode 100644 lua/plugins/flash.lua create mode 100644 lua/plugins/flatten.lua create mode 100644 lua/plugins/hlargs.lua create mode 100644 lua/plugins/icon-picker.lua create mode 100644 lua/plugins/inc-rename.lua create mode 100644 lua/plugins/indent.lua create mode 100644 lua/plugins/lazydev.lua create mode 100644 lua/plugins/lspsaga.lua create mode 100644 lua/plugins/luasnip.lua create mode 100644 lua/plugins/mini.lua create mode 100644 lua/plugins/modes.lua create mode 100644 lua/plugins/moonlfy.lua create mode 100644 lua/plugins/navbuddy.lua create mode 100644 lua/plugins/neoscroll.lua create mode 100644 lua/plugins/neotest.lua delete mode 100644 lua/plugins/nerdy.lua create mode 100644 lua/plugins/nui.lua create mode 100644 lua/plugins/numb.lua create mode 100644 lua/plugins/nvim-dap.lua create mode 100644 lua/plugins/plenary.lua create mode 100644 lua/plugins/rainbow-delimiters.lua create mode 100644 lua/plugins/screenkey.lua create mode 100644 lua/plugins/spectre.lua create mode 100644 lua/plugins/statuscol.lua delete mode 100644 lua/plugins/surround.lua create mode 100644 lua/plugins/transparent.lua create mode 100644 lua/plugins/trouble.lua create mode 100644 lua/plugins/undotree.lua create mode 100644 lua/plugins/vim-maximizer.lua create mode 100644 lua/plugins/wakatime.lua create mode 100644 lua/plugins/which-key.lua delete mode 100644 lua/plugins/wilder.lua create mode 100644 lua/plugins/zenmode.lua diff --git a/lazy-lock.json b/lazy-lock.json index fc3134e..f7432cf 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -2,8 +2,8 @@ "LuaSnip": { "branch": "master", "commit": "b84eeb3641b08324287587b426ec974b888390d9" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "alpha-nvim": { "branch": "main", "commit": "355fbb81a59637a8963cf5847074f8c44dbef11f" }, + "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, "bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" }, - "bufferline.nvim": { "branch": "main", "commit": "2e3c8cc5a57ddd32f1edd2ffd2ccb10c09421f6c" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, @@ -12,39 +12,76 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "codeium.vim": { "branch": "main", "commit": "0b74f274b82c00eaad4b5b5cd8b2e76f872d19f1" }, "dressing.nvim": { "branch": "master", "commit": "6741f1062d3dc6e4755367a7e9b347b553623f04" }, + "eagle.nvim": { "branch": "main", "commit": "f590404f510be11ef2cf7c68e135441bfa48c9a8" }, + "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, + "flatten.nvim": { "branch": "main", "commit": "e420e531d2ab24aebcf7b3c9fca28e6c5c34964d" }, "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, + "guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" }, + "hlargs.nvim": { "branch": "main", "commit": "cc0d9ee75e5ffba730393049119361b9e3a5b1b6" }, + "icon-picker.nvim": { "branch": "master", "commit": "3ee9a0ea9feeef08ae35e40c8be6a2fa2c20f2d3" }, + "inc-rename.nvim": { "branch": "main", "commit": "8ba77017ca468f3029bf88ef409c2d20476ea66b" }, "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }, + "lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" }, "lspkind.nvim": { "branch": "master", "commit": "cff4ae321a91ee3473a92ea1a8c637e3a9510aec" }, + "lspsaga.nvim": { "branch": "main", "commit": "4ce44df854f447cf0a8972e5387b3aeb5efc798b" }, "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "3ed90180e70a6a50cd37ce7ecc3693bcdaa7b290" }, "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, - "mini.comment": { "branch": "main", "commit": "03c13e37318bdb18481311c0ac1adc9ed731caf1" }, - "mini.surround": { "branch": "main", "commit": "57caca9525cec0ea771a67326b0ee637d056078a" }, + "mini.nvim": { "branch": "main", "commit": "49e2699dc0d585b445eda24ed4bb45952ac20508" }, + "modes.nvim": { "branch": "main", "commit": "3188692abf02a8838ec75e59d68c2ce3e4323f5c" }, + "moonfly": { "branch": "master", "commit": "4f7d18cb471ede7407dd966c7563868cae7f4f99" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "29f7c215332ba95e470811c380ddbce2cebe2af4" }, - "nerdy.nvim": { "branch": "main", "commit": "b467d6609b78d6a5f1e12cbc08fcc1ac87af20f5" }, + "neoscroll.nvim": { "branch": "master", "commit": "532dcc8cea4287c4cad6bb77532989a8217cfc7b" }, + "neotest": { "branch": "master", "commit": "32ff2ac21135a372a42b38ae131e531e64833bd3" }, + "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, + "neotest-vitest": { "branch": "main", "commit": "353364aa05b94b09409cbef21b79c97c5564e2ce" }, + "noice.nvim": { "branch": "main", "commit": "448bb9c524a7601035449210838e374a30153172" }, "none-ls.nvim": { "branch": "main", "commit": "cfa65d86e21eeb60544d5e823f6db43941322a53" }, "nui.nvim": { "branch": "main", "commit": "61574ce6e60c815b0a0c4b5655b8486ba58089a1" }, + "numb.nvim": { "branch": "master", "commit": "3f7d4a74bd456e747a1278ea1672b26116e0824d" }, "nvim-autopairs": { "branch": "master", "commit": "48ca9aaee733911424646cb1605f27bc01dedbe3" }, "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-cokeline": { "branch": "main", "commit": "adfd1eb87e0804b6b86126e03611db6f62bb2909" }, + "nvim-dap": { "branch": "master", "commit": "2b428ff2632e73295e9decbcf1c40d8e26213305" }, + "nvim-dap-go": { "branch": "main", "commit": "5511788255c92bdd845f8d9690f88e2e0f0ff9f2" }, + "nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" }, + "nvim-lsp-file-operations": { "branch": "master", "commit": "92a673de7ecaa157dd230d0128def10beb56d103" }, "nvim-lspconfig": { "branch": "master", "commit": "037ea0901ce9a28cfcaa36302618f06d2e164fbf" }, + "nvim-navbuddy": { "branch": "master", "commit": "f22bac988f2dd073601d75ba39ea5636ab6e38cb" }, + "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, + "nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" }, "nvim-treesitter": { "branch": "master", "commit": "bfb50de9cb0673a3bff620d881f690fb7e0d1328" }, "nvim-treesitter-context": { "branch": "master", "commit": "0f3332788e0bd37716fbd25f39120dcfd557c90f" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "ced6375723b20616282f9f6a1018a63ae19b106a" }, "nvim-ts-autotag": { "branch": "main", "commit": "0cb76eea80e9c73b88880f0ca78fbd04c5bdcac7" }, "nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" }, - "onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" }, + "odoo-snippets": { "branch": "main", "commit": "5e6b7191e3ea60bba00df6cdbc031291b194768d" }, "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "c097f728a409d9923a3c70c1507e8389978a9b85" }, + "resession.nvim": { "branch": "master", "commit": "e087ebeef81df25a12fcc4ec067ca73e2bb54c4a" }, + "screenkey.nvim": { "branch": "main", "commit": "a96a13fede30bba0b37f6a87cb0a2cdd1679e422" }, + "statuscol.nvim": { "branch": "main", "commit": "93d8bcda516fc86e11c03f9ef577bae9a72fba0e" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "a46780830b576049c675680650f773bedfa8677a" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "5972437de807c3bc101565175da66a1aa4f8707a" }, "termim.nvim": { "branch": "main", "commit": "58344167abb97bcef9bf720a762ea653a94e9daa" }, + "toggleterm.nvim": { "branch": "main", "commit": "137d06fb103952a0fb567882bb8527e2f92d327d" }, + "transparent.nvim": { "branch": "main", "commit": "2c78d94448b534c35ca1d88a3bae90b1cd1a3d4d" }, + "trouble.nvim": { "branch": "main", "commit": "6efc446226679fda0547c0fd6a7892fd5f5b15d8" }, + "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, "vim-dadbod": { "branch": "master", "commit": "7888cb7164d69783d3dce4e0283decd26b82538b" }, "vim-dadbod-completion": { "branch": "master", "commit": "880f7e9f2959e567c718d52550f9fae1aa07aa81" }, "vim-dadbod-ui": { "branch": "master", "commit": "0f51d8de368c8c6220973e8acd156d17da746f4c" }, - "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" } + "vim-maximizer": { "branch": "master", "commit": "2e54952fe91e140a2e69f35f22131219fcd9c5f1" }, + "vim-wakatime": { "branch": "master", "commit": "53bba6bb8342de9cbdafc82142a9b5e82008d858" }, + "which-key.nvim": { "branch": "main", "commit": "6c1584eb76b55629702716995cca4ae2798a9cca" }, + "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } } diff --git a/lua/config/diagnostics.lua b/lua/config/diagnostics.lua new file mode 100644 index 0000000..86f2dc2 --- /dev/null +++ b/lua/config/diagnostics.lua @@ -0,0 +1,73 @@ +local fn = vim.fn +local api = vim.api +local ns_id = vim.api.nvim_create_namespace('md-codeblaock') +local M = {} + +vim.cmd([[ +hi DError guibg=#2F1D29 guifg=#EB4838 +hi DBError guibg=#2F1D29 +hi DWarn guibg=#322425 guifg=#FA9535 +hi DBWarn guibg=#322425 +]]) + +function get_hl_group_bg_color(hl_group) + local hl_info = vim.api.nvim_get_hl_by_name(hl_group, true) + if hl_info and hl_info.background then + local bg_color = string.format('#%06x', hl_info.background) + return bg_color + else + return nil + end +end + +function hl_line(bufnr, line, hl, vtext) + local text = string.rep(' ', fn.winwidth(fn.bufwinnr(bufnr))) + local opts = { + virt_text = { { ' ' .. vtext .. text, hl.vig } }, + hl_eol = true, + virt_text_pos = 'overlay', + } + api.nvim_buf_add_highlight(bufnr, ns_id, hl.gui, line, 0, -1) + pcall(api.nvim_buf_set_extmark, bufnr, ns_id, line, fn.len(fn.getline(line + 1)), opts) +end + +function show_diag(bufnr, level, message, lnum) + local hl = { + [1] = { + gui = 'DBError', + vig = 'DError', + }, + [2] = { + gui = 'DBWarn', + vig = 'DWarn', + }, + [3] = { + gui = 'DBWarn', + vig = 'DWarn', + }, + [4] = { + gui = 'DBWarn', + vig = 'DWarn', + }, + [5] = { + gui = 'DBWarn', + vig = 'DWarn', + }, + } + hl_line(bufnr, lnum, hl[level], message) +end + +vim.lsp.handlers['textDocument/publishDiagnostics'] = function(_, result, ctx, _) + if not result.diagnostics then + return + end + local bufnr = vim.uri_to_bufnr(result.uri) + vim.api.nvim_buf_clear_namespace(bufnr, ns_id, 0, -1) + for _, diagnostic in ipairs(result.diagnostics) do + local line = diagnostic.range.start.line + local severity = diagnostic.severity + local message = diagnostic.message + show_diag(bufnr, severity, message, line) + end +end +return M diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 8975fd4..ea13ed3 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -1,5 +1,3 @@ -local opts = { noremap = true, silent = true } - -- Increment / Decrement vim.keymap.set('n', '+', '') vim.keymap.set('n', '-', '') @@ -11,8 +9,14 @@ vim.keymap.set('n', '', 'ggG') vim.keymap.set('x', 'p', '"_dP') -- Delete without yanking -vim.keymap.set('n', 'd', '"_d') -vim.keymap.set('v', 'd', '"_d') +vim.keymap.set('n', 'd', '"_d', { desc = 'Delete highlighted text' }) +vim.keymap.set('v', 'd', '"_d', { desc = 'Delete highlighted text' }) + +-- save file +vim.keymap.set('n', 'w', ':w', { desc = 'Save file' }) + +-- save and quit +vim.keymap.set('n', 'Q', 'wq!', { desc = 'Force save and quit' }) -- Clear highlights on search when pressing in normal mode vim.keymap.set('n', '', 'nohlsearch') @@ -25,10 +29,14 @@ vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Increa -- Visual vim.keymap.sets vim.keymap.set('v', 'r', '"hy:%s/h//g') -- Replace all instances of highlighted words -vim.keymap.set('v', '', ':sort') -- Sort highlighted text in visual mode with Control+S +vim.keymap.set('v', '', ':sort') -- Sort highlighted text in visual mode with Control+S vim.keymap.set('v', 'K', ":m '>-2gv=gv") -- Move current line up vim.keymap.set('v', 'J', ":m '>+1gv=gv") -- Move current line down +-- for buffers +vim.api.nvim_set_keymap('n', '', ':bnext', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':bprev', { noremap = true, silent = true }) + --utility vim.keymap.setpings vim.keymap.set('n', 'n', 'nzzzv') -- keep the cursor centered when doing 'n' vim.keymap.set('n', 'N', 'Nzzzv') -- keep the cursor centered when doing 'N' @@ -46,8 +54,8 @@ vim.keymap.set({ 'i' }, '', '', { desc = 'Move cursor to right' }) vim.keymap.set({ 'i' }, '', '', { desc = 'Move cursor to right' }) -- Better window management -vim.keymap.set('n', 'hs', ':split', opts) -vim.keymap.set('n', 'vs', ':vsplit', opts) +vim.keymap.set('n', 'vs', ':vsp', { noremap = true, silent = true }) +vim.keymap.set('n', 'hs', ':sp', { noremap = true, silent = true }) vim.keymap.set('n', '', 'h', { desc = 'Move to left split' }) vim.keymap.set('n', '', 'j', { desc = 'Move to below split' }) vim.keymap.set('n', '', 'k', { desc = 'Move to above split' }) @@ -61,8 +69,13 @@ vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Resize vim.keymap.set('v', '<', '', '>gv', { desc = '(V) Indent to right' }) +vim.keymap.set('n', 'lo', 'lopen', { desc = 'Open location list' }) +vim.keymap.set('n', 'lc', 'lclose', { desc = 'Close location list' }) +vim.keymap.set('n', 'ln', 'lnext', { desc = 'Next location list item' }) +vim.keymap.set('n', 'lp', 'lprev', { desc = 'Previous location list item' }) + -- insert semicolon in the end --- vim.keymap.set('i', '', 'miA;`ii', { desc = 'insert semicolon in the end' }) +vim.keymap.set('i', '', 'miA;`ii', { desc = 'insert semicolon in the end' }) -- Change text without putting it into the vim register, vim.keymap.set({ 'n', 'x' }, 'c', '"_c', { desc = 'Change without yanking' }) @@ -79,6 +92,3 @@ vim.keymap.set('i', 'jj', '') vim.keymap.set('t', 'jk', '') vim.keymap.set('t', 'kj', '') vim.keymap.set('t', '', '') - --- save file -vim.keymap.set({ 'i', 'v', 'n', 's' }, '', 'wa', { desc = 'Save all file' }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 480406d..affdb8d 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -19,7 +19,6 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ spec = { { import = 'plugins' }, - -- { import = 'plugins.themes' }, }, install = { missing = true, diff --git a/lua/plugins/alpha.lua b/lua/plugins/alpha.lua index 10261b6..99c0164 100644 --- a/lua/plugins/alpha.lua +++ b/lua/plugins/alpha.lua @@ -44,7 +44,7 @@ return { end dashboard.section.buttons.val = { dashboard.button('n', ' ' .. ' New File', 'ene'), - dashboard.button('spc e', ' ' .. ' File Tree', ':Neotree toggle left'), + dashboard.button('e', ' ' .. ' File Tree', ':Telescope file_browser '), dashboard.button('f', ' ' .. ' Find files', ':Telescope find_files '), dashboard.button('o', ' ' .. ' Recent files', ':Telescope oldfiles '), dashboard.button('l', '󰒲 ' .. ' Lazy', ':Lazy '), diff --git a/lua/plugins/auto-pairs.lua b/lua/plugins/auto-pairs.lua index 6f12acf..7f7091e 100644 --- a/lua/plugins/auto-pairs.lua +++ b/lua/plugins/auto-pairs.lua @@ -2,6 +2,7 @@ return { 'windwp/nvim-autopairs', event = 'InsertEnter', + enabled = false, config = function(_, opts) require('nvim-autopairs').setup(opts) diff --git a/lua/plugins/barbecue.lua b/lua/plugins/barbecue.lua new file mode 100644 index 0000000..84d0c6c --- /dev/null +++ b/lua/plugins/barbecue.lua @@ -0,0 +1,40 @@ +return { + 'utilyre/barbecue.nvim', + name = 'barbecue', + version = '*', + event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, + dependencies = { + 'SmiteshP/nvim-navic', + 'nvim-tree/nvim-web-devicons', -- optional dependency + }, + opts = {}, + keys = { + { + 'bq', + function() + require('barbecue.ui').toggle() + end, + desc = 'toggle barbecue', + }, + }, + config = function() + require('barbecue').setup({ + create_autocmd = false, -- prevent barbecue from updating itself automatically + }) + + vim.api.nvim_create_autocmd({ + 'WinScrolled', -- or WinResized on NVIM-v0.9 and higher + 'BufWinEnter', + 'CursorHold', + 'InsertLeave', + + -- include this if you have set `show_modified` to `true` + -- "BufModifiedSet", + }, { + group = vim.api.nvim_create_augroup('barbecue.updater', {}), + callback = function() + require('barbecue.ui').update() + end, + }) + end, +} diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua deleted file mode 100644 index 1d182c5..0000000 --- a/lua/plugins/bufferline.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - 'akinsho/bufferline.nvim', - event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, - version = '*', - dependencies = 'nvim-tree/nvim-web-devicons', - keys = { - { '', 'BufferLineCycleNext', desc = 'Next Buffer' }, - { '', 'BufferLineCyclePrev', desc = 'Previous Buffer' }, - }, - opts = { - options = { - debug = { logging = true }, - mode = 'buffers', - indicator = { icon = '▍', style = 'none' }, - sort_by = 'insert_after_current', - move_wraps_at_ends = true, - right_mouse_command = 'vert sbuffer %d', - show_close_icon = false, - show_buffer_close_icons = false, - diagnostics = 'nvim_lsp', - diagnostics_indicator = function(count, level) - local icon = level:match('error') and ' ' or ' ' - return ' ' .. icon .. count - end, - diagnostics_update_in_insert = false, - hover = { enabled = true, reveal = { 'close' } }, - offsets = { - { - filetype = 'neo-tree', - text = ' File Explorer', - highlight = 'Directory', - separator = false, - }, - }, - }, - }, -} diff --git a/lua/plugins/cokeline.lua b/lua/plugins/cokeline.lua new file mode 100644 index 0000000..fb31c35 --- /dev/null +++ b/lua/plugins/cokeline.lua @@ -0,0 +1,82 @@ +return { + 'willothy/nvim-cokeline', + dependencies = { + 'nvim-lua/plenary.nvim', -- Required for v0.4.0+ + 'nvim-tree/nvim-web-devicons', -- If you want devicons + 'stevearc/resession.nvim', -- Optional, for persistent history + }, + config = function() + local get_hex = require('cokeline.hlgroups').get_hl_attr + + local yellow = vim.g.terminal_color_3 + + require('cokeline').setup({ + default_hl = { + fg = function(buffer) + return buffer.is_focused and get_hex('Normal', 'fg') or get_hex('Comment', 'fg') + end, + bg = function() + return get_hex('ColorColumn', 'bg') + end, + }, + + sidebar = { + filetype = { 'NvimTree', 'neo-tree' }, + components = { + { + text = function(buf) + -- Center the text by adding padding spaces + local total_width = vim.api.nvim_win_get_width(0) + local padding = math.floor((total_width - #buf.filetype) / 2) + return string.rep(' ', padding) .. buf.filetype .. string.rep(' ', padding) + end, + fg = yellow, + bg = function() + return get_hex('NvimTreeNormal', 'bg') + end, + bold = true, + }, + }, + }, + + components = { + { + text = function(buffer) + return (buffer.index ~= 1) and '▏' or '' + end, + }, + { + text = ' ', + }, + { + text = function(buffer) + return buffer.devicon.icon + end, + fg = function(buffer) + return buffer.devicon.color + end, + }, + { + text = ' ', + }, + { + text = function(buffer) + return buffer.filename .. ' ' + end, + bold = function(buffer) + return buffer.is_focused + end, + }, + { + text = '', + on_click = function(_, _, _, _, buffer) + buffer:delete() + end, + }, + { + text = ' ', + }, + }, + }) + end, +} diff --git a/lua/plugins/colorschemes.lua b/lua/plugins/colorschemes.lua deleted file mode 100644 index 493c372..0000000 --- a/lua/plugins/colorschemes.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - 'navarasu/onedark.nvim', - lazy = false, - priority = 1000, - config = function() - local onedark = require('onedark') - onedark.setup({ - style = 'deep', - transparent = true, - term_colors = false, - ending_tildes = false, - cmp_itemkind_reverse = false, - -- toggle_style_key = 'ot', - -- toggle_style_list = { 'dark', 'darker', 'cool', 'warm', 'warmer', 'deep', 'light' }, - - -- Options are italic, bold, underline, none and combos 'italic,bold' - code_style = { - comments = 'italic', - keywords = 'none', - functions = 'none', - strings = 'none', - variables = 'none', - }, - - lualine = { transparent = true }, - diagnostics = { darker = true, undercurl = true, background = false }, - }) - onedark.load() - end, -} diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua deleted file mode 100644 index ab11a7d..0000000 --- a/lua/plugins/comment.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - { - 'echasnovski/mini.comment', - version = false, - event = { 'BufReadPost', 'BufNewFile' }, - config = function() - require('mini.comment').setup() - end, - }, -} diff --git a/lua/plugins/completions.lua b/lua/plugins/completions.lua index af3cb2c..c218ee0 100644 --- a/lua/plugins/completions.lua +++ b/lua/plugins/completions.lua @@ -1,7 +1,7 @@ -- configure autocomplete return { 'hrsh7th/nvim-cmp', - event = { 'InsertEnter', 'CmdlineEnter' }, + event = { 'InsertEnter' }, dependencies = { -- autocomplete plugins 'hrsh7th/cmp-buffer', @@ -17,7 +17,6 @@ return { 'onsails/lspkind.nvim', -- snippet plugin { 'L3MON4D3/LuaSnip', event = { 'BufReadPost', 'BufNewFile' } }, - { 'rafamadriz/friendly-snippets', event = { 'BufReadPost', 'BufNewFile' } }, }, config = function() local cmp = require('cmp') @@ -29,6 +28,10 @@ return { keyword_length = 1, completeopt = 'menu,menuone', }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, formatting = { fields = { 'kind', 'abbr', 'menu' }, format = function(entry, vim_item) @@ -64,7 +67,7 @@ return { { name = 'cmdline' }, }, }), - cmp.setup.cmdline({ '/', '?' }, { + cmp.setup.cmdline('/', { mapping = cmp.mapping.preset.cmdline(), sources = { { name = 'buffer' }, diff --git a/lua/plugins/dressing.lua b/lua/plugins/dressing.lua index eff1471..aeae662 100644 --- a/lua/plugins/dressing.lua +++ b/lua/plugins/dressing.lua @@ -1,32 +1,5 @@ +-- Neovim plugin to improve the default vim.ui interfaces return { 'stevearc/dressing.nvim', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - require('dressing').setup({ - win_options = { - winblend = 10, - winhighlight = - 'Normal:DressingInputNormalFloat,NormalFloat:DressingInputNormalFloat,FloatBorder:DressingInputFloatBorder', - }, - input = { - enabled = true, - default_prompt = 'Input:', - prompt_align = 'left', - insert_only = true, - start_in_insert = true, - border = 'rounded', - relative = 'cursor', - prefer_width = 40, - width = nil, - max_width = { 140, 0.9 }, - min_width = { 20, 0.2 }, - get_config = nil, - }, - select = { - enabled = true, - backend = { 'telescope', 'fzf_lua', 'fzf', 'nui', 'builtin' }, - trim_prompt = true, - }, - }) - end, + event = 'VeryLazy', } diff --git a/lua/plugins/eagle.lua b/lua/plugins/eagle.lua new file mode 100644 index 0000000..7d4a746 --- /dev/null +++ b/lua/plugins/eagle.lua @@ -0,0 +1,7 @@ +return { + 'soulis-1256/eagle.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + require('eagle').setup({}) + end, +} diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua new file mode 100644 index 0000000..a592375 --- /dev/null +++ b/lua/plugins/flash.lua @@ -0,0 +1,14 @@ +return { + 'folke/flash.nvim', + event = { 'CursorHold', 'CursorHoldI' }, + vscode = true, + opts = {}, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, +} diff --git a/lua/plugins/flatten.lua b/lua/plugins/flatten.lua new file mode 100644 index 0000000..7c1cc24 --- /dev/null +++ b/lua/plugins/flatten.lua @@ -0,0 +1,10 @@ +--open files in neovim without creating a nested sessions +return { + 'willothy/flatten.nvim', + priority = 1001, + opts = { + window = { + open = 'alternate', + }, + }, +} diff --git a/lua/plugins/hlargs.lua b/lua/plugins/hlargs.lua new file mode 100644 index 0000000..f14e3d5 --- /dev/null +++ b/lua/plugins/hlargs.lua @@ -0,0 +1,3 @@ +return { + 'm-demare/hlargs.nvim', +} diff --git a/lua/plugins/icon-picker.lua b/lua/plugins/icon-picker.lua new file mode 100644 index 0000000..2a2e475 --- /dev/null +++ b/lua/plugins/icon-picker.lua @@ -0,0 +1,9 @@ +return { + 'ziontee113/icon-picker.nvim', + enabled = true, + cmd = { 'IconPickerInsert' }, + vim.keymap.set('n', 'se', 'IconPickerInsert emoji'), + config = function() + require('icon-picker').setup({ disable_legacy_commands = true }) + end, +} diff --git a/lua/plugins/inc-rename.lua b/lua/plugins/inc-rename.lua new file mode 100644 index 0000000..5713da2 --- /dev/null +++ b/lua/plugins/inc-rename.lua @@ -0,0 +1,6 @@ +-- Incremental rename +return { + 'smjonas/inc-rename.nvim', + cmd = 'IncRename', + config = true, +} diff --git a/lua/plugins/indent.lua b/lua/plugins/indent.lua new file mode 100644 index 0000000..0ddab27 --- /dev/null +++ b/lua/plugins/indent.lua @@ -0,0 +1,10 @@ +return { + { + 'nmac427/guess-indent.nvim', + enabled = true, + config = function() + require('guess-indent').setup({}) + end, + event = 'BufReadPost', + }, +} diff --git a/lua/plugins/lazydev.lua b/lua/plugins/lazydev.lua new file mode 100644 index 0000000..b7c18f9 --- /dev/null +++ b/lua/plugins/lazydev.lua @@ -0,0 +1,13 @@ +return { + { + 'folke/lazydev.nvim', + ft = 'lua', -- only load on lua files + cmd = 'LazyDev', + lazy = true, + event = 'LspAttach', + opts = { + library = {}, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, -- optional `vim.uv` typings +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 90060d0..0f556fd 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -1,43 +1,170 @@ return { - { - 'neovim/nvim-lspconfig', - event = { 'BufReadPre', 'BufNewFile' }, + 'neovim/nvim-lspconfig', + lazy = true, + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + { 'antosha417/nvim-lsp-file-operations', config = true }, + }, + config = function() + -- import lspconfig plugin + local lspconfig = require('lspconfig') + -- import cmp-nvim-lsp plugin + local cmp_nvim_lsp = require('cmp_nvim_lsp') - config = function() - local lspconfig = require('lspconfig') - local handlers = { - ['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'rounded' }), - ['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = 'rounded' }), - } - local capabilities = require('cmp_nvim_lsp').default_capabilities() + local keymap = vim.keymap -- for conciseness - lspconfig.lua_ls.setup({ - settings = { - Lua = { - diagnostics = { - globals = { 'vim' }, + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + -- Buffer local mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + local opts = { buffer = ev.buf, silent = true } + + -- set keybinds + opts.desc = 'Show LSP references' + keymap.set('n', 'gR', 'Telescope lsp_references', opts) -- show definition, references + + opts.desc = 'Go to declaration' + keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) -- go to declaration + + opts.desc = 'Show LSP definitions' + keymap.set('n', 'gd', 'Telescope lsp_definitions', opts) -- show lsp definitions + + opts.desc = 'Show LSP implementations' + keymap.set('n', 'gi', 'Telescope lsp_implementations', opts) -- show lsp implementations + + opts.desc = 'Show LSP type definitions' + keymap.set('n', 'gt', 'Telescope lsp_type_definitions', opts) -- show lsp type definitions + + opts.desc = 'See available code actions' + keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection + + opts.desc = 'Smart rename' + keymap.set('n', 'rn', vim.lsp.buf.rename, opts) -- smart rename + + opts.desc = 'Show buffer diagnostics' + keymap.set('n', 'D', 'Telescope diagnostics bufnr=0', opts) -- show diagnostics for file + + opts.desc = 'Show line diagnostics' + keymap.set('n', 'd', vim.diagnostic.open_float, opts) -- show diagnostics for line + + opts.desc = 'Show documentation for what is under cursor' + keymap.set('n', 'K', vim.lsp.buf.hover, opts) -- show documentation for what is under cursor + + opts.desc = 'Restart LSP' + keymap.set('n', 'rs', ':LspRestart', opts) -- mapping to restart lsp if necessary + end, + }) + + -- used to enable autocompletion (assign to every lsp server config) + local capabilities = cmp_nvim_lsp.default_capabilities() + + -- configure matlab server + lspconfig['clangd'].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + -- configure bash server + lspconfig['bashls'].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + -- configure html server + lspconfig['html'].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + -- configure typescript server with plugin + lspconfig['tsserver'].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure css server + lspconfig['cssls'].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure tailwindcss server + lspconfig['tailwindcss'].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure svelte server + lspconfig['svelte'].setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + on_attach(client, bufnr) + + vim.api.nvim_create_autocmd('BufWritePost', { + pattern = { '*.js', '*.ts' }, + callback = function(ctx) + if client.name == 'svelte' then + client.notify('$/onDidChangeTsOrJsFile', { uri = ctx.file }) + end + end, + }) + end, + }) + -- configure python server + lspconfig['pyright'].setup({ + capabilities = capabilities, + on_attach = on_attach, + }) + + -- configure lua server (with special settings) + lspconfig['lua_ls'].setup({ + capabilities = capabilities, + on_attach = on_attach, + settings = { -- custom settings for lua + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { 'vim' }, + }, + workspace = { + -- make language server aware of runtime files + library = { + [vim.fn.expand('$VIMRUNTIME/lua')] = true, + [vim.fn.stdpath('config') .. '/lua'] = true, }, }, }, - capabilities = capabilities, - handlers = handlers, - }) + }, + }) - lspconfig.clangd.setup({ - capabilities = capabilities, - handlers = handlers, - }) - lspconfig.gdscript.setup({ - capabilities = capabilities, - }) - lspconfig.pyright.setup({ - capabilities = capabilities, - handlers = handlers, - }) - lspconfig.tsserver.setup({ - capabilities = capabilities, - handlers = handlers, - }) - end, - }, + local x = vim.diagnostic.severity + local config = { + -- Enable virtual text + virtual_text = { -- or false for disable + prefix = '', -- ■  󰊠 + suffix = '', + format = function(diagnostic) + local prefix = '󰊠 ' + local suffix = ' ' + -- return full message with custom prefix & suffix + return prefix .. diagnostic.message .. suffix + end, + }, + update_in_insert = true, + signs = { text = { [x.ERROR] = '', [x.WARN] = '', [x.HINT] = '󰌵', [x.INFO] = '' } }, + underline = false, + severity_sort = true, + float = { + focusable = false, + style = 'minimal', + border = 'rounded', + source = 'always', + header = '', + prefix = '', + }, + } + + vim.diagnostic.config(config) + -- add borders to lsp info window + require('lspconfig.ui.windows').default_options.border = 'single' + end, } diff --git a/lua/plugins/lspsaga.lua b/lua/plugins/lspsaga.lua new file mode 100644 index 0000000..87d61c9 --- /dev/null +++ b/lua/plugins/lspsaga.lua @@ -0,0 +1,41 @@ +return { + 'nvimdev/lspsaga.nvim', + lazy = true, + event = 'LspAttach', + config = function() + vim.keymap.set( + 'n', + 'ot', + 'Lspsaga outline', + { desc = 'Lspsaga | Code Outline', silent = true } + ) + require('lspsaga').setup({ + ui = { + theme = 'round', + border = 'rounded', + winblend = 0, + expand = '', + collaspe = '', + preview = ' ', + code_action = '󱧣 ', + diagnostic = ' ', + hover = ' ', + kind = {}, + }, + lightbulb = { + enable = false, + enable_in_insert = true, + sign = true, + sign_priority = 40, + virtual_text = true, + }, + symbol_in_winbar = { + enable = false, + separator = '  ', + hide_keyword = true, + show_file = true, + folder_level = 0, + }, + }) + end, +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 6236d6e..ac7a0f7 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -5,22 +5,26 @@ return { }, event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, config = function() + -- Eviline config for lualine + -- Author: shadmansaleh + -- Credit: glepnir local lualine = require('lualine') - -- Color table for highlights - local colors = { - bg = 'none', - fg = '#bbc2cf', - yellow = '#ECBE7B', - cyan = '#008080', - darkblue = '#081633', - green = '#98be65', - orange = '#FF8800', - violet = '#a9a1e1', - magenta = '#c678dd', - blue = '#51afef', - red = '#ec5f67', - } +-- Color table for highlights + -- stylua: ignore + local colors = { + bg = 'none', + fg = '#bbc2cf', + yellow = '#ECBE7B', + cyan = '#008080', + darkblue = '#081633', + green = '#98be65', + orange = '#FF8800', + violet = '#a9a1e1', + magenta = '#c678dd', + blue = '#51afef', + red = '#ec5f67', + } local conditions = { buffer_not_empty = function() @@ -42,6 +46,11 @@ return { -- Disable sections and component separators component_separators = '', section_separators = '', + disabled_filetypes = { + 'NeoTree', + 'NvimTree', + 'Outline', + }, theme = { -- We are going to use lualine_c an lualine_x as left and -- right section. Both are highlighted by c theme . So we diff --git a/lua/plugins/luasnip.lua b/lua/plugins/luasnip.lua new file mode 100644 index 0000000..648277f --- /dev/null +++ b/lua/plugins/luasnip.lua @@ -0,0 +1,19 @@ +-- snippet plugin +return { + 'L3MON4D3/LuaSnip', + event = { 'BufReadPost', 'BufNewFile' }, + dependencies = { + 'rafamadriz/friendly-snippets', + 'mstuttgart/odoo-snippets', + }, + opts = { + history = true, + updateevents = 'TextChanged,TextChangedI', + }, + keys = function() + return {} + end, + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua index 2e6f906..748538b 100644 --- a/lua/plugins/mason.lua +++ b/lua/plugins/mason.lua @@ -2,7 +2,7 @@ return { 'williamboman/mason.nvim', cmd = { 'Mason', 'MasonInstall', 'MasonInstallAll', 'MasonUpdate' }, dependencies = { - 'williamboman/mason-lspconfig.nvim', + { 'williamboman/mason-lspconfig.nvim', event = { 'BufReadPre', 'BufNewFile' } }, 'WhoIsSethDaniel/mason-tool-installer.nvim', }, config = function() @@ -29,6 +29,7 @@ return { 'html', 'cssls', 'tailwindcss', + 'svelte', 'lua_ls', 'pyright', 'jdtls', diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua new file mode 100644 index 0000000..e1205e1 --- /dev/null +++ b/lua/plugins/mini.lua @@ -0,0 +1,39 @@ +return { + { + 'echasnovski/mini.nvim', + event = { 'BufReadPost', 'BufAdd', 'BufNewFile' }, + version = false, + config = function() + require('mini.comment').setup({}) + require('mini.pairs').setup({}) + require('mini.move').setup({}) + require('mini.cursorword').setup() + -- require("mini.tabline").setup() + local statusline = require('mini.statusline') + statusline.setup({ use_icons = true }) + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end + + require('mini.bracketed').setup({ + file = { suffix = '' }, + window = { suffix = '' }, + quickfix = { suffix = '' }, + yank = { suffix = '' }, + treesitter = { suffix = 'n' }, + }) + require('mini.surround').setup({ + mappings = { + add = 'gsa', -- Add surrounding in Normal and Visual modes + delete = 'gsd', -- Delete surrounding + replace = 'gsr', -- Replace surrounding + find = 'gsf', -- Find surrounding (to the right) + find_left = 'gsF', -- Find surrounding (to the left) + highlight = 'gsh', -- Highlight surrounding + update_n_lines = 'gsn', -- Update `n_lines` + }, + }) + end, + }, +} diff --git a/lua/plugins/modes.lua b/lua/plugins/modes.lua new file mode 100644 index 0000000..22b6ec5 --- /dev/null +++ b/lua/plugins/modes.lua @@ -0,0 +1,32 @@ +return { + 'mvllow/modes.nvim', + tag = 'v0.2.0', + config = function() + require('modes').setup({ + + colors = { + visual = '#f5c359', + delete = '#c75c6a', + copy = '#78ccc5', + insert = '#c5739a', + }, + + -- Set opacity for cursorline and number background + line_opacity = 0.15, + + -- Enable cursor highlights + set_cursor = true, + + -- Enable cursorline initially, and disable cursorline for inactive windows + -- or ignored filetypes + set_cursorline = true, + + -- Enable line number highlights to match cursorline + set_number = true, + + -- Disable modes highlights in specified filetypes + -- Please PR commonly ignored filetypes + ignore_filetypes = { 'NvimTree', 'TelescopePrompt' }, + }) + end, +} diff --git a/lua/plugins/moonlfy.lua b/lua/plugins/moonlfy.lua new file mode 100644 index 0000000..498bfaf --- /dev/null +++ b/lua/plugins/moonlfy.lua @@ -0,0 +1,12 @@ +return { + 'bluz71/vim-moonfly-colors', + name = 'moonfly', + lazy = false, + priority = 1000, + config = function() + require('moonfly').custom_colors({ + bg = '#000000', + }) + vim.cmd([[colorscheme moonfly]]) + end, +} diff --git a/lua/plugins/navbuddy.lua b/lua/plugins/navbuddy.lua new file mode 100644 index 0000000..d2207c5 --- /dev/null +++ b/lua/plugins/navbuddy.lua @@ -0,0 +1,27 @@ +return { + 'SmiteshP/nvim-navbuddy', + dependencies = { + 'neovim/nvim-lspconfig', + 'SmiteshP/nvim-navic', + 'MunifTanjim/nui.nvim', + }, + keys = { + { 'nv', 'Navbuddy', desc = 'Nav' }, + }, + config = function() + local actions = require('nvim-navbuddy.actions') + local navbuddy = require('nvim-navbuddy') + navbuddy.setup({ + window = { + border = 'double', + }, + mappings = { + ['k'] = actions.next_sibling, + ['i'] = actions.previous_sibling, + ['j'] = actions.parent, + ['l'] = actions.children, + }, + lsp = { auto_attach = true }, + }) + end, +} diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 51d655a..fb1e3e9 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -7,7 +7,7 @@ return { 'MunifTanjim/nui.nvim', }, keys = { - -- { 'ee', ':Neotree toggle float', silent = true, desc = 'Float File Explorer' }, - { 'e', ':Neotree toggle left', silent = true, desc = 'Left File Explorer' }, + { 'ee', ':Neotree toggle float', silent = true, desc = 'Float File Explorer' }, + { '', ':Neotree toggle left', silent = true, desc = 'Left File Explorer' }, }, } diff --git a/lua/plugins/neoscroll.lua b/lua/plugins/neoscroll.lua new file mode 100644 index 0000000..6046795 --- /dev/null +++ b/lua/plugins/neoscroll.lua @@ -0,0 +1,28 @@ +-- Smooth scrolling neovim plugin written in lua +return { + 'karb94/neoscroll.nvim', + event = { 'CursorHold', 'CursorHoldI' }, + config = function() + require('neoscroll').setup({ + mappings = { -- Keys to be mapped to their corresponding default scrolling animation + '', + '', + '', + '', + '', + '', + 'zt', + 'zz', + 'zb', + }, + hide_cursor = true, -- Hide cursor while scrolling + stop_eof = true, -- Stop at when scrolling downwards + respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file + cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further + easing = 'linear', -- Default easing function + pre_hook = nil, -- Function to run before the scrolling animation starts + post_hook = nil, -- Function to run after the scrolling animation ends + performance_mode = false, -- Disable "Performance Mode" on all buffers. + }) + end, +} diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua new file mode 100644 index 0000000..7e8b872 --- /dev/null +++ b/lua/plugins/neotest.lua @@ -0,0 +1,73 @@ +return { + 'nvim-neotest/neotest', + dependencies = { 'haydenmeade/neotest-jest', 'marilari88/neotest-vitest' }, + cmd = 'Neotest', + config = function() + require('neotest').setup({ + status = { virtual_text = true }, + output = { open_on_run = true }, + adapters = { + require('neotest-vitest'), + require('neotest-jest')({ + jestCommand = 'npm test --', + jestConfigFile = 'custom.jest.config.ts', + env = { CI = true }, + cwd = function(path) + return vim.fn.getcwd() + end, + }), + }, + }) + end, + keys = { + { + 'tw', + function() + require('neotest').run.run(vim.fn.expand('%')) + end, + desc = 'Run File', + }, + { + 'tT', + function() + require('neotest').run.run(vim.loop.cwd()) + end, + desc = 'Run All Test Files', + }, + { + 'tr', + function() + require('neotest').run.run() + end, + desc = 'Run Nearest', + }, + { + 'ts', + function() + require('neotest').summary.toggle() + end, + desc = 'Toggle Summary', + }, + { + 'to', + function() + require('neotest').output.open({ enter = true, auto_close = true }) + end, + desc = 'Show Output', + }, + { + 'tO', + function() + require('neotest').output_panel.toggle() + end, + desc = 'Toggle Output Panel', + }, + { + 'tS', + function() + require('neotest').run.stop() + end, + desc = 'Stop', + }, + }, +} diff --git a/lua/plugins/nerdy.lua b/lua/plugins/nerdy.lua deleted file mode 100644 index 0a946d5..0000000 --- a/lua/plugins/nerdy.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - '2kabhishek/nerdy.nvim', - dependencies = { - 'stevearc/dressing.nvim', - 'nvim-telescope/telescope.nvim', - }, - cmd = 'Nerdy', - vim.keymap.set('n', 'si', 'Nerdy'), --> nerd icons -} diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 5f04b0d..82c779a 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -1,32 +1,102 @@ +-- override nvim ui return { 'folke/noice.nvim', event = 'VeryLazy', - enabled = false, + enabled = true, dependencies = { + 'nvim-treesitter/nvim-treesitter', 'MunifTanjim/nui.nvim', 'rcarriga/nvim-notify', }, - config = function() - require('noice').setup({ - cmdline = { - format = { - cmdline = { pattern = '^:', icon = ' ', lang = 'vim' }, - filter = { pattern = '^:%s*!', icon = ' ', lang = 'bash' }, - lua = { pattern = { '^:%s*lua%s+', '^:%s*lua%s*=%s*', '^:%s*=%s*' }, icon = ' ', lang = 'lua' }, - help = { pattern = '^:%s*he?l?p?%s+', icon = ' ' }, - search_down = { kind = 'search', pattern = '^/', icon = ' ', lang = 'regex' }, - search_up = { kind = 'search', pattern = '^%?', icon = ' ', lang = 'regex' }, - input = { view = 'cmdline_input', icon = ' ' }, + opts = { + cmdline = { + view = 'cmdline', + format = { + cmdline = { icon = '▍' }, + substitute = { + pattern = '^:%%?s/', + icon = ' ', + ft = 'regex', + opts = { border = { text = { top = ' sub (old/new/) ' } } }, + }, + input = { view = 'cmdline_input', icon = '█' }, + }, + }, + routes = { + { + view = 'notify', + filter = { event = 'msg_showmode' }, + }, + { + filter = { + event = 'msg_show', + kind = '', + find = 'written', + }, + opts = { skip = true }, + }, + }, + lsp = { + progress = { + enabled = false, + -- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin + -- See the section on formatting for more details on how to customize. + format = 'lsp_progress', + format_done = 'lsp_progress_done', + throttle = 1000 / 30, -- frequency to update lsp progress message + view = 'mini', + }, + override = { + -- override the default lsp markdown formatter with Noice + ['vim.lsp.util.convert_input_to_markdown_lines'] = true, + -- override the lsp markdown formatter with Noice + ['vim.lsp.util.stylize_markdown'] = true, + -- override cmp documentation with Noice (needs the other options to work) + ['cmp.entry.get_documentation'] = true, + }, + hover = { + enabled = true, + silent = false, -- set to true to not show a message if hover is not available + view = nil, -- when nil, use defaults from documentation + opts = {}, -- merged with defaults from documentation + }, + signature = { + enabled = false, + auto_open = { + enabled = true, + trigger = true, -- Automatically show signature help when typing a trigger character from the LSP + luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes + throttle = 50, -- Debounce lsp signature help request by 50ms + }, + view = nil, -- when nil, use defaults from documentation + opts = {}, -- merged with defaults from documentation + }, + message = { + -- Messages shown by lsp servers + enabled = true, + view = 'notify', + opts = {}, + }, + -- defaults for hover and signature help + documentation = { + view = 'hover', + opts = { + lang = 'markdown', + replace = true, + render = 'plain', + format = { '{message}' }, + win_options = { concealcursor = 'n', conceallevel = 3 }, }, }, - lsp = { - signature = { - enabled = false, - }, - }, - presets = { - command_palette = true, - }, - }) - end, + }, + presets = { + -- you can enable a preset by setting it to true, or a table that will override the preset config + -- you can also add custom presets that you can enable/disable with enabled=true + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = false, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = true, -- add a border to hover docs and signature help + }, + }, } diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua index 06e028b..cabf007 100644 --- a/lua/plugins/none-ls.lua +++ b/lua/plugins/none-ls.lua @@ -1,6 +1,6 @@ return { 'nvimtools/none-ls.nvim', -- configure formatters & linters - event = { 'CursorHold', 'CursorHoldI' }, + event = { 'BufReadPre', 'BufNewFile' }, dependencies = { 'jay-babu/mason-null-ls.nvim', }, diff --git a/lua/plugins/nui.lua b/lua/plugins/nui.lua new file mode 100644 index 0000000..f79aec6 --- /dev/null +++ b/lua/plugins/nui.lua @@ -0,0 +1 @@ +return { 'MunifTanjim/nui.nvim', lazy = true } diff --git a/lua/plugins/numb.lua b/lua/plugins/numb.lua new file mode 100644 index 0000000..2263482 --- /dev/null +++ b/lua/plugins/numb.lua @@ -0,0 +1,12 @@ +return { + 'nacro90/numb.nvim', + config = function() + require('numb').setup({ + show_numbers = true, -- Enable 'number' for the window while peeking + show_cursorline = true, -- Enable 'cursorline' for the window while peeking + hide_relativenumbers = true, -- Enable turning off 'relativenumber' for the window while peeking + number_only = false, -- Peek only when the command is only a number instead of when it starts with a number + centered_peeking = true, -- Peeked line will be centered relative to window + }) + end, +} diff --git a/lua/plugins/nvim-dap.lua b/lua/plugins/nvim-dap.lua new file mode 100644 index 0000000..8e30c2e --- /dev/null +++ b/lua/plugins/nvim-dap.lua @@ -0,0 +1,32 @@ +return { + 'mfussenegger/nvim-dap', + dependencies = { + 'leoluz/nvim-dap-go', + 'rcarriga/nvim-dap-ui', + 'nvim-neotest/nvim-nio', + }, + lazy = true, + config = function() + require('dap-go').setup() + require('dapui').setup() + local dap = require('dap') + local keymap = vim.keymap + local dapui = require('dapui') + + keymap.set('n', 'dt', dap.toggle_breakpoint, {}) + keymap.set('n', 'dc', dap.continue, {}) + + dap.listeners.before.attach.dapui_config = function() + dapui.open() + end + dap.listeners.before.launch.dapui_config = function() + dapui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + dapui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + dapui.close() + end + end, +} diff --git a/lua/plugins/plenary.lua b/lua/plugins/plenary.lua new file mode 100644 index 0000000..5fec6f0 --- /dev/null +++ b/lua/plugins/plenary.lua @@ -0,0 +1 @@ +return { 'nvim-lua/plenary.nvim', lazy = true } diff --git a/lua/plugins/rainbow-delimiters.lua b/lua/plugins/rainbow-delimiters.lua new file mode 100644 index 0000000..6ed0b62 --- /dev/null +++ b/lua/plugins/rainbow-delimiters.lua @@ -0,0 +1,31 @@ +return { + 'HiPhish/rainbow-delimiters.nvim', + config = function() + local rainbow_delimiters = require('rainbow-delimiters') + require('rainbow-delimiters.setup').setup({ + { + strategy = { + [''] = rainbow_delimiters.strategy['global'], + vim = rainbow_delimiters.strategy['local'], + }, + query = { + [''] = 'rainbow-delimiters', + lua = 'rainbow-blocks', + }, + priority = { + [''] = 110, + lua = 210, + }, + highlight = { + 'RainbowDelimiterRed', + 'RainbowDelimiterYellow', + 'RainbowDelimiterBlue', + 'RainbowDelimiterOrange', + 'RainbowDelimiterGreen', + 'RainbowDelimiterViolet', + 'RainbowDelimiterCyan', + }, + }, + }) + end, +} diff --git a/lua/plugins/screenkey.lua b/lua/plugins/screenkey.lua new file mode 100644 index 0000000..a69016c --- /dev/null +++ b/lua/plugins/screenkey.lua @@ -0,0 +1,28 @@ +return { + 'NStefan002/screenkey.nvim', + cmd = 'Screenkey', + version = '*', + vim.keymap.set('n', 'kt', 'Screenkey', { desc = 'Toggle keys' }), + config = function() + require('screenkey').setup({ + -- see :h nvim_open_win + win_opts = { + relative = 'editor', + anchor = 'SE', + width = 40, + height = 1, + border = 'single', + }, + -- compress input when repeated times + compress_after = 3, + -- clear the input after seconds of inactivity + clear_after = 3, + -- temporarily disable screenkey (for example when inside of the terminal) + disable = { + filetypes = {}, -- for example: "toggleterm" + -- :h 'buftype' + buftypes = {}, -- for example: "terminal" + }, + }) + end, +} diff --git a/lua/plugins/spectre.lua b/lua/plugins/spectre.lua new file mode 100644 index 0000000..90e51f2 --- /dev/null +++ b/lua/plugins/spectre.lua @@ -0,0 +1,10 @@ +return { + 'nvim-pack/nvim-spectre', + build = false, + cmd = 'Spectre', + opts = { open_cmd = 'noswapfile vnew' }, + -- stylua: ignore + keys = { + { "sr", function() require("spectre").open() end, desc = "Replace in Files (Spectre)" }, + }, +} diff --git a/lua/plugins/statuscol.lua b/lua/plugins/statuscol.lua new file mode 100644 index 0000000..da6a089 --- /dev/null +++ b/lua/plugins/statuscol.lua @@ -0,0 +1,22 @@ +return { + { + 'luukvbaal/statuscol.nvim', + event = 'BufReadPre', + config = function() + local builtin = require('statuscol.builtin') + require('statuscol').setup({ + setopt = true, + separator = '', + foldfunc = 'builtin', + relculright = true, + segments = { + { text = { '%s' }, click = 'v:lua.ScSa' }, + { + text = { builtin.lnumfunc, ' ' }, + click = 'v:lua.ScLa', + }, + }, + }) + end, + }, +} diff --git a/lua/plugins/surround.lua b/lua/plugins/surround.lua deleted file mode 100644 index 988bb5e..0000000 --- a/lua/plugins/surround.lua +++ /dev/null @@ -1,15 +0,0 @@ -return { - 'echasnovski/mini.surround', - event = { 'BufReadPre', 'BufNewFile', 'BufWritePre' }, - opts = { - mappings = { - add = 'gsa', -- Add surrounding in Normal and Visual modes - delete = 'gsd', -- Delete surrounding - find = 'gsf', -- Find surrounding (to the right) - find_left = 'gsF', -- Find surrounding (to the left) - highlight = 'gsh', -- Highlight surrounding - replace = 'gsr', -- Replace surrounding - update_n_lines = 'gsn', -- Update `n_lines` - }, - }, -} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 22f051a..92a6316 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -3,71 +3,73 @@ return { 'nvim-telescope/telescope.nvim', cmd = 'Telescope', version = false, + lazy = true, dependencies = { { 'nvim-lua/plenary.nvim' }, { 'nvim-tree/nvim-web-devicons' }, { 'nvim-telescope/telescope-fzf-native.nvim', build = 'zig' }, { 'nvim-telescope/telescope-ui-select.nvim' }, + { 'nvim-telescope/telescope-file-browser.nvim' }, }, keys = { { - 'ff', + 'sf', function() require('telescope.builtin').find_files() end, desc = 'Find File (CWD)', }, { - 'fh', + 'sh', function() require('telescope.builtin').help_tags() end, desc = 'Find Help', }, { - 'fH', + 'sH', function() require('telescope.builtin').highlights() end, desc = 'Find highlight groups', }, { - 'fM', + 'sM', function() require('telescope.builtin').man_pages() end, desc = 'Map Pages', }, { - 'of', + 'so', function() require('telescope.builtin').oldfiles() end, desc = 'Open Recent File', }, { - 'tl', + 'sg', function() require('telescope.builtin').live_grep() end, desc = 'Live Grep', }, { - 'tw', + 'sw', function() require('telescope.builtin').grep_string() end, desc = 'Grep String', }, { - 'km', + 'sk', function() require('telescope.builtin').keymaps() end, desc = 'Keymaps', }, { - 'tC', + 'sC', function() require('telescope.builtin').commands() end, @@ -81,22 +83,21 @@ return { desc = 'Buffers', }, { - 'td', + 'sd', function() require('telescope.builtin').diagnostics() end, desc = 'diagnostics', }, { - 'cc', - function() - require('telescope.builtin').colorscheme({ enable_preview = true }) - end, - desc = 'Colorscheme with preview', + 'sF', + 'Telescope file_browser', + "desc = 'File Browser'", }, }, config = function() local telescope = require('telescope') + local fb_actions = require('telescope').extensions.file_browser.actions telescope.setup({ file_ignore_patterns = { '%.git/.' }, defaults = { @@ -104,11 +105,6 @@ return { treesitter = false, }, }, - -- picker = { - -- colorscheme = { - -- enable_preview = true, - -- }, - -- }, extensions = { fzf = { fuzzy = true, -- false will only do exact matching @@ -116,6 +112,24 @@ return { override_file_sorter = true, -- override the file sorter case_mode = 'smart_case', -- or "ignore_case" or "respect_case" }, + file_browser = { + theme = 'ivy', + hijack_netrw = true, + mapping = { + ['i'] = { + [''] = fb_actions.create, + [''] = fb_actions.rename, + [''] = fb_actions.remove, + [''] = fb_actions.toggle_hidden, + }, + ['n'] = { + ['a'] = fb_actions.create, + ['r'] = fb_actions.rename, + ['d'] = fb_actions.remove, + ['h'] = fb_actions.toggle_hidden, + }, + }, + }, }, borderchars = { prompt = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }, @@ -123,6 +137,7 @@ return { }, }) telescope.load_extension('ui-select') + telescope.load_extension('file_browser') -- telescope.load_extension("refactoring") telescope.load_extension('notify') end, diff --git a/lua/plugins/terminal.lua b/lua/plugins/terminal.lua index 6308ac0..64732b5 100644 --- a/lua/plugins/terminal.lua +++ b/lua/plugins/terminal.lua @@ -1,8 +1,51 @@ +local size = function() + return vim.o.columns * 0.5 +end return { - '2kabhishek/termim.nvim', - cmd = { 'Fterm', 'FTerm', 'Sterm', 'STerm', 'Vterm', 'VTerm' }, + 'akinsho/toggleterm.nvim', + lazy = true, + cmd = { + 'ToggleTerm', + 'ToggleTermSetName', + 'ToggleTermToggleAll', + 'ToggleTermSendVisualLines', + 'ToggleTermSendCurrentLine', + 'ToggleTermSendVisualSelection', + }, keys = { - { 'tv', 'Vterm' }, -- Vertical terminal - { 'th', 'Sterm' }, -- Horizontal terminal + { '1', '1ToggleTerm', desc = 'Toggle Terminal', mode = 'n' }, + { '', 'ToggleTerm size=' .. size() .. '', desc = 'Toggle Terminal', mode = 'n' }, + { '2', '2ToggleTerm', desc = 'Toggle Terminal', mode = 'n' }, + }, + opts = { + size = 10, + open_mapping = [[]], + hide_numbers = true, + shade_filetypes = {}, + shade_terminals = true, + shading_factor = '2', + start_in_insert = true, + insert_mappings = true, + terminal_mappings = true, + persist_size = true, + direction = 'float', -- Use 'float' for floating terminal windows + close_on_exit = true, + shell = vim.o.shell, + float_opts = { + border = 'curved', -- or 'single', 'double', 'shadow', etc. + winblend = 0, -- Set to 0 for full transparency + highlights = { + border = 'Normal', + background = 'Normal', + }, + }, + }, + { + '2kabhishek/termim.nvim', + cmd = { 'Fterm', 'FTerm', 'Sterm', 'STerm', 'Vterm', 'VTerm' }, + keys = { + { 'th', 'Sterm', desc = 'Horizontal Terminal' }, + { 'tv', 'Vterm', desc = 'Vertical Terminal' }, + }, }, } diff --git a/lua/plugins/transparent.lua b/lua/plugins/transparent.lua new file mode 100644 index 0000000..d03691c --- /dev/null +++ b/lua/plugins/transparent.lua @@ -0,0 +1,55 @@ +return { + { + 'xiyaowong/transparent.nvim', + config = function() + require('transparent').clear_prefix('Navic') + require('transparent').clear_prefix('Float') + -- require("transparent").clear_prefix("Normal") + require('transparent').clear_prefix('NeoTree') + require('transparent').clear_prefix('Noice') + require('transparent').clear_prefix('Notify') + -- require("transparent").clear_prefix("Mini") + require('transparent').clear_prefix('WhichKey') + require('transparent').clear_prefix('BufferLine') + require('transparent').clear_prefix('Telescope') + require('transparent').setup({ -- Optional, you don't have to run setup. + groups = { -- table: default groups + 'Comment', + 'Constant', + 'TabLineFill', + 'Special', + 'WinBar', + 'Identifier', + 'Statement', + 'PreProc', + 'Type', + 'Underlined', + 'Todo', + 'String', + 'Function', + 'Conditional', + 'Repeat', + 'Operator', + 'Structure', + 'LineNr', + 'NonText', + 'SignColumn', + 'StatusLine', + 'StatusLineNC', + 'EndOfBuffer', + 'SignColumn', + 'HoverNormal', + }, + extra_groups = { + 'OctoEditable', + 'EndOfBuffer', + 'Search', + 'Cursor', + 'LazyNormal', + }, -- table: additional groups that should be cleared + exclude_groups = {}, -- table: groups you don't want to clear + on_clear = function() end, + }) + end, + }, +} diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua new file mode 100644 index 0000000..7dfac42 --- /dev/null +++ b/lua/plugins/trouble.lua @@ -0,0 +1,48 @@ +return { + 'folke/trouble.nvim', + lazy = true, + cmd = { 'Trouble', 'TroubleToggle', 'TroubleRefresh' }, + opts = { + modes = { + lsp = { + win = { position = 'right' }, + }, + }, + }, + keys = { + { 'xx', 'Trouble diagnostics toggle', desc = 'Diagnostics (Trouble)' }, + { 'xX', 'Trouble diagnostics toggle filter.buf=0', desc = 'Buffer Diagnostics (Trouble)' }, + { 'cs', 'Trouble symbols toggle', desc = 'Symbols (Trouble)' }, + { 'cS', 'Trouble lsp toggle', desc = 'LSP references/definitions/... (Trouble)' }, + { 'xL', 'Trouble loclist toggle', desc = 'Location List (Trouble)' }, + { 'xQ', 'Trouble qflist toggle', desc = 'Quickfix List (Trouble)' }, + { + '[q', + function() + if require('trouble').is_open() then + require('trouble').prev({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cprev) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = 'Previous Trouble/Quickfix Item', + }, + { + ']q', + function() + if require('trouble').is_open() then + require('trouble').next({ skip_groups = true, jump = true }) + else + local ok, err = pcall(vim.cmd.cnext) + if not ok then + vim.notify(err, vim.log.levels.ERROR) + end + end + end, + desc = 'Next Trouble/Quickfix Item', + }, + }, +} diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua new file mode 100644 index 0000000..d5dcbab --- /dev/null +++ b/lua/plugins/undotree.lua @@ -0,0 +1,6 @@ +return { + 'mbbill/undotree', + keys = { + { 'uu', 'UndotreeToggle', desc = 'Toggle Undotree' }, + }, +} diff --git a/lua/plugins/vim-maximizer.lua b/lua/plugins/vim-maximizer.lua new file mode 100644 index 0000000..4acdf67 --- /dev/null +++ b/lua/plugins/vim-maximizer.lua @@ -0,0 +1,7 @@ +return { + 'szw/vim-maximizer', + + keys = { + { 'sm', 'MaximizerToggle', { desc = 'Maximize/minimize a split' } }, + }, +} diff --git a/lua/plugins/wakatime.lua b/lua/plugins/wakatime.lua new file mode 100644 index 0000000..d63a22b --- /dev/null +++ b/lua/plugins/wakatime.lua @@ -0,0 +1,4 @@ +return { + 'wakatime/vim-wakatime', + lazy = false, +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua new file mode 100644 index 0000000..18677cc --- /dev/null +++ b/lua/plugins/which-key.lua @@ -0,0 +1,16 @@ +return { + 'folke/which-key.nvim', + event = 'VeryLazy', + opts = { + preset = 'helix', + }, + keys = { + { + '?', + function() + require('which-key').show({ global = false }) + end, + desc = 'Buffer Local Keymaps (which-key)', + }, + }, +} diff --git a/lua/plugins/wilder.lua b/lua/plugins/wilder.lua deleted file mode 100644 index bd6a825..0000000 --- a/lua/plugins/wilder.lua +++ /dev/null @@ -1,39 +0,0 @@ -return { - { - 'gelguy/wilder.nvim', - keys = { - ':', - '/', - '?', - }, - config = function() - local wilder = require('wilder') - - -- Enable wilder when pressing :, / or ? - wilder.setup({ modes = { ':', '/', '?' } }) - - -- Enable fuzzy matching for commands and buffers - wilder.set_option('pipeline', { - wilder.branch( - wilder.cmdline_pipeline({ - fuzzy = 1, - }), - wilder.vim_search_pipeline({ - fuzzy = 1, - }) - ), - }) - - wilder.set_option( - 'renderer', - wilder.popupmenu_renderer(wilder.popupmenu_palette_theme({ - border = 'rounded', - max_height = '75%', - min_height = 0, - prompt_position = 'top', - reverse = 0, - })) - ) - end, - }, -} diff --git a/lua/plugins/zenmode.lua b/lua/plugins/zenmode.lua new file mode 100644 index 0000000..487de4a --- /dev/null +++ b/lua/plugins/zenmode.lua @@ -0,0 +1,10 @@ +return { + { + 'folke/zen-mode.nvim', + cmd = { 'ZenMode' }, + opts = {}, + keys = { + { 'zz', 'ZenMode', desc = 'Toggle zen mode' }, + }, + }, +}