Skip to content

Instantly share code, notes, and snippets.

@4ydx
Last active September 7, 2019 05:09
Show Gist options
  • Select an option

  • Save 4ydx/1bd64c1610e710fef59f to your computer and use it in GitHub Desktop.

Select an option

Save 4ydx/1bd64c1610e710fef59f to your computer and use it in GitHub Desktop.
Vim Setup
- mac:
brew install lua
brew install vim --with-lua
- plugin manager: https://github.com/junegunn/vim-plug
- double check that vim has +lua support: vim --version
- if not, compile:
sudo apt-get install lua5.2 liblua5.2-dev
./configure --with-features=huge --enable-cscope --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu --enable-multibyte --enable-fontset --disable-netbeans --enable-luainterp=yes --enable-largefile --enable-rubyinterp --enable-fail-if-missing --prefix=/opt
- .vimrc:
"""""""""""""""""""""""""""""""""""""""
" gocode debugging: gocode -s -debug
" note that go install *.a lib is required for gocode to autocomplete
"
set nocompatible " be iMproved, required
filetype off " required
call plug#begin('~/.local/share/nvim/plugged')
" Already installed by vim-go.
" Plug 'mdempsky/gocode', { 'rtp': 'nvim', 'do': '~/.config/nvim/plugged/gocode/nvim/symlink.sh' }
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries', 'tag': 'v1.19' }
Plug 'airblade/vim-gitgutter'
Plug 'flazz/vim-colorschemes'
Plug 'Shougo/deoplete.nvim'
Plug 'zchee/deoplete-go', { 'do': 'make'}
Plug 'majutsushi/tagbar'
Plug 'mileszs/ack.vim'
Plug 'vim-airline/vim-airline'
Plug 'scrooloose/nerdtree'
" seems more annoying than anything...
" Plug 'rjohnsondev/vim-compiler-go'
" not using
"Plug 'jodosha/vim-godebug'
"Plug 'pangloss/vim-javascript'
"Plug 'nathanaelkane/vim-indent-guides'
" rust
" Plug 'rust-lang/rust.vim'
" Plug 'vim-syntastic/syntastic'
call plug#end()
filetype plugin indent on " required
"""""""""""""""""""""""""""""""""""""""
set softtabstop=2
set shiftwidth=2
set tabstop=2
set rnu
set backspace=2
set nowrap
syntax on
if executable('ag')
let g:ackprg = 'ag --vimgrep --ignore "tags"'
endif
" had to manually install python 3.6.4 to get this to work
" https://www.rosehosting.com/blog/how-to-install-python-3-6-4-on-debian-9/
" https://www.python.org/downloads/release/python-364/
" md5 Gzipped source tarball Source release 9de6494314ea199e3633211696735f65 22710891
"
" pip install --upgrade neovim (python2)
" pip3 install --upgrade neovim (python3)
"
let g:python3_host_prog = '/usr/local/bin/python3.6'
let g:deoplete#enable_at_startup = 1
let g:deoplete#sources#go#gocode_binary = '~/go/bin/gocode'
let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const']
" let g:deoplete#sources#go#use_cache = 1
" let g:deoplete#sources#go#json_directory = '~/.cache/deoplete/go/$GOOS_$GOARCH'
let NERDTreeQuitOnOpen=1
nmap <F6> :NERDTreeToggle<CR>
nmap <F8> :TagbarToggle<CR>
" nmap <F9> :call RenewTagsFile()<CR>
"
" function! RenewTagsFile()
" call system('ctags -R --exclude=.git --languages=-javascript 2>/dev/null')
" endfunction
" rust
" let g:rustfmt_autosave = 1
" set completeopt-=preview
" colorscheme 256_noir
colorscheme Atelier_CaveDark
" autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
" autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" try to prevent autofolding -- on save
" autocmd InsertLeave,WinEnter * setlocal foldmethod=syntax
" autocmd InsertEnter,WinLeave * setlocal foldmethod=manual
set splitbelow
set splitright
" highlight ColorColumn ctermbg=235 guibg=#2c2d27
" let &colorcolumn=join(range(81,999),",")
" let &colorcolumn="80,".join(range(400,999),",")
" highlight CursorLine cterm=none ctermbg=235 ctermfg=white
" set cursorline
highlight CursorColumn ctermbg=235 guibg=#2c2d27
" highlight CursorColumn ctermbg=235 guibg=#ffffff
" set cursorcolumn
" let g:gitgutter_highlight_lines = 1
let g:go_auto_type_info = 1
" prevent folds from closing when GoFmt is called
let g:go_fmt_experimental = 1
" tagbar to left
let g:tagbar_left = 1
" let g:go_highlight_build_constraints = 1
" let g:go_highlight_extra_types = 1
" let g:go_highlight_fields = 1
" let g:go_highlight_functions = 1
" let g:go_highlight_methods = 1
" let g:go_highlight_operators = 1
" let g:go_highlight_structs = 1
" let g:go_highlight_types = 1
" Will highlight the same variable name. A bit annoying.
" let g:go_auto_sameids = 1
" esc in insert mode
inoremap kj <esc>
" esc in command mode
cnoremap kj <C-C>
" let g:go_info_mode = 'guru'
"
" let g:golang_goroot = "/usr/local/go/"
" let loaded_matchparen = 1
hi MatchParen cterm=none ctermbg=green ctermfg=blue
command Build !./build.sh
setlocal foldmethod=indent
" autocmd Syntax c,go,cpp,vim,xml,html,xhtml setlocal foldmethod=indent
autocmd Syntax c,go setlocal foldmethod=indent
" auto-open tagbar on known files
autocmd VimEnter * nested :call tagbar#autoopen(1)
au FileType json setlocal equalprg=python\ -m\ json.tool
"""""""""""""""""""""""""""""""""""""""
- finally vim, :PluginInstall, :GoInstallBinaries
- edit $PATH or use a soft link etc etc to make vim available (if you installed to /opt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment