123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- if exists("b:did_ftplugin")
- finish
- endif
- let b:did_ftplugin = 1
- let b:undo_ftplugin = "setl fo< com< cms<"
- setlocal formatoptions-=t
- setlocal comments=s1:/*,mb:*,ex:*/,://
- setlocal commentstring=//\ %s
- setlocal noexpandtab
- compiler go
- setlocal omnifunc=go#complete#Complete
- if get(g:, "go_doc_keywordprg_enabled", 1)
-
- nnoremap <buffer> <silent> K :GoDoc<cr>
- endif
- if get(g:, "go_def_mapping_enabled", 1)
-
-
- nnoremap <buffer> <silent> gd :GoDef<cr>
- nnoremap <buffer> <silent> <C-]> :GoDef<cr>
- nnoremap <buffer> <silent> <C-LeftMouse> <LeftMouse>:GoDef<cr>
- nnoremap <buffer> <silent> g<LeftMouse> <LeftMouse>:GoDef<cr>
- nnoremap <buffer> <silent> <C-w><C-]> :<C-u>call go#def#Jump("split")<CR>
- nnoremap <buffer> <silent> <C-w>] :<C-u>call go#def#Jump("split")<CR>
- nnoremap <buffer> <silent> <C-t> :<C-U>call go#def#StackPop(v:count1)<cr>
- endif
- if get(g:, "go_textobj_enabled", 1)
- onoremap <buffer> <silent> af :<c-u>call go#textobj#Function('a')<cr>
- onoremap <buffer> <silent> if :<c-u>call go#textobj#Function('i')<cr>
- xnoremap <buffer> <silent> af :<c-u>call go#textobj#Function('a')<cr>
- xnoremap <buffer> <silent> if :<c-u>call go#textobj#Function('i')<cr>
-
- nnoremap <buffer> <silent> ]] :<c-u>call go#textobj#FunctionJump('n', 'next')<cr>
- nnoremap <buffer> <silent> [[ :<c-u>call go#textobj#FunctionJump('n', 'prev')<cr>
- onoremap <buffer> <silent> ]] :<c-u>call go#textobj#FunctionJump('o', 'next')<cr>
- onoremap <buffer> <silent> [[ :<c-u>call go#textobj#FunctionJump('o', 'prev')<cr>
- xnoremap <buffer> <silent> ]] :<c-u>call go#textobj#FunctionJump('v', 'next')<cr>
- xnoremap <buffer> <silent> [[ :<c-u>call go#textobj#FunctionJump('v', 'prev')<cr>
- endif
- if get(g:, "go_auto_type_info", 0) || get(g:, "go_auto_sameids", 0)
- let &l:updatetime= get(g:, "go_updatetime", 800)
- endif
- " if get(g:, "go_sameid_search_enabled
- " " mode 0: next 1: prev
- " " reverse list to make it easy to find the prev occurrence
- " if !has_key(m, "group
- " if m.group != "goSameId
- " " reached start/end, jump to the end/start
- " if !has_key(initial_match, "group
- " if initial_match.group != "goSameId
- " return "nohlsearch
|