diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index dbc863e..b3fe4e3 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1 +1 @@ -require("config") +require('config') diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 0171051..1e54020 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -2,6 +2,7 @@ "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "auto-session": { "branch": "main", "commit": "00334ee24b9a05001ad50221c8daffbeedaa0842" }, "blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" }, + "catppuccin": { "branch": "main", "commit": "1bf070129c0b6f77cc23f6a2212dcdc868308c52" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "flutter-tools.nvim": { "branch": "main", "commit": "8fa438f36fa6cb747a93557d67ec30ef63715c20" }, @@ -18,12 +19,8 @@ "nvim-lspconfig": { "branch": "master", "commit": "8b0f47d851ee5343d38fe194a06ad16b9b9bd086" }, "nvim-treesitter": { "branch": "master", "commit": "684eeac91ed8e297685a97ef70031d19ac1de25a" }, "nvim-web-devicons": { "branch": "master", "commit": "68f70df44652d310d2adedf181b174c33a693665" }, - "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-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" } } diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index ee00f83..9f62316 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -6,8 +6,8 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) -vim.api.nvim_create_autocmd("User", { - pattern = "MiniFilesActionRename", +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 6657397..16ba720 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -1,4 +1,4 @@ --- NOTE: General -- +-- INFO: General -- -- hjkl to ijkl remap vim.keymap.set({ 'n', 'v', 'o' }, 'j', 'h', { desc = 'hjkl to ijkl' }) @@ -29,9 +29,9 @@ vim.keymap.set('i', '', '', { desc = 'delete word in insert mode' }) --- NOTE: Right Dock: Terminal & MiniOilFiles +-- INFO: Right Dock: Terminal & MiniOilFiles --- NOTE: ctrl m +-- INFO: ctrl m vim.keymap.set('n', '', 'Floaterminal', { desc = 'open terminal', nowait = true }) vim.keymap.set('t', '', 'q', { desc = 'close terminal window' }) @@ -47,7 +47,7 @@ vim.keymap.set('t', '', '', { desc = 'normal mode in terminal' } vim.keymap.set('n', '', require('mini.files').open, { desc = 'open mini files' }) --- NOTE: Windows +-- INFO: Windows -- this is weird because ctrl-i => Up & ctrl-k => Down in Kitty conf vim.keymap.set({ 'n', 'v', 'o' }, 'ki', ':wincmd k', { desc = 'move focus between windows', silent = true }) @@ -55,8 +55,25 @@ vim.keymap.set({ 'n', 'v', 'o' }, 'kk', ':wincmd j', { desc = 'move 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 }) +-- INFO: Picker --- NOTE: LSP +local Snacks = require('snacks') + +vim.keymap.set('n', 'sf', Snacks.picker.files, { desc = 'pick files' }) +vim.keymap.set('n', 'sw', Snacks.picker.grep, { desc = 'grep' }) +vim.keymap.set('n', 'st', function() + Snacks.picker.todo_comments() +end, { desc = 'search todos' }) +vim.keymap.set('n', 'sh', Snacks.picker.help, { desc = 'help' }) + +vim.keymap.set('n', '/', function() + Snacks.picker.lines({ layout = 'select' }) +end, { desc = 'fuzzily search in current buffer' }) + +vim.keymap.set('n', 'sp', 'Autosession search', { desc = 'search sessions' }) + + +-- INFO: LSP -- This function gets run when an LSP attaches to a particular buffer. -- That is to say, every time a new file is opened that is associated with @@ -66,8 +83,6 @@ vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) - local builtin = require('telescope.builtin') - local map = function(keys, func, desc, mode) mode = mode or 'n' vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc, nowait = true }) @@ -76,12 +91,12 @@ vim.api.nvim_create_autocmd('LspAttach', { -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. map('', function() - vim.api.nvim_exec_autocmds("User", { pattern = "SnacksInputRename" }) + vim.api.nvim_exec_autocmds('User', { pattern = 'SnacksInputRename' }) vim.lsp.buf.rename() - vim.api.nvim_create_autocmd("WinClosed", { + vim.api.nvim_create_autocmd('WinClosed', { callback = function (args) - vim.api.nvim_exec_autocmds("User", { - pattern = "SnacksInputReset" + vim.api.nvim_exec_autocmds('User', { + pattern = 'SnacksInputReset' }) vim.api.nvim_del_autocmd(args.id) end @@ -93,16 +108,16 @@ vim.api.nvim_create_autocmd('LspAttach', { map('ga', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) -- Find references for the word under your cursor. - map('gr', builtin.lsp_references, '[G]oto [R]eferences') + map('gr', Snacks.picker.lsp_references, '[G]oto [R]eferences') -- Jump to the implementation of the word under your cursor. -- Useful when your language has ways of declaring types without an actual implementation. - map('gi', builtin.lsp_implementations, '[G]oto [I]mplementation') + map('gi', Snacks.picker.lsp_implementations, '[G]oto [I]mplementation') -- Jump to the definition of the word under your cursor. -- This is where a variable was first declared, or where a function is defined, etc. -- To jump back, press . - map('gd', builtin.lsp_definitions, '[G]oto [D]efinition') + map('gd', Snacks.picker.lsp_definitions, '[G]oto [D]efinition') -- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. @@ -110,16 +125,16 @@ vim.api.nvim_create_autocmd('LspAttach', { -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. - map('go', builtin.lsp_document_symbols, 'Open Document Symbols') + map('go', Snacks.picker.lsp_symbols, 'Open Document Symbols') -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. - map('gO', builtin.lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') + map('gO', Snacks.picker.lsp_workspace_symbols, 'Open Workspace Symbols') -- Jump to the type of the word under your cursor. -- Useful when you're not sure what type a variable is and you want to see -- the definition of its *type*, not where it was *defined*. - map('gt', builtin.lsp_type_definitions, '[G]oto [T]ype Definition') + map('gt', Snacks.picker.lsp_type_definitions, '[G]oto [T]ype Definition') -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) ---@param client vim.lsp.Client @@ -175,18 +190,18 @@ vim.api.nvim_create_autocmd('LspAttach', { end, }) --- NOTE: Molten -vim.keymap.set("n", "mi", ":MoltenInit", - { silent = true, desc = "Initialize the plugin" }) -vim.keymap.set("n", "mo", ":MoltenEvaluateOperator", - { silent = true, desc = "run operator selection" }) -vim.keymap.set("n", "ml", ":MoltenEvaluateLine", - { silent = true, desc = "evaluate line" }) -vim.keymap.set("v", "mv", ":MoltenEvaluateVisualgv", - { silent = false, desc = "evaluate visual selection" }) -vim.keymap.set("n", "mc", ":MoltenReevaluateCell", - { silent = false, desc = "reevaluate cell" }) -vim.keymap.set("n", "me", ":noautocmd MoltenEnterOutput", - { silent = true, desc = "show/enter output" }) -vim.keymap.set("n", "mh", ":MoltenHideOutput", - { silent = true, desc = "hide output" }) +-- INFO: Molten +vim.keymap.set('n', 'mi', ':MoltenInit', + { silent = true, desc = 'Initialize the plugin' }) +vim.keymap.set('n', 'mo', ':MoltenEvaluateOperator', + { silent = true, desc = 'run operator selection' }) +vim.keymap.set('n', 'ml', ':MoltenEvaluateLine', + { silent = true, desc = 'evaluate line' }) +vim.keymap.set('v', 'mv', ':MoltenEvaluateVisualgv', + { silent = false, desc = 'evaluate visual selection' }) +vim.keymap.set('n', 'mc', ':MoltenReevaluateCell', + { silent = false, desc = 'reevaluate cell' }) +vim.keymap.set('n', 'me', ':noautocmd MoltenEnterOutput', + { silent = true, desc = 'show/enter output' }) +vim.keymap.set('n', 'mh', ':MoltenHideOutput', + { silent = true, desc = 'hide output' }) diff --git a/.config/nvim/lua/config/plugins/autosession.lua b/.config/nvim/lua/config/plugins/autosession.lua index 1b824f2..7c9d14e 100644 --- a/.config/nvim/lua/config/plugins/autosession.lua +++ b/.config/nvim/lua/config/plugins/autosession.lua @@ -3,7 +3,7 @@ return { lazy = false, ---enables autocomplete for opts - ---@module "auto-session" + ---@module 'auto-session' ---@type AutoSession.Config opts = { suppressed_dirs = { '~/', '~/Downloads', '/' }, diff --git a/.config/nvim/lua/config/plugins/git.lua b/.config/nvim/lua/config/plugins/git.lua index 6fffaeb..dbffb9e 100644 --- a/.config/nvim/lua/config/plugins/git.lua +++ b/.config/nvim/lua/config/plugins/git.lua @@ -38,7 +38,7 @@ return { }, }, { - "sindrets/diffview.nvim", + 'sindrets/diffview.nvim', config = function () local actions = require('diffview.config').actions require('diffview').setup({ @@ -57,10 +57,10 @@ return { end }, -- { - -- "NeogitOrg/neogit", + -- 'NeogitOrg/neogit', -- dependencies = { - -- "nvim-lua/plenary.nvim", - -- "nvim-telescope/telescope.nvim", + -- 'nvim-lua/plenary.nvim', + -- 'nvim-telescope/telescope.nvim', -- }, -- config = function() -- require('neogit').setup({ @@ -73,41 +73,41 @@ return { -- kind = 'floating', -- }, -- commit_select_view = { - -- kind = "floating", + -- kind = 'floating', -- }, -- commit_view = { - -- kind = "floating", - -- verify_commit = vim.fn.executable("gpg") == 1, -- Can be set to true or false, otherwise we try to find the binary + -- kind = 'floating', + -- verify_commit = vim.fn.executable('gpg') == 1, -- Can be set to true or false, otherwise we try to find the binary -- }, -- log_view = { - -- kind = "floating", + -- kind = 'floating', -- }, -- rebase_editor = { - -- kind = "floating", + -- kind = 'floating', -- }, -- reflog_view = { - -- kind = "floating", + -- kind = 'floating', -- }, -- merge_editor = { - -- kind = "floating", + -- kind = 'floating', -- }, -- description_editor = { - -- kind = "floating", + -- kind = 'floating', -- }, -- tag_editor = { - -- kind = "floating", + -- kind = 'floating', -- }, -- preview_buffer = { - -- kind = "floating", + -- kind = 'floating', -- }, -- popup = { - -- kind = "floating", + -- kind = 'floating', -- }, -- stash = { - -- kind = "floating", + -- kind = 'floating', -- }, -- refs_view = { - -- kind = "floating", + -- kind = 'floating', -- }, -- mappings = { -- status = { diff --git a/.config/nvim/lua/config/plugins/init.lua b/.config/nvim/lua/config/plugins/init.lua index 1234bb2..c236282 100644 --- a/.config/nvim/lua/config/plugins/init.lua +++ b/.config/nvim/lua/config/plugins/init.lua @@ -13,23 +13,23 @@ vim.opt.rtp:prepend(lazypath) -- local keymaps = require('config.pluginmaps') require('lazy').setup({ - -- NOTE: General Editing -- + -- INFO: General Editing -- 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = {} }, -- TODO: i dunno about this one -- { - -- "folke/noice.nvim", - -- event = "VeryLazy", + -- 'folke/noice.nvim', + -- event = 'VeryLazy', -- opts = { -- }, -- dependencies = { - -- -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - -- "MunifTanjim/nui.nvim", + -- -- 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", + -- 'rcarriga/nvim-notify', -- } -- }, @@ -40,7 +40,7 @@ require('lazy').setup({ require('config.plugins.git'), require('config.plugins.ui'), - require('config.plugins.telescope'), + -- require('config.plugins.telescope'), require('config.plugins.blinkcmp'), require('config.plugins.languages.lsp'), require('config.plugins.languages.treesitter'), diff --git a/.config/nvim/lua/config/plugins/snacks.lua b/.config/nvim/lua/config/plugins/snacks.lua index 11904bd..6c84aaf 100644 --- a/.config/nvim/lua/config/plugins/snacks.lua +++ b/.config/nvim/lua/config/plugins/snacks.lua @@ -5,19 +5,19 @@ return { init = function() local Snacks = require('snacks') - vim.api.nvim_create_autocmd("User", { - pattern = "SnacksInputRename", + vim.api.nvim_create_autocmd('User', { + pattern = 'SnacksInputRename', callback = function () - Snacks.config.input.win.relative = "cursor" + 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", + vim.api.nvim_create_autocmd('User', { + pattern = 'SnacksInputReset', callback = function () - Snacks.config.input.win.relative = "editor" + 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' @@ -60,6 +60,52 @@ return { quickfile = { enabled = true }, rename = { enabled = true }, + picker = { + enabled = true, + matcher = { frecency = true, }, + layout = { + cycle = true, + preset = 'telescope', + }, + ui_select = true, + win = { + input = { + keys = { + [''] = { 'close', mode = 'i' }, + [''] = { 'edit_split', mode = 'i' }, + [''] = { 'edit_vsplit', mode = 'i' }, + [''] = { 'preview_scroll_down', mode = 'i' }, + [''] = { 'preview_scroll_up', mode = 'i' }, + } + } + }, + + layouts = { + telescope = { + reverse = true, + layout = { + box = 'horizontal', + backdrop = false, + width = 0.8, + height = 0.9, + border = 'none', + { + box = 'vertical', + { win = 'list', title = ' Results ', title_pos = 'center', border = 'rounded' }, + { win = 'input', height = 1, border = 'rounded', title = '{title} {live} {flags}', title_pos = 'center' }, + }, + { + win = 'preview', + title = '{preview:Preview}', + width = 0.55, + border = 'rounded', + title_pos = 'center', + }, + } + } + } + }, + bufdelete = { enabled = false }, debug = { enabled = false }, dim = { enabled = false }, @@ -71,7 +117,6 @@ return { lazygit = { enabled = false }, notifier = { enabled = false }, notify = { enabled = false }, - picker = { enabled = false }, profiler = { enabled = false }, scope = { enabled = false }, scratch = { enabled = false }, diff --git a/.config/nvim/lua/config/plugins/telescope.lua b/.config/nvim/lua/config/plugins/telescope.lua index 3db362e..6284709 100644 --- a/.config/nvim/lua/config/plugins/telescope.lua +++ b/.config/nvim/lua/config/plugins/telescope.lua @@ -36,33 +36,33 @@ return { }) pcall(require('telescope').load_extension, 'fzf') - pcall(require("telescope").load_extension('ui-select')) + pcall(require('telescope').load_extension('ui-select')) - -- NOTE: Mappings -- + -- INFO: Mappings -- - local builtin = require('telescope.builtin') + -- local builtin = require('telescope.builtin') - vim.keymap.set('n', 'sf', builtin.find_files, { desc = 'find files' }) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = 'grep string' }) - vim.keymap.set('n', 'ss', builtin.lsp_document_symbols, { desc = 'document symbols' }) - vim.keymap.set('n', 'sS', builtin.lsp_workspace_symbols, { desc = 'workspace symbols' }) - - vim.keymap.set('n', 'st', 'TodoTelescope', { desc = 'search todos' }) - vim.keymap.set('n', 'sp', 'SessionSearch', { desc = 'search sessions' }) - - vim.keymap.set('n', 'sh', function () - builtin.help_tags({ - previewer = false - }) - end, { desc = 'help' }) - - vim.keymap.set('n', '/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = 'Fuzzily search in current buffer' }) + -- vim.keymap.set('n', 'sf', builtin.find_files, { desc = 'find files' }) + -- vim.keymap.set('n', 'sw', builtin.grep_string, { desc = 'grep string' }) + -- vim.keymap.set('n', 'ss', builtin.lsp_document_symbols, { desc = 'document symbols' }) + -- vim.keymap.set('n', 'sS', builtin.lsp_workspace_symbols, { desc = 'workspace symbols' }) + -- + -- vim.keymap.set('n', 'st', 'TodoTelescope', { desc = 'search todos' }) + -- vim.keymap.set('n', 'sp', 'SessionSearch', { desc = 'search sessions' }) + -- + -- vim.keymap.set('n', 'sh', function () + -- builtin.help_tags({ + -- previewer = false + -- }) + -- end, { desc = 'help' }) + -- + -- vim.keymap.set('n', '/', function() + -- -- You can pass additional configuration to Telescope to change the theme, layout, etc. + -- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + -- winblend = 10, + -- previewer = false, + -- }) + -- end, { desc = 'Fuzzily search in current buffer' }) end } diff --git a/.config/nvim/lua/config/plugins/ui.lua b/.config/nvim/lua/config/plugins/ui.lua index 9fe5f86..d9fe4b7 100644 --- a/.config/nvim/lua/config/plugins/ui.lua +++ b/.config/nvim/lua/config/plugins/ui.lua @@ -6,15 +6,15 @@ return { }, { - 'navarasu/onedark.nvim', - config = function () - require('onedark').setup({ - style = 'darker', - code_style = { - comments = 'none' - } - }) - require('onedark').load() + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + opts = { + flavour = 'mocha', + no_italic = true, + }, + config = function() + vim.cmd('colorscheme catppuccin') end - }, + } }