Skip to content

Instantly share code, notes, and snippets.

@ivcn
Created April 18, 2023 09:45
Show Gist options
  • Select an option

  • Save ivcn/6e52801c8609b3c66b94e916a9ad4da0 to your computer and use it in GitHub Desktop.

Select an option

Save ivcn/6e52801c8609b3c66b94e916a9ad4da0 to your computer and use it in GitHub Desktop.
My vimrc
set nocompatible "be Improved
filetype off
"syntax on " enable syntax processing
set background=light
colorscheme gruvbox
""""""" tab settings
set tabstop=4 " number of visual spaces per TAB
set softtabstop=4 " number of spaces in tab when editing
set expandtab " tabs are spaces
set shiftwidth=4 " amount of indentation for one level
"show invisible symbols
"set listchars=tab:▸\ ,eol:¬,trail:~,extends:>,precedes:<
set listchars=eol:$,tab:->,trail:~,extends:>,precedes:<
set list
""""""" misc
set nowrap
set number " show line numbers
set showcmd " show command in bottom bar
set cursorline " highlight current line
filetype indent on " load filetype-specific indent files (like .vim/indent/python.vim)
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw only when we need to
set showmatch " highlight matching braces [{()}]
set visualbell " don't beep
set noerrorbells
set laststatus=2
""""""" search
set incsearch " search as characters are entered
set hlsearch " highlight matches
"Using F3 to turn off search highlighting when we don't need it.
nnoremap <F3> :nohlsearch<CR>
""""""" folding
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default
set foldnestmax=10 " 10 nested fold max
" Overload command to open/close fold around the current block. Default by now.
"nnoremap <space> za
set foldmethod=syntax " folding based on syntax
""""""" Custom bindings. Mostly default by now.
" move vertically by visual line (do not skipping wrapped parts).
"nnoremap j gj
"nnoremap k gk
" move to beginning/end of line
"nnoremap B ^
"nnoremap E $
" $/^ doesn't do anything
"nnoremap $ <nop>
"nnoremap ^ <nop>
" highlight last inserted text
nnoremap gV `[v`]
"let mapleader="," " change leader symbol. Default is \
" use jk instead of escape key in insert mode
"inoremap jk <esc>
" Start Gundo plugin using 'u' key
"nnoremap <leader>u :GundoToggle<CR>
" Shortcuts for edit vimrc/zshrc and load vimrc
"nnoremap <leader>ev :vsp $MYVIMRC<CR>
"nnoremap <leader>ez :vsp ~/.zshrc<CR>
"nnoremap <leader>sv :source $MYVIMRC<CR>
" save vim session. (Reopen with vim -S)
nnoremap <leader>s :mksession<CR>
" open The Silver Searcher search plugin
"nnoremap <leader>a :Ag
" CtrlP fuzzy file search plugin settings
"let g:ctrlp_match_window = 'bottom,order:ttb' " order matching files top to bottom
"let g:ctrlp_switch_buffer = 0 " open files in new buffers
" we can change the working directory during a Vim session CtrlP will respect that change
"let g:ctrlp_working_path=0
" speed up CtrlP using Ag
"let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" Tmux integration
" allows cursor change in tmux mode
"if exists('$TMUX')
" let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
" let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
"else
" let &t_SI = "\<Esc>]50;CursorShape=1\x7"
" let &t_EI = "\<Esc>]50;CursorShape=0\x7"
"endif
""""""" Airline UI settings
let g:airline_powerline_fonts = 1 " use powerline fonts (to make arrows)
let g:airline#extensions#tabline#enabled = 1 " draw tabline (title for each buffer)
let g:airline_theme='solarized'
"""""""NERDTree settings
"autocmd vimenter * NERDTree "start automatically
" Go to previous (last accessed) window after start.
" In result focus will be on file, instead of NerdTree window
"autocmd VimEnter * wincmd p
" Automaticall close NerdTree on exit
"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"change default arrow symbols
"let g:NERDTreeDirArrowExpandable = '▸'
"let g:NERDTreeDirArrowCollapsible = '▾'
" UI settings
"let NERDTreeMinimalUI = 1
"let NERDTreeDirArrows = 1
"
"""""""vim-cpp-enhanced-highlight settings
let g:cpp_class_scope_highlight = 1
let g:cpp_member_variable_highlight = 1
"""""""vim-clang-format options
let g:clang_format#command='/home/ivan/dev/repo/llvm/build/bin/clang-format'
let g:clang_format#detect_style_file = 1
"tmp
let g:loaded_youcompleteme = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment