Last active
December 2, 2024 09:40
-
-
Save jdavid82/d40f40e6f124aad6223eba0ff0c7ad65 to your computer and use it in GitHub Desktop.
vim settings for full stack C# development in Windows 10
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
"Allow project specific .vimrc execution | |
set exrc | |
"no backup files | |
set nobackup | |
"only in case you don't want a backup file while editing | |
set nowritebackup | |
"no swap files | |
set noswapfile | |
" No wrapping | |
set nowrap | |
" Highlight search results when using / | |
set hlsearch | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=500 | |
" all utf-8 | |
set encoding=utf-8 | |
set fileencoding=utf-8 | |
set termencoding=utf-8 | |
" enable backspace... | |
set bs=2 | |
"show line numbers | |
set number | |
" don't beep | |
set belloff=all | |
" Show white spaces a | |
set listchars=tab:>·,trail:~,extends:>,precedes:<,space:· | |
set list | |
" 4 spaces indentation | |
set tabstop=4 softtabstop=0 expandtab shiftwidth=4 | |
" Deal with unwanted white spaces (show them in red) | |
highlight ExtraWhitespace ctermbg=red guibg=red | |
match ExtraWhitespace /\s\+$/ | |
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ | |
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/ | |
autocmd InsertLeave * match ExtraWhitespace /\s\+$/ | |
autocmd BufWinLeave * call clearmatches() | |
"Let's setup the plugins | |
call plug#begin() | |
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' } | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'OmniSharp/omnisharp-vim' | |
Plug 'mhinz/vim-signify' | |
Plug 'nickspoons/vim-sharpenup' | |
Plug 'arzg/vim-colors-xcode' | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'tpope/vim-dadbod' | |
Plug 'kristijanhusak/vim-dadbod-ui' | |
Plug 'vim-scripts/dbext.vim' | |
Plug 'dyng/ctrlsf.vim' | |
call plug#end() | |
" ====== coc settings start ============================= | |
let g:coc_global_extensions=[ 'coc-omnisharp', 'coc-json', 'coc-sql', 'coc-eslint', 'coc-html', 'coc-db' ] | |
" NOTE: For XAML files, in vim you can run :setf xml | |
" and this will treat it as an xml file and will show coloring which makes it easier to read. | |
" ====== coc settings end =============================== | |
" ========= airline settings start ====================== | |
" to see the full path of the editing file | |
let g:airline#extensions#tabline#formatter = 'unique_tail' | |
let g:airline_powerline_fonts = 1 | |
" show branch information | |
let g:airline#extensions#branch#enabled = 1 | |
let g:airline_theme='badwolf' | |
if !exists('g:airline_symbols') | |
let g:airline_symbols = {} | |
endif | |
" unicode symbols | |
let g:airline_left_sep = '»' | |
let g:airline_left_sep = '▶' | |
let g:airline_right_sep = '«' | |
let g:airline_right_sep = '◀' | |
let g:airline_symbols.crypt = '🔒' | |
let g:airline_symbols.linenr = '☰' | |
let g:airline_symbols.linenr = '␊' | |
let g:airline_symbols.linenr = '' | |
let g:airline_symbols.linenr = '¶' | |
let g:airline_symbols.maxlinenr = '' | |
let g:airline_symbols.maxlinenr = '㏑' | |
let g:airline_symbols.branch = '⎇' | |
let g:airline_symbols.paste = 'ρ' | |
let g:airline_symbols.paste = 'Þ' | |
let g:airline_symbols.paste = '∥' | |
let g:airline_symbols.spell = 'Ꞩ' | |
let g:airline_symbols.notexists = 'Ɇ' | |
let g:airline_symbols.whitespace = 'Ξ' | |
" powerline symbols | |
let g:airline_left_sep = '' | |
let g:airline_left_alt_sep = '' | |
let g:airline_right_sep = '' | |
let g:airline_right_alt_sep = '' | |
let g:airline_symbols.branch = '' | |
let g:airline_symbols.readonly = '' | |
let g:airline_symbols.linenr = '☰' | |
let g:airline_symbols.maxlinenr = '' | |
let g:airline_symbols.dirty='⚡' | |
let g:airline#extensions#tabline#enabled = 1 | |
" ========= airline settings end ======================== | |
" =============== OmniSharp settings start=============== | |
" OmniSharp won't work without this setting | |
filetype plugin on | |
" Use Roslyin and also better performance than HTTP | |
let g:OmniSharp_server_stdio = 1 | |
let g:omnicomplete_fetch_full_documentation = 1 | |
" Timeout in seconds to wait for a response from the server | |
let g:OmniSharp_timeout = 30 | |
" this will make it so any subsequent C# files that you open are using the same solution and you aren't prompted again (so you better choose the right solution the first time around :) ) | |
let g:OmniSharp_autoselect_existing_sln = 1 | |
let g:OmniSharp_popup_options = { | |
\ 'highlight': 'Normal', | |
\ 'padding': [1], | |
\ 'border': [1] | |
\} | |
" =============== OmniSharp settings end================= | |
" =================NERDTree settings start=============== | |
" For more docos check out https://github.com/preservim/nerdtree/blob/master/doc/NERDTree.txt | |
" Open new NERDTree instance bt typing nto | |
nmap nt :NERDTree<cr> | |
" Open existing NERDTree buffer (if any) at current tab | |
nmap ntm :NERDTreeMirror<cr> | |
" If you are using vim-plug, you'll also need to add these lines to avoid crashes when calling vim-plug functions while the cursor is on the NERDTree window | |
let g:plug_window = 'noautocmd vertical topleft new' | |
" =================NERDTree settings end================= | |
" =================vim Sharpenup settings start========== | |
" note that using CTRL isn't feasible so we will use z instead, I chose z because it's the closest key to left ctrl | |
let g:sharpenup_map_prefix = '.' | |
" =================vim Sharpenup settings end============ | |
" ================ dyng/ctrlsf.vim settings start ============== | |
" Ctrl + f, f | |
nmap <C-F>f <Plug>CtrlSFPrompt | |
" ================ dyng/ctrlsf.vim settings end ================ | |
" Bookmarks: | |
" It's best to use vim's native bookmarks: | |
" https://www.thegeekstuff.com/2009/02/how-to-add-bookmarks-inside-vi-and-vim-editor/ | |
" I personally use numbers because they are easier to remember and are global | |
" fix colors | |
set t_Co=256 | |
" use awesome Xcode dark color scheme (for some reason this only works if I specify it at the end of the file) | |
colorscheme xcodedark | |
syntax on | |
"Disable unsafe commands since we are allowing project specific .vimrc file execution | |
set secure |
Amazing work! Your config fixed so many issues I was facing. Thanks!
you are welcome @ivanpaulovich , here's the video related to it https://www.youtube.com/watch?v=zi2pReTFRG8
Also, there is a new version of the video, you'll find the link in the video description, happy vimming!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Once copied, open vim and run
then run: