diff --git a/init.lua b/init.lua index 638e8fa0..3a7f56a8 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -91,7 +5,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -169,12 +83,6 @@ vim.g.mapleader = ' ' vim.opt.swapfile = false --- Navigate vim panes better -vim.keymap.set('n', '', ':wincmd k') -vim.keymap.set('n', '', ':wincmd j') -vim.keymap.set('n', '', ':wincmd h') -vim.keymap.set('n', '', ':wincmd l') - vim.keymap.set('n', 'h', ':nohlsearch') vim.wo.number = true -- [[ Basic Keymaps ]] diff --git a/lua/custom/plugins/flash.lua b/lua/custom/plugins/flash.lua index 49d14bcc..06162249 100644 --- a/lua/custom/plugins/flash.lua +++ b/lua/custom/plugins/flash.lua @@ -3,12 +3,15 @@ return { event = 'VeryLazy', ---@type Flash.Config opts = { - jump = { - pos = 'end', + modes = { + char = { + enabled = false, + jump_labels = true, + }, }, }, -- stylua: ignore keys = { - { "", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "/", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, }, } diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua index 639b66f9..1491c2d2 100644 --- a/lua/custom/plugins/harpoon.lua +++ b/lua/custom/plugins/harpoon.lua @@ -1,37 +1,37 @@ return { - 'ThePrimeagen/harpoon', - branch = 'harpoon2', - dependencies = { 'nvim-lua/plenary.nvim' }, - init = function() - local harpoon = require 'harpoon' - - harpoon:setup() - vim.keymap.set('n', 'a', function() - harpoon:list():add() - end) - vim.keymap.set('n', '', function() - harpoon.ui:toggle_quick_menu(harpoon:list()) - end) - - 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) - - -- Toggle previous & next buffers stored within Harpoon list - vim.keymap.set('n', '', function() - harpoon:list():prev() - end) - vim.keymap.set('n', '', function() - harpoon:list():next() - end) - end, + -- 'ThePrimeagen/harpoon', + -- branch = 'harpoon2', + -- dependencies = { 'nvim-lua/plenary.nvim' }, + -- init = function() + -- local harpoon = require 'harpoon' + -- + -- harpoon:setup() + -- vim.keymap.set('n', 'a', function() + -- harpoon:list():add() + -- end) + -- vim.keymap.set('n', '', function() + -- harpoon.ui:toggle_quick_menu(harpoon:list()) + -- end) + -- + -- 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) + -- + -- -- Toggle previous & next buffers stored within Harpoon list + -- vim.keymap.set('n', '', function() + -- harpoon:list():prev() + -- end) + -- vim.keymap.set('n', '', function() + -- harpoon:list():next() + -- end) + -- end, } diff --git a/lua/custom/plugins/nvim-tmux-navigation.lua b/lua/custom/plugins/nvim-tmux-navigation.lua index 79d0a897..26fb72ba 100644 --- a/lua/custom/plugins/nvim-tmux-navigation.lua +++ b/lua/custom/plugins/nvim-tmux-navigation.lua @@ -1,6 +1,7 @@ return { 'christoomey/vim-tmux-navigator', cmd = { + 'TmuxNavigateLeft', 'TmuxNavigateDown', 'TmuxNavigateUp', 'TmuxNavigateRight', @@ -8,6 +9,7 @@ return { 'TmuxNavigatorProcessList', }, keys = { + { '', 'TmuxNavigateLeft' }, { '', 'TmuxNavigateDown' }, { '', 'TmuxNavigateUp' }, { '', 'TmuxNavigateRight' }, diff --git a/plugin/marks.lua b/plugin/marks.lua new file mode 100644 index 00000000..762ccfce --- /dev/null +++ b/plugin/marks.lua @@ -0,0 +1,33 @@ +-- Function to convert to uppercase and set a mark +vim.api.nvim_create_user_command('SetGlobalMark', function() + local ok, char = pcall(vim.fn.getcharstr) + if not ok then + return + end + + -- Convert lowercase to uppercase + if char:match '[a-z]' then + char = char:upper() + end + + vim.cmd('normal! m' .. char) +end, {}) + +-- Function to convert to uppercase and jump to a mark +vim.api.nvim_create_user_command('JumpToGlobalMark', function() + local ok, char = pcall(vim.fn.getcharstr) + if not ok then + return + end + + -- Convert lowercase to uppercase + if char:match '[a-z]' then + char = char:upper() + end + + vim.cmd("normal! '" .. char) +end, {}) + +-- Map your preferred key combinations to the functions +vim.keymap.set('n', '', ':SetGlobalMark', { noremap = true }) +vim.keymap.set('n', '', ':JumpToGlobalMark', { noremap = true }) diff --git a/plugin/multiselect.lua b/plugin/multiselect.lua deleted file mode 100644 index bb866b6f..00000000 --- a/plugin/multiselect.lua +++ /dev/null @@ -1,115 +0,0 @@ --- Add this to your init.lua or create a file in your lua director-- Add this to your init.lua or create a file in your lua directory --- and require it from your init.lua - --- State variables -local selection_active = false -local selected_symbol = nil -local initial_pos = nil -local visual_mode_active = false - --- Function to select the current symbol and handle iteration -function select_and_iterate_symbol() - -- Exit visual mode first if active to prevent issues - if visual_mode_active then - vim.cmd 'normal! ' - visual_mode_active = false - end - - -- If selection is not active, start a new selection - if not selection_active then - -- Get the current symbol under cursor (includes special characters) - local current_symbol = vim.fn.expand '' - - -- Check if there's actually a symbol under the cursor - if current_symbol == '' then - vim.api.nvim_echo({ { 'No symbol under cursor', 'ErrorMsg' } }, false, {}) - return - end - - -- Store the symbol for later use (exact match) - selected_symbol = current_symbol - - -- Store the initial position before moving - initial_pos = vim.fn.getpos '.' - - -- Set up a search pattern for the exact symbol - vim.fn.setreg('/', '\\V\\<' .. vim.fn.escape(selected_symbol, '\\') .. '\\>') - - -- Enter visual mode and select the current symbol - vim.cmd 'normal! viw' - visual_mode_active = true - - -- Set state to active - selection_active = true - - -- Echo instructions - vim.api.nvim_echo({ { 'Selected symbol: ' .. current_symbol .. '. Press Ctrl-R again to iterate, to edit all.', 'Normal' } }, false, {}) - else - -- Selection is active, find the next occurrence - - -- Search for the next occurrence (exact match with very nomagic mode \V) - local search_pattern = '\\V\\<' .. vim.fn.escape(selected_symbol, '\\') .. '\\>' - local found = vim.fn.search(search_pattern, 'W') - - if found == 0 then - -- If no more occurrences, wrap around to the beginning - vim.cmd 'normal! gg' - found = vim.fn.search(search_pattern, 'W') - - -- If still no occurrences or we've come full circle - if found == 0 or vim.fn.line '.' == vim.fn.line(initial_pos[2]) and vim.fn.col '.' == vim.fn.col(initial_pos[3]) then - vim.api.nvim_echo({ { 'No more occurrences found.', 'Normal' } }, false, {}) - -- Reset state - selection_active = false - selected_symbol = nil - initial_pos = nil - return - end - end - - -- Select the symbol - vim.cmd 'normal! viw' - visual_mode_active = true - end -end - --- Function to edit all occurrences -function edit_all_occurrences() - -- If no symbol is selected, do nothing - if not selection_active then - vim.api.nvim_echo({ { 'No symbol selected. Use Ctrl-R first.', 'ErrorMsg' } }, false, {}) - return - end - - -- Exit visual mode - vim.cmd 'normal! ' - visual_mode_active = false - - -- Set up a command to find and replace with very nomagic mode for exact matching - local escaped_symbol = vim.fn.escape(selected_symbol, '/\\') - local cmd = ':%s/\\V\\<' .. escaped_symbol .. '\\>//gc' - - -- Use feedkeys with 'n' to avoid triggering mappings - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(':' .. cmd, true, false, true), 'n', false) - - -- Reset state - selection_active = false - selected_symbol = nil - initial_pos = nil -end - --- Reset function for cancellation -function reset_selection() - selection_active = false - selected_symbol = nil - initial_pos = nil - visual_mode_active = false - vim.cmd 'normal! ' - vim.api.nvim_echo({ { 'Symbol selection canceled', 'Normal' } }, false, {}) -end - --- Set up key mappings -vim.api.nvim_set_keymap('n', '', [[lua select_and_iterate_symbol()]], { noremap = true, silent = true }) -vim.api.nvim_set_keymap('v', '', [[lua select_and_iterate_symbol()]], { noremap = true, silent = true }) -vim.api.nvim_set_keymap('v', '', [[lua edit_all_occurrences()]], { noremap = true, silent = true }) -vim.api.nvim_set_keymap('v', '', [[lua reset_selection()]], { noremap = true, silent = true })