Mercurial > vim
annotate runtime/ftplugin/j.vim @ 6545:1ef8ce97fc40 v7.4.599
updated for version 7.4.599
Problem: Out-of-memory error.
Solution: Avoid trying to allocate a negative amount of memory, use size_t
instead of int. (Dominique Pelle)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Tue, 27 Jan 2015 14:40:00 +0100 |
parents | 198e1e498edf |
children | fbc1131f0ba5 |
rev | line source |
---|---|
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
1 " Vim filetype plugin |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
2 " Language: J |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
3 " Maintainer: David Bürgin <676c7473@gmail.com> |
5734 | 4 " URL: https://github.com/glts/vim-j |
6505 | 5 " Last Change: 2015-01-11 |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
6 |
5734 | 7 if exists('b:did_ftplugin') |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
8 finish |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
9 endif |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
10 let b:did_ftplugin = 1 |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
11 |
5815 | 12 let s:save_cpo = &cpo |
13 set cpo&vim | |
14 | |
15 setlocal iskeyword=48-57,A-Z,_,a-z | |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
16 setlocal comments=:NB. |
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
17 setlocal commentstring=NB.\ %s |
5425 | 18 setlocal formatoptions-=t |
6505 | 19 setlocal shiftwidth=2 |
20 setlocal softtabstop=2 | |
21 setlocal expandtab | |
5425 | 22 setlocal matchpairs=(:) |
5362
ab1508486b12
Update runtime files. Add support for J.
Bram Moolenaar <bram@vim.org>
parents:
diff
changeset
|
23 |
5734 | 24 let b:undo_ftplugin = 'setlocal matchpairs< expandtab< softtabstop< shiftwidth< formatoptions< commentstring< comments< iskeyword<' |
5815 | 25 |
26 " Section movement with ]] ][ [[ []. The start/end patterns below are amended | |
27 " inside the function in order to avoid matching on the current cursor line. | |
6505 | 28 let s:sectionstart = '\%(\s*Note\|.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\)\>.*' |
5815 | 29 let s:sectionend = '\s*)\s*' |
30 | |
31 function! s:SearchSection(end, backwards, visualmode) abort | |
32 if a:visualmode !=# '' | |
33 normal! gv | |
34 endif | |
6505 | 35 let l:flags = a:backwards ? 'bsW' : 'sW' |
5815 | 36 if a:end |
6505 | 37 call search('^' . s:sectionend . (a:backwards ? '\n\_.\{-}\%#' : '$'), l:flags) |
5815 | 38 else |
6505 | 39 call search('^' . s:sectionstart . (a:backwards ? '\n\_.\{-}\%#' : '$'), l:flags) |
5815 | 40 endif |
41 endfunction | |
42 | |
6505 | 43 noremap <buffer> <silent> ]] :<C-U>call <SID>SearchSection(0, 0, '')<CR> |
44 xnoremap <buffer> <silent> ]] :<C-U>call <SID>SearchSection(0, 0, visualmode())<CR> | |
5815 | 45 sunmap <buffer> ]] |
6505 | 46 noremap <buffer> <silent> ][ :<C-U>call <SID>SearchSection(1, 0, '')<CR> |
47 xnoremap <buffer> <silent> ][ :<C-U>call <SID>SearchSection(1, 0, visualmode())<CR> | |
5815 | 48 sunmap <buffer> ][ |
6505 | 49 noremap <buffer> <silent> [[ :<C-U>call <SID>SearchSection(0, 1, '')<CR> |
50 xnoremap <buffer> <silent> [[ :<C-U>call <SID>SearchSection(0, 1, visualmode())<CR> | |
5815 | 51 sunmap <buffer> [[ |
6505 | 52 noremap <buffer> <silent> [] :<C-U>call <SID>SearchSection(1, 1, '')<CR> |
53 xnoremap <buffer> <silent> [] :<C-U>call <SID>SearchSection(1, 1, visualmode())<CR> | |
5815 | 54 sunmap <buffer> [] |
55 | |
56 let b:undo_ftplugin .= ' | silent! execute "unmap <buffer> ]]"' | |
57 \ . ' | silent! execute "unmap <buffer> ]["' | |
58 \ . ' | silent! execute "unmap <buffer> [["' | |
59 \ . ' | silent! execute "unmap <buffer> []"' | |
60 | |
61 " Browse dialog filter on Windows (see ":help browsefilter") | |
62 if has('gui_win32') && !exists('b:browsefilter') | |
63 let b:browsefilter = "J Script Files (*.ijs)\t*.ijs\n" | |
64 \ . "All Files (*.*)\t*.*\n" | |
65 let b:undo_ftplugin .= ' | unlet! b:browsefilter' | |
66 endif | |
67 | |
68 " Enhanced "%" matching (see ":help matchit") | |
69 if exists('loaded_matchit') && !exists('b:match_words') | |
70 let b:match_ignorecase = 0 | |
6505 | 71 let b:match_words = '^\%(\s*Note\|.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(\:\s*0\|def\s\+0\|define\)\)\>:^\s*\:\s*$:^\s*)\s*$' |
5815 | 72 \ . ',\<\%(for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.:\<\%(case\|catch[dt]\=\|else\%(if\)\=\|fcase\)\.:\<end\.' |
73 let b:undo_ftplugin .= ' | unlet! b:match_ignorecase b:match_words' | |
74 endif | |
75 | |
76 let &cpo = s:save_cpo | |
77 unlet s:save_cpo |