Skip to content

Instantly share code, notes, and snippets.

@elleryq
Created October 15, 2019 15:52
Show Gist options
  • Select an option

  • Save elleryq/fe6ba95972db89871fbe28236e3bfcb4 to your computer and use it in GitHub Desktop.

Select an option

Save elleryq/fe6ba95972db89871fbe28236e3bfcb4 to your computer and use it in GitHub Desktop.

Revisions

  1. elleryq revised this gist Oct 15, 2019. No changes.
  2. elleryq created this gist Oct 15, 2019.
    49 changes: 49 additions & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,49 @@
    " First, you need to install pathogen: https://blog.longwin.com.tw/2014/07/vim-use-pathogen-manage-plugin-2014/
    execute pathogen#infect()

    set nocompatible
    set t_Co=256

    set nu " line number
    set cursorline
    " set cursorcolumn
    set showmatch

    " indent
    set tabstop=4
    set shiftwidth=4
    set autoindent

    set incsearch
    set ignorecase
    syntax enable
    syntax on
    filetype plugin indent on

    " 退出插入模式指定类型的文件自动保存
    au InsertLeave *.go,*.sh,*.php write

    call plug#begin('~/.vim/plugged')
    Plug 'fatih/vim-go'
    Plug 'dgryski/vim-godef'
    Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
    Plug 'fatih/molokai'
    call plug#end()

    " vim-go
    let g:go_highlight_functions = 1
    let g:go_highlight_methods = 1
    let g:go_highlight_structs = 1
    let g:go_highlight_operators = 1
    let g:go_highlight_build_constraints = 1

    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)
    let g:go_fmt_command = "goimports"

    colorscheme molokai

    set directory^=$HOME/.vim/.swap//
    set undodir^=$HOME/.vim/.undo//