" avoid 'X more file(s) to edit' filetype on set nocompatible set confirm " prevent the 'no write since last change' message when changing buffers set hidden " Reopen the last edited position in files au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif set history " undo persists after quit set undofile set undodir=$HOME/.vim/undo " italicize comments highlight Comment cterm=italic gui=italic set relativenumber " four-space tabs filetype indent plugin on set smartindent setlocal shiftwidth=2 softtabstop=2 expandtab au FileType python setl softtabstop=4 shiftwidth=4 tabstop=4 let mapleader = "\" " toggle comment nnoremap gc " save all and quit nnoremap q :waZQ function! RunBlackIfInPythonFile() if &filetype ==# 'python' :call Black() endif endfunction " save nnoremap :call RunBlackIfInPythonFile():w " save and close buffer nnoremap w :w:bw nnoremap :bp nnoremap :bn " clear highlights nnoremap :noh nnoremap p :PlugInstall nnoremap b :call RunBlackIfInPythonFile() " show number of lines in buffer nnoremap l :echo line("$") " quickly source vimrc with + s nnoremap s :source ~/.vimrc " move selection nnoremap :m .+1== nnoremap :m .-2== inoremap :m .+1==gi inoremap :m .-2==gi vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv let g:python3_host_prog = $HOME . '/.local/venv/nvim/bin/python' let g:black#settings = { \ 'fast': 1, \ 'line_length': 100 \} call plug#begin('~/.vim/plugged') Plug 'folke/tokyonight.nvim', { 'branch': 'main' } Plug 'averms/black-nvim', {'do': ':UpdateRemotePlugins'} Plug 'tpope/vim-commentary' call plug#end() colorscheme tokyonight