Last active
August 9, 2018 18:17
-
-
Save metalrufflez/b264026976867720f830fad90c0de73d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim: set ft=vim: | |
function! SSHconfigFolds() | |
let thisline = getline(v:lnum) | |
if match(thisline, '^## ') >= 0 | |
return ">2" | |
elseif match(thisline, '^# ') >= 0 | |
return ">1" | |
else | |
return "=" | |
endif | |
endfunction | |
setlocal foldexpr=SSHconfigFolds() | |
au BufRead,BufNewFile *.ssh/config set foldexpr=SSHconfigFolds() | |
function! FoldText() | |
let foldsize = (v:foldend-v:foldstart) | |
return getline(v:foldstart).' ('.foldsize.' lines)' | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Vundle configfile source. Add the bundles to ~/.vundle and not here | |
" Do not add any config BEFORE this line | |
source ~/.vundle | |
source ~/.vim_functions | |
" BASIC CONFIG {{{1 | |
syn on | |
set bg=dark | |
set is ic hls scs aw ru si ai | |
set sw=4 sts=4 ts=4 | |
set expandtab | |
set wildmenu wim=longest,list | |
set cursorline relativenumber | |
set nocompatible modeline modelines=1 | |
set showmode showcmd ttyfast | |
set splitbelow splitright | |
set laststatus=2 | |
set noshowmode | |
set scrolloff=3 | |
set undofile | |
set autoread | |
colorscheme hybrid | |
filetype plugin indent on | |
" Setting swap and undo directories | |
set undodir=$HOME/.vim/undo | |
set backupdir=$HOME/.vim/swap | |
set directory=$HOME/.vim/swap | |
" Color fix | |
let &t_Co=256 | |
let g:hybrid_custom_term_colors = 1 | |
let g:hybrid_reduced_contrast = 0 | |
" REMAPS {{{1 | |
cab W w | |
cab Wq wq | |
" Fix j/k | |
" nnoremap j gj | |
" nnoremap k gk | |
" Always display search results in the center of the screen | |
nnoremap n nzz | |
nnoremap N Nzz | |
nnoremap * *zz | |
nnoremap # #zz | |
nnoremap g* g*zz | |
nnoremap g# g#zz | |
" LEADER MAGIC {{{1 | |
" | |
" Easily clean search hilighting with \<space> | |
nnoremap <leader><space> :noh<cr> | |
" Easily clean search hilighting with \<space> | |
nnoremap <leader>n :set relativenumber!<cr> | |
" Easily set paste! | |
nnoremap <leader>p :set paste!<cr> | |
" Remove trailing whitespace with \q | |
nnoremap <leader>q :%s/\s\+$//<cr>:let @/=''<CR> | |
" Easy switch wrap/nowrap | |
nnoremap <leader>w :set wrap!<CR> | |
" Open current file in GUI app (OSX Only) | |
nnoremap <buffer> <leader>o :exec '!open' shellescape(@%, 1)<cr><cr> | |
" Toggle visible whitespace | |
nnoremap <leader>l :set list!<CR> | |
set listchars=tab:▸\ ,eol:¬ | |
" Easy open/close folds | |
nnoremap <leader>z zi | |
vnoremap <leader>z zi | |
nnoremap <Space> za | |
vnoremap <Space> za | |
nnoremap <S-Space> zA | |
vnoremap <S-Space> zA | |
nnoremap <silent> n n:call HLNext(0.4)<cr> | |
nnoremap <silent> N N:call HLNext(0.4)<cr> | |
" vmap <expr> <S-h> DVB_Drag('left') | |
" vmap <expr> <S-l> DVB_Drag('right') | |
" vmap <expr> <S-k> DVB_Drag('down') | |
" vmap <expr> <S-j> DVB_Drag('up') | |
" vmap <expr> D DVB_Duplicate() | |
" Open VSplit with vimrc | |
nnoremap <leader>ec <C-w><C-v><C-l>:e $MYVIMRC<cr> | |
" Source vimrc | |
nnoremap <leader>rc :source ~/.vimrc<cr> | |
" Open VSplit e move to it | |
nnoremap <leader>v <C-w>v<C-w>l | |
" Open file Browser vertically | |
nnoremap <leader>\| :Ve<cr> | |
" Open file Browser horizontally | |
nnoremap <leader>_ :Se<cr> | |
" Enable diff | |
nnoremap <leader>dt :windo diffthis<cr> | |
" Update diff | |
nnoremap <leader>du :windo diffup<cr> | |
" Disable Diff | |
nnoremap <leader>do :windo diffoff<cr>:windo set noscrollbind nocursorbind<cr> | |
" PLUGIN CONFIG {{{1 | |
" Enable Indent Guides | |
let g:indent_guides_enable_on_vim_startup=1 | |
" NERDTree Toggle | |
map <leader>T :NERDTreeToggle<CR> | |
map <leader>t :NERDTreeFocus<CR> | |
map <leader>c :NERDTreeCWD<CR> | |
let NERDTreeHijackNetrw=0 | |
let NERDTreeShowBookmarks=1 | |
" NERDTree auto close | |
au bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
" Auto Open if no file | |
" autocmd StdinReadPre * let s:std_in=1 | |
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif | |
" Gundo Toggle | |
nnoremap <leader>u :GundoToggle<CR> | |
" Gundo Settings | |
let g:gundo_right = 1 | |
let g:gundo_close_on_revert = 1 | |
let g:gundo_preview_bottom = 1 | |
let g:gundo_prefer_python3 = 1 | |
" Taglist plugin mapping | |
nmap <leader>o :TagbarToggle<CR> | |
let g:tagbar_type_ansible = { | |
\ 'ctagstype' : 'ansible', | |
\ 'kinds' : [ | |
\ 't:tasks' | |
\ ], | |
\ 'sort' : 0 | |
\ } | |
" THeme | |
let g:enable_bold_font = 1 | |
" Airline Config | |
let g:airline_powerline_fonts = 1 | |
let g:airline_theme = 'hybridline' | |
let g:airline_extensions = ['branch','virtualenv'] | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#formatter = 'unique_tail_improved' | |
" Syntastic Settings | |
let g:syntastic_json_checkers=['jsonlint'] | |
let g:syntastic_always_populate_loc_list = 1 | |
let g:syntastic_error_symbol = '✗' | |
let g:syntastic_warning_symbol = '!' | |
" Git Push | |
" nmap <leader>gp :Git push<CR> | |
" CTRL-P | |
nnoremap <C-l> :CtrlPMRUFiles<CR> | |
let g:ctrlp_prompt_mappings = { | |
\ 'PrtClearCache()': ['<c-q>'], | |
\ } | |
" YouCompleteMe | |
let g:ycm_autoclose_preview_window_after_completion=0 | |
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
let g:ConqueTerm_PyVersion = 3 | |
" ADVANCED CONFIGS {{{1 | |
" Return cursor to where left | |
au BufWinLeave ?* mkview | |
au BufWinEnter ?* silent loadview | |
let g:skipview_files = [ | |
\ '/private/tmp/*', | |
\ '/private/var/*', | |
\ '/dev/*', | |
\ ] | |
" Save when losing focus | |
" au FocusLost ?* :wa | |
" FILE TYPE SPECIFIC CONFIGS {{{2 | |
" Custom file syntax | |
au BufRead,BufNewFile *.pp set filetype=puppet | |
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} set ft=markdown | |
au BufRead,BufNewFile *.{json,jsonp} set filetype=json | |
au BufRead,BufNewFile *.sls set filetype=sls | |
au BufRead,BufNewFile */ansible/*.yml set filetype=ansible | |
au BufRead,BufNewFile *.j2 set filetype=jinja | |
" Python | |
" au FileType python set omnifunc=pythoncomplete#Complete | |
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif | |
autocmd InsertLeave * if pumvisible() == 0|pclose|endif | |
nnoremap <buffer> <leader>rr :exec '!python' shellescape(@%, 1)<cr> | |
nnoremap <buffer> <leader>re :exec '!python3' shellescape(@%, 1)<cr> | |
au BufNewFile,BufRead *.py | |
\ set tabstop=4 | | |
\ set softtabstop=4 | | |
\ set shiftwidth=4 | | |
\ set expandtab | | |
\ set autoindent | | |
\ set fileformat=unix | | |
\ set encoding=utf-8 | | |
\ set foldmethod=indent | | |
\ set foldlevel=99 | |
"python with virtualenv support | |
if has('pyton3') | |
py3 << EOF | |
import os | |
import sys | |
if 'VIRTUAL_ENV' in os.environ: | |
project_base_dir = os.environ['VIRTUAL_ENV'] | |
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') | |
exec(open(activate_this).read(), dict(__file__=activate_this)) | |
EOF | |
elsif has('python') | |
py << EOF | |
import os | |
import sys | |
if 'VIRTUAL_ENV' in os.environ: | |
project_base_dir = os.environ['VIRTUAL_ENV'] | |
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') | |
execfile(activate_this, dict(__file__=activate_this)) | |
EOF | |
endif | |
let python_highlight_all=1 | |
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree | |
" JSON settings | |
au Filetype json set sts=2 ts=2 sw=2 foldmethod=syntax | |
" Preview | |
nmap <leader>i :Preview<CR> | |
" Change hybrid change highlight color | |
if g:colors_name == 'hybrid' | |
highlight DiffText ctermfg=11 ctermbg=53 guifg=#f0c674 guibg=#5f005f | |
endif | |
" Folding Configs {{{2 | |
" au BufRead,BufNewFile ?* set foldtext=FoldText() | |
" SSHconfig | |
au BufRead,BufNewFile *.ssh/config set foldexpr=SSHconfigFolds() | |
" Vim configs | |
au FileType vim set foldmethod=marker | |
" MACVIM CONFIG {{{1 | |
if has("gui_running") | |
set guioptions-=r | |
set guioptions-=L | |
" set guifont=DroidSansMonoSlashedForPowerline:h12 | |
set guifont=PragmataProMono:h14 | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim: set ft=vim: | |
" Vundle config | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" Vundle config | |
filetype plugin indent on | |
" Bundles {{{1 | |
Bundle 'gmarik/vundle' | |
Bundle 'msanders/snipmate.vim' | |
Bundle 'tpope/vim-surround' | |
Bundle 'tpope/vim-repeat' | |
Bundle 'tpope/vim-commentary' | |
Bundle 'tpope/vim-unimpaired' | |
Bundle 'tpope/vim-fugitive' | |
Bundle 'scrooloose/nerdtree' | |
Bundle 'vim-syntastic/syntastic' | |
Bundle 'sjl/gundo.vim' | |
Bundle 'matthias-guenther/hammer.vim' | |
Bundle 'godlygeek/tabular' | |
Bundle 'Valloric/YouCompleteMe' | |
Bundle 'junegunn/goyo.vim' | |
Bundle 'junegunn/limelight.vim' | |
Bundle 'ctrlpvim/ctrlp.vim' | |
" Bundle 'fholgado/minibufexpl.vim' | |
Bundle 'bling/vim-airline' | |
Bundle 'nvie/vim-flake8' | |
Bundle 'majutsushi/tagbar' | |
Bundle 'mtth/scratch.vim' | |
Bundle 'tmhedberg/SimpylFold' | |
Bundle 'vim-airline/vim-airline-themes' | |
Bundle 'nathanaelkane/vim-indent-guides' | |
" Bundle 'AutoTag' | |
" Colorschemes {{{1 | |
Bundle 'sjl/badwolf' | |
Bundle 'tomasr/molokai' | |
Bundle 'croaker/mustang-vim' | |
Bundle 'altercation/vim-colors-solarized' | |
Bundle 'chriskempson/vim-tomorrow-theme' | |
Bundle 'nanotech/jellybeans.vim' | |
Bundle 'djjcast/mirodark' | |
Bundle 'kristijanhusak/vim-hybrid-material' | |
Bundle 'w0ng/vim-hybrid' | |
Bundle 'jnurmine/Zenburn' | |
Bundle 'HenryNewcomer/vim-theme-papaya' | |
Bundle 'morhetz/gruvbox' | |
Bundle 'junegunn/seoul256.vim' | |
Bundle 'jonathanfilip/vim-lucius' | |
Bundle 'romainl/Apprentice' | |
Bundle 'jpo/vim-railscasts-theme' | |
" Syntax {{{1 | |
Bundle 'plasticboy/vim-markdown' | |
Bundle 'elzr/vim-json' | |
Bundle 'vim-ruby/vim-ruby' | |
Bundle 'rodjek/vim-puppet' | |
Bundle "lepture/vim-jinja" | |
Bundle "saltstack/salt-vim" | |
Bundle 'chase/vim-ansible-yaml' | |
Bundle 'Matt-Deacalion/vim-systemd-syntax' | |
Bundle 'robbles/logstash.vim' | |
Bundle 'stephpy/vim-yaml' | |
Bundle 'nginx.vim' | |
" Bundle 'hdima/python-syntax' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment