Last active
July 22, 2021 18:37
-
-
Save bcawrse/1a6d44248427b51ad65b9fa5d6a47aac to your computer and use it in GitHub Desktop.
General .vimrc file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set tabstop=2 | |
set shiftwidth=2 | |
set textwidth=120 | |
set expandtab | |
set number | |
set hlsearch | |
set pastetoggle=<F2> | |
:color delek | |
" Allow saving of files as sudo when I forgot to start vim using sudo. | |
cmap w!! w !sudo tee > /dev/null % | |
:hi ColorColumn ctermbg=lightgrey guibg=lightgrey | |
" set colorcolumn=140 " Enable colorColumn at 140. set cc=140 also works. | |
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
" Plugins will be downloaded under the specified directory. | |
call plug#begin('~/.vim/plugged') | |
" Install new plugins with :PlugInstall | |
" Declare the list of plugins. | |
Plug 'tpope/vim-sensible' | |
Plug 'junegunn/seoul256.vim' | |
Plug 'scrooloose/nerdtree' | |
Plug 'tpope/vim-commentary' | |
Plug 'tpope/vim-surround' | |
Plug 'kana/vim-textobj-user' | Plug 'kana/vim-textobj-line' | |
"Plug 'OrangeT/vim-csharp' | |
" List ends here. Plugins become visible to Vim after this call. | |
call plug#end() | |
" Set OmniSharp for vim within WSL using Windows binary | |
"let g:OmniSharp_server_path = '/mnt/c/OmniSharp/omnisharp.win-x64/OmniSharp.exe' | |
"let g:OmniSharp_translate_cygwin_wsl = 1 | |
" NerdTree setup | |
autocmd StdinReadPre * let s:std_in=1 | |
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif | |
map <C-n> :NERDTreeToggle<CR> | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
" Faster alternative to pressing ESC | |
inoremap kj <ESC> | |
let mapleader = " " | |
syntax on | |
set encoding=utf-8 | |
" set clipboard=unnamedplus #CAUSES CLI PASTE ISSUES | |
"### NOTES ### | |
" vim-surround rocks | |
" ysiw' // surround in word `'` | |
" ds' // drop surround `'` | |
" cs'" // change surround from `'` to `"` | |
" cst<em> // change surround tag to <em> FOR HTML TAGS! | |
" 'S' '(' // Surround highlighted copy with '( )' - works for other changes too like tags! | |
" 'vil' | 'val' // vim-textobj-line adds hotkeys for il (in line) and al (all line) such as vil & val |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment