diff --git a/lua/keymap.lua b/lua/keymap.lua index d4ca057..ed07d0b 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -39,23 +39,36 @@ end, { desc = 'Log node' }) -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands +local function win_or_treesj(dir_cmd, desc) + return function() + local cur = vim.api.nvim_get_current_win() + vim.cmd('wincmd ' .. dir_cmd) + if vim.api.nvim_get_current_win() == cur then + local ok, treesj = pcall(require, 'treesj') + if ok and type(treesj.toggle) == 'function' then + treesj.toggle() + end + end + end, { desc = desc } +end + vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +vim.keymap.set('n', '', (win_or_treesj)('j', 'Move focus to the lower window or treesj.toggle()')) +vim.keymap.set('n', '', (win_or_treesj)('k', 'Move focus to the upper window or treesj.toggle()')) vim.keymap.set({ 'i' }, '', function() local ls = require 'luasnip' if ls.choice_active() then ls.change_choice(1) end -end, { silent = true }) +end, { desc = 'Toggle snippet choice', silent = true }) vim.keymap.set({ 'i' }, '', function() local ls = require 'luasnip' if ls.choice_active() then ls.change_choice(-1) end -end, { silent = true }) +end, { desc = 'Toggle snippet choice', silent = true }) vim.keymap.set({ 'i', 's' }, '', function() local ls = require 'luasnip' if ls.expandable() then @@ -63,13 +76,13 @@ vim.keymap.set({ 'i', 's' }, '', function() elseif ls.in_snippet() then ls.jump(1) end -end, { silent = true }) +end, { desc = 'Expand snippet', silent = true }) vim.keymap.set({ 'i', 's' }, '', function() local ls = require 'luasnip' if ls.in_snippet() then ls.jump(-1) end -end, { silent = true }) +end, { desc = 'Go back a snippet slot', silent = true }) vim.keymap.set('n', '', 'H', { desc = 'Move window to the left' }) vim.keymap.set('n', '', 'L', { desc = 'Move window to the right' }) diff --git a/lua/plugins/mcp.lua b/lua/plugins/mcp.lua deleted file mode 100644 index 7a52c75..0000000 --- a/lua/plugins/mcp.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - 'ravitemer/mcphub.nvim', - dependencies = { - 'nvim-lua/plenary.nvim', -- Required for Job and HTTP requests - }, - -- uncomment the following line to load hub lazily - cmd = 'MCPHub', -- lazy load - build = 'npm install -g mcp-hub@latest', -- Installs required mcp-hub npm module - -- uncomment this if you don't want mcp-hub to be available globally or can't use -g - -- build = "bundled_build.lua", -- Use this and set use_bundled_binary = true in opts (see Advanced configuration) - config = function() - require('mcphub').setup({ - auto_approve = true, - }) - end, -} diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua index 9d94694..1a16252 100644 --- a/lua/plugins/mini.lua +++ b/lua/plugins/mini.lua @@ -25,16 +25,36 @@ return { require('mini.pairs').setup() - -- require('mini.jump').setup() + require('mini.jump').setup { + mappings = { + repeat_jump = ':', + }, + } - require('mini.jump2d').setup() + local MiniJump2d = require 'mini.jump2d' + MiniJump2d.setup { + spotter = MiniJump2d.gen_spotter.union( + MiniJump2d.gen_spotter.pattern('[([{][^$]', 'end'), + MiniJump2d.gen_spotter.pattern('%$.', 'end'), + MiniJump2d.gen_spotter.pattern('->.', 'end'), + MiniJump2d.gen_spotter.pattern('^%s*%S', 'end') + ), + mappings = { + start_jumping = 'S', + }, + allowed_lines = { + blank = false, + cursor_at = false, + fold = false, + }, + } require('mini.splitjoin').setup() require('mini.map').setup() -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, + -- You could remove this setup call i you don't like it, -- and try some other statusline plugin local statusline = require 'mini.statusline' -- set use_icons to true if you have a Nerd Font diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua deleted file mode 100644 index c22c451..0000000 --- a/lua/plugins/neo-tree.lua +++ /dev/null @@ -1,58 +0,0 @@ --- Neo-tree is a Neovim plugin to browse the file system --- https://github.com/nvim-neo-tree/neo-tree.nvim - -return { - -- 'nvim-neo-tree/neo-tree.nvim', - -- version = '*', - -- dependencies = { - -- 'nvim-lua/plenary.nvim', - -- 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended - -- 'MunifTanjim/nui.nvim', - -- }, - -- cmd = 'Neotree', - -- keys = { - -- { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, - -- }, - -- - -- build = function() - -- if vim.fn.executable 'fd' == 0 then - -- local install_cmd - -- if vim.fn.has 'mac' == 1 then - -- install_cmd = 'brew install fd' - -- elseif vim.fn.has 'unix' == 1 then - -- if vim.fn.filereadable '/etc/arch-release' == 1 then - -- install_cmd = 'sudo pacman -S --noconfirm fd' - -- else - -- install_cmd = 'sudo apt-get install -y fd-find' - -- end - -- else - -- vim.notify("Please install 'fd' manually for neo-tree.", vim.log.levels.WARN) - -- return - -- end - -- vim.fn.system(install_cmd) - -- end - -- end, - -- - -- opts = function(_, opts) - -- local function on_move(data) - -- Snacks.rename.on_rename_file(data.source, data.destination) - -- end - -- local events = require 'neo-tree.events' - -- opts.event_handlers = opts.event_handlers or {} - -- vim.list_extend(opts.event_handlers, { - -- { event = events.FILE_MOVED, handler = on_move }, - -- { event = events.FILE_RENAMED, handler = on_move }, - -- }) - -- - -- opts.filesystem = { - -- window = { - -- mappings = { - -- ['\\'] = 'close_window', - -- }, - -- }, - -- filtered_items = { - -- hide_dotfiles = false, - -- }, - -- } - -- end, -} diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua deleted file mode 100644 index 2cb15c2..0000000 --- a/lua/plugins/neotest.lua +++ /dev/null @@ -1,27 +0,0 @@ -require('helpers').edit_cf('pt', '/lua/plugins/neotest.lua') -return { - 'nvim-neotest/neotest', - lazy = true, - dependencies = { - 'nvim-neotest/nvim-nio', - 'nvim-lua/plenary.nvim', - 'antoinemadec/FixCursorHold.nvim', - 'nvim-treesitter/nvim-treesitter', - -- Adapters - 'V13Axel/neotest-pest', - -- "olimorris/neotest-phpunit", - }, - config = function() - require('neotest').setup { - adapters = { - require 'neotest-pest' { - sail_enabled = function() - return false - end, - parallel = 10, - }, - -- require('neotest-phpunit'), - }, - } - end, -} diff --git a/lua/plugins/treesj.lua b/lua/plugins/treesj.lua new file mode 100644 index 0000000..f150216 --- /dev/null +++ b/lua/plugins/treesj.lua @@ -0,0 +1,10 @@ +return { + 'Wansmer/treesj', + lazy = true, + dependencies = { 'nvim-treesitter/nvim-treesitter' }, -- if you install parsers with `nvim-treesitter` + config = function() + require('treesj').setup({ + use_default_keymaps = false, + }) + end, +} diff --git a/lua/plugins/vectorcode.lua b/lua/plugins/vectorcode.lua deleted file mode 100644 index a50c06a..0000000 --- a/lua/plugins/vectorcode.lua +++ /dev/null @@ -1,13 +0,0 @@ -require('helpers').edit_cf('pv', '/lua/plugins/vectorcode.lua') - -return {} --- return { --- 'Davidyz/VectorCode', --- version = '*', -- optional, depending on whether you're on nightly or release --- dependencies = { 'nvim-lua/plenary.nvim' }, --- build = 'pipx upgrade vectorcode', --- cmd = 'VectorCode', -- if you're lazy-loading VectorCode --- opts = { --- async_backend = 'lsp', --- }, --- } diff --git a/lua/plugins/wakatime.lua b/lua/plugins/wakatime.lua deleted file mode 100644 index 7db9959..0000000 --- a/lua/plugins/wakatime.lua +++ /dev/null @@ -1,8 +0,0 @@ -if vim.loop.os_uname().sysname == 'Darwin' then - return { - 'wakatime/vim-wakatime', - lazy = false, - } -else - return {} -end