]> Sergey Matveev's repositories - dotfiles.git/blobdiff - vim/.vim/ftplugin/go/motion.vim
Move to vim9script
[dotfiles.git] / vim / .vim / ftplugin / go / motion.vim
index 041347c73d8fbe3a9a9546d360934e5f062c71bc..410ce9a4b1b31bb1e35dd752dfa48d7881ae6251 100644 (file)
@@ -1,18 +1,6 @@
-nnoremap <silent> <buffer> ]] :call <SID>Go_jump('/^\(func\\|type\)')<cr>
-nnoremap <silent> <buffer> [[ :call <SID>Go_jump('?^\(func\\|type\)')<cr>
-nnoremap <silent> <buffer> ]m :call <SID>Go_jump('/^\s*\(func\\|type\)')<cr>
-nnoremap <silent> <buffer> [m :call <SID>Go_jump('?^\s*\(func\\|type\)')<cr>
-
-if exists('*<SID>Go_jump') | finish | endif
-
-fun! <SID>Go_jump(motion) range
-    let cnt = v:count1
-    let save = @/    " save last search pattern
-    mark '
-    while cnt > 0
-        silent! exe a:motion
-        let cnt = cnt - 1
-    endwhile
-    call histdel('/', -1)
-    let @/ = save    " restore last search pattern
-endfun
+vim9script
+if exists("*go#jump#Do") | finish | endif
+nnoremap <silent> <buffer> ]] :call go#jump#Do(':/^\(func\\|type\)')<CR>
+nnoremap <silent> <buffer> [[ :call go#jump#Do(':?^\(func\\|type\)')<CR>
+nnoremap <silent> <buffer> ]m :call go#jump#Do(':/^\s*\(func\\|type\)')<CR>
+nnoremap <silent> <buffer> [m :call go#jump#Do(':?^\s*\(func\\|type\)')<CR>