On Mon, 22 Feb 2016, David Nebauer wrote:

Newbie question: are there any vim snippets available for context?

I use the attached (tuned to my writing style and this depends on latex suite for IMAP functions). This file is placed in $VIM/after/ftplugin

Aditya
if !exists('loaded_snippet') || &cp
    finish
endif

let st = g:snip_start_tag
let et = g:snip_end_tag
let cd = g:snip_elem_delim
let bt = st.et
let si = IMAP_GetPlaceHolderStart()
let ei = IMAP_GetPlaceHolderEnd()

exec "Snippet for \\startformula<CR>".st.et."<CR>\\stopformula".si.ei
exec "Snippet pfor \\placeformula[".st."tag".et."] 
\\startformula<CR>".st.et."<CR>\\stopformula".si.ei

exec "Snippet fora \\startformula \\startalign<CR>".st.et."<CR>\\stopalign 
\\stopformula".si.ei
exec "Snippet pfora \\placeformula[".st."tag".et."] \\startformula 
\\startalign<CR>".st.et."<CR>\\stopalign \\stopformula".si.ei

" Stepping
exec "Snippet Step \\StartStep ".st. "step".et."<CR>\\StopStep".si.ei

" Slides
exec "Snippet head \\starthead 
{".st."head".et."}<CR>\\startindented<CR>".st.et."<CR>\\stopindented<CR>\\stophead"

" Solution
exec "Snippet soln \\startsolution<CR>".st. et."<CR>\\stopsolution"


" For specific project
exec "Snippet FL \\FIELD ".bt
exec "Snippet AL \\ALPHABET ".bt
exec "Snippet FS \\FSPACE ".bt
exec "Snippet WN \\WINDOW ".bt

" exec "Snippet sub 
\\subsection{".st."name".et."}\\label{sub:".st."name:substitute(@z,'.','\\l&','g')".et."}<CR>".st.et
" exec "Snippet $$ \\[<CR>".st.et."<CR>\\]<CR>".st.et
" exec "Snippet ssub 
\\subsubsection{".st."name".et."}\\label{ssub:".st."name:substitute(@z,'.','\\l&','g')".et."}<CR>".st.et
" exec "Snippet itd \\item[".st."desc".et."] ".st.et
" exec "Snippet sec 
\\section{".st."name".et."}\\label{sec:".st."name:substitute(@z,'.','\\l&','g')".et."}<CR>".st.et
"

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to