summaryrefslogtreecommitdiff
path: root/mnv/runtime/ftplugin/go.mnv
diff options
context:
space:
mode:
authorMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-04 12:41:27 +0300
committerMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-04 12:41:27 +0300
commit4f2d36194b4f299aa7509d815c07121039ea833b (patch)
treef3ded014bad3a4c76ff6a22b8726ebaab68c3d13 /mnv/runtime/ftplugin/go.mnv
parent5b578e70c314723a3cde5c9bfc2be0bf1dadc93b (diff)
downloadProject-Tick-4f2d36194b4f299aa7509d815c07121039ea833b.tar.gz
Project-Tick-4f2d36194b4f299aa7509d815c07121039ea833b.zip
NOISSUE change uvim folder name to mnv
Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
Diffstat (limited to 'mnv/runtime/ftplugin/go.mnv')
-rw-r--r--mnv/runtime/ftplugin/go.mnv86
1 files changed, 86 insertions, 0 deletions
diff --git a/mnv/runtime/ftplugin/go.mnv b/mnv/runtime/ftplugin/go.mnv
new file mode 100644
index 0000000000..74505a962d
--- /dev/null
+++ b/mnv/runtime/ftplugin/go.mnv
@@ -0,0 +1,86 @@
+" MNV filetype plugin file
+" Language: Go
+" Maintainer: David Barnett (https://github.com/google/mnv-ft-go is archived)
+" Last Change: 2014 Aug 16
+" 2024 Jul 16 by MNV Project (add recommended indent style)
+" 2025 Mar 07 by MNV Project (add formatprg and keywordprg option #16804)
+" 2025 Mar 18 by MNV Project (use :term for 'keywordprg' #16911)
+" 2025 Apr 16 by MNV Project (set 'cpoptions' for line continuation, #17121)
+" 2025 Jul 02 by MNV Project (add section movement mappings #17641)
+" 2025 Jul 05 by MNV Project (update b:undo_ftplugin #17664)
+" 2026 Feb 13 by MNV Project (remove formatprg #19108)
+
+if exists('b:did_ftplugin')
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&mnv
+
+setlocal formatoptions-=t
+
+setlocal comments=s1:/*,mb:*,ex:*/,://
+setlocal commentstring=//\ %s
+setlocal keywordprg=:GoKeywordPrg
+
+command! -buffer -nargs=* GoKeywordPrg call s:GoKeywordPrg()
+
+let b:undo_ftplugin = 'setl fo< com< cms< kp<'
+ \ . '| delcommand -buffer GoKeywordPrg'
+
+if get(g:, 'go_recommended_style', 1)
+ setlocal noexpandtab softtabstop=0 shiftwidth=0
+ let b:undo_ftplugin .= ' | setl et< sts< sw<'
+endif
+
+if !exists('*' . expand('<SID>') . 'GoKeywordPrg')
+ func! s:GoKeywordPrg()
+ let temp_isk = &l:iskeyword
+ setl iskeyword+=.
+ try
+ let cmd = 'go doc -C ' . shellescape(expand('%:h')) . ' ' . shellescape(expand('<cword>'))
+ if has('gui_running') || has('nmnv')
+ exe 'hor term' cmd
+ else
+ exe '!' . cmd
+ endif
+ finally
+ let &l:iskeyword = temp_isk
+ endtry
+ endfunc
+endif
+
+if !exists("no_plugin_maps") && !exists("no_go_maps")
+ noremap <silent> <buffer> ]] <Cmd>call <SID>GoFindSection('next_start', v:count1)<CR>
+ noremap <silent> <buffer> ][ <Cmd>call <SID>GoFindSection('next_end', v:count1)<CR>
+ noremap <silent> <buffer> [[ <Cmd>call <SID>GoFindSection('prev_start', v:count1)<CR>
+ noremap <silent> <buffer> [] <Cmd>call <SID>GoFindSection('prev_end', v:count1)<CR>
+ let b:undo_ftplugin .= ''
+ \ . "| silent! exe 'unmap <buffer> ]]'"
+ \ . "| silent! exe 'unmap <buffer> ]['"
+ \ . "| silent! exe 'unmap <buffer> [['"
+ \ . "| silent! exe 'unmap <buffer> []'"
+endif
+
+function! <SID>GoFindSection(dir, count)
+ mark '
+ let c = a:count
+ while c > 0
+ if a:dir == 'next_start'
+ keepjumps call search('^\(type\|func\)\>', 'W')
+ elseif a:dir == 'next_end'
+ keepjumps call search('^}', 'W')
+ elseif a:dir == 'prev_start'
+ keepjumps call search('^\(type\|func\)\>', 'bW')
+ elseif a:dir == 'prev_end'
+ keepjumps call search('^}', 'bW')
+ endif
+ let c -= 1
+ endwhile
+endfunction
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" mnv: sw=2 sts=2 et