User:Andrew Nikitin/vimfiles

From J Wiki
Jump to navigation Jump to search

vimfiles/ftplugin/ijs.vim

" Vim filetype plugin file
" Language:	J
" Maintainer:	Andrew Nikitin
" Last Change:	2002-09-25
" 2002-09-25 -- created by nsg
" 2004-04-29 09:10:25 created macros by nsg
" 2004-07-18 22:08:51 joined
" 2005-02-04 16:02:26 f6 (copy string) binding
" 2005-04-01 11:57:45 foldmethod=syntax
" 2005-08-18 16:25:59 fixed includeexpr
"
" echo "IJS plugin start"
if exists("b:did_ftplugin") | finish | endif
let b:did_ftplugin = 1

setlocal include=\\<\\(load\|require\\)\\s*
setlocal includeexpr=substitute(v:fname,'$','.ijs')
"setlocal include=^\\s*require\\s*'\\s*
"setlocal includeexpr=substitute(v:fname,nr2char(39).'.*','','')

" Redefine [[ to jump at the beginning of current procedure
" This will not work with nested procedures (if they are permitted)
map [[ <esc>?=.*[0-4]\s\+:\s*0<cr>0j

map <f5> <esc>:let @*="load '".expand("%:p")."'"<cr>
au! BufWritePost *.ijs let @*="load '".expand("%:p")."'"
map <f6> <esc>:let @*=getline(line("."))<CR>

" Change the browse dialog on Win32 to show mainly Perl-related files
if has("gui_win32") && !exists("b:browsefilter")
    let b:browsefilter = "J script files (*.ijs)\t*.ijs\n" .
		       \ "All Files (*.*)\t*.*\n"
endif
setlocal define=[^A-Za-z_]
setlocal ai
" Set 'formatoptions' to break comment lines but not other lines,
" and insert the comment leader when hitting <CR> or using "o".
setlocal formatoptions-=tn
setlocal formatoptions+=croql
setlocal comments=:NB.
setlocal textwidth=72
setlocal iskeyword=48-57,_,A-Z,a-z
" Examples of keywords:
" abc
" {x.}
" {name}_loc_
" {name}__loc
" /\h\w*[.:]\=\(_\w\+_\|__\w\+\\|)\@=
" used to contain . and :
setlocal foldmethod=syntax
setl path=.,c:/nsg/j,

vimfiles/filetype.vim

" my filetype file
if exists("did_load_filetypes")
  finish
endif
augroup filetypedetect
"... insert this line in filetypedetect group
  au! BufRead,BufNewFile *.ijs		setfiletype ijs
"...
augroup END