diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2014-03-01 00:15:51 +0100 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2014-03-01 00:15:51 +0100 | 
| commit | 9b3b092d15503ed70ea4bf60c4e1345b196c3677 (patch) | |
| tree | 45fdb6e08c380ab8bfe0988c66b15ab014688a55 /ftplugin | |
| parent | 959a2ffa3ddf3a716b37e15d0034546236a97957 (diff) | |
| download | vim-polyglot-9b3b092d15503ed70ea4bf60c4e1345b196c3677.tar.gz vim-polyglot-9b3b092d15503ed70ea4bf60c4e1345b196c3677.zip | |
Update
Diffstat (limited to '')
| -rw-r--r-- | ftplugin/clojure.vim | 17 | ||||
| -rw-r--r-- | ftplugin/csv.vim | 4 | ||||
| -rw-r--r-- | ftplugin/latex-box/common.vim | 2 | ||||
| -rw-r--r-- | ftplugin/latex-box/complete.vim | 80 | ||||
| -rw-r--r-- | ftplugin/latex-box/mappings.vim | 4 | ||||
| -rw-r--r-- | ftplugin/ruby.vim | 1 | ||||
| -rw-r--r-- | ftplugin/scala.vim | 24 | 
7 files changed, 122 insertions, 10 deletions
| diff --git a/ftplugin/clojure.vim b/ftplugin/clojure.vim index b46b9c80..2741a3a1 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 95058edd..82ef430e 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 e132e22b..72a6ef0f 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 3b47a2f3..866ffc3c 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('$', "<Esc>/q: close") +		call append('$', "<Space>: jump") +		call append('$', "<Enter>: 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 <silent> <Plug>LatexChangeEnv				:call <SID>ChangeEnvPrompt()<CR>  nnoremap <silent> <Plug>LatexToggleStarEnv			:call <SID>LatexToggleStarEnv()<CR>  " }}} +" Commands {{{ +command! LatexLabels call <SID>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 509f5f19..6ff621c1 100644 --- a/ftplugin/latex-box/mappings.vim +++ b/ftplugin/latex-box/mappings.vim @@ -23,6 +23,10 @@ map <buffer> <LocalLeader>lv :LatexView<CR>  map <silent> <buffer> <LocalLeader>lt :LatexTOC<CR>  " }}} +" List of labels {{{ +map <silent> <buffer> <LocalLeader>lj :LatexLabels<CR> +" }}} +  " Jump to match {{{  if !exists('g:LatexBox_loaded_matchparen')  	nmap <buffer> % <Plug>LatexBox_JumpToMatch diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 9630a940..a8ef8866 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') =~ '" .  	\ "\\<ruby\\%(String\\|StringDelimiter\\|ASCIICode\\|Escape\\|" . +        \ "Regexp\\|RegexpDelimiter\\|" .  	\ "Interpolation\\|NoInterpolation\\|Comment\\|Documentation\\|" .  	\ "ConditionalModifier\\|RepeatModifier\\|OptionalDo\\|" .  	\ "Function\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" . diff --git a/ftplugin/scala.vim b/ftplugin/scala.vim index b042d4d3..18941e07 100644 --- a/ftplugin/scala.vim +++ b/ftplugin/scala.vim @@ -168,3 +168,27 @@ let g:tagbar_type_scala = {        \ 'case class' : 'r'      \ }  \ } + +function! s:CreateOrExpression(keywords) +  return '('.join(a:keywords, '|').')' +endfunction + +function! s:NextSection(backwards) +  if a:backwards +    let dir = '?' +  else +    let dir = '/' +  endif +  let keywords = [ 'def', 'class', 'trait', 'object' ] +  let keywordsOrExpression = s:CreateOrExpression(keywords) + +  let modifiers = [ 'public', 'private', 'private\[\w*\]', 'protected', 'abstract', 'case', 'override', 'implicit', 'final', 'sealed'] +  let modifierOrExpression = s:CreateOrExpression(modifiers) + +  let regex = '^ *('.modifierOrExpression.' )* *'.keywordsOrExpression."\r" +  execute 'silent normal! ' . dir . '\v'.regex +endfunction + +noremap <script> <buffer> <silent> ]] :call <SID>NextSection(0)<cr> + +noremap <script> <buffer> <silent> [[ :call <SID>NextSection(1)<cr> | 
