Skip to content

Instantly share code, notes, and snippets.

@fabifrank
Last active December 31, 2018 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabifrank/b3ce5b8309dfc618298685b2ac335e9d to your computer and use it in GitHub Desktop.
Save fabifrank/b3ce5b8309dfc618298685b2ac335e9d to your computer and use it in GitHub Desktop.
.vimrc
if &compatible
set nocompatible
endif
set runtimepath+=/Users/skober/.cache/dein/repos/github.com/Shougo/dein.vim
if dein#load_state('/Users/skober/.cache/dein')
call dein#begin('/Users/skober/.cache/dein')
call dein#add('jelera/vim-javascript-syntax')
"call dein#add('suan/vim-instant-markdown')
call dein#add("leafgarland/typescript-vim")
call dein#add('mhinz/vim-startify')
call dein#add('redguardtoo/evil-nerd-commenter')
call dein#add('moll/vim-node')
call dein#add('Chiel92/vim-autoformat')
call dein#add('dyng/ctrlsf.vim')
call dein#add('jlanzarotta/bufexplorer')
call dein#add('vim-scripts/grep.vim')
call dein#add('chrisbra/csv.vim')
call dein#add('maksimr/vim-jsbeautify')
call dein#add('vim-scripts/sudo.vim')
call dein#add('Lokaltog/vim-easymotion')
call dein#add('Shougo/dein.vim')
call dein#add('vim-airline/vim-airline')
call dein#add('jelera/vim-javascript-syntax')
call dein#add('Rykka/riv.vim')
call dein#add('matze/vim-move')
call dein#add('leafgarland/typescript-vim')
call dein#add('lepture/vim-jinja')
call dein#add('vim-scripts/groovy.vim')
call dein#add('kien/ctrlp.vim')
call dein#add('heavenshell/vim-jsdoc')
call dein#add('airblade/vim-gitgutter')
call dein#add('terryma/vim-expand-region')
call dein#add('ntpeters/vim-better-whitespace')
call dein#add('motemen/git-vim')
call dein#add('vim-syntastic/syntastic')
call dein#add('/Users/skober/.cache/dein/repos/github.com/Shougo/dein.vim')
call dein#end()
call dein#save_state()
if dein#check_install()
call dein#install()
endif
endif
syntax on
colorscheme onedark
set number
autocmd FileType javascript noremap <buffer> <c-f> :call JsBeautify()<cr>
autocmd FileType json noremap <buffer> <c-f> :call JsonBeautify()<cr>
" for jsx
autocmd FileType jsx noremap <buffer> <c-f> :call JsxBeautify()<cr>
" for html
autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr>
" for css or scss
autocmd FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr>
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4
" autocmd FileType python setlocal equalprg=/home/martin/src/Python-3.5.1/Tools/scripts/reindent.py
"filetype plugin indent on
"Use TAB to complete when typing words, else inserts TABs as usual.
""Uses dictionary and source files to find matching words to complete.
"See help completion for source,
""Note: usual completion is on <C-n> but more trouble to press all the time.
"Never type the same word twice and maybe learn a new spellings!
""Use the Linux dictionary when spelling is in doubt.
"Window users can copy the file to their machine.
function! Tab_Or_Complete()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-N>"
else
return "\<Tab>"
endif
endfunction
:inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
":set dictionary="~/dict/javascript/words"
set hlsearch
set cursorline
set noswapfile
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
map <C-H> <C-W>h
" manage git
map <C-G>a :GitAdd <Enter>
map <C-G>c :GitCommit -m '
map <C-G>s :GitStatus <Enter>
map <C-G>l :GitLog <Enter>
map <C-G>checkout :GitCheckout
map <C-G>diff :GitDiff
map <C-G>pull :GitPull <Enter>
map <C-G>push :GitPush <Enter>
map <C-G>git :Git
map <C-G>merge :GitVimDiffMerge <Enter>
map <C-G>done :GitVimDiffMergeDone <Enter>
map <S-Q> :q <Enter>
map <S-T> :tabe <Enter>
" switch tabs with shift key combi
map <S-F> gT
map <S-J> gt
map <S-R>c :CtrlPClearCache <Enter>
map <S-R>f :e <Enter>
map <ScrollWheelUp> <C-Y>
map <S-ScrollWheelUp> <C-U>
map <ScrollWheelDown> <C-E>
map <S-ScrollWheelDown> <C-D>
let g:ctrlp_map = '<C-P>'
map <C-F> :Vexplore <Enter>
map <C-L> :CtrlPTag <Enter>
" open ctrlp files in new tab per default
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>'],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ }
set tabstop=2
set shiftwidth=2
set autoindent
set noexpandtab
set incsearch
set softtabstop=-1
set autoread
" this hook on save checks whether theres a hooks/save file in directory and if so will trigger it
autocmd BufWritePost * silent! execute '! if [ -f hooks/save ]; then ./hooks/save %; fi'
set tags=tags;/
" Move lines up and down short cuts (selection)
" Disabled due to lack of free keys and without autokey multiple control keys
" are not possible
"nnoremap <C-S-Up> :m .+1<CR>==
"nnoremap <C-S-Down> :m .-2<CR>==
"inoremap <C-S-Up> <Esc>:m .+1<CR>==gi
"inoremap <C-S-Down> <Esc>:m .-2<CR>==gi
"vnoremap <C-S-Up> :m '>+1<CR>gv=gv
"vnoremap <C-S-Down> :m '<-2<CR>gv=gv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment