From 1cc4706e94489498b12c4844c1b3a2e9aa5cc921 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 20 Aug 2022 10:04:55 +0200 Subject: vim-patch:e80086446cc2 (#19848) * vim-patch:e80086446cc2 Update runtime files https://github.com/vim/vim/commit/e80086446cc20856ed8359bc8dc87c4d430da4c8 Co-authored-by: Sean Dewar --- runtime/ftplugin/j.vim | 66 ++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 32 deletions(-) (limited to 'runtime/ftplugin') diff --git a/runtime/ftplugin/j.vim b/runtime/ftplugin/j.vim index 3cd0cb8e2b..ae235abba8 100644 --- a/runtime/ftplugin/j.vim +++ b/runtime/ftplugin/j.vim @@ -2,7 +2,7 @@ " Language: J " Maintainer: David Bürgin " URL: https://gitlab.com/glts/vim-j -" Last Change: 2015-10-27 +" Last Change: 2022-08-06 if exists('b:did_ftplugin') finish @@ -29,41 +29,43 @@ let b:undo_ftplugin = 'setlocal suffixesadd< includeexpr< include< path< matchpa " Section movement with ]] ][ [[ []. The start/end patterns below are amended " inside the function in order to avoid matching on the current cursor line. -let s:sectionstart = '\%(\s*Note\|.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\)\>.*' -let s:sectionend = '\s*)\s*' +if !exists('no_plugin_maps') && !exists('no_j_maps') + let s:sectionstart = '\%(\s*Note\|.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\)\>.*' + let s:sectionend = '\s*)\s*' -function! s:SearchSection(end, backwards, visualmode) abort - if a:visualmode !=# '' - normal! gv - endif - let l:flags = a:backwards ? 'bsW' : 'sW' - if a:end - call search('^' . s:sectionend . (a:backwards ? '\n\_.\{-}\%#' : '$'), l:flags) - else - call search('^' . s:sectionstart . (a:backwards ? '\n\_.\{-}\%#' : '$'), l:flags) - endif -endfunction + function! s:SearchSection(end, backwards, visualmode) abort + if a:visualmode !=# '' + normal! gv + endif + let l:flags = a:backwards ? 'bsW' : 'sW' + if a:end + call search('^' . s:sectionend . (a:backwards ? '\n\_.\{-}\%#' : '$'), l:flags) + else + call search('^' . s:sectionstart . (a:backwards ? '\n\_.\{-}\%#' : '$'), l:flags) + endif + endfunction -noremap ]] :call SearchSection(0, 0, '') -xnoremap ]] :call SearchSection(0, 0, visualmode()) -sunmap ]] -noremap ][ :call SearchSection(1, 0, '') -xnoremap ][ :call SearchSection(1, 0, visualmode()) -sunmap ][ -noremap [[ :call SearchSection(0, 1, '') -xnoremap [[ :call SearchSection(0, 1, visualmode()) -sunmap [[ -noremap [] :call SearchSection(1, 1, '') -xnoremap [] :call SearchSection(1, 1, visualmode()) -sunmap [] + noremap ]] :call SearchSection(0, 0, '') + xnoremap ]] :call SearchSection(0, 0, visualmode()) + sunmap ]] + noremap ][ :call SearchSection(1, 0, '') + xnoremap ][ :call SearchSection(1, 0, visualmode()) + sunmap ][ + noremap [[ :call SearchSection(0, 1, '') + xnoremap [[ :call SearchSection(0, 1, visualmode()) + sunmap [[ + noremap [] :call SearchSection(1, 1, '') + xnoremap [] :call SearchSection(1, 1, visualmode()) + sunmap [] -let b:undo_ftplugin .= ' | silent! execute "unmap ]]"' - \ . ' | silent! execute "unmap ]["' - \ . ' | silent! execute "unmap [["' - \ . ' | silent! execute "unmap []"' + let b:undo_ftplugin .= ' | silent! execute "unmap ]]"' + \ . ' | silent! execute "unmap ]["' + \ . ' | silent! execute "unmap [["' + \ . ' | silent! execute "unmap []"' +endif -" Browse dialog filter on Windows (see ":help browsefilter") -if has('gui_win32') && !exists('b:browsefilter') +" Browse dialog filter on Windows and GTK (see ":help browsefilter") +if (has('gui_win32') || has('gui_gtk')) && !exists('b:browsefilter') let b:browsefilter = "J Script Files (*.ijs)\t*.ijs\n" \ . "All Files (*.*)\t*.*\n" let b:undo_ftplugin .= ' | unlet! b:browsefilter' -- cgit