From dc7fdbfaa0b8ee1197df67ef1ff440d6d15fd4b0 Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Wed, 3 May 2017 22:30:43 +0500 Subject: Vim and git config update. git: - branch alias vim: - add diff option to prefer vertical split - map *GeoJSON* files to json file type - add map for json formatting using jq - list files using *find* in CtrlP --- files/.gitconfig | 1 + files/.vimrc | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/files/.gitconfig b/files/.gitconfig index a179549..07a1e6b 100644 --- a/files/.gitconfig +++ b/files/.gitconfig @@ -16,6 +16,7 @@ [alias] aa = add --all --intent-to-add ar = !sh -c 'git archive --format=tar --prefix="$(basename "$PWD")-$1/" $1^{tree} | bzip2 >"$(basename "$PWD")-$1.tar.bz2"' - + br = branch c = commit --verbose co = checkout ci = commit diff --git a/files/.vimrc b/files/.vimrc index 5539f77..cbd8356 100644 --- a/files/.vimrc +++ b/files/.vimrc @@ -17,6 +17,7 @@ Plugin 'https://github.com/vim-scripts/L9.git' " Git inside vim Plugin 'https://github.com/tpope/vim-fugitive.git' +Plugin 'https://github.com/tpope/vim-unimpaired' " Intelligent date inc/dec Plugin 'https://github.com/tpope/vim-speeddating' @@ -117,6 +118,7 @@ set omnifunc=syntaxcomplete#Complete runtime! macros/matchit.vim set virtualedit+=block set backspace=indent,eol,start +set diffopt+=vertical " Показывать столбец с номерами строк set number set relativenumber @@ -296,6 +298,8 @@ if has('autocmd') au BufEnter * if &filetype == "" | setlocal ft=text | endif au BufReadPost *.ledger norm G + au BufRead,BufNewFile *.geojson if &ft == "" | setfiletype json | endif + " Set scripts to be executable from shell "au BufWritePost * if getline(1) =~ "^#!.*/bin/" | silent !chmod +x | endif au BufWritePost * if getline(1) =~ "^#!.*/bin/" | silent exec "!chmod +x " | endif @@ -422,6 +426,19 @@ augroup ft_javascript au FileType javascript setlocal foldmethod=marker foldmarker={,} augroup END +" }}} +" JSON {{{ + +augroup ft_json + au! + + if executable('jq') + au FileType json noremap jq :%!jq --indent 4 . + au FileType json vnoremap jq :'<,'>!jq --indent 4 . + endif + +augroup END + " }}} " Ledger {{{ augroup ft_ledger @@ -532,6 +549,11 @@ au FileType html let b:delimitMate_matchpairs="(:),[:],{:}" let g:templates_directory=$HOME . "/.vim/templates" +" }}} +" Ctrl-P {{{ + +let g:ctrlp_user_command = 'find %s -type f' + " }}} " }}} " Load custom local config {{{ -- cgit v1.2.3