Skip to content

Instantly share code, notes, and snippets.

@jogardi
Created June 22, 2022 17:06
Show Gist options
  • Save jogardi/c2a85ff26bdc973d6e939b6335b2fcb6 to your computer and use it in GitHub Desktop.
Save jogardi/c2a85ff26bdc973d6e939b6335b2fcb6 to your computer and use it in GitHub Desktop.
" Auto install from https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
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
call plug#begin('~/.vim/plugged')
Plug 'majutsushi/tagbar', { 'do': 'cp -R ./plugin ~/.vim/' }
Plug 'nathanaelkane/vim-indent-guides'
Plug 'Chiel92/vim-autoformat'
Plug 'chrisbra/csv.vim'
" Plug 'davidhalter/jedi-vim'
Plug 'ap/vim-buftabline'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'https://github.com/w0rp/ale.git'
Plug 'fvictorio/vim-extract-variable'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-surround'
Plug 'henrik/vim-indexed-search'
call plug#end()
noremap <Leader>y "*y
noremap <Leader>p "*p
noremap \x "*x
set textwidth=120
set statusline=%<%f\ %h%m%r%{kite#statusline()}%=%-14.(%l,%c%V%)\ %P
set laststatus=2 " always display the status line
filetype plugin on
set backspace=indent,eol,start
" just for ideavim
set visualbell
set noerrorbells
if exists('surround')
set surround
nmap <leader>d :action GotoDeclaration<cr>
endif
" make scrolling work in iterm
set mouse=a
nnoremap <C-Left> :call search('\<\<Bar>\u', 'bW')<CR>
nnoremap <C-Right> :call search('\<\<Bar>\u', 'W')<CR>
inoremap <C-Left> <C-o>:call search('\<\<Bar>\u', 'bW')<CR>
inoremap <C-Right> <C-o>:call search('\<\<Bar>\u', 'W')<CR>
" show marks shortcut
nnoremap <C-m> :<C-u>marks<CR>:normal! `
let g:indent_guides_enable_on_vim_startup = 1
set ts=4 sw=4 et
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
set expandtab " don't use actual tab character (ctrl-v)
set shiftwidth=4 " indenting is 4 spaces
set autoindent " turns it on
set smartindent " does the right thing (mostly) in programs
set smarttab
set cindent " stricter rules for C programs
set number
set hidden
nnoremap gn :bnext<CR>
nnoremap gp :bprev<CR>
set statusline+=%#warningmsg#
set statusline+=%*
let g:jedi#show_call_signatures = "0"
" highlight all matches and unhilight key binding
set hlsearch
nnoremap <silent> <Esc><Esc> <Esc>:nohlsearch<CR><Esc>
" ale setup
" ale keybindings
map <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
"let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 0
let g:ale_fix_on_save = 1
" https://stackoverflow.com/questions/749297/can-i-see-changes-before-i-save-my-file-in-vim
function! s:DiffWithSaved()
let filetype=&ft
diffthis
vnew | r # | normal! 1Gdd
diffthis
exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
endfunction
com! DiffSaved call s:DiffWithSaved()
map ' "
map <leader>r :register<ENTER>
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
map <leader>t :TagbarCurrentTag<ENTER>
" refresh cursor position for tagbar
set updatetime=500
map :tb :Tagbar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment