Skip to content

Instantly share code, notes, and snippets.

@av-ast
Created January 27, 2017 04:37
Show Gist options
  • Save av-ast/0bb6f826a84a3bfb9317a57aae18ee25 to your computer and use it in GitHub Desktop.
Save av-ast/0bb6f826a84a3bfb9317a57aae18ee25 to your computer and use it in GitHub Desktop.
" brew install vim --with-lua
"
" gem install haml-lint ruby-lint rubocop sass
" pip install pylint
" npm install -g js-yaml jsxhint eslint jsonlint
" https://github.com/ten0s/syntaxerl
set nocompatible
filetype off
" let mapleader="\<Space>"
set rtp+=~/.vim/bundle/vundle
call vundle#begin()
Plugin 'gmarik/vundle'
Plugin 'fatih/vim-go'
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/syntastic'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-commentary'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-unimpaired'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'bling/vim-airline'
Plugin 'jeetsukumaran/vim-buffergator'
Plugin 'elzr/vim-json'
Plugin 'Valloric/MatchTagAlways'
Plugin 'plasticboy/vim-markdown'
Plugin 'tpope/vim-haml'
Plugin 'tpope/vim-git'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-bundler'
Plugin 'Shougo/neocomplete.vim'
Plugin 'Shougo/neosnippet'
Plugin 'Shougo/neosnippet-snippets'
Plugin 'chase/vim-ansible-yaml'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'vim-scripts/paredit.vim'
Plugin 'chrisbra/csv.vim'
Plugin 'bogado/file-line'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'jiangmiao/auto-pairs'
" Plugin 'vim-scripts/vim-auto-save'
Plugin 'kchmck/vim-coffee-script'
Plugin 'airblade/vim-gitgutter'
Plugin 'rking/ag.vim'
Plugin 'akalyaev/vim-erlang-spec'
Plugin 'thoughtbot/vim-rspec'
Plugin 'jgdavey/tslime.vim'
Plugin 'vim-erlang/vim-erlang-runtime'
Plugin 'vim-erlang/vim-erlang-compiler'
Plugin 'vim-erlang/vim-erlang-omnicomplete'
Plugin 'vim-erlang/vim-erlang-tags'
Plugin 'easymotion/vim-easymotion'
Plugin 'elixir-lang/vim-elixir'
" Plugin 'slashmili/alchemist.vim'
" Plugin 'powerman/vim-plugin-AnsiEsc'
call vundle#end()
filetype plugin indent on
set mouse=a
set cursorline
set hidden
set expandtab
set tabstop=2
"set modelines=0
set shiftwidth=2
set clipboard+=unnamed
"set synmaxcol=128
"set ttyscroll=10
"set encoding=utf-8
set nonumber
"set nowritebackup
set noswapfile
"set nobackup
set hlsearch
set ignorecase
set smartcase
set timeoutlen=250 " Time to wait after ESC (default causes an annoying delay)
set background=dark
colorscheme solarized
" ================ Persistent Undo ==================
" Keep undo history across sessions, by storing in file.
" Only works all the time.
if has('persistent_undo')
silent !mkdir ~/.vim/backups > /dev/null 2>&1
set undodir=~/.vim/backups
set undofile
endif
let g:vim_json_syntax_conceal = 0
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" autocmd FileType ruby setlocal omnifunc=rubycomplete#CompleteTags
" autocmd FileType java setlocal omnifunc=javacomplete#Complete
au Filetype erlang setlocal tabstop=4
au Filetype erlang setlocal softtabstop=4
au Filetype erlang setlocal shiftwidth=4
let g:buffergator_viewport_split_policy = "B"
let g:buffergator_sort_regime = "mru"
let g:vim_markdown_folding_disabled = 1
let g:syntastic_javascript_checkers = ['eslint', 'jsxhint']
let g:syntastic_erlang_checkers = ['syntaxerl']
let g:auto_save = 1 " enable AutoSave on Vim startup
let g:auto_save_silent = 1 " do not display the auto-save notification
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" Map ctrl-movement keys to window switching
map <C-k> <C-w><Up>
map <C-j> <C-w><Down>
map <C-l> <C-w><Right>
map <C-h> <C-w><Left>
" Toggle paste mode
nmap <silent> <F4> :set invpaste<CR>:set paste?<CR>
imap <silent> <F4> <ESC>:set invpaste<CR>:set paste?<CR>
" format the entire file
nnoremap <leader>fef :normal! gg=G``<CR>
" set text wrapping toggles
nmap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
" find merge conflict markers
nmap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
" upper/lower word
nmap <leader>u mQviwU`Q
nmap <leader>l mQviwu`Q
nmap <C-\> :NERDTreeFind<CR>
nmap <silent> <leader><leader> :NERDTreeToggle<CR>
nmap <silent> // :nohlsearch<CR>
noremap ,hl :set hlsearch! hlsearch?<CR>
" Allows you to enter sudo pass and save the file
" " when you forgot to open your file with sudo
cmap w!! %!sudo tee > /dev/null %
" Allow to copy/paste between VIM instances
" "copy the current visual selection to ~/.vbuf
vmap <Leader>y :w! ~/.vbuf<CR>
" "copy the current line to the buffer file if no visual selection
nmap <Leader>y :.w! ~/.vbuf<CR>
" "paste the contents of the buffer file
nmap <Leader>p :r ~/.vbuf<CR>
" save changes
" map <Leader>s :w<CR>
" imap <Leader>s <ESC>:w<CR>
" vmap <Leader>s <ESC><ESC>:w<CR>
" Automatically removing all trailing whitespace
autocmd BufWritePre * :%s/\s\+$//e
" Lines moving
" ∆ means <Alt+j>
" ˚ means <Alt+k>
" Normal mode
nnoremap ∆ :m .+1<CR>==
nnoremap ˚ :m .-2<CR>==
" Insert mode
inoremap ∆ <ESC>:m .+1<CR>==gi
inoremap ˚ <ESC>:m .-2<CR>==gi
" Visual mode
vnoremap ∆ :m '>+1<CR>gv=gv
vnoremap ˚ :m '<-2<CR>gv=gv
" set iskeyword-=_
nnoremap <leader>s :ErlangSpec<CR>
let g:rspec_command = 'call Send_to_Tmux("spring rspec {spec}\n")'
" vim-rspec mappings
" map <Leader>t :call RunCurrentSpecFile()<CR>
" map <Leader>s :call RunNearestSpec()<CR>
" map <Leader>l :call RunLastSpec()<CR>
" map <Leader>a :call RunAllSpecs()<CR>
autocmd TextChanged,TextChangedI <buffer> silent write
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment