refactor(keys): improve keymap configurations and remove unused floaterm plugin
This commit is contained in:
6 files changed
+137
-178
No files matched your search
+13
-17
@@ -80,10 +80,12 @@ map('v', "<leader>'", "s''<esc>Pll", { desc = 'wrap selection with single quotes
|
||||
map('v', '<leader>"', 's""<esc>Pll', { desc = 'wrap selection with double quotes' })
|
||||
|
||||
-- Insert mode cursor movement with Ctrl+hjkl
|
||||
map('i', '<C-h>', '<Left>', { desc = 'Move to end of previous line' })
|
||||
map('i', '<C-j>', '<Down>', { desc = 'Move cursor down' })
|
||||
map('i', '<C-k>', '<Up>', { desc = 'Move cursor up' })
|
||||
map('i', '<C-l>', '<Right>', { desc = 'Move cursor right' })
|
||||
map('i', '<C-h>', '<Left>', { noremap = true, silent = true })
|
||||
map('i', '<C-j>', '<Down>', { noremap = true, silent = true })
|
||||
map('i', '<C-k>', '<Up>', { noremap = true, silent = true })
|
||||
map('i', '<C-l>', '<Right>', { noremap = true, silent = true })
|
||||
|
||||
map('n', '<leader>re', ':%s/<C-R><C-W>/', { desc = 'Shortcut to replace current word under cursor' })
|
||||
|
||||
-- toggle inlay hints
|
||||
vim.keymap.set('n', '<leader>th', function()
|
||||
@@ -91,17 +93,11 @@ vim.keymap.set('n', '<leader>th', function()
|
||||
end)
|
||||
|
||||
-- No arrow navigation
|
||||
vim.api.nvim_set_keymap('n', '<Up>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<Down>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<Left>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('n', '<Right>', '<Nop>', opts)
|
||||
local modes = { 'n', 'v', 'i' }
|
||||
local arrows = { '<Up>', '<Down>', '<Left>', '<Right>' }
|
||||
|
||||
vim.api.nvim_set_keymap('v', '<Up>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('v', '<Down>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('v', '<Left>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('v', '<Right>', '<Nop>', opts)
|
||||
|
||||
vim.api.nvim_set_keymap('i', '<Up>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('i', '<Down>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('i', '<Left>', '<Nop>', opts)
|
||||
vim.api.nvim_set_keymap('i', '<Right>', '<Nop>', opts)
|
||||
for _, mode in ipairs(modes) do
|
||||
for _, key in ipairs(arrows) do
|
||||
vim.api.nvim_set_keymap(mode, key, '<Nop>', opts)
|
||||
end
|
||||
end
|
||||
+53
-53
@@ -1,66 +1,66 @@
|
||||
local options = {
|
||||
ai = true,
|
||||
clipboard = "unnamedplus", -- use system clipboard
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
undofile = true, -- save state of file on write
|
||||
undodir = vim.fn.stdpath("cache") .. "/undo",
|
||||
undolevels = 10000,
|
||||
autoread = true, -- autoread changes from other sources
|
||||
signcolumn = "yes",
|
||||
cursorline = true,
|
||||
cursorlineopt = "number",
|
||||
wrap = false,
|
||||
scrolloff = 3,
|
||||
ruler = false, -- removes cursor position from lastline
|
||||
pumheight = 10, -- size of completion window
|
||||
showmode = false, -- do not show mode under statusline
|
||||
swapfile = false, -- creates a swapfile
|
||||
backup = false, -- creates a backup file
|
||||
writebackup = false, -- do not edit backups
|
||||
winminwidth = 5, -- Minimum window width
|
||||
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||
showtabline = 0, -- always show tabs
|
||||
showcmd = false,
|
||||
mouse = "a", -- allow the mouse to be used in neovim
|
||||
confirm = true, -- Confirm to save changes before exiting modified buffer
|
||||
ai = true,
|
||||
clipboard = 'unnamedplus', -- use system clipboard
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
undofile = true, -- save state of file on write
|
||||
undodir = vim.fn.stdpath('cache') .. '/undo',
|
||||
undolevels = 10000,
|
||||
autoread = true, -- autoread changes from other sources
|
||||
signcolumn = 'yes',
|
||||
cursorline = true,
|
||||
cursorlineopt = 'number',
|
||||
wrap = false,
|
||||
scrolloff = 3,
|
||||
ruler = false, -- removes cursor position from lastline
|
||||
pumheight = 10, -- size of completion window
|
||||
showmode = false, -- do not show mode under statusline
|
||||
swapfile = false, -- creates a swapfile
|
||||
backup = false, -- creates a backup file
|
||||
writebackup = false, -- do not edit backups
|
||||
winminwidth = 5, -- Minimum window width
|
||||
termguicolors = true, -- set term gui colors (most terminals support this)
|
||||
showtabline = 0, -- always show tabs
|
||||
showcmd = false,
|
||||
mouse = 'a', -- allow the mouse to be used in neovim
|
||||
confirm = true, -- Confirm to save changes before exiting modified buffer
|
||||
|
||||
-- tabs
|
||||
smarttab = true,
|
||||
tabstop = 4, -- 1 tab represented as 4 spaces
|
||||
expandtab = true, -- <tab> key will create " " instead of "\t"
|
||||
shiftwidth = 4, -- indent change after backspace and >> <<
|
||||
softtabstop = 4, -- number of spaces instead of tab
|
||||
autoindent = true, -- auto indent
|
||||
smartindent = true, -- make indenting smarter again
|
||||
list = true,
|
||||
-- listchars = { trail = "", tab = "", nbsp = "_", extends = ">", precedes = "<" }, -- highlight
|
||||
showbreak = string.rep(" ", 3),
|
||||
-- tabs
|
||||
smarttab = true,
|
||||
tabstop = 4, -- 1 tab represented as 4 spaces
|
||||
expandtab = true, -- <tab> key will create " " instead of "\t"
|
||||
shiftwidth = 4, -- indent change after backspace and >> <<
|
||||
softtabstop = 4, -- number of spaces instead of tab
|
||||
autoindent = true, -- auto indent
|
||||
smartindent = true, -- make indenting smarter again
|
||||
list = true,
|
||||
-- listchars = { trail = "", tab = "", nbsp = "_", extends = ">", precedes = "<" }, -- highlight
|
||||
showbreak = string.rep(' ', 3),
|
||||
|
||||
-- Search
|
||||
ignorecase = true,
|
||||
smartcase = true,
|
||||
hlsearch = true,
|
||||
wildmenu = true,
|
||||
wildmode = "longest:full,full",
|
||||
wildoptions = "pum",
|
||||
-- Search
|
||||
ignorecase = true,
|
||||
smartcase = true,
|
||||
hlsearch = true,
|
||||
wildmenu = true,
|
||||
wildmode = 'longest:full,full',
|
||||
wildoptions = 'pum',
|
||||
|
||||
-- Folds (keep open by default, works well with nvim-ufo)
|
||||
foldlevel = 99,
|
||||
foldlevelstart = 99,
|
||||
foldenable = true,
|
||||
-- Folds (keep open by default, works well with nvim-ufo)
|
||||
foldlevel = 99,
|
||||
foldlevelstart = 99,
|
||||
foldenable = true,
|
||||
|
||||
-- Window
|
||||
splitright = true,
|
||||
splitbelow = true,
|
||||
title = true,
|
||||
-- Window
|
||||
splitright = true,
|
||||
splitbelow = true,
|
||||
title = true,
|
||||
}
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
vim.opt[k] = v
|
||||
end
|
||||
|
||||
vim.opt.path:append({ "**" })
|
||||
vim.opt.path:append({ '**' })
|
||||
vim.opt.shortmess:append({ W = true, I = true, c = true }) -- disable greeting
|
||||
|
||||
-- Fix markdown indentation settings
|
||||
|
||||
+44
-53
@@ -1,55 +1,46 @@
|
||||
return {
|
||||
{
|
||||
"echasnovski/mini.files",
|
||||
version = "*",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
config = function()
|
||||
require("mini.files").setup({
|
||||
content = {
|
||||
filter = nil,
|
||||
prefix = nil,
|
||||
sort = nil,
|
||||
},
|
||||
mappings = {
|
||||
close = "q",
|
||||
go_in = "L",
|
||||
go_in_plus = "l",
|
||||
go_out = "h",
|
||||
go_out_plus = "H",
|
||||
mark_goto = "'",
|
||||
mark_set = "m",
|
||||
reset = "<BS>",
|
||||
reveal_cwd = "@",
|
||||
show_help = "g?",
|
||||
synchronize = "<CR>",
|
||||
trim_left = "<",
|
||||
trim_right = ">",
|
||||
},
|
||||
options = {
|
||||
permanent_delete = true,
|
||||
use_as_default_explorer = true,
|
||||
},
|
||||
windows = {
|
||||
max_number = math.huge,
|
||||
preview = false,
|
||||
width_focus = 30,
|
||||
width_nofocus = 20,
|
||||
width_preview = 80,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"prichrd/netrw.nvim",
|
||||
config = function()
|
||||
require("netrw").setup({
|
||||
icons = {
|
||||
symlink = "",
|
||||
directory = "",
|
||||
file = "",
|
||||
},
|
||||
use_devicons = true,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.files',
|
||||
version = '*',
|
||||
event = { 'BufReadPost', 'BufNewFile' },
|
||||
config = function()
|
||||
require('mini.files').setup({
|
||||
content = {
|
||||
filter = nil,
|
||||
prefix = nil,
|
||||
sort = nil,
|
||||
},
|
||||
mappings = {
|
||||
close = 'q',
|
||||
go_in = 'L',
|
||||
go_in_plus = 'l',
|
||||
go_out = 'h',
|
||||
go_out_plus = 'H',
|
||||
mark_goto = "'",
|
||||
mark_set = 'm',
|
||||
reset = '<BS>',
|
||||
reveal_cwd = '@',
|
||||
show_help = 'g?',
|
||||
synchronize = '<CR>',
|
||||
trim_left = '<',
|
||||
trim_right = '>',
|
||||
},
|
||||
options = {
|
||||
permanent_delete = true,
|
||||
use_as_default_explorer = true,
|
||||
},
|
||||
windows = {
|
||||
max_number = math.huge,
|
||||
preview = false,
|
||||
width_focus = 30,
|
||||
width_nofocus = 20,
|
||||
width_preview = 80,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'prichrd/netrw.nvim',
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
+12
-26
@@ -81,12 +81,12 @@ return {
|
||||
insert_mappings = true,
|
||||
terminal_mappings = true,
|
||||
persist_size = true,
|
||||
direction = 'float', -- Use 'float' for floating terminal windows
|
||||
direction = 'float', -- 'vertical' | 'horizontal' | 'tab' | 'float'
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
float_opts = {
|
||||
border = 'curved', -- or 'single', 'double', 'shadow', etc.
|
||||
winblend = 0, -- Set to 0 for full transparency
|
||||
border = 'curved', -- 'single', 'double', 'shadow', etc.
|
||||
winblend = 0, -- Set to 0 for full transparency
|
||||
highlights = {
|
||||
border = 'Normal',
|
||||
background = 'Normal',
|
||||
@@ -95,20 +95,6 @@ return {
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvzone/floaterm',
|
||||
dependencies = 'nvzone/volt',
|
||||
opts = {
|
||||
mappings = {
|
||||
term = function(buf)
|
||||
vim.keymap.set({ 'n', 't' }, '<Tab>', function()
|
||||
require('floaterm.api').cycle_term_bufs('prev')
|
||||
end, { buffer = buf })
|
||||
end,
|
||||
},
|
||||
},
|
||||
cmd = 'FloatermToggle',
|
||||
},
|
||||
|
||||
-- smooth scrolling
|
||||
{
|
||||
@@ -131,16 +117,16 @@ return {
|
||||
picker_integration = true,
|
||||
keymaps = {
|
||||
prefix = '<leader>u', -- Main prefix for uv commands
|
||||
commands = true, -- Show uv commands menu (<leader>x)
|
||||
run_file = true, -- Run current file (<leader>xr)
|
||||
commands = true, -- Show uv commands menu (<leader>x)
|
||||
run_file = true, -- Run current file (<leader>xr)
|
||||
run_selection = true, -- Run selected code (<leader>xs)
|
||||
run_function = true, -- Run function (<leader>xf)
|
||||
venv = true, -- Environment management (<leader>xe)
|
||||
init = true, -- Initialize uv project (<leader>xi)
|
||||
add = true, -- Add a package (<leader>xa)
|
||||
remove = true, -- Remove a package (<leader>xd)
|
||||
sync = true, -- Sync packages (<leader>xc)
|
||||
sync_all = true, -- Sync all packages, extras and groups (<leader>xC)
|
||||
run_function = true, -- Run function (<leader>xf)
|
||||
venv = true, -- Environment management (<leader>xe)
|
||||
init = true, -- Initialize uv project (<leader>xi)
|
||||
add = true, -- Add a package (<leader>xa)
|
||||
remove = true, -- Remove a package (<leader>xd)
|
||||
sync = true, -- Sync packages (<leader>xc)
|
||||
sync_all = true, -- Sync all packages, extras and groups (<leader>xC)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -101,23 +101,9 @@ return {
|
||||
{ '<leader>gu', ':Gitsigns undo_stage_hunk<cr>', desc = 'Undo Stage Hunk' },
|
||||
{ '<leader>gv', ':Gitsigns select_hunk<cr>', desc = 'Select Hunk' },
|
||||
{ '<leader>gw', ':lua require("snacks").gitbrowse()<cr>', desc = 'Git Browse' },
|
||||
{ '<leader>gbr', ':lua Snacks.picker.git_branches()<cr>', desc = 'Pick and Switch Git Branches' },
|
||||
{ '<leader>gp', ':lua Snacks.picker.git_branches()<cr>', desc = 'Pick and Switch Git Branches' },
|
||||
|
||||
{ '<leader>h', group = 'Harpoon' },
|
||||
-- {
|
||||
-- '<leader>ha',
|
||||
-- function()
|
||||
-- require('harpoon'):list():add()
|
||||
-- end,
|
||||
-- desc = 'Harpoon add file',
|
||||
-- },
|
||||
-- {
|
||||
-- '<leader>hl',
|
||||
-- function()
|
||||
-- require('harpoon').ui:toggle_quick_menu(require('harpoon'):list())
|
||||
-- end,
|
||||
-- desc = 'Harpoon quick menu',
|
||||
-- },
|
||||
|
||||
{ '<leader>gt', group = 'Toggle' },
|
||||
{ '<leader>gtb', ':Gitsigns toggle_current_line_blame<cr>', desc = 'Blame' },
|
||||
|
||||
Reference in new issue
Block a user