V2 of my Neovim configuration.
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.
 
 

57 lines
2.1 KiB

-- 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 = " "
-- Telescope
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
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)
-- Autocomplete bindings
-- 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)
-- vimspector keybinds
vim.keymap.set('n', '<F9>', '<cmd>call vimspector#Launch()<cr>')
vim.keymap.set('n', '<F8>', '<cmd>call vimspector#Reset()<cr>')
vim.keymap.set('n', '<F11>', '<cmd>call vimspector#StepOver()<cr>')
vim.keymap.set('n', '<F12>', '<cmd>call vimspector#StepOut()<cr>')
vim.keymap.set('n', '<F10>', '<cmd>call vimspector#StepInto()<cr>')
vim.keymap.set('n', "Db", ":call vimspector#ToggleBreakpoint()<cr>")
vim.keymap.set('n', "Dw", ":call vimspector#AddWatch()<cr>")
vim.keymap.set('n', "De", ":call vimspector#Evaluate()<cr>")
-- Fugitive bindings
vim.api.nvim_set_keymap('n', '<Leader>gs', ':Git<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<Leader>gd', ':Git diff<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<Leader>gb', ':Git blame<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<Leader>gc', ':Git commit<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<Leader>gp', ':Git push<CR>', {noremap = true})