Added better comments in keys.vim
This commit is contained in:
parent
a5dcb6a0e2
commit
5668a4a467
5 changed files with 35 additions and 35 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
# neovim-config
|
# neovim-config
|
||||||
|
|
||||||
This repo contains the full Neovim config that I use on a daily basis for
|
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
|
## Config structure
|
||||||
The config exists of a few key components:
|
The config exists of a few key components:
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
" Show width column
|
setlocal textwidth=79
|
||||||
setlocal colorcolumn=120
|
setlocal colorcolumn=80
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
augroup langs
|
|
||||||
autocmd!
|
|
||||||
" Remove trailing whitespace
|
|
||||||
" autocmd BufWritePre *.py,*.java :silent! %s/\s\+$//g
|
|
||||||
augroup END
|
|
||||||
|
|
@ -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 j jzz
|
||||||
nnoremap k kzz
|
nnoremap k kzz
|
||||||
nnoremap gg ggzz
|
nnoremap gg ggzz
|
||||||
nnoremap G Gzz
|
nnoremap G Gzz
|
||||||
|
|
||||||
" Navigate between ctags
|
" I navigate my splits using <leader>hjkl. This setup allows for fast
|
||||||
" Jump to definition
|
" switching, which is important as I often end up with 3-4 splits after a while
|
||||||
" nnoremap gd <C-]>
|
|
||||||
" Go back up stack
|
|
||||||
" nnoremap gb <C-t>
|
|
||||||
|
|
||||||
" Remap split navigation keybindings
|
|
||||||
nnoremap <silent> <leader>h :wincmd h<CR>
|
nnoremap <silent> <leader>h :wincmd h<CR>
|
||||||
nnoremap <silent> <leader>j :wincmd j<CR>
|
nnoremap <silent> <leader>j :wincmd j<CR>
|
||||||
nnoremap <silent> <leader>k :wincmd k<CR>
|
nnoremap <silent> <leader>k :wincmd k<CR>
|
||||||
nnoremap <silent> <leader>l :wincmd l<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>
|
nnoremap <silent> <leader>w :w<CR>
|
||||||
" Quit using <leader>+q
|
|
||||||
nnoremap <silent> <leader>q :q<CR>
|
nnoremap <silent> <leader>q :q<CR>
|
||||||
|
|
||||||
" Use arrow keys for split resizing in normal mode
|
" As I don't use the arrow keys for navigation, I remapped them to allow for
|
||||||
nnoremap <silent> <Up> :resize +3<CR>
|
" resizing of my splits. If you hold down shift, you can control the size of
|
||||||
nnoremap <silent> <Down> :resize -3<CR>
|
" the splits more precisely
|
||||||
nnoremap <silent> <Right> :vertical resize +3<CR>
|
nnoremap <silent> <Up> :resize +5<CR>
|
||||||
nnoremap <silent> <Left> :vertical resize -3<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 <Right> <nop>
|
||||||
inoremap <Left> <nop>
|
inoremap <Left> <nop>
|
||||||
inoremap <Up> <nop>
|
inoremap <Up> <nop>
|
||||||
|
|
@ -38,6 +40,7 @@ vnoremap <Up> <nop>
|
||||||
vnoremap <Down> <nop>
|
vnoremap <Down> <nop>
|
||||||
|
|
||||||
" Tabs bindings
|
" Tabs bindings
|
||||||
|
" TODO improve on these
|
||||||
" Create tab
|
" Create tab
|
||||||
nnoremap <silent> <leader>o :tabnew<CR>
|
nnoremap <silent> <leader>o :tabnew<CR>
|
||||||
" Close current tab
|
" Close current tab
|
||||||
|
|
@ -47,12 +50,9 @@ nnoremap <silent> <leader>i :tabnext<CR>
|
||||||
" Go to previous tab
|
" Go to previous tab
|
||||||
nnoremap <silent> <leader>u :tabprevious<CR>
|
nnoremap <silent> <leader>u :tabprevious<CR>
|
||||||
|
|
||||||
" Make commands
|
" This function allows me to switch between a dark & light theme. I mainly use
|
||||||
nnoremap <silent> <leader>mr :make! run<CR>
|
" the dark theme, but when I'm sitting outside, the light theme can be much
|
||||||
nnoremap <silent> <leader>mt :make! test<CR>
|
" more readable
|
||||||
|
|
||||||
|
|
||||||
" Keybinding for switching between light/dark colorschemes
|
|
||||||
function! ColorschemeToggle()
|
function! ColorschemeToggle()
|
||||||
if g:colors_name == 'flattened_dark'
|
if g:colors_name == 'flattened_dark'
|
||||||
colorscheme flattened_light
|
colorscheme flattened_light
|
||||||
|
|
@ -63,17 +63,20 @@ endfunction
|
||||||
|
|
||||||
nnoremap <silent> <leader>c :call ColorschemeToggle()<CR>
|
nnoremap <silent> <leader>c :call ColorschemeToggle()<CR>
|
||||||
|
|
||||||
" Quick config editing
|
" As I'm constantly tweaking my config, I use keybindings to easily open &
|
||||||
" Re-source vimrc/init.vim
|
" source it without leaving my session
|
||||||
nnoremap <silent> <leader>vs :source $MYVIMRC<CR>
|
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>
|
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 jk <Esc>
|
||||||
inoremap <Esc> <nop>
|
inoremap <Esc> <nop>
|
||||||
|
|
||||||
" Switch between 2 files quickly
|
" I use this binding to quickly switch between two files.
|
||||||
nnoremap <leader>a <C-^>
|
nnoremap <leader>a <C-^>
|
||||||
|
|
||||||
" Terminal keybindings
|
" Terminal keybindings
|
||||||
|
|
|
||||||
Reference in a new issue