Skip to content

Instantly share code, notes, and snippets.

@abner
Created October 21, 2017 11:23
Show Gist options
  • Save abner/9e2fff1eb9b392715dffbdec3e51ff43 to your computer and use it in GitHub Desktop.
Save abner/9e2fff1eb9b392715dffbdec3e51ff43 to your computer and use it in GitHub Desktop.
vim.rc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
Bundle 'tpope/vim-sensible'
Bundle 'tpope/vim-surround'
" Bundle 'tpope/vim-fugitive'
" Bundle 'tpope/vim-rails'
Bundle 'vim-ruby/vim-ruby'
" Bundle 'tpope/vim-rake'
Bundle 'nanotech/jellybeans.vim'
" Bundle 'Lokaltog/vim-powerline'
Bundle 'scrooloose/syntastic'
Bundle 'scrooloose/nerdtree'
Bundle 'jistr/vim-nerdtree-tabs'
Bundle 'kien/ctrlp.vim'
" Bundle 'rking/ag.vim'
" Bundle 'kana/vim-textobj-user'
" Bundle 'nelstrom/vim-textobj-rubyblock'
" Bundle 'slim-template/vim-slim'
" Bundle 'bling/vim-airline'
Bundle 'jlanzarotta/bufexplorer'
Bundle 'Xuyuanp/nerdtree-git-plugin'
" Bundle 'Quramy/tsuquyomi'
Bundle 'leafgarland/typescript-vim'
Bundle 'Shougo/vimproc.vim'
" Plugin 'Chiel92/vim-autoformat'
" Plugin 'nsf/gocode', {'rtp': 'vim/'}
Plugin 'crusoexia/vim-monokai'
Plugin 'tomasr/molokai'
" Bundle 'jordwalke/flatlandia'
" Bundle 'Lokaltog/vim-distinguished'
" Bundle 'guns/jellyx.vim'
Bundle 'vim-scripts/BusyBee'
Bundle 'vim-scripts/twilight256.vim'
Bundle 'blindFS/flattr.vim'
Bundle 'gosukiwi/vim-atom-dark'
Bundle 'ajh17/Spacegray.vim'
Bundle 'Valloric/YouCompleteMe'
" Bundle 'elixir-lang/vim-elixir'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" EDITOR SETUP
set cursorline
set expandtab
set modelines=0
set shiftwidth=2
set clipboard=unnamed
set synmaxcol=128
set ttyscroll=10
set encoding=utf-8
set tabstop=2
set nowrap
set number
set expandtab
set nowritebackup
set noswapfile
set nobackup
set hlsearch
set ignorecase
set smartcase
" Automatic formatting
autocmd BufWritePre *.rb :%s/\s\+$//e
autocmd BufWritePre *.go :%s/\s\+$//e
autocmd BufWritePre *.haml :%s/\s\+$//e
autocmd BufWritePre *.html :%s/\s\+$//e
autocmd BufWritePre *.scss :%s/\s\+$//e
autocmd BufWritePre *.slim :%s/\s\+$//e
" Ruby AutoComplete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
au BufNewFile * set noeol
au BufRead,BufNewFile *.go set filetype=go
"au BufRead,BufNewFile *.ts set filetype=typescript
"autocmd BufNewFile,BufRead *.ts,*.tsx setlocal filetype=typescript
" No show command
autocmd VimEnter * set nosc
" Quick ESC
imap jj <ESC>
" Jump to the next row on long lines
map <Down> gj
map <Up> gk
nnoremap j gj
nnoremap k gk
" format the entire file
nmap <leader>fef ggVG=
" Open new buffers
nmap <leader>s<left> :leftabove vnew<cr>
nmap <leader>s<right> :rightbelow vnew<cr>
nmap <leader>s<up> :leftabove new<cr>
nmap <leader>s<down> :rightbelow new<cr>
" Tab between buffers
noremap <tab> <c-w><c-w>
" Switch between last two buffers
nnoremap <leader><leader> <C-^>
" Resize buffers
if bufwinnr(1)
nmap Ä <C-W><<C-W><
nmap Ö <C-W>><C-W>>
nmap ö <C-W>-<C-W>-
nmap ä <C-W>+<C-W>+
endif
" NERDTree
nmap <leader>n :NERDTreeToggle<CR>
nmap ,n :NERDTreeFind<CR>
let NERDTreeHighlightCursorline=1
let NERDTreeIgnore = ['tmp', '.yardoc', 'pkg']
" Syntastic
let g:syntastic_mode_map = { 'mode': 'passive' }
let g:syntastic_ruby_exec = '~/.rvm/rubies/ruby-2.0.0-p0/bin/ruby'
" CtrlP
nnoremap <silent> t :CtrlP<cr>
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_by_filename = 1
let g:ctrlp_max_files = 600
let g:ctrlp_max_depth = 10
let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|dist)|(\.(swp|ico|git|svn))$'
let g:ctrlp_switch_buffer = 'et'
" Go programming
set rtp+=/usr/local/Cellar/go/1.0.3/misc/vim
" Quit with :Q
command -nargs=0 Quit :qa!
map <C-n> :NERDTreeToggle<CR>
map gn :bn!<cr>
map gp :bp!<cr>
map gd :bd<cr>
set ballooneval
autocmd FileType typescript setlocal balloonexpr=tsuquyomi#balloonexpr()
set guifont=Source\ Code\ Pro\ Regular\ 15
set guifont=PragmataPro\ Regular\ 15
"AutoFormat
noremap <F3> :Autoformat<CR>
let g:ycm_semantic_triggers = {
\ 'c' : ['->', '.'],
\ 'objc' : ['->', '.', 're!\[[_a-zA-Z]+\w*\s', 're!^\s*[^\W\d]\w*\s',
\ 're!\[.*\]\s'],
\ 'ocaml' : ['.', '#'],
\ 'cpp,objcpp' : ['->', '.', '::'],
\ 'perl' : ['->'],
\ 'php' : ['->', '::'],
\ 'cs,java,javascript,typescript,d,python,perl6,scala,vb,elixir,go' : ['.'],
\ 'ruby' : ['.', '::'],
\ 'lua' : ['.', ':'],
\ 'erlang' : [':'],
\ }
autocmd FileType typescript setlocal completeopt+=menu,preview
"let g:EclimCompletionMethod = 'omnifunc'
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_add_preview_to_completeopt=1
let g:ycm_autoclose_preview_window_after_insertion=1
let g:ycm_collect_identifiers_from_tags_files = 1
set tags+=./.tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment