From 879a4e6cbe97721bbc6cd18b324524159b4807ef Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 9 May 2013 22:21:33 -0400 Subject: v5 dev branch opened (starts as copy of v4 stable branch); v3 branch closed * 5.0.0 dev opened * 4.1.0 stable * 3.* branch gone --- .../conf/editor-syntax-etc/vim/ftplugin/sisu.vim | 185 +++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim (limited to 'data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim') diff --git a/data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim new file mode 100644 index 00000000..a72251da --- /dev/null +++ b/data/sisu/conf/editor-syntax-etc/vim/ftplugin/sisu.vim @@ -0,0 +1,185 @@ +"%% SiSU Vim ftplugin +" SiSU Maintainer: Ralph Amissah +" SiSU Markup: SiSU (sisu-3.3) 2012-08-18 +" an ftplugin setting defaults for editing sisu markup files +:syntax on +:filetype on +:filetype indent on +:autocmd FileType sisu :set nonumber +:set encoding=utf-8 fileencodings= +:set ff=unix +:set autowrite " Automatically save before commands like :next and :make +:set nocompatible +:set tabstop=2 +:set expandtab +:set shiftwidth=2 +:set autoindent +:set showcmd " Show (partial) command in status line. +:set showmatch " Show matching brackets. +:set ignorecase " Do case insensitive matching +:set smartcase +:set incsearch +:set hlsearch +:set gdefault +:set guioptions=agr " add 'm' for menu +:map :if &guioptions =~# 'm' + \set guioptions-=m + \set guioptions-=T + \else + \set guioptions+=m + \set guioptions-=T + \endif +:set paste +:set statusline=%f%m%r%h%w\ [type=%Y]\ [format=%{&ff}]\ [%v:%l/%L\ %p%%] +:set laststatus=2 " status line always on +"% textwrap +:set whichwrap=<,>,h,l,[,] +:set nolinebreak " only affects display not buffer +:set wrap +:set wrapmargin=0 +"% map +":let mapleader = "," " consider +:map paste :set invpaste +"% wrap/formatting paragraph according to the current 'textwidth' with ^J (control-j): +:imap gqap +:nmap gqap +:vmap gq +"% save file, go to next file in buffer +:map nf :w :n +"% vimdiff q exits +:if &diff +: cmap q qa +:endif +"% directory files, placed in vertical split window +:map ls :vs :Explore +:map dir :vs :Explore +:if &diff +: cmap q qa +:endif +"% remapping lines make cursor jump a line at a time within wrapped text +:nnoremap j gj +:nnoremap k gk +:vnoremap j gj +:vnoremap k gk +:nnoremap gj +:nnoremap gk +:vnoremap gj +:vnoremap gk +:inoremap gj +:inoremap gk +"% search and replace +:map rd :.,$s///c "search and replace down +:map rg :%s///c "search and replace whole file +:map rr :rubyd gsub!(//,"") +"% pwd t64 working directory set to that of the file you're editing +"changes pwd to directory of file in current buffer +:function! CHANGE_CURR_DIR() +: let _dir = expand("%:p:h") +: exec "cd " . _dir +: unlet _dir +:endfunction +"% Change to the directory the file in your current buffer is in +:if has("autocmd") + autocmd BufEnter * :lcd %:p:h +:endif +"% autocompletefilenames To search for files in the current directory +:set path=,, +"auto-completion for file to edit in current dir, used in normal mode +:map e :e =expand("%:p:h") . "/" +:map pwd :exe 'cd ' . expand ("%:p:h") +"% searchhighlight t93: Toggle search highlight +:function! ToggleHLSearched() +: if &hls +: set nohls +: else +: set hls +: endif +:endfun +:nmap :silent call ToggleHLSearched() +"%% SiSU vim folds +"% foldsearchx FoldSearch (opens result of search all else closed) t77 +:map fs :set foldmethod=expr foldcolumn=2 foldlevel=0 +:map ff :F +:map fe :F zE +"% foldtoggle Fold Toggle mapped to +:fun! ToggleFold() +: if foldlevel('.') == 0 +: normal! l +: else +: if foldclosed('.') < 0 +: foldclose +: else +: foldopen +: endif +: endif +" Clear status line +: echo +:endfun +" Map this function to Space key. +:noremap :call ToggleFold() +"% foldtype Fold? set foldtext +:set foldtext=v:folddashes.substitute(getline(v:foldstart),'\\=','','g',) +:set foldexpr=getline(v:lnum-1)!~@/&&getline(v:lnum)!~@/&&getline(v:lnum+1)!~@/ +"% foldsearch t77: Fold on search result +:function! FoldMake(search) +: set fdm=manual +: normal zE +: normal G$ +: let folded = 0 "flag to set when a fold is found +: let flags = "w" "allow wrapping in the search +: let line1 = 0 "set marker for beginning of fold +: while search(a:search, flags) > 0 +: let line2 = line(".") +: if (line2 -1 > line1) +: "echo line1 . ":" . (line2-1) +: "echo "a fold goes here." +: execute ":" . line1 . "," . (line2-1) . "fold" +: let folded = 1 "at least one fold has been found +: endif +: let line1 = line2 "update marker +: let flags = "W" "turn off wrapping +: endwhile +" create the last fold which goes to the end of the file. +: normal $G +: let line2 = line(".") +: if (line2 > line1 && folded == 1) +: execute ":". line1 . "," . line2 . "fold" +: endif +: normal 1G +:endfunction +"% folds Fold Patterns +:command! -nargs=+ -complete=command FMake call FoldMake() +: if ( &filetype == "ruby" ) +: command! F FMake ^# ==\?\|^\s*\(\(def\|class\|module\)\s\|\(public\|protected\|private\|__END__\)\s*$\)\|\(^\s*\|\s\+\)#%\s +: command! Fa FMake \(^# ==\?\|^\s*\(\(\(def\|class\|module\)\s\)\|\(\(public\|protected\|private\|__END__\)\(\s*$\)\)\)\)\|^[0-9]\~\|\([#%]\|^["]\)\{1,4\}\s*%\|{\({\|!!\) +: command! FD FMake \(^# ==\?\|^\s*\(\(def\|class\|module\)\s\)\)\|^\s*\([#%"0-9]\{0,4\}\~\(%\+\s\|!!\)\|#\s\+=\+\s\+\) +: else +"% folds :F Fold Patterns SiSU Markup :F +: command! F FMake ^\([1-8]\|:\?[A-C]\)\~\|\(^%\|\(^\|\s\+\)[#"]\)%\{1,2\}\(\s\|$\)\|^<<\s*| +: command! Fa FMake ^\([1-8]\|:\?[A-C]\)\~\|\(^%\|\(^\|\s\+\)[#"]\)%\{1,2\}\(\s\|$\)\|^<<\s*|\|^\(Book\|Part\|Chapter\|Section\|Article\|BOOK\|PART\|CHAPTER\|SECTION\|ARTICLE\)\s +: command! F0 FMake ^\(\s*0\~\|@\S\+:[+-]\?\s\+\) +: command! FA FMake ^:\?A\~ +: command! FB FMake ^:\?[AB]\~ +: command! FC FMake ^:\?[A-C]\~ +: command! F1 FMake ^\(:\?[A-C]\|1\)\~ +: command! F2 FMake ^\(:\?[A-C]\|[12]\)\~ +: command! F3 FMake ^\(:\?[A-C]\|[1-3]\)\~ +: command! F4 FMake ^[1-4]\~ +: command! F5 FMake ^[4-5]\~ +: command! F6 FMake ^[4-6]\~ +: command! Fc FMake ^[%]\+\s\+ +: endif +"% folds Fold Patterns misc +":command! Fp FMake ^\s*[A-Za-z0-9#] +:command! Fp FMake ^\s*\S +:command! Fo FMake ^[%\"]\s*[{>] +"% linenumbering, on, relative, off +:map nn :set ={'00':'','01':'r','10':'nor'}[&rnu.&nu]nu +"% cursorline +:map cu :if &cursorcolumn + \set nocursorline nocursorcolumn + \else + \set cursorline cursorcolumn + \endif +:map cu- :set nocursorline nocursorcolumn +:map cu+ :set cursorline cursorcolumn -- cgit v1.2.3