From 5668a4a467ded8260711a69f8cbac365ee756211 Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Mon, 1 Feb 2021 10:26:29 +0100 Subject: [PATCH] Added better comments in keys.vim --- README.md | 4 +++- ftplugin/vim.vim | 4 ++-- init/autogroups.vim | 5 ---- init/keys.vim | 57 ++++++++++++++++++++++++--------------------- init/terminal.vim | 0 5 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 init/autogroups.vim delete mode 100644 init/terminal.vim diff --git a/README.md b/README.md index cb83140..35ca8f5 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/ftplugin/vim.vim b/ftplugin/vim.vim index 3ade533..c13c740 100644 --- a/ftplugin/vim.vim +++ b/ftplugin/vim.vim @@ -1,2 +1,2 @@ -" Show width column -setlocal colorcolumn=120 +setlocal textwidth=79 +setlocal colorcolumn=80 diff --git a/init/autogroups.vim b/init/autogroups.vim deleted file mode 100644 index 45a2a6d..0000000 --- a/init/autogroups.vim +++ /dev/null @@ -1,5 +0,0 @@ -augroup langs - autocmd! - " Remove trailing whitespace - " autocmd BufWritePre *.py,*.java :silent! %s/\s\+$//g -augroup END diff --git a/init/keys.vim b/init/keys.vim index ffc5f5d..dccd09a 100644 --- a/init/keys.vim +++ b/init/keys.vim @@ -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 -" Go back up stack -" nnoremap gb - -" Remap split navigation keybindings +" I navigate my splits using hjkl. This setup allows for fast +" switching, which is important as I often end up with 3-4 splits after a while nnoremap h :wincmd h nnoremap j :wincmd j nnoremap k :wincmd k nnoremap l :wincmd l -" Write using +w +" These mappings just exist because I'm lazy, and they only really work in +" QWERTY nnoremap w :w -" Quit using +q nnoremap q :q -" Use arrow keys for split resizing in normal mode -nnoremap :resize +3 -nnoremap :resize -3 -nnoremap :vertical resize +3 -nnoremap :vertical resize -3 +" 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 :resize +5 +nnoremap :resize -5 +nnoremap :vertical resize +5 +nnoremap :vertical resize -5 +nnoremap :resize +1 +nnoremap :resize -1 +nnoremap :vertical resize +1 +nnoremap :vertical resize -1 -" Disable arrow keys in editing & visual mode +" Disable arrow keys in editing & visual mode, as I have no need for them inoremap inoremap inoremap @@ -38,6 +40,7 @@ vnoremap vnoremap " Tabs bindings +" TODO improve on these " Create tab nnoremap o :tabnew " Close current tab @@ -47,12 +50,9 @@ nnoremap i :tabnext " Go to previous tab nnoremap u :tabprevious -" Make commands -nnoremap mr :make! run -nnoremap mt :make! test - - -" 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 c :call ColorschemeToggle() -" 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 vs :source $MYVIMRC -" Open CtrlP in config directory +" Opens CtrlP in my config directory nnoremap ve :split:exec 'CtrlP ' . fnamemodify($MYVIMRC, ':h') -" 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 inoremap -" Switch between 2 files quickly +" I use this binding to quickly switch between two files. nnoremap a " Terminal keybindings diff --git a/init/terminal.vim b/init/terminal.vim deleted file mode 100644 index e69de29..0000000