Adding my custom plugins
This commit is contained in:
parent
87db21c4b0
commit
4ed51b3acb
|
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
"danilamihailov/beacon.nvim",
|
||||||
|
version = "*",
|
||||||
|
config = function()
|
||||||
|
--require("beacon").setup({
|
||||||
|
-- minimal_jump = 5,
|
||||||
|
--})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
-- You can add your own plugins here or in other files in this directory!
|
||||||
|
-- I promise not to create any merge conflicts in this directory :)
|
||||||
|
--
|
||||||
|
-- See the kickstart.nvim README for more information
|
||||||
|
|
||||||
|
package.path = package.path .. ";?.lua"
|
||||||
|
|
||||||
|
-- Set the blinking cursor settings
|
||||||
|
vim.o.guicursor = 'n-v:block,i:ver25,r-cr-o:hor20,a:blinkwait700-blinkoff400-blinkon250'
|
||||||
|
|
||||||
|
-- Adjust the split that it makes sense
|
||||||
|
vim.opt.splitbelow = true
|
||||||
|
vim.opt.splitright = true
|
||||||
|
|
||||||
|
-- Make sure, that when we exit nvim the previous cursor settings get restored
|
||||||
|
vim.cmd([[
|
||||||
|
augroup RestoreCursorShapeOnExit
|
||||||
|
autocmd!
|
||||||
|
autocmd VimLeave * set guicursor=a:block20
|
||||||
|
augroup END
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Adding relative line numbers
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
-- Fix the cursor in the middle of windows when scrolling
|
||||||
|
vim.opt.scrolloff = 6
|
||||||
|
|
||||||
|
-- Remap for dealing with word wrap in v mode (see init.lua:284)
|
||||||
|
vim.keymap.set('v', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true})
|
||||||
|
vim.keymap.set('v', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true})
|
||||||
|
|
||||||
|
-- Provide function and keymap binding to show not saved changes of current buffer
|
||||||
|
function showBufferDiff()
|
||||||
|
vim.cmd([[w !diff % - ]])
|
||||||
|
end
|
||||||
|
-- ":vim.cmd([[w !diff % - ]])"
|
||||||
|
vim.keymap.set('n', '<leader>pd', showBufferDiff, { expr = true, silent = true, desc = "Print diff between buffer and file"})
|
||||||
|
|
||||||
|
|
||||||
|
-- Mimic the tmux config here. S for vertical split, v for horizontal:
|
||||||
|
-- - Remap for easier window control access
|
||||||
|
-- - Remap general the window control access to <A-w>.
|
||||||
|
-- - Remap (swapping) particular "s" to "v" when entering window control access.
|
||||||
|
-- (Bear in mind that you have to release <A-w> keys, and then press "s" or "v".
|
||||||
|
-- Otherwise the swapping of "s" and "v" does not work.
|
||||||
|
local map = vim.api.nvim_set_keymap
|
||||||
|
map('n', '<A-w>', '<C-w>', {noremap = false})
|
||||||
|
map('n', '<C-w>s', '<C-w>v', {noremap = true})
|
||||||
|
map('n', '<C-w>v', '<C-w>s', {noremap = true})
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
return {
|
||||||
|
-- {{{ Define the Harpoon lazy.vim specificaiton.
|
||||||
|
|
||||||
|
"ThePrimeagen/harpoon",
|
||||||
|
enabled = true,
|
||||||
|
branch = "harpoon2",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- ----------------------------------------------------------------------- }}}
|
||||||
|
-- {{{ Define events to load Harpoon.
|
||||||
|
|
||||||
|
keys = function()
|
||||||
|
local harpoon = require("harpoon")
|
||||||
|
local conf = require("telescope.config").values
|
||||||
|
|
||||||
|
local function toggle_telescope(harpoon_files)
|
||||||
|
local file_paths = {}
|
||||||
|
for _, item in ipairs(harpoon_files.items) do
|
||||||
|
table.insert(file_paths, item.value)
|
||||||
|
end
|
||||||
|
require("telescope.pickers").new({}, {
|
||||||
|
prompt_title = "Harpoon",
|
||||||
|
finder = require("telescope.finders").new_table({
|
||||||
|
results = file_paths,
|
||||||
|
}),
|
||||||
|
previewer = conf.file_previewer({}),
|
||||||
|
sorter = conf.generic_sorter({}),
|
||||||
|
}):find()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
-- Harpoon marked files 1 through 4
|
||||||
|
{"<a-1>", function() harpoon:list():select(1) end, desc ="Harpoon buffer 1"},
|
||||||
|
{"<a-2>", function() harpoon:list():select(2) end, desc ="Harpoon buffer 2"},
|
||||||
|
{"<a-3>", function() harpoon:list():select(3) end, desc ="Harpoon buffer 3"},
|
||||||
|
{"<a-4>", function() harpoon:list():select(4) end, desc ="Harpoon buffer 4"},
|
||||||
|
|
||||||
|
-- Harpoon next and previous.
|
||||||
|
{"<a-5>", function() harpoon:list():next() end, desc ="Harpoon next buffer"},
|
||||||
|
{"<a-6>", function() harpoon:list():prev() end, desc ="Harpoon prev buffer"},
|
||||||
|
|
||||||
|
-- Harpoon user interface.
|
||||||
|
{"<leader>ht", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, desc ="Harpoon Toggle Menu"},
|
||||||
|
{"<leader>ha", function() harpoon:list():append() end, desc ="Harpoon add file"},
|
||||||
|
|
||||||
|
-- Use Telescope as Harpoon user interface.
|
||||||
|
{"<leader>hs", function() toggle_telescope(harpoon:list() )end, desc ="Show Harpoon window"},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- ----------------------------------------------------------------------- }}}
|
||||||
|
-- {{{ Use Harpoon defaults or my customizations.
|
||||||
|
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.settings = {
|
||||||
|
save_on_toggle = false,
|
||||||
|
sync_on_ui_close = false,
|
||||||
|
save_on_change = true,
|
||||||
|
enter_on_sendcmd = false,
|
||||||
|
tmux_autoclose_windows = false,
|
||||||
|
excluded_filetypes = { "harpoon", "alpha", "dashboard", "gitcommit" },
|
||||||
|
mark_branch = false,
|
||||||
|
key = function()
|
||||||
|
return vim.loop.cwd()
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- ----------------------------------------------------------------------- }}}
|
||||||
|
-- {{{ Configure Harpoon.
|
||||||
|
|
||||||
|
config = function(_, opts)
|
||||||
|
require("harpoon").setup(opts)
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- ----------------------------------------------------------------------- }}}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
return {
|
||||||
|
'tzachar/local-highlight.nvim',
|
||||||
|
|
||||||
|
dependencies = {
|
||||||
|
'folke/snacks.nvim',
|
||||||
|
},
|
||||||
|
|
||||||
|
config = function()
|
||||||
|
require('local-highlight').setup {
|
||||||
|
file_types = { 'xyz' },
|
||||||
|
highlight_single_match = false,
|
||||||
|
cw_hlgroup = 'Search',
|
||||||
|
insert_mode = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>ph', vim.cmd.LocalHighlightToggle, { expr = false, silent = true, desc = 'Toggle local-highlight.nvim' })
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
return {
|
||||||
|
'roobert/search-replace.nvim',
|
||||||
|
config = function()
|
||||||
|
require('search-replace').setup {
|
||||||
|
-- optionally override defaults
|
||||||
|
default_replace_single_buffer_options = 'gcI',
|
||||||
|
default_replace_multi_buffer_options = 'egcI',
|
||||||
|
}
|
||||||
|
vim.keymap.set('v', '<C-r>', '<CMD>SearchReplaceSingleBufferVisualSelection<CR>', opts)
|
||||||
|
vim.keymap.set('v', '<C-s>', '<CMD>SearchReplaceWithinVisualSelection<CR>', opts)
|
||||||
|
vim.keymap.set('v', '<C-b>', '<CMD>SearchReplaceWithinVisualSelectionCWord<CR>', opts)
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>rs', '<CMD>SearchReplaceSingleBufferSelections<CR>', { desc = '[s]elction list' })
|
||||||
|
vim.keymap.set('n', '<leader>ro', '<CMD>SearchReplaceSingleBufferOpen<CR>', { desc = '[o]pen' })
|
||||||
|
vim.keymap.set('n', '<leader>rw', '<CMD>SearchReplaceSingleBufferCWord<CR>', { desc = '[w]ord' })
|
||||||
|
vim.keymap.set('n', '<leader>rW', '<CMD>SearchReplaceSingleBufferCWORD<CR>', { desc = '[W]ORD' })
|
||||||
|
vim.keymap.set('n', '<leader>re', '<CMD>SearchReplaceSingleBufferCExpr<CR>', { desc = '[e]xpr' })
|
||||||
|
vim.keymap.set('n', '<leader>rf', '<CMD>SearchReplaceSingleBufferCFile<CR>', { desc = '[f]ile' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>rbs', '<CMD>SearchReplaceMultiBufferSelections<CR>', { desc = '[s]elction list' })
|
||||||
|
vim.keymap.set('n', '<leader>rbo', '<CMD>SearchReplaceMultiBufferOpen<CR>', { desc = '[o]pen' })
|
||||||
|
vim.keymap.set('n', '<leader>rbw', '<CMD>SearchReplaceMultiBufferCWord<CR>', { desc = '[w]ord' })
|
||||||
|
vim.keymap.set('n', '<leader>rbW', '<CMD>SearchReplaceMultiBufferCWORD<CR>', { desc = '[W]ORD' })
|
||||||
|
vim.keymap.set('n', '<leader>rbe', '<CMD>SearchReplaceMultiBufferCExpr<CR>', { desc = '[e]xpr' })
|
||||||
|
vim.keymap.set('n', '<leader>rbf', '<CMD>SearchReplaceMultiBufferCFile<CR>', { desc = '[f]ile' })
|
||||||
|
|
||||||
|
-- show the effects of a search / replace in a live preview window
|
||||||
|
vim.o.inccommand = 'split'
|
||||||
|
end,
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue