diff --git a/after/syntax/tex.vim b/after/syntax/tex.vim index b11207d..e096ed4 100644 --- a/after/syntax/tex.vim +++ b/after/syntax/tex.vim @@ -2,3 +2,8 @@ " \Cref, \cref, \cpageref, \labelcref, \labelcpageref syn region texRefZone matchgroup=texStatement start="\\Cref{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefZone matchgroup=texStatement start="\\\(label\|\)c\(page\|\)ref{" end="}\|%stopzone\>" contains=@texRefGroup + +" adds support for listings package +syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" +syn region texZone start="\\lstinputlisting" end="{\s*[a-zA-Z/.0-9_^]\+\s*}" +syn match texInputFile "\\lstinline\s*\(\[.*\]\)\={.\{-}}" contains=texStatement,texInputCurlies,texInputFileOpt diff --git a/autoload/clojurecomplete.vim b/autoload/clojurecomplete.vim index c9f8af9..5a41f23 100644 --- a/autoload/clojurecomplete.vim +++ b/autoload/clojurecomplete.vim @@ -15,7 +15,7 @@ function! clojurecomplete#Complete(findstart, base) if a:findstart return searchpos('\<', 'bnW', line('.'))[1] - 1 else - return { 'words': filter(copy(s:words), 'v:val =~ "\\V\\^' . a:base . '"') } + return { 'words': filter(copy(s:words), 'v:val =~# "\\V\\^' . a:base . '"') } endif endfunction diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 62821fc..7157e3c 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -88,7 +88,7 @@ au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/*,*/nginx/vhosts.d/*,nginx.c autocmd BufNewFile,BufRead *.proto setfiletype proto au BufRead,BufNewFile *.pp set filetype=puppet au BufNewFile,BufRead *.rb,*.rbw,*.gemspec set filetype=ruby -au BufNewFile,BufRead *.builder,*.rxml,*.rjs set filetype=ruby +au BufNewFile,BufRead *.builder,*.rxml,*.rjs,*.ruby set filetype=ruby au BufNewFile,BufRead [rR]akefile,*.rake set filetype=ruby au BufNewFile,BufRead [rR]antfile,*.rant set filetype=ruby au BufNewFile,BufRead .irbrc,irbrc set filetype=ruby @@ -108,6 +108,7 @@ au BufNewFile,BufRead *.jbuilder set filetype=ruby au BufNewFile,BufRead Puppetfile set filetype=ruby au BufNewFile,BufRead [Bb]uildfile set filetype=ruby au BufNewFile,BufRead Appraisals set filetype=ruby +au BufNewFile,BufRead Podfile,*.podspec set filetype=ruby au BufRead,BufNewFile *.rs set filetype=rust au BufRead,BufNewFile *.sbt set filetype=sbt fun! s:DetectScala() diff --git a/ftplugin/clojure.vim b/ftplugin/clojure.vim index b46b9c8..2741a3a 100644 --- a/ftplugin/clojure.vim +++ b/ftplugin/clojure.vim @@ -15,7 +15,7 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -let b:undo_ftplugin = 'setlocal iskeyword< define< formatoptions< comments< commentstring<' +let b:undo_ftplugin = 'setlocal iskeyword< define< formatoptions< comments< commentstring< lispwords<' setlocal iskeyword+=?,-,*,!,+,/,=,<,>,.,:,$ @@ -30,6 +30,21 @@ setlocal formatoptions-=t setlocal comments=n:; setlocal commentstring=;\ %s +" Specially indented symbols from clojure.core and clojure.test. +" +" Clojure symbols are indented in the defn style when they: +" +" * Define vars and anonymous functions +" * Create new lexical scopes or scopes with altered environments +" * Create conditional branches from a predicate function or value +" +" The arglists for these functions are generally in the form of [x & body]; +" Functions that accept a flat list of forms do not treat the first argument +" specially and hence are not indented specially. +" +" Generated from https://github.com/guns/vim-clojure-static/blob/%%RELEASE_TAG%%/clj/src/vim_clojure_static/generate.clj +setlocal lispwords=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doall,dorun,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test + " Provide insert mode completions for special forms and clojure.core. As " 'omnifunc' is set by popular Clojure REPL client plugins, we also set " 'completefunc' so that the user has some form of completion available when diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim index 95058ed..82ef430 100644 --- a/ftplugin/csv.vim +++ b/ftplugin/csv.vim @@ -11,10 +11,10 @@ " though, implementation differs. " Plugin folklore "{{{2 -if v:version < 700 || exists('b:did_csv_ftplugin') +if v:version < 700 || exists('b:did_ftplugin') finish endif -let b:did_csv_ftplugin = 1 +let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim diff --git a/ftplugin/latex-box/common.vim b/ftplugin/latex-box/common.vim index e132e22..72a6ef0 100644 --- a/ftplugin/latex-box/common.vim +++ b/ftplugin/latex-box/common.vim @@ -102,7 +102,7 @@ function! LatexBox_GetMainTexFile() endfor " 3. scan current file for "\begin{document}" - if &filetype == 'tex' && search('\C\\begin\_\s*{document}', 'nw') != 0 + if &filetype == 'tex' && search('\m\C\\begin\_\s*{document}', 'nw') != 0 return expand('%:p') endif diff --git a/ftplugin/latex-box/complete.vim b/ftplugin/latex-box/complete.vim index 3b47a2f..866ffc3 100644 --- a/ftplugin/latex-box/complete.vim +++ b/ftplugin/latex-box/complete.vim @@ -106,13 +106,13 @@ function! LatexBox_Complete(findstart, base) endwhile let line_start = line[:pos-1] - if line_start =~ '\C\\begin\_\s*{$' + if line_start =~ '\m\C\\begin\_\s*{$' let s:completion_type = 'begin' - elseif line_start =~ '\C\\end\_\s*{$' + elseif line_start =~ '\m\C\\end\_\s*{$' let s:completion_type = 'end' - elseif line_start =~ g:LatexBox_ref_pattern . '$' + elseif line_start =~ '\m' . g:LatexBox_ref_pattern . '$' let s:completion_type = 'ref' - elseif line_start =~ g:LatexBox_cite_pattern . '$' + elseif line_start =~ '\m' . g:LatexBox_cite_pattern . '$' let s:completion_type = 'bib' " check for multiple citations let pos = col('.') - 1 @@ -369,7 +369,7 @@ function! s:ExtractLabels() continue endif - if 0 == search( '{\w*{', 'ce', lblline ) + if 0 == search( '\m{\w*{', 'ce', lblline ) let [lblline, lblbegin] = searchpos( '\\newlabel{', 'ecW' ) continue endif @@ -382,7 +382,7 @@ function! s:ExtractLabels() endif let curnumber = strpart( getline( lblline ), numberbegin, numberend - numberbegin - 1 ) - if 0 == search( '\w*{', 'ce', lblline ) + if 0 == search( '\m\w*{', 'ce', lblline ) let [lblline, lblbegin] = searchpos( '\\newlabel{', 'ecW' ) continue endif @@ -755,6 +755,70 @@ function! s:PromptEnvWrapSelection(...) endfunction " }}} +" List Labels with Prompt {{{ +function! s:PromptLabelList(...) + " Check if window already exists + let winnr = bufwinnr(bufnr('LaTeX Labels')) + if winnr >= 0 + if a:0 == 0 + silent execute winnr . 'wincmd w' + else + " Supplying an argument to this function causes toggling instead + " of jumping to the labels window + if g:LatexBox_split_resize + silent exe "set columns-=" . g:LatexBox_split_width + endif + silent execute 'bwipeout' . bufnr('LaTeX Labels') + endif + return + endif + + " Get label suggestions + let regexp = input('filter labels with regexp: ', '') + let labels = s:CompleteLabels(regexp) + + let calling_buf = bufnr('%') + + " Create labels window and set local settings + if g:LatexBox_split_resize + silent exe "set columns+=" . g:LatexBox_split_width + endif + silent exe g:LatexBox_split_side g:LatexBox_split_width . 'vnew LaTeX\ Labels' + let b:toc = [] + let b:toc_numbers = 1 + let b:calling_win = bufwinnr(calling_buf) + setlocal filetype=latextoc + + " Add label entries and jump to the closest section + for entry in labels + let number = matchstr(entry['menu'], '^\s*(\zs[^)]\+\ze)') + let page = matchstr(entry['menu'], '^[^)]*)\s*\[\zs[^]]\+\ze\]') + let e = {'file': bufname(calling_buf), + \ 'level': 'label', + \ 'number': number, + \ 'text': entry['abbr'], + \ 'page': page} + call add(b:toc, e) + if b:toc_numbers + call append('$', e['number'] . "\t" . e['text']) + else + call append('$', e['text']) + endif + endfor + if !g:LatexBox_toc_hidehelp + call append('$', "") + call append('$', "/q: close") + call append('$', ": jump") + call append('$', ": jump and close") + call append('$', "s: hide numbering") + endif + 0delete _ + + " Lock buffer + setlocal nomodifiable +endfunction +" }}} + " Change Environment {{{ function! s:ChangeEnvPrompt() @@ -858,4 +922,8 @@ nnoremap LatexChangeEnv :call ChangeEnvPrompt() nnoremap LatexToggleStarEnv :call LatexToggleStarEnv() " }}} +" Commands {{{ +command! LatexLabels call PromptLabelList() +" }}} + " vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/ftplugin/latex-box/mappings.vim b/ftplugin/latex-box/mappings.vim index 509f5f1..6ff621c 100644 --- a/ftplugin/latex-box/mappings.vim +++ b/ftplugin/latex-box/mappings.vim @@ -23,6 +23,10 @@ map lv :LatexView map lt :LatexTOC " }}} +" List of labels {{{ +map lj :LatexLabels +" }}} + " Jump to match {{{ if !exists('g:LatexBox_loaded_matchparen') nmap % LatexBox_JumpToMatch diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 9630a94..a8ef886 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -34,6 +34,7 @@ if exists("loaded_matchit") && !exists("b:match_words") let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . \ "\\ ]] :call NextSection(0) + +noremap