diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index fa66972..0171051 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,31 +1,29 @@ { "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" }, - "autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" }, "blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "flutter-tools.nvim": { "branch": "main", "commit": "8fa438f36fa6cb747a93557d67ec30ef63715c20" }, "gitsigns.nvim": { "branch": "main", "commit": "ee7e50dfbdf49e3acfa416fd3ad3abbdb658582c" }, "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, "image.nvim": { "branch": "master", "commit": "c40215d7d7d1d8c823ee9a77be1a894d5c8df41b" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, + "mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" }, "molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" }, "nvim-lspconfig": { "branch": "master", "commit": "8b0f47d851ee5343d38fe194a06ad16b9b9bd086" }, "nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" }, "nvim-web-devicons": { "branch": "master", "commit": "68f70df44652d310d2adedf181b174c33a693665" }, - "oil.nvim": { "branch": "master", "commit": "685cdb4ffa74473d75a1b97451f8654ceeab0f4a" }, "onedark.nvim": { "branch": "master", "commit": "67a74c275d1116d575ab25485d1bfa6b2a9c38a6" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, - "vim-be-good": { "branch": "master", "commit": "0ae3de14eb8efc6effe7704b5e46495e91931cc5" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" } } diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index a9a4d7b..ee00f83 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -5,3 +5,10 @@ vim.api.nvim_create_autocmd('TextYankPost', { vim.highlight.on_yank() end, }) + +vim.api.nvim_create_autocmd("User", { + pattern = "MiniFilesActionRename", + callback = function(event) + require('snacks').rename.on_rename_file(event.data.from, event.data.to) + end, +}) diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 4ec2b47..6657397 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -29,7 +29,7 @@ vim.keymap.set('i', '', '', { desc = 'delete word in insert mode' }) --- NOTE: Right Dock: Terminal & Oil +-- NOTE: Right Dock: Terminal & MiniOilFiles -- NOTE: ctrl m vim.keymap.set('n', '', 'Floaterminal', { desc = 'open terminal', nowait = true }) @@ -37,23 +37,23 @@ vim.keymap.set('t', '', 'q', { desc = 'close terminal window' }) vim.keymap.set('t', '', 'Floaterminal 1', { desc = 'terminal 1' }) vim.keymap.set('t', '', 'Floaterminal 2', { desc = 'terminal 2' }) -vim.keymap.set('t', '', 'Floaterminal 3', { desc = 'terminal 3' }) -vim.keymap.set('t', '', 'Floaterminal 4', { desc = 'terminal 4' }) +vim.keymap.set('t', '', 'Floaterminal 3', { desc = 'terminal 3' }) +vim.keymap.set('t', '', 'Floaterminal 4', { desc = 'terminal 4' }) vim.keymap.set('t', '', '', { desc = 'kill terminal' }) vim.keymap.set('t', '', '', { desc = 'normal mode in terminal' }) -vim.keymap.set('n', '', 'Floateroil', { desc = 'open oil' }) +vim.keymap.set('n', '', require('mini.files').open, { desc = 'open mini files' }) -- NOTE: Windows -- this is weird because ctrl-i => Up & ctrl-k => Down in Kitty conf -vim.keymap.set({ 'n', 'v', 'o' }, '', ':wincmd k', { desc = 'moving around window using ctrl-k ijkl', silent = true }) -vim.keymap.set({ 'n', 'v', 'o' }, '', ':wincmd j', { desc = 'moving around window using ctrl-k ijkl', silent = true }) -vim.keymap.set({ 'n', 'v', 'o' }, '', ':wincmd l', { desc = 'moving around window using ctrl-k ijkl', silent = true }) -vim.keymap.set({ 'n', 'v', 'o' }, '', ':wincmd h', { desc = 'moving around window using ctrl-k ijkl', silent = true }) +vim.keymap.set({ 'n', 'v', 'o' }, 'ki', ':wincmd k', { desc = 'move focus between windows', silent = true }) +vim.keymap.set({ 'n', 'v', 'o' }, 'kk', ':wincmd j', { desc = 'move focus between windows', silent = true }) +vim.keymap.set({ 'n', 'v', 'o' }, 'kl', ':wincmd l', { desc = 'move focus between windows', silent = true }) +vim.keymap.set({ 'n', 'v', 'o' }, 'kj', ':wincmd h', { desc = 'move focus between windows', silent = true }) -- NOTE: LSP @@ -75,7 +75,18 @@ vim.api.nvim_create_autocmd('LspAttach', { -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. - map('', vim.lsp.buf.rename, '[R]e[n]ame') + map('', function() + vim.api.nvim_exec_autocmds("User", { pattern = "SnacksInputRename" }) + vim.lsp.buf.rename() + vim.api.nvim_create_autocmd("WinClosed", { + callback = function (args) + vim.api.nvim_exec_autocmds("User", { + pattern = "SnacksInputReset" + }) + vim.api.nvim_del_autocmd(args.id) + end + }) + end, '[R]e[n]ame') -- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. diff --git a/.config/nvim/lua/config/plugins/harpoon.lua b/.config/nvim/lua/config/plugins/harpoon.lua index 459891e..f163d98 100644 --- a/.config/nvim/lua/config/plugins/harpoon.lua +++ b/.config/nvim/lua/config/plugins/harpoon.lua @@ -18,8 +18,8 @@ return { vim.keymap.set('n', '', function() harpoon:list():select(1) end) vim.keymap.set('n', '', function() harpoon:list():select(2) end) - vim.keymap.set('n', '', function() harpoon:list():select(3) end) - vim.keymap.set('n', '', function() harpoon:list():select(4) end) + vim.keymap.set('n', '', function() harpoon:list():select(3) end) + vim.keymap.set('n', '', function() harpoon:list():select(4) end) -- -- Toggle previous & next buffers stored within Harpoon list -- vim.keymap.set('n', '', function() harpoon:list():prev() end) diff --git a/.config/nvim/lua/config/plugins/init.lua b/.config/nvim/lua/config/plugins/init.lua index 1e0a869..1234bb2 100644 --- a/.config/nvim/lua/config/plugins/init.lua +++ b/.config/nvim/lua/config/plugins/init.lua @@ -15,28 +15,29 @@ vim.opt.rtp:prepend(lazypath) require('lazy').setup({ -- NOTE: General Editing -- 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - { - 'm4xshen/autoclose.nvim', - opts = { - keys = { - ['%'] = { close = true, escape = true, pair = '%%', enabled_filetypes = { 'htmldjango' } }, - }, - options = { disable_when_touch = true, } - } - }, { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = {} }, - { - 'lukas-reineke/indent-blankline.nvim', - main = 'ibl', - ---@module 'ibl' - ---@type ibl.config - opts = {}, - }, + -- TODO: i dunno about this one + -- { + -- "folke/noice.nvim", + -- event = "VeryLazy", + -- opts = { + -- }, + -- dependencies = { + -- -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + -- "MunifTanjim/nui.nvim", + -- -- OPTIONAL: + -- -- `nvim-notify` is only needed, if you want to use the notification view. + -- -- If not available, we use `mini` as the fallback + -- "rcarriga/nvim-notify", + -- } + -- }, - 'ThePrimeagen/vim-be-good', + -- { 'stevearc/dressing.nvim', opts = {}, }, + + -- 'ThePrimeagen/vim-be-good', + -- { 'vuciv/golf' }, - require('config.plugins.oil'), require('config.plugins.git'), require('config.plugins.ui'), require('config.plugins.telescope'), @@ -45,20 +46,10 @@ require('lazy').setup({ require('config.plugins.languages.treesitter'), require('config.plugins.harpoon'), require('config.plugins.autosession'), + require('config.plugins.snacks'), + require('config.plugins.mini'), require('config.plugins.languages.molten'), require('config.plugins.languages.flutter'), - - -- NOTE: maybe revisit this later - -- { - -- 'brenton-leighton/multiple-cursors.nvim', - -- version = '*', -- Use the latest tagged version - -- opts = { - -- custom_key_maps = keymaps.multicursor_custom() - -- }, -- This causes the plugin setup function to be called - -- keys = keymaps.multicursor(), - -- }, - - }) diff --git a/.config/nvim/lua/config/plugins/languages/flutter.lua b/.config/nvim/lua/config/plugins/languages/flutter.lua index 0efe3b9..c11ea3f 100644 --- a/.config/nvim/lua/config/plugins/languages/flutter.lua +++ b/.config/nvim/lua/config/plugins/languages/flutter.lua @@ -1,11 +1,10 @@ return { 'nvim-flutter/flutter-tools.nvim', lazy = false, - dependencies = { - 'nvim-lua/plenary.nvim', - 'stevearc/dressing.nvim', -- optional for vim.ui.select - }, + dependencies = { 'nvim-lua/plenary.nvim', }, config = function() require('flutter-tools').setup({}) + vim.keymap.set('n', 'fd', 'FlutterDevices', { desc = 'show flutter devices' }) + vim.keymap.set('n', 'fq', 'FlutterQuit', { desc = 'stop flutter' }) end, } diff --git a/.config/nvim/lua/config/plugins/languages/lsp.lua b/.config/nvim/lua/config/plugins/languages/lsp.lua index a253de3..865edf0 100644 --- a/.config/nvim/lua/config/plugins/languages/lsp.lua +++ b/.config/nvim/lua/config/plugins/languages/lsp.lua @@ -62,6 +62,7 @@ return { emmet_language_server = {}, html = { filetypes = { 'html', 'htmldjango' }, }, cssls = {}, + vtsls = {}, -- -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- diff --git a/.config/nvim/lua/config/plugins/languages/treesitter.lua b/.config/nvim/lua/config/plugins/languages/treesitter.lua index a7b5607..bb7db15 100644 --- a/.config/nvim/lua/config/plugins/languages/treesitter.lua +++ b/.config/nvim/lua/config/plugins/languages/treesitter.lua @@ -3,15 +3,31 @@ return { build = ':TSUpdate', main = 'nvim-treesitter.configs', -- Sets main module to use for opts opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'css', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'rust', 'python', 'htmldjango', 'r', 'dart' }, - auto_install = false, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - -- additional_vim_regex_highlighting = { 'ruby' }, + ensure_installed = { + 'bash', + 'c', + 'diff', + 'html', + 'css', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'vim', + 'vimdoc', + 'rust', + 'python', + 'htmldjango', + 'r', + 'dart', + 'javascript', + 'typescript', + 'tsx', + 'regex' }, + auto_install = false, + highlight = { enable = true, }, indent = { enable = true }, }, -- There are additional nvim-treesitter modules that you can use to interact diff --git a/.config/nvim/lua/config/plugins/mini.lua b/.config/nvim/lua/config/plugins/mini.lua new file mode 100644 index 0000000..363370c --- /dev/null +++ b/.config/nvim/lua/config/plugins/mini.lua @@ -0,0 +1,34 @@ +return { + 'echasnovski/mini.nvim', + version = '*' , + config = function() + require('mini.pairs').setup({}) + require('mini.ai').setup({ + mappings = { + around = 'a', + inside = 'h', + + around_next = 'an', + inside_next = 'hn', + around_last = 'al', + inside_last = 'hl', + + goto_left = 'g[', + goto_right = 'g]', + }, + silent = true, + }) + require('mini.surround').setup({ + silent = true, + }) + require('mini.files').setup({ + mappings = { + go_in = 'l', + go_out = 'j', + go_in_plus = 'L', + go_out_plus = 'J', + synchronize = '' + } + }) + end +} diff --git a/.config/nvim/lua/config/plugins/oil.lua b/.config/nvim/lua/config/plugins/oil.lua deleted file mode 100644 index a10d805..0000000 --- a/.config/nvim/lua/config/plugins/oil.lua +++ /dev/null @@ -1,51 +0,0 @@ -return { - 'stevearc/oil.nvim', - ---@module 'oil' - ---@type oil.SetupOpts - opts = { - use_default_keymaps = false, - buf_options = { - buflisted = true - }, - keymaps = { - [''] = { '', remap = true }, - - [''] = { callback = function() - local oil = require('oil') - - local cursor_entry = oil.get_cursor_entry() - - if not cursor_entry then - return - end - if cursor_entry.type == 'directory' then - oil.select() - else - oil.select(nil, function() - vim.cmd.wincmd('h') - local buf_name = vim.api.nvim_buf_get_name(0) - local is_empty = buf_name == '' and not vim.bo.modified - if is_empty then - -- delete empty buffer - vim.cmd('bd') - else - -- close window of not empty buffer - vim.cmd('q') - end - end) - end - end, nowait = true }, - - -- shift space remapping - [''] = 'actions.parent', - - [''] = { callback = function() - vim.cmd('bd') - end, nowait = true } - } - }, - -- dependencies = { { 'echasnovski/mini.icons', opts = {} } }, - dependencies = { 'nvim-tree/nvim-web-devicons' }, -- use if you prefer nvim-web-devicons - -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. - lazy = false, -} diff --git a/.config/nvim/lua/config/plugins/snacks.lua b/.config/nvim/lua/config/plugins/snacks.lua new file mode 100644 index 0000000..11904bd --- /dev/null +++ b/.config/nvim/lua/config/plugins/snacks.lua @@ -0,0 +1,87 @@ +return { + 'folke/snacks.nvim', + priority = 1000, + lazy = false, + + init = function() + local Snacks = require('snacks') + vim.api.nvim_create_autocmd("User", { + pattern = "SnacksInputRename", + callback = function () + Snacks.config.input.win.relative = "cursor" + Snacks.config.input.win.col = -1 + Snacks.config.input.win.row = -3 + Snacks.config.input.win.title_pos = 'left' + end + }) + vim.api.nvim_create_autocmd("User", { + pattern = "SnacksInputReset", + callback = function () + Snacks.config.input.win.relative = "editor" + Snacks.config.input.win.col = nil + Snacks.config.input.win.row = 6 + Snacks.config.input.win.title_pos = 'center' + end + }) + end, + + + ---@type snacks.Config + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + bigfile = { enabled = true }, + dashboard = { + enabled = true, + preset = { + header = [[ + ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ + ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ + ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ + ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ + ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ + ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝]], + }, + sections = { + { section = 'header' }, + { section = 'startup' }, + } + }, + + indent = { + enabled = true, + animate = { enabled = false }, + }, + input = { + enabled = true, + win = {}, + }, + quickfile = { enabled = true }, + rename = { enabled = true }, + + bufdelete = { enabled = false }, + debug = { enabled = false }, + dim = { enabled = false }, + explorer = { enabled = false }, + git = { enabled = false }, + gitbrowse = { enabled = false }, + image = { enabled = false }, + layout = { enabled = false }, + lazygit = { enabled = false }, + notifier = { enabled = false }, + notify = { enabled = false }, + picker = { enabled = false }, + profiler = { enabled = false }, + scope = { enabled = false }, + scratch = { enabled = false }, + scroll = { enabled = false }, + statuscolumn = { enabled = false }, + terminal = { enabled = false }, + toggle = { enabled = false }, + win = { enabled = false }, + words = { enabled = false }, + zed = { enabled = false }, + }, + +} diff --git a/.config/nvim/lua/config/plugins/telescope.lua b/.config/nvim/lua/config/plugins/telescope.lua index c706234..3db362e 100644 --- a/.config/nvim/lua/config/plugins/telescope.lua +++ b/.config/nvim/lua/config/plugins/telescope.lua @@ -10,6 +10,7 @@ return { return vim.fn.executable 'make' == 1 end, }, + 'nvim-telescope/telescope-ui-select.nvim', }, config = function() local actions = require('telescope.actions') @@ -28,9 +29,14 @@ return { [''] = actions.file_vsplit } } + }, + extensions = { + ['ui-select'] = { require('telescope.themes').get_dropdown({}) }, } + }) pcall(require('telescope').load_extension, 'fzf') + pcall(require("telescope").load_extension('ui-select')) -- NOTE: Mappings -- diff --git a/.config/nvim/lua/config/plugins/ui.lua b/.config/nvim/lua/config/plugins/ui.lua index 896497b..9fe5f86 100644 --- a/.config/nvim/lua/config/plugins/ui.lua +++ b/.config/nvim/lua/config/plugins/ui.lua @@ -1,22 +1,4 @@ return { - -- { - -- 'akinsho/bufferline.nvim', - -- version = "*", - -- dependencies = 'nvim-tree/nvim-web-devicons', - -- opts = { - -- options = { - -- custom_filter = function(buf, _) - -- local buf_name = vim.api.nvim_buf_get_name(buf) - -- if string.find(buf_name, '^term://') or string.find(buf_name, '^oil://') then - -- return false - -- end - -- return true - -- end, - -- show_buffer_close_icons = false, - -- -- style_preset = require('bufferline').style_preset.minimal - -- } - -- } - -- }, { 'nvim-lualine/lualine.nvim', dependencies = { 'nvim-tree/nvim-web-devicons' },