Added better comments in keys.vim

master
Jef Roosens 2021-02-01 10:26:29 +01:00
parent a5dcb6a0e2
commit 5668a4a467
5 changed files with 35 additions and 35 deletions

View File

@ -1,7 +1,9 @@
# neovim-config
This repo contains the full Neovim config that I use on a daily basis for
college and personal projects.
college and personal projects. This file explains the basic structure of my
config, while setting-specific information can be found inside the config files
themselves.
## Config structure
The config exists of a few key components:

View File

@ -1,2 +1,2 @@
" Show width column
setlocal colorcolumn=120
setlocal textwidth=79
setlocal colorcolumn=80

View File

@ -1,5 +0,0 @@
augroup langs
autocmd!
" Remove trailing whitespace
" autocmd BufWritePre *.py,*.java :silent! %s/\s\+$//g
augroup END

View File

@ -1,33 +1,35 @@
" Keep cursor centered as much as possible
" zz centers the cursor, so combining this with navigation commands keeps my
" cursor centered
nnoremap j jzz
nnoremap k kzz
nnoremap gg ggzz
nnoremap G Gzz
" Navigate between ctags
" Jump to definition
" nnoremap gd <C-]>
" Go back up stack
" nnoremap gb <C-t>
" Remap split navigation keybindings
" I navigate my splits using <leader>hjkl. This setup allows for fast
" switching, which is important as I often end up with 3-4 splits after a while
nnoremap <silent> <leader>h :wincmd h<CR>
nnoremap <silent> <leader>j :wincmd j<CR>
nnoremap <silent> <leader>k :wincmd k<CR>
nnoremap <silent> <leader>l :wincmd l<CR>
" Write using <leader>+w
" These mappings just exist because I'm lazy, and they only really work in
" QWERTY
nnoremap <silent> <leader>w :w<CR>
" Quit using <leader>+q
nnoremap <silent> <leader>q :q<CR>
" Use arrow keys for split resizing in normal mode
nnoremap <silent> <Up> :resize +3<CR>
nnoremap <silent> <Down> :resize -3<CR>
nnoremap <silent> <Right> :vertical resize +3<CR>
nnoremap <silent> <Left> :vertical resize -3<CR>
" As I don't use the arrow keys for navigation, I remapped them to allow for
" resizing of my splits. If you hold down shift, you can control the size of
" the splits more precisely
nnoremap <silent> <Up> :resize +5<CR>
nnoremap <silent> <Down> :resize -5<CR>
nnoremap <silent> <Right> :vertical resize +5<CR>
nnoremap <silent> <Left> :vertical resize -5<CR>
nnoremap <silent> <S-Up> :resize +1<CR>
nnoremap <silent> <S-Down> :resize -1<CR>
nnoremap <silent> <S-Right> :vertical resize +1<CR>
nnoremap <silent> <S-Left> :vertical resize -1<CR>
" Disable arrow keys in editing & visual mode
" Disable arrow keys in editing & visual mode, as I have no need for them
inoremap <Right> <nop>
inoremap <Left> <nop>
inoremap <Up> <nop>
@ -38,6 +40,7 @@ vnoremap <Up> <nop>
vnoremap <Down> <nop>
" Tabs bindings
" TODO improve on these
" Create tab
nnoremap <silent> <leader>o :tabnew<CR>
" Close current tab
@ -47,12 +50,9 @@ nnoremap <silent> <leader>i :tabnext<CR>
" Go to previous tab
nnoremap <silent> <leader>u :tabprevious<CR>
" Make commands
nnoremap <silent> <leader>mr :make! run<CR>
nnoremap <silent> <leader>mt :make! test<CR>
" Keybinding for switching between light/dark colorschemes
" This function allows me to switch between a dark & light theme. I mainly use
" the dark theme, but when I'm sitting outside, the light theme can be much
" more readable
function! ColorschemeToggle()
if g:colors_name == 'flattened_dark'
colorscheme flattened_light
@ -63,17 +63,20 @@ endfunction
nnoremap <silent> <leader>c :call ColorschemeToggle()<CR>
" Quick config editing
" Re-source vimrc/init.vim
" As I'm constantly tweaking my config, I use keybindings to easily open &
" source it without leaving my session
nnoremap <silent> <leader>vs :source $MYVIMRC<CR>
" Open CtrlP in config directory
" Opens CtrlP in my config directory
nnoremap <silent> <leader>ve :split<CR>:exec 'CtrlP ' . fnamemodify($MYVIMRC, ':h')<CR>
" Overwrite Esc (experiment)
" This was probably one of the best ideas I found (it wasn't my original idea).
" By remapping Esc to jk, I could switch between modes without moving my hands.
" This improved my speed by much more than I was expecting, and helped with not
" straining my hands as much.
inoremap jk <Esc>
inoremap <Esc> <nop>
" Switch between 2 files quickly
" I use this binding to quickly switch between two files.
nnoremap <leader>a <C-^>
" Terminal keybindings

View File