Skip to content

Instantly share code, notes, and snippets.

@shanev
Created June 4, 2021 06:09
Show Gist options
  • Save shanev/2b7cc4b75408d896e93f7d41337aada4 to your computer and use it in GitHub Desktop.
Save shanev/2b7cc4b75408d896e93f7d41337aada4 to your computer and use it in GitHub Desktop.
" execute pathogen#infect()
syntax on
filetype plugin indent on
:imap jj <Esc>
" old tab settings...
" show existing tab with 4 spaces width
" set tabstop=4
" when indenting with '>', use 4 spaces width
" set shiftwidth=4
" On pressing tab, insert 4 spaces
" set expandtab
au FileType go set noexpandtab
au FileType go set shiftwidth=4
au FileType go set softtabstop=4
au FileType go set tabstop=4
" write file before :GoBuild
set autowrite
" stop wrapping lines
set nowrap
let g:go_highlight_structs = 1
let g:go_highlight_methods = 1
let g:go_highlight_functions = 1
let g:go_highlight_operators = 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_types = 1
" highlight same vars
let g:go_auto_sameids = 1
" run goimports and gofmt on save
let g:go_fmt_command = "goimports"
" show function signature under cursor
let g:go_auto_type_info = 1
" update above every 100ms instead of 800ms
" "let g:go_updatetime = 100
set wildmode=longest,list,full
silent! nmap <leader>p :NERDTreeToggle<CR>
silent! map <F3> :NERDTreeFind<CR>
" "let g:NERDTreeMapActivateNode="<F3>"
" "let g:NERDTreeMapPreview="<F4>"
packadd! dracula
syntax enable
colorscheme dracula
call plug#begin('~/.vim/plugged')
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
let g:deoplete#enable_at_startup = 1
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'mileszs/ack.vim'
" Initialize plugin system
call plug#end()
call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' })
set backspace=indent,eol,start
nmap <leader>\ gcc
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>ds <Plug>(go-def-split)
au FileType go nmap <Leader>dv <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
" Error and warning signs.
" let g:ale_sign_error = '⤫'
" let g:ale_sign_warning = '⚠'
" Set this. Airline will handle the rest.
" let g:airline#extensions#ale#enabled = 1
" add line numbers
set number
" :GoAlternate
au Filetype go nmap <leader>ga <Plug>(go-alternate-edit)
au Filetype go nmap <leader>gah <Plug>(go-alternate-split)
au Filetype go nmap <leader>gav <Plug>(go-alternate-vertical)
au FileType go nmap <F10> :GoTest<cr>
au FileType go nmap <F9> :GoCoverageToggle<cr>
if &diff
map <leader>1 :diffget LOCAL<CR>
map <leader>2 :diffget BASE<CR>
map <leader>3 :diffget REMOTE<CR>
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment