Skip to content

Instantly share code, notes, and snippets.

@genotrance
Last active September 20, 2025 08:53
Show Gist options
  • Select an option

  • Save genotrance/57d327501443f440f522e2c886dadc1b to your computer and use it in GitHub Desktop.

Select an option

Save genotrance/57d327501443f440f522e2c886dadc1b to your computer and use it in GitHub Desktop.
vimrc
" Syntax and colors
filetype plugin indent on
syntax on
colorscheme default
" Tabs
set tabstop=2
set shiftwidth=2
set expandtab
au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4
set noerrorbells " no noise
set novisualbell " no flashing
set hidden " move without saving
set nobackup " no backfup files
set noswapfile " no .swp
set number " line numbering
set foldlevel=99 " all folds opened
set backspace=indent,eol,start " backspace behaves normally
set colorcolumn=80 " max-width of 80 chars
set wildmenu " menu for vim completion
" Key map
" -------
" buffers = =
" buffer next = <C-l>
" buffer prev = <C-h>
" buffer close = \\
" close window = \q
" files curdir = -
" files .. = _
" git diff = \d
" git history = \h
" git status = \s
" line number = F3
" nerdtree toggle = \e
" save file = F2
" srch word buf = \f
" srch .. buf = \F
" srch word files = \a
" srch .. files = \A
" startify = +
" tab new = \t
" tab prev = [t
" tab next = ]t
" tab close = \Q
" tab complete = <tab>
" Useful
" ------
" comment = gc
" search = s{char}{char}
" fuzzy search = z/ or z?
let mapleader='\' " leader key
nnoremap <leader>\ :close<CR> " close window
nnoremap <F2> :w<CR>
inoremap <F2> <esc>:w<CR>a
nnoremap <leader>t :tabnew<CR>
autocmd VimEnter * nnoremap [t :tabprevious<CR>
autocmd VimEnter * nnoremap ]t :tabnext<CR>
nnoremap <leader>Q :tabclose<CR>
vnoremap . :normal .<CR> " redo on visual block
nnoremap <C-l> :bn<CR> " buffer next
nnoremap <C-h> :bp<CR> " buffer prev
nnoremap <leader>\ :bd<CR> " buffer close
nnoremap <C-Space> :buffer
inoremap <C-Space> :buffer
" Terminal
tnoremap <Esc> <C-\><C-n> " terminal ESC
tnoremap <C-l> <C-\><C-n>:bn<CR> " terminal next
tnoremap <C-h> <C-\><C-n>:bp<CR> " terminal prev
tnoremap <leader>\ :bd!<CR> " terminal close
tnoremap <C-Space> <C-\><C-n>:buffer
"if has('win32')
" set pythondll=C:\Miniconda\envs\27\python27.dll
" set pythonhome=C:\Miniconda\envs\27
" set pythonthreedll=C:\Miniconda\python36.dll
" set pythonthreehome=C:\Miniconda
"endif
if has('win32unix')
let g:nvim_nim_exec_nimble="/c/Users/gt/.nimble/bin/nimble.exe"
endif
if !has('gui_running')
set t_Co=256 " turn on colors in terminal for airline
endif
if has('gui')
set guifont=Consolas:h10 " readable font
set guioptions=gm " only menubar
set lines=60
set columns=200
endif
" change dir to opened buffer
" autocmd BufEnter * silent! lcd %:p:h
" reload file on change
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI *
\ if mode() !~ '\v(c|r.?|!|t)' && getcmdwintype() == '' | checktime | endif
" Notification after file change
autocmd FileChangedShellPost *
\ echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None
" Git
" ---
" Plug 'airblade/vim-gitgutter.git'
let g:gitgutter_diff_args = '-w' " ignore whitespaces in git signs
" Plug 'gregsexton/gitv'
nnoremap <leader>h :Gitv<CR> " git history of current file
" Plug 'tpope/vim-fugitive'
nnoremap <leader>d :Gvdiff<CR> " git diff of current file
nnoremap <leader>s :Gstatus<CR> " git status
" Plug 'APZelos/blamer.nvim'
let g:blamer_enabled = 1
" UI
" --
" Plug 'itchyny/lightline.vim'
set laststatus=2 " lightline
set noshowmode " hide -- INSERT --
" -Plug 'nathanaelkane/vim-indent-guides.git'
"let g:indent_guides_enable_on_vim_startup=1
" Plug 'ntpeters/vim-better-whitespace.git'
let g:better_whitespace_enabled = 1
" File/Search
" -----------
" -Plug 'junegunn/fzf'
" -Plug 'junegunn/fzf.vim'
" Plug 'cloudhead/neovim-fuzzy'
nnoremap - :FuzzyOpen<CR>
nnoremap <leader>a "zyiw:FuzzyGrep <C-r>z<CR>
nnoremap <leader>A :FuzzyGrep
" Plug 'haya14busa/incsearch.vim'
" Plug 'haya14busa/incsearch-fuzzy.vim'
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map z/ <Plug>(incsearch-fuzzy-/)
map z? <Plug>(incsearch-fuzzy-?)
" Plug 'airblade/vim-rooter'
let g:rooter_change_directory_for_non_project_files = 'current'
let g:rooter_silent_chdir = 1
" Plug 'justinmk/vim-sneak.git'
let g:sneak#label = 1
" Plug 'mhinz/vim-startify'
nnoremap = :Startify<CR> " start Startify
" Actions
" -------
" Plug 'Townk/vim-autoclose'
" Plug 'tpope/vim-commentary.git'
" Plug 'tpope/vim-unimpaired.git'
" Language
" --------
" Plug 'w0rp/ale.git'
" Plug 'alaviss/nim.nvim'
let g:asyncomplete_auto_popup = 0
au User asyncomplete_setup call asyncomplete#register_source({
\ 'name': 'nim',
\ 'whitelist': ['nim'],
\ 'completor': {opt, ctx -> nim#suggest#sug#GetAllCandidates({start, candidates -> asyncomplete#complete(opt['name'], ctx, start, candidates)})}
\ })
" Completion
" ----------
" Plug 'prabirshrestha/asyncomplete.vim'
" Plug 'ervandew/supertab'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment