Skip to content

Instantly share code, notes, and snippets.

@Pryz
Created August 23, 2017 00:33
Show Gist options
  • Save Pryz/416f5df2a2bd2b9c6ba6493cdebc6e3f to your computer and use it in GitHub Desktop.
Save Pryz/416f5df2a2bd2b9c6ba6493cdebc6e3f to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
let mapleader = ','
let g:mapleader = ','
if has('nvim')
let s:editor_root=expand("~/.nvim")
else
let s:editor_root=expand("~/.vim")
endif
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" For neovim
call vundle#rc(s:editor_root . '/bundle')
" let Vundle manage Vundle, required
" to install plugin run : vim +PluginInstall +qall
Plugin 'gmarik/Vundle.vim'
Plugin 'tpope/vim-fugitive' " Git wrapper
Plugin 'vim-airline/vim-airline' " statusbar/tabline
Plugin 'vim-airline/vim-airline-themes'
Plugin 'tpope/vim-endwise' " and 'end' in Ruby
Plugin 'scrooloose/nerdtree' " best source tree ever
Plugin 'ctrlpvim/ctrlp.vim' " fuzzy finder etc etc
Plugin 'vim-ruby/vim-ruby' " Compile Ruby
Plugin 'tpope/vim-surround' " Add surrounding !
Plugin 'scrooloose/syntastic' " Check your syntax bro
Plugin 'godlygeek/tabular' " Text alignment
Plugin 'SirVer/ultisnips' " Ultimate snippets
Plugin 'honza/vim-snippets'
Plugin 'tpope/vim-markdown' " Markdown mode
Plugin 'fatih/vim-go' " Go go go !
Plugin 'vim-scripts/gnupg.vim' " Live gpg edits !
Plugin 'hashivim/vim-terraform' " Some TF stuff
Plugin 'ryanoasis/vim-devicons' " More beauty
Plugin 'altercation/vim-colors-solarized' " Well... solarized
Plugin 'bling/vim-bufferline' " Get filename into Airline :)
Plugin 'Shougo/deoplete.nvim'
Plugin 'zchee/deoplete-go', {'build': 'make'}
Plugin 'airblade/vim-gitgutter' " Show git diff :)
Plugin 'Raimondi/delimitMate' " Auto close thinkgs like brackets
" Plugins I don't use anymore
"Plugin 'airblade/vim-rooter'
"Plugin 'elzr/vim-json' " better json
"Plugin 'L9'
"Plugin 'smerrill/vcl-vim-plugin'
"Plugin 'mhartington/oceanic-next'
" 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
syntax on
"" Theme
colorscheme solarized
set background=dark
" no backup files
set backupcopy=no
set nobackup
set noswapfile
" indentation
set tabstop=4
"set softtabstop=2
set shiftwidth=4
set smarttab
set smartindent
set expandtab
set et
set textwidth=200
set autoindent
" Encoding
set encoding=utf-8
" Highlight search
set hlsearch
set incsearch
" Add line number
set number
" Play with buffers
nnoremap <Leader>b :bp<CR>
nnoremap <Leader>n :bn<CR>
nnoremap <Leader>1 :1b<CR>
nnoremap <Leader>q :bw<CR>
nnoremap <Leader>w :w<CR>
set hidden
" Reactivate backspace
set backspace=2 "
" Mouse scrolling
set mouse=a
set modifiable
"" Plugins configuration
" Deoplete
call deoplete#enable()
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_at_startup = 1
let g:deoplete#ignore_sources = {}
let g:deoplete#ignore_sources._ = ['buffer', 'member', 'tag', 'file', 'neosnippet']
let g:deoplete#sources#go#sort_class = ['func', 'type', 'var', 'const']
let g:deoplete#sources#go#align_class = 1
" Use partial fuzzy matches like YouCompleteMe
call deoplete#custom#set('_', 'matchers', ['matcher_fuzzy'])
call deoplete#custom#set('_', 'converters', ['converter_remove_paren'])
call deoplete#custom#set('_', 'disabled_syntaxes', ['Comment', 'String'])
" Go
let g:deoplete#sources#go#gocode_binary = $GOPATH.'/bin/gocode'
let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const']
set completeopt-=preview
" Syntastic
let g:syntastic_puppet_lint_arguments='--no-class_inherits_from_params_class-check --no-80chars-check'
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
" Ultisnip
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" If you want :UltiSnipsEdit to split your window.
let g:UltiSnipsEditSplit="vertical"
" Powerline - vim-airline
let g:airline_theme='solarized'
let g:airline#extentions#tabline#fnamemod=':t'
let g:airline#extensions#bufferline#enabled=1
let g:airline#extensions#bufferline#overwrite_variables=1
let g:bufferline_echo=0
" NERDTree
nmap <C-n> :NERDTreeToggle<CR>
noremap <Leader>t :NERDTreeToggle<cr>
noremap <Leader>f :NERDTreeFind<cr><Paste>
let g:NERDTreeMinimalUI = 1
let g:NERDTreeWinSize = 30
let NERDTreeShowHidden=1
" CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_max_height = 10
let g:ctrlp_switch_buffer = 'et' " jump to a file if it's open already
let g:ctrlp_mruf_max=450
let g:ctrlp_max_files=0
let g:ctrlp_use_caching = 1
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
let g:ctrlp_buftag_types = {'go' : '--language-force=go --golang-types=ftv'}
" Auto remove trailing spaces
autocmd FileType c,cpp,php,ruby,sh,puppet,python,go,yaml,erb,groovy autocmd BufWritePre <buffer> :%s/\s\+$//e
" Set filetype Groovy for Jenkinsfile
autocmd BufNewFile,BufRead Jenkinsfile setl ft=groovy
" Golang
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:go_list_type = "quickfix"
" Terraform
let g:terraform_fmt_on_save = 1
" Autoclose brackets
let delimitMate_expand_cr = 1
"" Clipboard
" Copy to clipboard
vnoremap <leader>y "+y
nnoremap <leader>Y "+yg_
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>p "+p
vnoremap <leader>P "+P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment