Skip to content

Instantly share code, notes, and snippets.

@arnaldorusso
Forked from cuducos/init.vim
Last active August 29, 2015 14:15
Show Gist options
  • Save arnaldorusso/9173f6955a34ac3dd99a to your computer and use it in GitHub Desktop.
Save arnaldorusso/9173f6955a34ac3dd99a to your computer and use it in GitHub Desktop.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" NeoBundle "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" install and init NeoBundle
if has('vim_starting')
set nocompatible
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
let neobundle_readme=expand('~/.vim/bundle/neobundle.vim/README.md')
if !filereadable(neobundle_readme)
echo "Installing NeoBundle..."
echo ""
silent !mkdir -p ~/.vim/bundle
silent !git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
call neobundle#end()
filetype plugin indent on
" file navigation
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'ctrlpvim/ctrlp.vim'
" syntax, completion & file types
NeoBundle 'sheerun/vim-polyglot'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'mattn/emmet-vim'
" NeoBundle 'klen/python-mode'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'davidhalter/jedi-vim'
NeoBundle 'tpope/vim-commentary'
NeoBundle 'cakebaker/scss-syntax.vim'
NeoBundle 'vim-scripts/UltiSnips'
NeoBundle 'honza/vim-snippets'
NeoBundle 'dagwieers/asciidoc-vim'
" cursor navigation
NeoBundle 'bkad/CamelCaseMotion'
NeoBundle 'Lokaltog/vim-easymotion'
" visual enhancements
NeoBundle 'bling/vim-airline'
NeoBundle 'rodnaph/vim-color-schemes'
NeoBundle 'nathanaelkane/vim-indent-guides'
NeoBundle 'Valloric/MatchTagAlways'
" tools
NeoBundle 'dkprice/vim-easygrep'
NeoBundle 'mileszs/ack.vim'
NeoBundle 'airblade/vim-gitgutter'
NeoBundle 'godlygeek/csapprox'
NeoBundle 'majutsushi/tagbar'
NeoBundle 'tpope/vim-fugitive'
if has("nvim")
NeoBundle 'floobits/floobits-neovim'
endif
NeoBundleCheck
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin configurations "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" config NERDTree
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.pyc$', '\.db$', '\.sqlite$', '__pycache__', '.git', '.vagrant', '.DS_Store', '.idea', '.ropeproject']
" airline
let g:airline_theme = 'powerlineish'
set laststatus=2
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
" easy motion
let g:EasyMotion_leader_key = ';;'
" ack
let g:ack_default_options = " -H --nocolor -- nogroup -- column --smart-case --follow"
let g:ackprg = "ag --nogroup --nocolor --column"
" ultisnips
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
let g:UltiSnipsEditSplit="vertical"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Visual settings "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" show line numbers
set number
" detect file type and load plugins for them
filetype on
filetype plugin on
filetype plugin indent on
" enabe mouse
set mouse=a
" disable code folding
" set nofoldenable
" color scheme
colorscheme molokai
" set font and color column
set colorcolumn=80
if has("gui_running")
set guifont=Monaco:h13
if has("gui_gtk2")
set guifont=DejaVu\ Sans\ Mono\ 14
endif
endif
" hide gui elements & maximize gvim
if has("gui_gtk2")
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set lines=999 columns=999
endif
" search and highlight as you type
set incsearch
set hlsearch
" when scrolling, keep cursor visible within 3 lines
set scrolloff=3
" show pending operator
set showcmd
" highlight extra spaces
highlight BadWhitespace ctermbg=red guibg=red
" remove blink
set gcr=a:blinkon0
" status bar
set laststatus=2
set statusline=%F%m%r%h%w%=(%{&ff}/%Y)\ (line\ %l\/%L,\ col\ %c)\
" window title
set title
set titleold="Terminal"
set titlestring=%F
"enable color syntax highlight
syntax on
" .md to .markdown and .adoc to .asciidoctor
autocmd BufNewFile,BufRead *.md setlocal ft=markdown " .md ->markdown
autocmd BufNewFile,BufRead *.adoc setlocal ft=asciidoc " .adoc ->asciidoc
" use block cursor in cygwin
if system('uname') =~ 'CYGWIN_NT-6.1'
let &t_ti.="\e[1 q"
let &t_SI.="\e[5 q"
let &t_EI.="\e[1 q"
let &t_te.="\e[0 q"
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Shortcuts & aliases "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" leader to , and create some leader shortcuts
let mapleader=','
noremap <silent> <leader><space> :nohl<CR>
noremap <silent> <leader>n :NERDTreeToggle<CR>
noremap <silent> <leader>p :CtrlP<CR>
noremap <silent> <leader>t :CtrlPBuffer<CR>
noremap <silent> <leader>h :split<CR>
noremap <silent> <leader>v :vsplit<CR>
" camel case
map <S-W> <Plug>CamelCaseMotion_w
map <S-B> <Plug>CamelCaseMotion_b
map <S-E> <Plug>CamelCaseMotion_e
" indent and keep in visual mode
map < <gv
map > >gv
" disable arrows navigation
noremap <up> <nop>
noremap <down> <nop>
noremap <left> <nop>
noremap <right> <nop>
" inoremap <up> <nop> " navigate through jedi
" inoremap <down> <nop> " navigate through jedi
inoremap <left> <nop>
inoremap <right> <nop>
" use c-j c-k in command mode
cmap <c-j> <down>
cmap <c-k> <up>
" use clipboard for Y/P/X
if has('unnamedplus')
set clipboard=unnamed,unnamedplus
endif
noremap YY "+y<CR>
noremap P "+gP<CR>
noremap XX "+x<CR>
" buffer nav
noremap <leader>z :bp<CR>
noremap <leader>x :bn<CR>
noremap <leader>q :bd<CR>
" no one is really happy until you have this shortcuts
cnoreabbrev W w
cnoreabbrev W! w!
cnoreabbrev Q q
cnoreabbrev Q! q!
cnoreabbrev Wq wq
cnoreabbrev Wa wa
cnoreabbrev WQ wq
cnoreabbrev Wqa wqa
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Word processor mode "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
autocmd BufNewFile,BufRead *.adoc call WordProcessor()
function AsciiDocFold()
let line = getline(v:lnum)
if match(line, '^===') >= 0
return ">2"
elseif match(line, '^==') >= 0
return ">1"
endif
return "="
endfunction
function AsciiDocFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
function WordProcessor()
if has("gui_macvim")
set guifont=PT\ Mono:h14
endif
colorscheme summerfruit
syntax on
set wrap
set linebreak
set nolist
set textwidth=0
set wrapmargin=0
set colorcolumn=0
set spell
setlocal foldmethod=expr
setlocal foldexpr=AsciiDocFold()
setlocal foldtext=AsciiDocFoldText()
endfunction
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Other customizations "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ignore certain type of siles
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.db,*.sqlite,*.db
" auto-reload external changes
set autoread
" line endings & other file chars settings
set encoding=utf-8
set fileencoding=utf-8
set fileformat=unix
set fileformats=unix,dos,mac
set binary
" indentation with 4 spaces
set expandtab " use spaces instead of tabs
set autoindent " autoindent based on line above
set smartindent " smarter indent for C-like languages
set shiftwidth=4 " when using Shift + > or <
set softtabstop=4 " in insert mode
set tabstop=4 " set the space occupied by a regular tab
" enable switch buffers without saving
set hidden
" allow non-case-sensitive case when using only lowercase
set ignorecase
set smartcase
" disable swaps and backups
set nobackup
set noswapfile
" fast rendering terminal
if has("neovim")
set ttyfast
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment