You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
887 B
32 lines
887 B
-- General-Purpose keybinds |
|
local keymap_opts = { silent = true, noremap = true } |
|
|
|
function NumberToggle() |
|
if vim.o.relativenumber then |
|
vim.opt.relativenumber = false |
|
vim.opt.number = true |
|
else |
|
vim.opt.relativenumber = true |
|
end |
|
end |
|
|
|
-- Space is the leader key when outside of insert mode. |
|
vim.g.mapleader = " " |
|
|
|
vim.api.nvim_set_keymap('', '<Leader>t', ':NERDTreeToggle<CR>', {silent = true}) |
|
|
|
-- <SPC>-r controls relative line numbering. |
|
vim.api.nvim_set_keymap('n', '<Leader>r', '<cmd>lua NumberToggle()<CR>', keymap_opts) |
|
|
|
-- Pressing enter in command mode clears the current search highlighting until |
|
-- the next search. |
|
vim.api.nvim_set_keymap('n', '<CR>', ':noh<CR><CR>', keymap_opts) |
|
|
|
-- This one maps F5 to delete all trailing whitespace |
|
vim.api.nvim_set_keymap( |
|
'n', |
|
'<F5>', |
|
[[:let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>]], |
|
keymap_opts) |
|
|
|
|
|
|