From 8b502d60ab312106c48c5e05c5de08c385527f32 Mon Sep 17 00:00:00 2001 From: John Mertz Date: Wed, 20 Jul 2022 18:04:01 -0400 Subject: [PATCH] Update generic Configs for both Vim and NeoVim --- vim/generic | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 vim/generic diff --git a/vim/generic b/vim/generic new file mode 100644 index 000000000..37855aac0 --- /dev/null +++ b/vim/generic @@ -0,0 +1,114 @@ +set nocompatible " iMproved only, no vi compatibility +set sessionoptions-=options " stop sessions from messing with 'runtimepath' + +syntax on +filetype plugin indent on + +set backspace=indent,eol,start +set incsearch +set scrolloff=1000 " Center cursor, unless near edge + +" Colorize and theme +set t_Co=16 +let g:gruvbox_contrast_dark="hard" +let g:gruvbox_italic=1 +let g:gruvbox_bold=1 +let g:gruvbox_underline=1 +let g:gruvbox_undercurl=1 +let g:gruvbox_termcolors=256 +set background=dark +colorscheme gruvbox-oled +" autocmd vimenter * colorscheme gruvbox +"autocmd vimenter * colorscheme gruvbox-oled +"theme autoload/airline/themes/gruvbox-oled.vim +" colorscheme autoload/lightline/colorscheme/gruvbox-oled.vim +" colorscheme base16-gruvbox-dark-hard + +set ttyfast + +set termguicolors +set laststatus=2 +set guioptions-=e +set encoding=utf-8 +set autoread +set autoindent +set hlsearch + +set number +set noswapfile +set title + +syn on se title +set ts=8 +set softtabstop=8 +set shiftwidth=8 +set expandtab +" Show tabs and trailing spaces +set list listchars=tab:»\ ,trail:· + +set spelllang=en_ca + +" Strip whitespace on save +fun! StripTrailingWhitespaces() + " Preparation: save last search, and cursor position. + let _s=@/ + let l = line(".") + let c = col(".") + " Do the business: + %s/\s\+$//e + " Clean up: restore previous search history, and cursor position + let @/=_s + call cursor(l, c) +endfun + +"command -nargs=0 Stripwhitespace :call StripTrailingWhitespaces() + +" Fix indentation in file +map i mmgg=G`m + +" Toggle highlighting of search results +nnoremap :nohlsearch + +" Unsmart Quotes +nnoremap guq :%s/\v[“”]/"/g + +if has("autocmd") + " StripTrailingWhitespaces + " TODO: autocmd BufWritePre * DeleteTrailingWhitespace + +" To spell check all git commit messages + au BufNewFile,BufRead COMMIT_EDITMSG set spell nonumber nolist wrap linebreak + + " Set filetype tab settings + autocmd FileType python,doctest set ai ts=8 sw=8 sts=8 et + + autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif +endif + +" 80 characters line +set colorcolumn=81 +"execute "set colorcolumn=" . join(range(81,335), ',') +highlight ColorColumn ctermbg=Black ctermfg=DarkRed + +" Highlight trailing spaces +" http://vim.wikia.com/wiki/Highlight_unwanted_spaces +highlight ExtraWhitespace ctermbg=red guibg=red +match ExtraWhitespace /\s\+$/ +autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ +autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@