aboutsummaryrefslogtreecommitdiff
path: root/runtime/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r--runtime/ftplugin/bzl.vim94
-rw-r--r--runtime/ftplugin/changelog.vim12
-rw-r--r--runtime/ftplugin/fortran.vim25
-rw-r--r--runtime/ftplugin/hgcommit.vim16
-rw-r--r--runtime/ftplugin/hog.vim39
-rw-r--r--runtime/ftplugin/j.vim13
-rw-r--r--runtime/ftplugin/man.vim8
-rw-r--r--runtime/ftplugin/spec.vim2
-rw-r--r--runtime/ftplugin/systemd.vim7
9 files changed, 197 insertions, 19 deletions
diff --git a/runtime/ftplugin/bzl.vim b/runtime/ftplugin/bzl.vim
new file mode 100644
index 0000000000..0296b0c0b8
--- /dev/null
+++ b/runtime/ftplugin/bzl.vim
@@ -0,0 +1,94 @@
+" Vim filetype plugin file
+" Language: Bazel (http://bazel.io)
+" Maintainer: David Barnett (https://github.com/google/vim-ft-bzl)
+" Last Change: 2015 Aug 11
+
+""
+" @section Introduction, intro
+" Core settings for the bzl filetype, used for BUILD and *.bzl files for the
+" Bazel build system (http://bazel.io/).
+
+if exists('b:did_ftplugin')
+ finish
+endif
+
+
+" Vim 7.4.051 has opinionated settings in ftplugin/python.vim that try to force
+" PEP8 conventions on every python file, but these conflict with Google's
+" indentation guidelines. As a workaround, we explicitly source the system
+" ftplugin, but save indentation settings beforehand and restore them after.
+let s:save_expandtab = &l:expandtab
+let s:save_shiftwidth = &l:shiftwidth
+let s:save_softtabstop = &l:softtabstop
+let s:save_tabstop = &l:tabstop
+
+" NOTE: Vim versions before 7.3.511 had a ftplugin/python.vim that was broken
+" for compatible mode.
+let s:save_cpo = &cpo
+set cpo&vim
+
+" Load base python ftplugin (also defines b:did_ftplugin).
+source $VIMRUNTIME/ftplugin/python.vim
+
+" NOTE: Vim versions before 7.4.104 and later set this in ftplugin/python.vim.
+setlocal comments=b:#,fb:-
+
+" Restore pre-existing indentation settings.
+let &l:expandtab = s:save_expandtab
+let &l:shiftwidth = s:save_shiftwidth
+let &l:softtabstop = s:save_softtabstop
+let &l:tabstop = s:save_tabstop
+
+setlocal formatoptions-=t
+
+" Make gf work with imports in BUILD files.
+setlocal includeexpr=substitute(v:fname,'//','','')
+
+" Enable syntax-based folding, if specified.
+if get(g:, 'ft_bzl_fold', 0)
+ setlocal foldmethod=syntax
+ setlocal foldtext=BzlFoldText()
+endif
+
+if exists('*BzlFoldText')
+ finish
+endif
+
+function BzlFoldText() abort
+ let l:start_num = nextnonblank(v:foldstart)
+ let l:end_num = prevnonblank(v:foldend)
+
+ if l:end_num <= l:start_num + 1
+ " If the fold is empty, don't print anything for the contents.
+ let l:content = ''
+ else
+ " Otherwise look for something matching the content regex.
+ " And if nothing matches, print an ellipsis.
+ let l:content = '...'
+ for l:line in getline(l:start_num + 1, l:end_num - 1)
+ let l:content_match = matchstr(l:line, '\m\C^\s*name = \zs.*\ze,$')
+ if !empty(l:content_match)
+ let l:content = l:content_match
+ break
+ endif
+ endfor
+ endif
+
+ " Enclose content with start and end
+ let l:start_text = getline(l:start_num)
+ let l:end_text = substitute(getline(l:end_num), '^\s*', '', '')
+ let l:text = l:start_text . ' ' . l:content . ' ' . l:end_text
+
+ " Compute the available width for the displayed text.
+ let l:width = winwidth(0) - &foldcolumn - (&number ? &numberwidth : 0)
+ let l:lines_folded = ' ' . string(1 + v:foldend - v:foldstart) . ' lines'
+
+ " Expand tabs, truncate, pad, and concatenate
+ let l:text = substitute(l:text, '\t', repeat(' ', &tabstop), 'g')
+ let l:text = strpart(l:text, 0, l:width - len(l:lines_folded))
+ let l:padding = repeat(' ', l:width - len(l:lines_folded) - len(l:text))
+ return l:text . l:padding . l:lines_folded
+endfunction
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim
index 244245e271..257e9cd9d4 100644
--- a/runtime/ftplugin/changelog.vim
+++ b/runtime/ftplugin/changelog.vim
@@ -1,7 +1,8 @@
" Vim filetype plugin file
-" Language: generic Changelog file
-" Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2014-01-10
+" Language: generic Changelog file
+" Maintainer: Martin Florian <marfl@posteo.de>
+" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
+" Latest Revision: 2015-10-25
" Variables:
" g:changelog_timeformat (deprecated: use g:changelog_dateformat instead) -
" description: the timeformat used in ChangeLog entries.
@@ -167,7 +168,7 @@ if &filetype == 'changelog'
let cursor = stridx(line, '{cursor}')
call setline(lnum, substitute(line, '{cursor}', '', ''))
endif
- startinsert!
+ startinsert
endfunction
" Internal function to create a new entry in the ChangeLog.
@@ -223,7 +224,8 @@ if &filetype == 'changelog'
endfunction
if exists(":NewChangelogEntry") != 2
- noremap <buffer> <silent> <Leader>o <Esc>:call <SID>new_changelog_entry('')<CR>
+ nnoremap <buffer> <silent> <Leader>o :<C-u>call <SID>new_changelog_entry('')<CR>
+ xnoremap <buffer> <silent> <Leader>o :<C-u>call <SID>new_changelog_entry('')<CR>
command! -nargs=0 NewChangelogEntry call s:new_changelog_entry('')
endif
diff --git a/runtime/ftplugin/fortran.vim b/runtime/ftplugin/fortran.vim
index 7591edd821..5d42409fd4 100644
--- a/runtime/ftplugin/fortran.vim
+++ b/runtime/ftplugin/fortran.vim
@@ -1,9 +1,9 @@
" Vim settings file
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, 77, 66)
-" Version: 0.49
-" Last Change: 2013 Oct. 01
+" Version: 0.50
+" Last Change: 2015 Nov. 30
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
-" Usage: Do :help fortran-plugin from Vim
+" Usage: For instructions, do :help fortran-plugin from Vim
" Credits:
" Useful suggestions were made by Stefano Zacchiroli, Hendrik Merx, Ben
" Fritz, and David Barnett.
@@ -20,7 +20,10 @@ set cpoptions&vim
let b:did_ftplugin = 1
" Determine whether this is a fixed or free format source file
-" if this hasn't been done yet
+" if this hasn't been done yet using the priority:
+" buffer-local value
+" > global value
+" > file extension as in Intel ifort, gcc (gfortran), NAG, Pathscale, and Cray compilers
if !exists("b:fortran_fixed_source")
if exists("fortran_free_source")
" User guarantees free source form
@@ -28,13 +31,19 @@ if !exists("b:fortran_fixed_source")
elseif exists("fortran_fixed_source")
" User guarantees fixed source form
let b:fortran_fixed_source = 1
+ elseif expand("%:e") ==? "f\<90\|95\|03\|08\>"
+ " Free-form file extension defaults as in Intel ifort, gcc(gfortran), NAG, Pathscale, and Cray compilers
+ let b:fortran_fixed_source = 0
+ elseif expand("%:e") ==? "f\|f77\|for"
+ " Fixed-form file extension defaults
+ let b:fortran_fixed_source = 1
else
- " Modern Fortran allows both fixed and free source form
- " assume fixed source form unless signs of free source form
- " are detected in the first five columns of the first s:lmax lines
+ " Modern fortran still allows both fixed and free source form
+ " Assume fixed source form unless signs of free source form
+ " are detected in the first five columns of the first s:lmax lines.
" Detection becomes more accurate and time-consuming if more lines
" are checked. Increase the limit below if you keep lots of comments at
- " the very top of each file and you have a fast computer
+ " the very top of each file and you have a fast computer.
let s:lmax = 500
if ( s:lmax > line("$") )
let s:lmax = line("$")
diff --git a/runtime/ftplugin/hgcommit.vim b/runtime/ftplugin/hgcommit.vim
new file mode 100644
index 0000000000..d5a6c0a383
--- /dev/null
+++ b/runtime/ftplugin/hgcommit.vim
@@ -0,0 +1,16 @@
+" Vim filetype plugin file
+" Language: hg (Mercurial) commit file
+" Maintainer: Ken Takata <kentkt at csc dot jp>
+" Last Change: 2016 Jan 6
+" Filenames: hg-editor-*.txt
+" License: VIM License
+" URL: https://github.com/k-takata/hg-vim
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+setlocal nomodeline
+
+let b:undo_ftplugin = 'setl modeline<'
diff --git a/runtime/ftplugin/hog.vim b/runtime/ftplugin/hog.vim
new file mode 100644
index 0000000000..4ee0a9f934
--- /dev/null
+++ b/runtime/ftplugin/hog.vim
@@ -0,0 +1,39 @@
+" Vim filetype plugin
+" Language: hog (snort.conf)
+" Maintainer: . Victor Roemer, <vroemer@badsec.org>.
+" Last Change: Mar 1, 2013
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:undo_ftplugin = "setl fo< com< cms< def< inc<"
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+setlocal formatoptions=croq
+setlocal comments=:#
+setlocal commentstring=\c#\ %s
+setlocal define=\c^\s\{-}var
+setlocal include=\c^\s\{-}include
+
+" Move around configurations
+let s:hog_keyword_match = '\c^\s*\<\(preprocessor\\|config\\|output\\|include\\|ipvar\\|portvar\\|var\\|dynamicpreprocessor\\|' .
+ \ 'dynamicengine\\|dynamicdetection\\|activate\\|alert\\|drop\\|block\\|dynamic\\|log\\|pass\\|reject\\|sdrop\\|sblock\)\>'
+
+exec "nnoremap <buffer><silent> ]] :call search('" . s:hog_keyword_match . "', 'W' )<CR>"
+exec "nnoremap <buffer><silent> [[ :call search('" . s:hog_keyword_match . "', 'bW' )<CR>"
+
+if exists("loaded_matchit")
+ let b:match_words =
+ \ '^\s*\<\%(preprocessor\|config\|output\|include\|ipvar\|portvar' .
+ \ '\|var\|dynamicpreprocessor\|dynamicengine\|dynamicdetection' .
+ \ '\|activate\|alert\|drop\|block\|dynamic\|log\|pass\|reject' .
+ \ '\|sdrop\|sblock\>\):$,\::\,:;'
+ let b:match_skip = 'r:\\.\{-}$\|^\s*#.\{-}$\|^\s*$'
+endif
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/ftplugin/j.vim b/runtime/ftplugin/j.vim
index 774696836f..9dc1692534 100644
--- a/runtime/ftplugin/j.vim
+++ b/runtime/ftplugin/j.vim
@@ -2,7 +2,7 @@
" Language: J
" Maintainer: David Bürgin <676c7473@gmail.com>
" URL: https://github.com/glts/vim-j
-" Last Change: 2015-03-27
+" Last Change: 2015-09-27
if exists('b:did_ftplugin')
finish
@@ -12,13 +12,20 @@ let b:did_ftplugin = 1
let s:save_cpo = &cpo
set cpo&vim
-setlocal iskeyword=48-57,A-Z,_,a-z
+setlocal iskeyword=48-57,A-Z,a-z,_
setlocal comments=:NB.
setlocal commentstring=NB.\ %s
setlocal formatoptions-=t
setlocal matchpairs=(:)
+setlocal path-=/usr/include
-let b:undo_ftplugin = 'setlocal matchpairs< formatoptions< commentstring< comments< iskeyword<'
+" Includes. To make the shorthand form "require 'web/cgi'" work, double the
+" last path component. Also strip off leading folder names like "~addons/".
+setlocal include=\\v^\\s*(load\|require)\\s*'\\zs\\f+\\ze'
+setlocal includeexpr=substitute(substitute(tr(v:fname,'\\','/'),'\\v^[^~][^/.]*(/[^/.]+)$','&\\1',''),'\\v^\\~[^/]+/','','')
+setlocal suffixesadd=.ijs
+
+let b:undo_ftplugin = 'setlocal matchpairs< formatoptions< commentstring< comments< iskeyword< path< include< includeexpr< suffixesadd<'
" Section movement with ]] ][ [[ []. The start/end patterns below are amended
" inside the function in order to avoid matching on the current cursor line.
diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim
index 133a28e626..04ab539fb1 100644
--- a/runtime/ftplugin/man.vim
+++ b/runtime/ftplugin/man.vim
@@ -24,14 +24,18 @@ setlocal buftype=nofile noswapfile
setlocal nomodifiable readonly bufhidden=hide nobuflisted tabstop=8
if !exists("g:no_plugin_maps") && !exists("g:no_man_maps")
- nnoremap <silent> <buffer> <C-]> :call man#get_page(v:count)<CR>
+ nnoremap <silent> <buffer> <C-]> :call man#get_page(v:count, expand('<cword>'))<CR>
nnoremap <silent> <buffer> <C-T> :call man#pop_page()<CR>
nnoremap <silent> <nowait><buffer> q <C-W>c
if &keywordprg !=# ':Man'
- nnoremap <silent> <buffer> K :call man#get_page(v:count)<CR>
+ nnoremap <silent> <buffer> K :call man#get_page(v:count, expand('<cword>'))<CR>
endif
endif
+if exists('g:ft_man_folding_enable') && (g:ft_man_folding_enable == 1)
+ setlocal foldmethod=indent foldnestmax=1 foldenable
+endif
+
let b:undo_ftplugin = 'setlocal iskeyword<'
" vim: set sw=2:
diff --git a/runtime/ftplugin/spec.vim b/runtime/ftplugin/spec.vim
index f972753533..6d5bf4b806 100644
--- a/runtime/ftplugin/spec.vim
+++ b/runtime/ftplugin/spec.vim
@@ -2,7 +2,7 @@
" Filename: spec.vim
" Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com
" Former Maintainer: Gustavo Niemeyer <niemeyer@conectiva.com> (until March 2014)
-" Last Change: Fri Feb 20 16:01 MSK 2014 Igor Gnatenko
+" Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko
if exists("b:did_ftplugin")
finish
diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim
new file mode 100644
index 0000000000..60b3fd996d
--- /dev/null
+++ b/runtime/ftplugin/systemd.vim
@@ -0,0 +1,7 @@
+" Vim filetype plugin file
+" Language: systemd.unit(5)
+
+if !exists('b:did_ftplugin')
+ " Looks a lot like dosini files.
+ runtime! ftplugin/dosini.vim
+endif