Vim Cheat Sheet

Description VIM can be hard. Remembering all the neat shortcuts achieved by such an awesome tool is harder. This won’t be a cheat sheet that helps with the basics but rather an ever expanding post on shortcuts that I discover to help improve efficiency. command description gtd go to definition, jump to function ^o / ^i backward/forward a location di" delete inside “, can delete inside other characters as well ci” change inside “, can change inside other characters as well “+yy copy to + buffer, can change + to other buffers as well vap Select a paragraph, useful for easy increase/decrease of indent with < or >. Eliminates need to ctrl+v, move to select lines, and then use « or »

August 1, 2021 · 1 min · David Spencer

Using Neovim as an IDE for Python

In this post I’ll demonstrate my setup of neovim for python development. Setup Install neovim Install Python neovim configuration All of the config files for neovim will be in our config directory. If any of the folders or files do not exist we will create them now. mkdir -p ~/.config/nvim/lua touch ~/.config/nvim/init.vim touch ~/.config/nvim/lua/{lua_config,lsp_config}.lua Using neovim, we will edit the init.vim syntax on "syntax highlighting, see :help syntax filetype plugin indent on "file type detection, see :help filetype set number "display line number set relativenumber "display relative line numbers set path+=** "improves searching, see :help path set noswapfile "disable use of swap files set wildmenu "completion menu set backspace=indent,eol,start "ensure proper backspace functionality set undodir=~/.cache/nvim/undo "undo ability will persist after exiting file set undofile "see :help undodir and :help undofile set incsearch "see results while search is being typed, see :help incsearch set smartindent "auto indent on new lines, see :help smartindent set ic "ignore case when searching set colorcolumn=80 "display color when line reaches pep8 standards set expandtab "expanding tab to spaces set tabstop=4 "setting tab to 4 columns set shiftwidth=4 "setting tab to 4 columns set softtabstop=4 "setting tab to 4 columns set showmatch "display matching bracket or parenthesis set hlsearch incsearch "highlight all pervious search pattern with incsearch highlight ColorColumn ctermbg=9 "display ugly bright red bar at color column number " Keybind Ctrl+l to clear search nnoremap <C-l> :nohl<CR><C-l>:echo "Search Cleared"<CR> " When python filetype is detected, F5 can be used to execute script autocmd FileType python nnoremap <buffer> <F5> :w<cr>:exec '!clear'<cr>:exec '!python3' shellescape(expand('%:p'), 1)<cr> I set colorcolumn to 80 instead of 79 due to preferring the red wall, this way I can type up to the wall instead of having one character on the wall. ...

July 24, 2021 · 4 min · David Spencer