vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

lprolog.vim (1934B)


      1 " Vim settings file
      2 " Language:     LambdaProlog (Teyjus)
      3 " Maintainer:   Markus Mottl  <markus.mottl@gmail.com>
      4 " URL:          http://www.ocaml.info/vim/ftplugin/lprolog.vim
      5 " Last Change:  2025 Jun 08 - set 'comments', 'commentstring'
      6 "               2025 Apr 16 - set 'cpoptions' for line continuation
      7 "               2023 Aug 28 - added undo_ftplugin (Vim Project)
      8 "               2006 Feb 05
      9 "               2001 Sep 16 - fixed 'no_mail_maps'-bug (MM)
     10 "               2001 Sep 02 - initial release  (MM)
     11 
     12 " Only do these settings when not done yet for this buffer
     13 if exists("b:did_ftplugin")
     14   finish
     15 endif
     16 
     17 let s:cpo_save = &cpo
     18 set cpo&vim
     19 
     20 " Don't do other file type settings for this buffer
     21 let b:did_ftplugin = 1
     22 
     23 " Error format
     24 setlocal efm=%+A./%f:%l.%c:\ %m
     25 
     26 " Formatting of comments
     27 setlocal formatprg=fmt\ -w75\ -p\\%
     28 
     29 setlocal comments=s1:/*,mb:*,ex:*/,:% commentstring=%\ %s
     30 
     31 let b:undo_ftplugin = "setlocal efm< fp< com< cms<"
     32 
     33 " Add mappings, unless the user didn't want this.
     34 if !exists("no_plugin_maps") && !exists("no_lprolog_maps")
     35   " Uncommenting
     36   if !hasmapto('<Plug>Comment')
     37     nmap <buffer> <LocalLeader>c <Plug>LUncomOn
     38     vmap <buffer> <LocalLeader>c <Plug>BUncomOn
     39     nmap <buffer> <LocalLeader>C <Plug>LUncomOff
     40     vmap <buffer> <LocalLeader>C <Plug>BUncomOff
     41     let b:undo_ftplugin ..=
     42           \ " | silent! execute 'nunmap <buffer> <LocalLeader>c'" ..
     43           \ " | silent! execute 'vunmap <buffer> <LocalLeader>c'" ..
     44           \ " | silent! execute 'nunmap <buffer> <LocalLeader>C'" ..
     45           \ " | silent! execute 'vunmap <buffer> <LocalLeader>C'"
     46   endif
     47 
     48   nnoremap <buffer> <Plug>LUncomOn mz0i/* <ESC>$A */<ESC>`z
     49   nnoremap <buffer> <Plug>LUncomOff <ESC>:s/^\/\* \(.*\) \*\//\1/<CR>
     50   vnoremap <buffer> <Plug>BUncomOn <ESC>:'<,'><CR>`<O<ESC>0i/*<ESC>`>o<ESC>0i*/<ESC>`<
     51   vnoremap <buffer> <Plug>BUncomOff <ESC>:'<,'><CR>`<dd`>dd`<
     52 endif
     53 
     54 let &cpo = s:cpo_save
     55 unlet s:cpo_save