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' }, + }, + }, +}