Skip to content

Instantly share code, notes, and snippets.

@jion
Created December 16, 2016 15:20
Show Gist options
  • Save jion/6f8ec78d26e00a3a4f4b79c1ca3e9779 to your computer and use it in GitHub Desktop.
Save jion/6f8ec78d26e00a3a4f4b79c1ca3e9779 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved
filetype on
"""""""""""""""""""
" Begin Plug Block (https://github.com/junegunn/vim-plug)
"""""""""""""""""""
function! BuildYCM(info)
" info is a dictionary with 3 fields
" - name: name of the plugin
" - status: 'installed', 'updated', or 'unchanged'
" - force: set on PlugInstall! or PlugUpdate!
if a:info.status == 'installed' || a:info.force
!./install.py --all
endif
endfunction
" Specify a directory for plugins (for Neovim: ~/.local/share/nvim/plugged)
call plug#begin('~/.vim/plugged')
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'airblade/vim-gitgutter'
Plug 'bling/vim-airline'
Plug 'wting/gitsessions.vim'
Plug 'cfsalguero/perl-go-to-def'
Plug 'fatih/vim-go'
Plug 'gmarik/Vundle.vim'
Plug 'kshenoy/vim-signature'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/syntastic'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' }
Plug 'wting/rust.vim'
Plug 'yegappan/mru'
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } | Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
Plug 'pangloss/vim-javascript'
Plug 'crusoexia/vim-javascript-lib'
Plug 'mxw/vim-jsx'
Plug 'crusoexia/vim-monokai'
Plug 'tpope/vim-sleuth'
Plug 'altercation/vim-colors-solarized'
Plug 'Raimondi/delimitMate'
Plug 'paul-nechifor/vim-svn-blame'
" Add plugins to &runtimepath
call plug#end()
"""""""""""""""""""
" End Plug Block
"""""""""""""""""""
syntax on
set completeopt=menu
set showtabline=2
set hidden " Allow to switch between buffers without saving them
:let mapleader = ","
let g:ycm_auto_trigger=1
let g:ycm_key_invoke_completion = '<C-Space>'
let g:ycm_complete_in_strings = 1 "default 1
let g:ycm_min_num_of_chars_for_completion=3
let g:ycm_register_as_syntastic_checker = 1 "default 1
let g:Show_diagnostics_ui = 1 "default 1
let g:ycm_enable_diagnostic_signs = 1
let g:ycm_enable_diagnostic_highlighting = 1
let g:ycm_always_populate_location_list = 1 "default 0
"let g:ycm_open_loclist_on_ycm_diags = 1 "default 1
""let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': ['go'] }
let g:syntastic_scss_scss_lint_args = "-c scss-lint.yml"
let g:SignatureMarkerTextHLDynamic = 1 " vim-signature colored based in gitgutter status
"air-line
"let g:airline_theme = 'dark'
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
"
au FileType go nmap <Leader>s <Plug>(go-implements)
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>gv <Plug>(go-doc-vertical)
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <leader>c <Plug>(go-coverage)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
au FileType go nmap <Leader>e <Plug>(go-rename)
au FileType go nmap <Leader>i <Plug>(go-info)
au BufRead,BufNewFile *.md set filetype=markdown
:let g:session_autosave = 'yes'
" To speed up GitSessions
set ssop-=options " do not store global and local values in a session
set ssop-=folds " do not store folds
let g:go_fmt_fail_silently = 0
let g:go_fmt_autosave = 1
let g:go_highlight_functions = 0
let g:go_highlight_methods = 0
let g:go_highlight_structs = 0
let g:go_fmt_command = "goimports"
set number
" set t_Co=256
set background=dark
set tabstop=2
set shiftwidth=2
set virtualedit=all
set backspace=2
set nocompatible
set nowrap
set cursorline
set syntax=sh
set showmatch
set autoindent
set expandtab
set history=150
set formatoptions=tcql
set nostartofline
set laststatus=2
set hlsearch
set foldmethod=syntax
set foldlevelstart=20
set path+=**
syntax on
colorscheme solarized "hybrid monokai
" set t_Co=256
let g:monokai_term_italic = 1
let g:monokai_gui_italic = 1
hi CursorLine term=none cterm=none ctermbg=Black
hi TabLineFill ctermfg=DarkGrey ctermbg=DarkGrey
hi TabLine term=none cterm=none ctermfg=White ctermbg=DarkGrey
hi TabLineSel term=none cterm=none ctermfg=White ctermbg=Blue
" Overriden by airline
set statusline=%F%m%r%h%w\ \ \ [FORMAT=%{&ff}]\ [TYPE=%Y]\ \ \ \ \ \ \ \ [POS=%4l,%4v]\ \ \ \ \ \ [%p%%]\ [LEN=%L]
"
let NERDTreeQuitOnOpen = 1
" Mappings for Solaris
"set <F3>=OR
"set <F4>=[[D
"set <F5>=[[E
"set <F6>=[17~
"set <F7>=[18~
"set <F8>=[19~
"set <F9>=[20~
"set <F10>=[21~
"set <s-F2>=[24~
"set <s-F4>=O1;2S
"set <Del>=[3~
"set <C-u>=
"set <PageUp>=[5~
"set <PageDown>=[6~
"set <Home>=[1~
"set <End>=[4~
"set <Insert>=[2~
map <C-n> :NERDTreeToggle<CR>
map <C-k> <Esc>:bn<CR>
map <C-j> <Esc>:bp<CR>
map <C-x> <Esc>:bd<CR>
map <C-Right> <Esc>:tabn<CR>
map <C-Left> <Esc>:tabp<CR>
map <C-Down> <Esc><C-w><Down>
map <C-Up> <Esc><C-w><Up>
map <C-h> <Esc>:noh<CR>
" :w!! will write read only files not opened with sudo
cmap w!! w !sudo tee % >/dev/null
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Save current view settings on a per-window, per-buffer basis.
function! AutoSaveWinView()
if !exists("w:SavedBufView")
let w:SavedBufView = {}
endif
let w:SavedBufView[bufnr("%")] = winsaveview()
endfunction
" Restore current view settings.
function! AutoRestoreWinView()
let buf = bufnr("%")
if exists("w:SavedBufView") && has_key(w:SavedBufView, buf)
let v = winsaveview()
let atStartOfFile = v.lnum == 1 && v.col == 0
if atStartOfFile && !&diff
call winrestview(w:SavedBufView[buf])
endif
unlet w:SavedBufView[buf]
endif
endfunction
" When switching buffers, preserve window view.
if v:version >= 700
autocmd BufLeave * call AutoSaveWinView()
autocmd BufEnter * call AutoRestoreWinView()
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment