Update 2024-01-19 22:17 OpenBSD/amd64-x13

This commit is contained in:
c0dev0id 2024-01-19 22:17:16 +01:00
parent b255eb5c10
commit da8daa77e0
69 changed files with 74 additions and 19342 deletions

View File

@ -1,6 +1,6 @@
#!/bin/ksh
rm -f "${HOME}/.ksh-complete"
rm -f "${HOME}/.ksh/complete.ksh"
add() { ( printf '%s %s' "$1" "$2" | tr '\n' ' '; printf '\n') >> "${HOME}/.ksh-complete"; }

View File

@ -10,15 +10,15 @@
# | WINDOW DECORATION
# +--------------------------------------------------
border_width = 2
border_width = 1
color_focus = rgb:AF/5F/00
color_focus_maximized = rgb:AF/5F/00
color_focus_maximized_free = rgb:AF/5F/00
color_focus_free = rgb:AF/5F/00
color_unfocus = rgb:44/44/44
color_unfocus_free = rgb:55/35/00
tile_gap = 16
region_padding = 16
tile_gap = 8
region_padding = 8
disable_border = 0
maximize_hide_bar = 0
@ -152,8 +152,8 @@ bind[mcorner] = MOD+Shift+X
program[mixer] = texec cmixer
bind[mixer] = MOD+Shift+M
program[vim] = texec vim
bind[vim] = Control+o
program[vim] = texec "vim -c ':History'"
bind[vim] = MOD+Shift+o
program[vpn] = dexec_vpn
bind[vpn] = MOD+V
@ -161,8 +161,8 @@ bind[vpn] = MOD+V
program[exec] = dexec
bind[exec] = MOD+D
program[cexec] = dexec_command
bind[cexec] = MOD+C
program[cexec] = dexec_command
bind[cexec] = MOD+C
program[texec] = dexec_term
bind[texec] = MOD+Shift+D
@ -173,8 +173,8 @@ bind[ssh] = MOD+S
program[ssh] = dexec_ssh
bind[ssh] = MOD+S
program[edit] = dexec_edit
bind[edit] = MOD+numbersign
program[edit] = dexec_edit
bind[edit] = MOD+numbersign
program[scratchpad] = sp
bind[scratchpad] = MOD+minus

View File

@ -13,10 +13,6 @@ alias sxhkdrc="vim ~/.config/bspwm/sxhkdrc"
alias vimbrc="vim ~/.config/vimb/config"
alias exrc="vim ~/.exrc"
alias web-ebay="chrome https://www.kleinanzeigen.de/m-nachrichten.html &"
alias web-scottsbasslessons="chrome https://scottsbasslessons.com &"
alias vmctl="doas /usr/sbin/vmctl"
# translation
alias trans-en="trans -l de -s en -t de --no-ansi"

View File

@ -17,6 +17,10 @@ case $(hostname -s) in
openbsd) PKGOPT="-Dsnap"; ;;
esac
alias pkg_add="doas \pkg_add ${PKGOPT}"
alias pkg_delete="doas \pkg_delete ${PKGOPT}"
alias pkg_info="\pkg_info ${PKGOPT}"
#
# SUPER LAZY ALIASES FOR THE ALIASES
#

99
.kshrc
View File

@ -47,12 +47,6 @@ export PRINTER
# MANDATORY ENVIRONMENT
########################################################################
# hack for more colors in cool-retro-term
if [ ! -z $COLORFGBG ]
then
TERM=xterm-256color
fi
### HISTORY
HISTCONTROL=ignoredups:ignorespace:erasedups
HISTFILE=$HOME/.ksh-history
@ -65,10 +59,14 @@ LESSHISTFILE="$HOME/.less-history"
export LESS LESSHISTFILE
########################################################################
# PROMPT (SIMPLE)
# PROMPT
########################################################################
PS1="\h|\${?}\w\\$ "
C1="\[$(tput setaf 240)\]" # gray
C2="\[$(tput setaf 208)\]" # orange
C0="\[$(tput op)\]" # reset
x=$(print \\001) # hack from ksh(1)
PS1="$x\${C1}[\${C2}\h\${C1}](\${C2}\${?}\${C1})(\${C2}\W\${C1})\\$ \${C0}$x"
########################################################################
# SHELL SETTINGS
@ -95,102 +93,31 @@ load ytdl.ksh
load amused.ksh
load gnupg.ksh
load fzf.ksh
load dotfiles.ksh
load localstuff.ksh
load complete.ksh
########################################################################
# ALIASES (MISC)
########################################################################
alias sudo="doas"
alias su="doas su"
# packages
alias pkg_add="doas \pkg_add ${PKGOPT}"
alias pkg_delete="doas \pkg_delete ${PKGOPT}"
alias pkg_info="\pkg_info ${PKGOPT}"
# mount
alias mount_msdos="doas \mount_msdos -o nodev,nosuid,noatime -u 1000 -g 1000"
mount_tank() { awk '$3=="nfs"{print $2}' /etc/fstab | xargs -n1 doas mount; }
umount_tank() { awk '$3=="nfs"{print $2}' /etc/fstab | xargs -n1 doas umount; }
mount_tank() { awk '$3=="nfs"{print $2}' /etc/fstab | xargs -n1 doas mount -v | cut -d" " -f-3; }
umount_tank() { awk '$3=="nfs"{print $2}' /etc/fstab | xargs -n1 doas umount -v | cut -d" " -f-3; }
pw() { pwgen -1 -y --remove-chars=\~\`\"\'{}\(\)\[\]\*.\;\|,\<\> 22; }
########################################################################
# KERNEL STUFF
########################################################################
alias update-ksh="cd /usr/src/bin/ksh \
&& doas make clean \
&& doas make obj \
&& doas make -j $MAKE_JOBS \
&& doas make install"
########################################################################
# TWITCH FROM CLI
########################################################################
alias twitch-play="mpv https://www.twitch.tv/c0dev0id"
twitch-stream() {
alias twitch_play="mpv https://www.twitch.tv/c0dev0id"
twitch_stream() {
local API_KEY=$(pass Internet/Twitch | head -1)
local RES=$(xrandr | grep "*+" | awk '{print $1}')
local FAUX_OPTS="-d snd/default -m -vmic 5.0 -vmon 0.2 -r $RES -f 20 -b 4000"
fauxstream $FAUX_OPTS rtmp://live-ams.twitch.tv/app/$API_KEY
}
########################################################################
# DOTFILES WITH GIT
########################################################################
alias config='git --git-dir=${HOME}/.cfg/ --work-tree=${HOME}'
dotfiles_autoupdate() {
config add -u && \
config commit -m "Update $(date +"%Y-%m-%d %H:%M") \
$(uname -s)/$(uname -m)-$(hostname -s)" && config push
}
dotfiles_init() {
git --no-replace-objects clone --bare --depth 1 \
_gitea@git.uugrn.org:sdk/dotfiles.git $HOME/.cfg;
config config --local status.showUntrackedFiles no;
config checkout -f
}
########################################################################
# FILE SHARING
########################################################################
doupload-http() {
[ ! -f "$1" ] && return 2
chmod ugo+r "$1"
_name=$(basename "$1");
scp -r "$1" codevoid.de:/tmp
ssh codevoid.de "doas mv /tmp/$_name /home/www/htdocs/http/$_name"
echo "https://codevoid.de/h/$_name";
}
doupload-gopher() {
[ ! -f "$1" ] && return 2
chmod ugo+r "$1"
_name=$(basename "$1");
scp -r "$1" codevoid.de:/tmp
ssh codevoid.de "doas mv /tmp/$_name /home/www/htdocs/gopher/p/$_name"
case "$(file --mime-type -b "$1")" in
image/*) S="I";;
text/*) S="0";;
message/*) S="0";;
*/x-shellscript) S="0";;
*/pgp-keys) S="0";;
application/*) S="9";;
esac
echo "https://codevoid.de/$S/p/$_name";
echo "gopher://codevoid.de/$S/p/$_name";
}
########################################################################
# KSH COMPLETIONS
########################################################################
[ -f $HOME/.ksh-complete ] && . $HOME/.ksh-complete

View File

@ -1,264 +0,0 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.4
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
" .vimrc is the only other setup necessary.
"
" The API is documented inline below.
if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1
" Point of entry for basic default usage. Give a relative path to invoke
" pathogen#interpose() or an absolute path to invoke pathogen#surround().
" Curly braces are expanded with pathogen#expand(): "bundle/{}" finds all
" subdirectories inside "bundle" inside all directories in the runtime path.
" If no arguments are given, defaults "bundle/{}", and also "pack/{}/start/{}"
" on versions of Vim without native package support.
function! pathogen#infect(...) abort
if a:0
let paths = filter(reverse(copy(a:000)), 'type(v:val) == type("")')
else
let paths = ['bundle/{}', 'pack/{}/start/{}']
endif
if has('packages')
call filter(paths, 'v:val !~# "^pack/[^/]*/start/[^/]*$"')
endif
let static = '^\%([$~\\/]\|\w:[\\/]\)[^{}*]*$'
for path in filter(copy(paths), 'v:val =~# static')
call pathogen#surround(path)
endfor
for path in filter(copy(paths), 'v:val !~# static')
if path =~# '^\%([$~\\/]\|\w:[\\/]\)'
call pathogen#surround(path)
else
call pathogen#interpose(path)
endif
endfor
call pathogen#cycle_filetype()
if pathogen#is_disabled($MYVIMRC)
return 'finish'
endif
return ''
endfunction
" Split a path into a list.
function! pathogen#split(path) abort
if type(a:path) == type([]) | return a:path | endif
if empty(a:path) | return [] | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction
" Convert a list to a path.
function! pathogen#join(...) abort
if type(a:1) == type(1) && a:1
let i = 1
let space = ' '
else
let i = 0
let space = ''
endif
let path = ""
while i < a:0
if type(a:000[i]) == type([])
let list = a:000[i]
let j = 0
while j < len(list)
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
let path .= ',' . escaped
let j += 1
endwhile
else
let path .= "," . a:000[i]
endif
let i += 1
endwhile
return substitute(path,'^,','','')
endfunction
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort
return call('pathogen#join',[1] + a:000)
endfunction
" Turn filetype detection off and back on again if it was already enabled.
function! pathogen#cycle_filetype() abort
if exists('g:did_load_filetypes')
filetype off
filetype on
endif
endfunction
" Check if a bundle is disabled. A bundle is considered disabled if its
" basename or full name is included in the list g:pathogen_blacklist or the
" comma delimited environment variable $VIMBLACKLIST.
function! pathogen#is_disabled(path) abort
if a:path =~# '\~$'
return 1
endif
let sep = pathogen#slash()
let blacklist = get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) + pathogen#split($VIMBLACKLIST)
if !empty(blacklist)
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
endif
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
endfunction
" Prepend the given directory to the runtime path and append its corresponding
" after directory. Curly braces are expanded with pathogen#expand().
function! pathogen#surround(path) abort
let sep = pathogen#slash()
let rtp = pathogen#split(&rtp)
let path = fnamemodify(a:path, ':s?[\\/]\=$??')
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
call filter(rtp, 'index(before + after, v:val) == -1')
let &rtp = pathogen#join(before, rtp, after)
return &rtp
endfunction
" For each directory in the runtime path, add a second entry with the given
" argument appended. Curly braces are expanded with pathogen#expand().
function! pathogen#interpose(name) abort
let sep = pathogen#slash()
let name = a:name
if has_key(s:done_bundles, name)
return ""
endif
let s:done_bundles[name] = 1
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
else
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction
let s:done_bundles = {}
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() abort
let sep = pathogen#slash()
for glob in pathogen#split(&rtp)
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
silent! execute 'helptags' pathogen#fnameescape(dir)
endif
endfor
endfor
endfunction
command! -bar Helptags :call pathogen#helptags()
" Execute the given command. This is basically a backdoor for --remote-expr.
function! pathogen#execute(...) abort
for command in a:000
execute command
endfor
return ''
endfunction
" Section: Unofficial
function! pathogen#is_absolute(path) abort
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
endfunction
" Given a string, returns all possible permutations of comma delimited braced
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
" and globbed. Actual globs are preserved.
function! pathogen#expand(pattern, ...) abort
let after = a:0 ? a:1 : ''
let pattern = substitute(a:pattern, '^[~$][^\/]*', '\=expand(submatch(0))', '')
if pattern =~# '{[^{}]\+}'
let [pre, pat, post] = split(substitute(pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
let found = map(split(pat, ',', 1), 'pre.v:val.post')
let results = []
for pattern in found
call extend(results, pathogen#expand(pattern))
endfor
elseif pattern =~# '{}'
let pat = matchstr(pattern, '^.*{}[^*]*\%($\|[\\/]\)')
let post = pattern[strlen(pat) : -1]
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
else
let results = [pattern]
endif
let vf = pathogen#slash() . 'vimfiles'
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
return filter(results, '!empty(v:val)')
endfunction
" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#slash() abort
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction
function! pathogen#separator() abort
return pathogen#slash()
endfunction
" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
endfunction
" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction
" Remove duplicates from a list.
function! pathogen#uniq(list) abort
let i = 0
let seen = {}
while i < len(a:list)
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
call remove(a:list,i)
elseif a:list[i] ==# ''
let i += 1
let empty = 1
else
let seen[a:list[i]] = 1
let i += 1
endif
endwhile
return a:list
endfunction
" Backport of fnameescape().
function! pathogen#fnameescape(string) abort
if exists('*fnameescape')
return fnameescape(a:string)
elseif a:string ==# '-'
return '\-'
else
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
endif
endfunction
" Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#runtime_findfile(file,count) abort
let rtp = pathogen#join(1,pathogen#split(&rtp))
let file = findfile(a:file,rtp,a:count)
if file ==# ''
return ''
else
return fnamemodify(file,':p')
endif
endfunction
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':

View File

@ -1,22 +0,0 @@
The MIT License (MIT)
Copyright (c) 2016 Romain Lafourcade
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,64 +0,0 @@
# vim-cool
Vim-cool disables search highlighting when you are done searching and re-enables it when you search again. That's it. No more `:noh<CR>`, no more `/sytdstdrsid<CR>`, and no more dodgy `<C-l>` mappings.
Vim-cool is cool.
Vim-cool is *experimental*.
![cool](https://user-images.githubusercontent.com/344335/226825463-4ff5e352-ac2e-4f4d-94c7-a8109da7b6db.gif)
## Requirements
Vim-cool is intended to be used with Vim, **and only Vim**, 7.4.2008 or later. It may or may not work in other editors but they are not and will not be officially supported.
## Installation
Follow your favorite plugin/runtimepath manager's instructions.
If you choose manual installation, just put `plugin/cool.vim` where it belongs:
$HOME/.vim/plugin/cool.vim on Unix-like systems
$HOME\vimfiles\plugin\cool.vim on Windows
In Vim 8.0 and above, see `:help package`.
## Setup
The whole assumption behind Vim-cool is that the user enabled search highlighting but they don't want the highlighting to linger on when they are done searching. This implies that the user has the following line in their `vimrc`:
set hlsearch
That's it. Nothing else to do.
## Experimental features
* Show number of matches in the command-line:
let g:cool_total_matches = 1
![demo](https://user-images.githubusercontent.com/344335/226825418-12931cf3-5f89-4375-89be-c98a57e177df.png)
* Do something when we are doing `nnnNNnn`, do something else or do nothing when we are not:
set statusline+=%{get(g:,'cool_is_searching',0)?'Yep':''}
## Background
I wrote the first iteration of vim-cool in about twenty minutes, mostly to test a few ideas I had after a short discussion about `'hlsearch'` and `:nohlsearch` on #vim.
Because it relied almost exclusively on mappings, that first iteration was way too brittle to be of any use and actually messed with a bunch of my own mappings.
Then came [@purpleP](https://github.com/purpleP) and [the game-changing approach](https://github.com/romainl/vim-cool/issues/9) he put together with the help of [@chrisbra](https://github.com/chrisbra), [@justinmk](https://github.com/justinmk), [@jamessan](https://github.com/jamessan), and [@ZyX-I](https://github.com/ZyX-I).
The current version, essentially a weaponized version of @purpleP's code, doesn't rely on mappings anymore and thus should be devoid of nasty side-effects.
Many thanks to [@bounceme](https://github.com/bounceme) for his help.
## What they say about vim-cool
- **puremourning**, in #vim:
> vim-cool is by far my favourite plugin
>
> it's just so... cool.

View File

@ -1,136 +0,0 @@
" vim-cool - Disable hlsearch when you are done searching.
" Maintainer: romainl <romainlafourcade@gmail.com>
" Version: 0.0.2
" License: MIT License
" Location: plugin/cool.vim
" Website: https://github.com/romainl/vim-cool
if exists("g:loaded_cool") || v:version < 704 || &compatible
finish
endif
let g:loaded_cool = 1
let s:save_cpo = &cpo
set cpo&vim
augroup Cool
autocmd!
augroup END
if exists('##OptionSet')
if !exists('*execute')
autocmd Cool OptionSet highlight let <SID>saveh = &highlight
endif
" toggle coolness when hlsearch is toggled
autocmd Cool OptionSet hlsearch call <SID>PlayItCool(v:option_old, v:option_new)
endif
function! s:StartHL()
if !v:hlsearch || mode() isnot 'n'
return
endif
let g:cool_is_searching = 1
let [pos, rpos] = [winsaveview(), getpos('.')]
silent! exe "keepjumps go".(line2byte('.')+col('.')-(v:searchforward ? 2 : 0))
try
silent keepjumps norm! n
if getpos('.') != rpos
throw 0
endif
catch /^\%(0$\|Vim\%(\w\|:Interrupt$\)\@!\)/
call <SID>StopHL()
return
finally
call winrestview(pos)
endtry
if !get(g:,'cool_total_matches') || !exists('*reltimestr')
return
endif
exe "silent! norm! :let g:cool_char=nr2char(screenchar(screenrow(),1))\<cr>"
let cool_char = remove(g:,'cool_char')
if cool_char !~ '[/?]'
return
endif
let [f, ws, now, noOf] = [0, &wrapscan, reltime(), [0,0]]
set nowrapscan
try
while f < 2
if reltimestr(reltime(now))[:-6] =~ '[1-9]'
" time >= 100ms
return
endif
let noOf[v:searchforward ? f : !f] += 1
try
silent exe "keepjumps norm! ".(f ? 'n' : 'N')
catch /^Vim[^)]\+):E38[45]\D/
call setpos('.',rpos)
let f += 1
endtry
endwhile
finally
call winrestview(pos)
let &wrapscan = ws
endtry
redraw|echo cool_char.@/ 'match' noOf[0] 'of' noOf[0] + noOf[1] - 1
endfunction
function! s:StopHL()
if !v:hlsearch || mode() isnot 'n'
return
else
let g:cool_is_searching = 0
silent call feedkeys("\<Plug>(StopHL)", 'm')
endif
endfunction
if !exists('*execute')
let s:saveh = &highlight
" toggle highlighting, a workaround for :nohlsearch in autocmds
function! s:AuNohlsearch()
noautocmd set highlight+=l:-
autocmd Cool Insertleave *
\ noautocmd let &highlight = s:saveh | autocmd! Cool InsertLeave *
return ''
endfunction
endif
function! s:PlayItCool(old, new)
if a:old == 0 && a:new == 1
" nohls --> hls
" set up coolness
noremap <silent> <Plug>(StopHL) :<C-U>nohlsearch<cr>
if !exists('*execute')
noremap! <expr> <Plug>(StopHL) <SID>AuNohlsearch()
" If no "execute()", ":tnoremap" isn't probably implemented too.
else
noremap! <expr> <Plug>(StopHL) execute('nohlsearch')[-1]
if exists(':tnoremap')
tnoremap <expr> <Plug>(StopHL) execute('nohlsearch')[-1]
endif
endif
autocmd Cool CursorMoved * call <SID>StartHL()
autocmd Cool InsertEnter * call <SID>StopHL()
elseif a:old == 1 && a:new == 0
" hls --> nohls
" tear down coolness
nunmap <Plug>(StopHL)
unmap! <expr> <Plug>(StopHL)
if exists(':tunmap')
tunmap <Plug>(StopHL)
endif
autocmd! Cool CursorMoved
autocmd! Cool InsertEnter
else
" nohls --> nohls
" do nothing
return
endif
endfunction
" play it cool
call <SID>PlayItCool(0, &hlsearch)
let &cpo = s:save_cpo

File diff suppressed because it is too large Load Diff

View File

@ -1,891 +0,0 @@
easy-align.txt easy-align Last change: December 14 2014
EASY-ALIGN - TABLE OF CONTENTS *easyalign* *easy-align* *easy-align-toc*
==============================================================================
vim-easy-align
Demo |easy-align-1|
Features |easy-align-2|
Installation |easy-align-3|
TLDR - One-minute guide |easy-align-4|
Usage |easy-align-5|
Concept of alignment rule |easy-align-5-1|
Execution models |easy-align-5-2|
1. Using <Plug> mappings |easy-align-5-2-1|
2. Using :EasyAlign command |easy-align-5-2-2|
Interactive mode |easy-align-5-3|
Predefined alignment rules |easy-align-5-3-1|
Examples |easy-align-5-3-2|
Using regular expressions |easy-align-5-3-3|
Alignment options in interactive mode |easy-align-5-3-4|
Live interactive mode |easy-align-5-4|
Non-interactive mode |easy-align-5-5|
Partial alignment in blockwise-visual mode |easy-align-5-6|
Alignment options |easy-align-6|
List of options |easy-align-6-1|
Filtering lines |easy-align-6-2|
Examples |easy-align-6-2-1|
Ignoring delimiters in comments or strings |easy-align-6-3|
Ignoring unmatched lines |easy-align-6-4|
Aligning delimiters of different lengths |easy-align-6-5|
Adjusting indentation |easy-align-6-6|
Alignments over multiple occurrences of delimiters |easy-align-6-7|
Extending alignment rules |easy-align-6-8|
Examples |easy-align-6-8-1|
Other options |easy-align-7|
Disabling &foldmethod during alignment |easy-align-7-1|
Left/right/center mode switch in interactive mode |easy-align-7-2|
Advanced examples and use cases |easy-align-8|
Related work |easy-align-9|
Author |easy-align-10|
License |easy-align-11|
VIM-EASY-ALIGN *vim-easy-align*
==============================================================================
A simple, easy-to-use Vim alignment plugin.
*easy-align-1*
DEMO *easy-align-demo*
==============================================================================
Screencast:
https://raw.githubusercontent.com/junegunn/i/master/vim-easy-align.gif
(Too fast? Slower GIF is {here}{1})
{1} https://raw.githubusercontent.com/junegunn/i/master/vim-easy-align-slow.gif
*easy-align-2*
FEATURES *easy-align-features*
==============================================================================
- Easy to use
- Comes with a predefined set of alignment rules
- Provides a fast and intuitive interface
- Extensible
- You can define your own rules
- Supports arbitrary regular expressions
- Optimized for code editing
- Takes advantage of syntax highlighting feature to avoid unwanted
alignments
*easy-align-3*
INSTALLATION *easy-align-installation*
==============================================================================
Use your favorite plugin manager.
Using {vim-plug}{2}:
>
Plug 'junegunn/vim-easy-align'
<
{2} https://github.com/junegunn/vim-plug
*easy-align-4*
TLDR - ONE-MINUTE GUIDE *easy-align-tldr-one-minute-guide*
==============================================================================
Add the following mappings to your .vimrc.
*<Plug>(EasyAlign)*
>
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
<
And with the following lines of text,
>
apple =red
grass+=green
sky-= blue
<
try these commands:
- vip<Enter>=
- `v`isual-select `i`nner `p`aragraph
- Start EasyAlign command (<Enter>)
- Align around `=`
- `gaip=`
- Start EasyAlign command (`ga`) for `i`nner `p`aragraph
- Align around `=`
Notice that the commands are repeatable with `.` key if you have installed
{repeat.vim}{3}. Install {visualrepeat}{4} as well if you want to repeat in
visual mode.
{3} https://github.com/tpope/vim-repeat
{4} https://github.com/vim-scripts/visualrepeat
*easy-align-5*
USAGE *easy-align-usage*
==============================================================================
< Concept of alignment rule >_________________________________________________~
*easy-align-concept-of-alignment-rule*
*easy-align-5-1*
Though easy-align can align lines of text around any delimiter, it provides
shortcuts for the most common use cases with the concept of "alignment rule".
An alignment rule is a predefined set of options for common alignment tasks,
which is identified by a single character, DELIMITER KEY, such as <Space>,
`=`, `:`, `.`, `|`, `&`, `#`, and `,`.
Think of it as a shortcut. Instead of writing regular expression and setting
several options, you can just type in a single character.
< Execution models >__________________________________________________________~
*easy-align-execution-models*
*easy-align-5-2*
There are two ways to use easy-align.
1. Using <Plug> mappings~
*easy-align-1-using-plug-mappings*
*easy-align-5-2-1*
The recommended method is to use <Plug> mappings as described earlier.
*<Plug>(LiveEasyAlign)*
----------------------+--------+-----------------------------------------------------
Mapping | Mode | Description ~
----------------------+--------+-----------------------------------------------------
<Plug>(EasyAlign) | normal | Start interactive mode for a motion/text object
<Plug>(EasyAlign) | visual | Start interactive mode for the selection
<Plug>(LiveEasyAlign) | normal | Start live-interactive mode for a motion/text object
<Plug>(LiveEasyAlign) | visual | Start live-interactive mode for the selection
----------------------+--------+-----------------------------------------------------
2. Using :EasyAlign command~
*easy-align-2-using-easyalign-command*
*easy-align-5-2-2*
*:EasyAlign*
If you prefer command-line or do not want to start interactive mode, you can
use `:EasyAlign` command instead.
*:LiveEasyAlign*
-------------------------------------------+-----------------------------------------------
Mode | Command ~
-------------------------------------------+-----------------------------------------------
Interactive mode | `:EasyAlign[!] [OPTIONS]`
Live interactive mode | `:LiveEasyAlign[!] [...]`
Non-interactive mode (predefined rules) | `:EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]`
Non-interactive mode (regular expressions) | `:EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]`
-------------------------------------------+-----------------------------------------------
< Interactive mode >__________________________________________________________~
*easy-align-interactive-mode*
*easy-align-5-3*
The following sections will assume that you have <Plug>(EasyAlign) mappings in
your .vimrc as below:
>
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
<
With these mappings, you can align text with only a few keystrokes.
1. <Enter> key in visual mode, or `ga` followed by a motion or a text object to
start interactive mode
2. Optional: Enter keys to select alignment mode (left, right, or center)
3. Optional: N-th delimiter (default: 1)
- `1` Around the 1st occurrences of delimiters
- `2` Around the 2nd occurrences of delimiters
- ...
- `*` Around all occurrences of delimiters
- `**` Left-right alternating alignment around all delimiters
- `-` Around the last occurrences of delimiters (`-1`)
- `-2` Around the second to last occurrences of delimiters
- ...
4. Delimiter key (a single keystroke; <Space>, `=`, `:`, `.`, `|`, `&`, `#`, `,`)
Predefined alignment rules~
*easy-align-predefined-alignment-rules*
*easy-align-5-3-1*
--------------+--------------------------------------------------------------------
Delimiter key | Description/Use cases ~
--------------+--------------------------------------------------------------------
<Space> | General alignment around whitespaces
`=` | Operators containing equals sign ( `=` , `==,` `!=` , `+=` , `&&=` , ...)
`:` | Suitable for formatting JSON or YAML
`.` | Multi-line method chaining
`,` | Multi-line method arguments
`&` | LaTeX tables (matches `&` and `\\` )
`#` | Ruby/Python comments
`"` | Vim comments
<Bar> | Table markdown
--------------+--------------------------------------------------------------------
*g:easy_align_delimiters*
You can override these default rules or define your own rules with
`g:easy_align_delimiters`, which will be described in {the later section}{5}.
{5} https://github.com/junegunn/vim-easy-align#extending-alignment-rules
Examples~
*easy-align-examples*
*easy-align-5-3-2*
------------------+------------------------------------+--------------------
With visual map | Description | Equivalent command ~
------------------+------------------------------------+--------------------
<Enter><Space> | Around 1st whitespaces | :'<,'>EasyAlign\
<Enter>2<Space> | Around 2nd whitespaces | :'<,'>EasyAlign2\
<Enter>-<Space> | Around the last whitespaces | :'<,'>EasyAlign-\
<Enter>-2<Space> | Around the 2nd to last whitespaces | :'<,'>EasyAlign-2\
<Enter>: | Around 1st colon ( `key: value` ) | :'<,'>EasyAlign:
<Enter><Right>: | Around 1st colon ( `key : value` ) | :'<,'>EasyAlign:<l1
<Enter>= | Around 1st operators with = | :'<,'>EasyAlign=
<Enter>3= | Around 3rd operators with = | :'<,'>EasyAlign3=
<Enter>*= | Around all operators with = | :'<,'>EasyAlign*=
<Enter>**= | Left-right alternating around = | :'<,'>EasyAlign**=
<Enter><Enter>= | Right alignment around 1st = | :'<,'>EasyAlign!=
<Enter><Enter>**= | Right-left alternating around = | :'<,'>EasyAlign!**=
------------------+------------------------------------+--------------------
Using regular expressions~
*easy-align-using-regular-expressions*
*easy-align-5-3-3*
Instead of finishing the command with a predefined delimiter key, you can type
in a regular expression after CTRL-/ or CTRL-X key. For example, if you want
to align text around all occurrences of numbers:
- <Enter>
- `*`
- CTRL-X
- `[0-9]\+`
Alignment options in interactive mode~
*easy-align-alignment-options-in-interactive-mode*
*easy-align-5-3-4*
While in interactive mode, you can set alignment options using special
shortcut keys listed below. The meaning of each option will be described in
{the following sections}{6}.
--------+--------------------+---------------------------------------------------
Key | Option | Values ~
--------+--------------------+---------------------------------------------------
CTRL-F | `filter` | Input string ( `[gv]/.*/?` )
CTRL-I | `indentation` | shallow, deep, none, keep
CTRL-L | `left_margin` | Input number or string
CTRL-R | `right_margin` | Input number or string
CTRL-D | `delimiter_align` | left, center, right
CTRL-U | `ignore_unmatched` | 0, 1
CTRL-G | `ignore_groups` | [], ["String'], ["Comment'], ["String', "Comment']
CTRL-A | `align` | Input string ( `/[lrc]+\*{0,2}/` )
<Left> | `stick_to_left` | `{ 'stick_to_left': 1, 'left_margin': 0 }`
<Right> | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }`
<Down> | `*_margin` | `{ 'left_margin': 0, 'right_margin': 0 }`
--------+--------------------+---------------------------------------------------
{6} https://github.com/junegunn/vim-easy-align#alignment-options
< Live interactive mode >_____________________________________________________~
*easy-align-live-interactive-mode*
*easy-align-5-4*
If you're performing a complex alignment where multiple options should be
carefully adjusted, try "live interactive mode" where you can preview the
result of the alignment on-the-fly as you type in.
Live interactive mode can be started with either <Plug>(LiveEasyAlign) map or
`:LiveEasyAlign` command. Or you can switch to live interactive mode while in
ordinary interactive mode by pressing CTRL-P. (P for Preview)
In live interactive mode, you have to type in the same delimiter (or CTRL-X on
regular expression) again to finalize the alignment. This allows you to
preview the result of the alignment and freely change the delimiter using
backspace key without leaving the interactive mode.
< Non-interactive mode >______________________________________________________~
*easy-align-non-interactive-mode*
*easy-align-5-5*
Instead of starting interactive mode, you can use declarative, non-interactive
`:EasyAlign` command.
>
" Using predefined alignment rules
" :EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]
:EasyAlign :
:EasyAlign =
:EasyAlign *=
:EasyAlign 3\
" Using arbitrary regular expressions
" :EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]
:EasyAlign /[:;]\+/
:EasyAlign 2/[:;]\+/
:EasyAlign */[:;]\+/
:EasyAlign **/[:;]\+/
<
A command can end with alignment options, {each of which will be discussed in
detail later}{6}, in Vim dictionary format.
- `:EasyAlign * /[:;]\+/ { 'stick_to_left': 1, 'left_margin': 0 }`
`stick_to_left` of 1 means that the matched delimiter should be positioned
right next to the preceding token, and `left_margin` of 0 removes the margin
on the left. So we get:
>
apple;: banana:: cake
data;; exchange:; format
<
Option names are fuzzy-matched, so you can write as follows:
- `:EasyAlign * /[:;]\+/ { 'stl': 1, 'l': 0 }`
You can even omit spaces between the arguments, so concisely (or cryptically):
- `:EasyAlign*/[:;]\+/{'s':1,'l':0}`
Nice. But let's make it even shorter. Option values can be written in
shorthand notation.
- `:EasyAlign*/[:;]\+/<l0`
The following table summarizes the shorthand notation.
-------------------+-----------
Option | Expression~
-------------------+-----------
`filter` | `[gv]/.*/`
`left_margin` | `l[0-9]+`
`right_margin` | `r[0-9]+`
`stick_to_left` | `<` or `>`
`ignore_unmatched` | `iu[01]`
`ignore_groups` | `ig\[.*\]`
`align` | `a[lrc*]*`
`delimiter_align` | `d[lrc]`
`indentation` | `i[ksdn]`
-------------------+-----------
For your information, the same operation can be done in interactive mode as
follows:
- <Enter>
- `*`
- <Left>
- CTRL-X
- `[:;]\+`
{6} https://github.com/junegunn/vim-easy-align#alignment-options
< Partial alignment in blockwise-visual mode >________________________________~
*easy-align-partial-alignment-in-blockwise-visual-mode*
*easy-align-5-6*
In blockwise-visual mode (CTRL-V), EasyAlign command aligns only the selected
text in the block, instead of the whole lines in the range.
Consider the following case where you want to align text around `=>`
operators.
>
my_hash = { :a => 1,
:aa => 2,
:aaa => 3 }
<
In non-blockwise visual mode (`v` / `V`), <Enter>= won't work since the
assignment operator in the first line gets in the way. So we instead enter
blockwise-visual mode (CTRL-V), and select the text around`=>` operators, then
press <Enter>=.
>
my_hash = { :a => 1,
:aa => 2,
:aaa => 3 }
<
However, in this case, we don't really need blockwise visual mode since the
same can be easily done using the negative N-th parameter: <Enter>-=
*easy-align-6*
ALIGNMENT OPTIONS *easy-align-alignment-options*
==============================================================================
< List of options >___________________________________________________________~
*easy-align-list-of-options*
*easy-align-6-1*
-------------------+---------+-----------------------+--------------------------------------------------------
Option | Type | Default | Description ~
-------------------+---------+-----------------------+--------------------------------------------------------
`filter` | string | | Line filtering expression: `g/../` or `v/../`
`left_margin` | number | 1 | Number of spaces to attach before delimiter
`left_margin` | string | `' '` | String to attach before delimiter
`right_margin` | number | 1 | Number of spaces to attach after delimiter
`right_margin` | string | `' '` | String to attach after delimiter
`stick_to_left` | boolean | 0 | Whether to position delimiter on the left-side
`ignore_groups` | list | ["String', "Comment'] | Delimiters in these syntax highlight groups are ignored
`ignore_unmatched` | boolean | 1 | Whether to ignore lines without matching delimiter
`indentation` | string | `k` | Indentation method (keep, deep, shallow, none)
`delimiter_align` | string | `r` | Determines how to align delimiters of different lengths
`align` | string | `l` | Alignment modes for multiple occurrences of delimiters
-------------------+---------+-----------------------+--------------------------------------------------------
There are 4 ways to set alignment options (from lowest precedence to highest):
1. Some option values can be set with corresponding global variables
2. Option values can be specified in the definition of each alignment rule
3. Option values can be given as arguments to `:EasyAlign` command
4. Option values can be set in interactive mode using special shortcut keys
*g:easy_align_ignore_groups* *g:easy_align_ignore_unmatched*
*g:easy_align_indentation* *g:easy_align_delimiter_align*
-------------------+-----------------+-------------+--------------------------------
Option name | Shortcut key | Abbreviated | Global variable ~
-------------------+-----------------+-------------+--------------------------------
`filter` | CTRL-F | `[gv]/.*/` |
`left_margin` | CTRL-L | `l[0-9]+` |
`right_margin` | CTRL-R | `r[0-9]+` |
`stick_to_left` | <Left>, <Right> | `<` or `>` |
`ignore_groups` | CTRL-G | `ig\[.*\]` | `g:easy_align_ignore_groups`
`ignore_unmatched` | CTRL-U | `iu[01]` | `g:easy_align_ignore_unmatched`
`indentation` | CTRL-I | `i[ksdn]` | `g:easy_align_indentation`
`delimiter_align` | CTRL-D | `d[lrc]` | `g:easy_align_delimiter_align`
`align` | CTRL-A | `a[lrc*]*` |
-------------------+-----------------+-------------+--------------------------------
< Filtering lines >___________________________________________________________~
*easy-align-filtering-lines*
*easy-align-6-2*
With `filter` option, you can align lines that only match or do not match a
given pattern. There are several ways to set the pattern.
1. Press CTRL-F in interactive mode and type in `g/pat/` or `v/pat/`
2. In command-line, it can be written in dictionary format: `{'filter':
'g/pat/'}`
3. Or in shorthand notation: `g/pat/` or `v/pat/`
(You don't need to escape "/'s in the regular expression)
Examples~
*easy-align-6-2-1*
>
" Start interactive mode with filter option set to g/hello/
EasyAlign g/hello/
" Start live interactive mode with filter option set to v/goodbye/
LiveEasyAlign v/goodbye/
" Align the lines with 'hi' around the first colons
EasyAlign:g/hi/
<
< Ignoring delimiters in comments or strings >________________________________~
*easy-align-ignoring-delimiters-in-comments-or-strings*
*easy-align-6-3*
EasyAlign can be configured to ignore delimiters in certain syntax highlight
groups, such as code comments or strings. By default, delimiters that are
highlighted as code comments or strings are ignored.
>
" Default:
" If a delimiter is in a highlight group whose name matches
" any of the followings, it will be ignored.
let g:easy_align_ignore_groups = ['Comment', 'String']
<
For example, the following paragraph
>
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape:fruits: 3
'grape:fruits': 3
}
<
becomes as follows on <Enter>: (or `:EasyAlign:`)
>
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape:fruits: 3
'grape:fruits': 3
}
<
Naturally, this feature only works when syntax highlighting is enabled.
You can change the default rule by using one of these 4 methods.
1. Press CTRL-G in interactive mode to switch groups
2. Define global `g:easy_align_ignore_groups` list
3. Define a custom rule in `g:easy_align_delimiters` with `ignore_groups` option
4. Provide `ignore_groups` option to `:EasyAlign` command. e.g. `:EasyAlign:ig[]`
For example if you set `ignore_groups` option to be an empty list, you get
>
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape: fruits: 3
'grape: fruits': 3
}
<
If a pattern in `ignore_groups` is prepended by a `!`, it will have the
opposite meaning. For instance, if `ignore_groups` is given as `['!Comment']`,
delimiters that are not highlighted as Comment will be ignored during the
alignment.
< Ignoring unmatched lines >__________________________________________________~
*easy-align-ignoring-unmatched-lines*
*easy-align-6-4*
`ignore_unmatched` option determines how EasyAlign command processes lines
that do not have N-th delimiter.
1. In left-alignment mode, they are ignored
2. In right or center-alignment mode, they are not ignored, and the last tokens
from those lines are aligned as well as if there is an invisible trailing
delimiter at the end of each line
3. If `ignore_unmatched` is 1, they are ignored regardless of the alignment mode
4. If `ignore_unmatched` is 0, they are not ignored regardless of the mode
Let's take an example. When we align the following code block around the (1st)
colons,
>
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
<
this is usually what we want.
>
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
<
However, we can override this default behavior by setting `ignore_unmatched`
option to zero using one of the following methods.
1. Press CTRL-U in interactive mode to toggle `ignore_unmatched` option
2. Set the global `g:easy_align_ignore_unmatched` variable to 0
3. Define a custom alignment rule with `ignore_unmatched` option set to 0
4. Provide `ignore_unmatched` option to `:EasyAlign` command. e.g.
`:EasyAlign:iu0`
Then we get,
>
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
<
< Aligning delimiters of different lengths >__________________________________~
*easy-align-aligning-delimiters-of-different-lengths*
*easy-align-6-5*
Global `g:easy_align_delimiter_align` option and rule-wise/command-wise
`delimiter_align` option determines how matched delimiters of different
lengths are aligned.
>
apple = 1
banana += apple
cake ||= banana
<
By default, delimiters are right-aligned as follows.
>
apple = 1
banana += apple
cake ||= banana
<
However, with `:EasyAlign=dl`, delimiters are left-aligned.
>
apple = 1
banana += apple
cake ||= banana
<
And on `:EasyAlign=dc`, center-aligned.
>
apple = 1
banana += apple
cake ||= banana
<
In interactive mode, you can change the option value with CTRL-D key.
< Adjusting indentation >_____________________________________________________~
*easy-align-adjusting-indentation*
*easy-align-6-6*
By default :EasyAlign command keeps the original indentation of the lines. But
then again we have `indentation` option. See the following example.
>
# Lines with different indentation
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Default: _k_eep the original indentation
# :EasyAlign=
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Use the _s_hallowest indentation among the lines
# :EasyAlign=is
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Use the _d_eepest indentation among the lines
# :EasyAlign=id
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Indentation: _n_one
# :EasyAlign=in
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
<
In interactive mode, you can change the option value with CTRL-I key.
< Alignments over multiple occurrences of delimiters >________________________~
*easy-align-alignments-over-multiple-occurrences-of-delimiters*
*easy-align-6-7*
As stated above, "N-th" parameter is used to target specific occurrences of
the delimiter when it appears multiple times in each line.
To recap:
>
" Left-alignment around the FIRST occurrences of delimiters
:EasyAlign =
" Left-alignment around the SECOND occurrences of delimiters
:EasyAlign 2=
" Left-alignment around the LAST occurrences of delimiters
:EasyAlign -=
" Left-alignment around ALL occurrences of delimiters
:EasyAlign *=
" Left-right ALTERNATING alignment around all occurrences of delimiters
:EasyAlign **=
" Right-left ALTERNATING alignment around all occurrences of delimiters
:EasyAlign! **=
<
In addition to these, you can fine-tune alignments over multiple occurrences
of the delimiters with "align' option. (The option can also be set in
interactive mode with the special key CTRL-A)
>
" Left alignment over the first two occurrences of delimiters
:EasyAlign = { 'align': 'll' }
" Right, left, center alignment over the 1st to 3rd occurrences of delimiters
:EasyAlign = { 'a': 'rlc' }
" Using shorthand notation
:EasyAlign = arlc
" Right, left, center alignment over the 2nd to 4th occurrences of delimiters
:EasyAlign 2=arlc
" (*) Repeating alignments (default: l, r, or c)
" Right, left, center, center, center, center, ...
:EasyAlign *=arlc
" (**) Alternating alignments (default: lr or rl)
" Right, left, center, right, left, center, ...
:EasyAlign **=arlc
" Right, left, center, center, center, ... repeating alignment
" over the 3rd to the last occurrences of delimiters
:EasyAlign 3=arlc*
" Right, left, center, right, left, center, ... alternating alignment
" over the 3rd to the last occurrences of delimiters
:EasyAlign 3=arlc**
<
< Extending alignment rules >_________________________________________________~
*easy-align-extending-alignment-rules*
*easy-align-6-8*
Although the default rules should cover the most of the use cases, you can
extend the rules by setting a dictionary named `g:easy_align_delimiters`.
You may refer to the definitions of the default alignment rules {here}{7}.
{7} https://github.com/junegunn/vim-easy-align/blob/2.9.6/autoload/easy_align.vim#L32-L46
Examples~
*easy-align-6-8-1*
>
let g:easy_align_delimiters = {
\ '>': { 'pattern': '>>\|=>\|>' },
\ '/': {
\ 'pattern': '//\+\|/\*\|\*/',
\ 'delimiter_align': 'l',
\ 'ignore_groups': ['!Comment'] },
\ ']': {
\ 'pattern': '[[\]]',
\ 'left_margin': 0,
\ 'right_margin': 0,
\ 'stick_to_left': 0
\ },
\ ')': {
\ 'pattern': '[()]',
\ 'left_margin': 0,
\ 'right_margin': 0,
\ 'stick_to_left': 0
\ },
\ 'd': {
\ 'pattern': ' \(\S\+\s*[;=]\)\@=',
\ 'left_margin': 0,
\ 'right_margin': 0
\ }
\ }
<
*easy-align-7*
OTHER OPTIONS *easy-align-other-options*
==============================================================================
< Disabling &foldmethod during alignment >____________________________________~
*easy-align-disabling-foldmethod-during-alignment*
*easy-align-7-1*
*g:easy_align_bypass_fold*
{It is reported}{8} that 'foldmethod' value of `expr` or `syntax` can
significantly slow down the alignment when editing a large, complex file with
many folds. To alleviate this issue, EasyAlign provides an option to
temporarily set 'foldmethod' to `manual` during the alignment task. In order
to enable this feature, set `g:easy_align_bypass_fold` switch to 1.
>
let g:easy_align_bypass_fold = 1
<
{8} https://github.com/junegunn/vim-easy-align/issues/14
< Left/right/center mode switch in interactive mode >_________________________~
*easy-align-left-right-center-mode-switch-in-interactive-mode*
*easy-align-7-2*
In interactive mode, you can choose the alignment mode you want by pressing
enter keys. The non-bang command, `:EasyAlign` starts in left-alignment mode
and changes to right and center mode as you press enter keys, while the bang
version first starts in right-alignment mode.
- `:EasyAlign`
- Left, Right, Center
- `:EasyAlign!`
- Right, Left, Center
If you do not prefer this default mode transition, you can define your own
settings as follows.
*g:easy_align_interactive_modes* *g:easy_align_bang_interactive_modes*
>
let g:easy_align_interactive_modes = ['l', 'r']
let g:easy_align_bang_interactive_modes = ['c', 'r']
<
*easy-align-8*
ADVANCED EXAMPLES AND USE CASES *easy-align-advanced-examples-and-use-cases*
==============================================================================
See {EXAMPLES.md}{9} for more examples.
{9} https://github.com/junegunn/vim-easy-align/blob/master/EXAMPLES.md
*easy-align-9*
RELATED WORK *easy-align-related-work*
==============================================================================
- {DrChip's Alignment Tool for Vim}{10}
- {Tabular}{11}
{10} http://www.drchip.org/astronaut/vim/align.html
{11} https://github.com/godlygeek/tabular
*easy-align-10*
AUTHOR *easy-align-author*
==============================================================================
{Junegunn Choi}{12}
{12} https://github.com/junegunn
*easy-align-11*
LICENSE *easy-align-license*
==============================================================================
MIT
==============================================================================
vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:

View File

@ -1,84 +0,0 @@
:EasyAlign easy_align.txt /*:EasyAlign*
:LiveEasyAlign easy_align.txt /*:LiveEasyAlign*
<Plug>(EasyAlign) easy_align.txt /*<Plug>(EasyAlign)*
<Plug>(LiveEasyAlign) easy_align.txt /*<Plug>(LiveEasyAlign)*
easy-align easy_align.txt /*easy-align*
easy-align-1 easy_align.txt /*easy-align-1*
easy-align-1-using-plug-mappings easy_align.txt /*easy-align-1-using-plug-mappings*
easy-align-10 easy_align.txt /*easy-align-10*
easy-align-11 easy_align.txt /*easy-align-11*
easy-align-2 easy_align.txt /*easy-align-2*
easy-align-2-using-easyalign-command easy_align.txt /*easy-align-2-using-easyalign-command*
easy-align-3 easy_align.txt /*easy-align-3*
easy-align-4 easy_align.txt /*easy-align-4*
easy-align-5 easy_align.txt /*easy-align-5*
easy-align-5-1 easy_align.txt /*easy-align-5-1*
easy-align-5-2 easy_align.txt /*easy-align-5-2*
easy-align-5-2-1 easy_align.txt /*easy-align-5-2-1*
easy-align-5-2-2 easy_align.txt /*easy-align-5-2-2*
easy-align-5-3 easy_align.txt /*easy-align-5-3*
easy-align-5-3-1 easy_align.txt /*easy-align-5-3-1*
easy-align-5-3-2 easy_align.txt /*easy-align-5-3-2*
easy-align-5-3-3 easy_align.txt /*easy-align-5-3-3*
easy-align-5-3-4 easy_align.txt /*easy-align-5-3-4*
easy-align-5-4 easy_align.txt /*easy-align-5-4*
easy-align-5-5 easy_align.txt /*easy-align-5-5*
easy-align-5-6 easy_align.txt /*easy-align-5-6*
easy-align-6 easy_align.txt /*easy-align-6*
easy-align-6-1 easy_align.txt /*easy-align-6-1*
easy-align-6-2 easy_align.txt /*easy-align-6-2*
easy-align-6-2-1 easy_align.txt /*easy-align-6-2-1*
easy-align-6-3 easy_align.txt /*easy-align-6-3*
easy-align-6-4 easy_align.txt /*easy-align-6-4*
easy-align-6-5 easy_align.txt /*easy-align-6-5*
easy-align-6-6 easy_align.txt /*easy-align-6-6*
easy-align-6-7 easy_align.txt /*easy-align-6-7*
easy-align-6-8 easy_align.txt /*easy-align-6-8*
easy-align-6-8-1 easy_align.txt /*easy-align-6-8-1*
easy-align-7 easy_align.txt /*easy-align-7*
easy-align-7-1 easy_align.txt /*easy-align-7-1*
easy-align-7-2 easy_align.txt /*easy-align-7-2*
easy-align-8 easy_align.txt /*easy-align-8*
easy-align-9 easy_align.txt /*easy-align-9*
easy-align-adjusting-indentation easy_align.txt /*easy-align-adjusting-indentation*
easy-align-advanced-examples-and-use-cases easy_align.txt /*easy-align-advanced-examples-and-use-cases*
easy-align-aligning-delimiters-of-different-lengths easy_align.txt /*easy-align-aligning-delimiters-of-different-lengths*
easy-align-alignment-options easy_align.txt /*easy-align-alignment-options*
easy-align-alignment-options-in-interactive-mode easy_align.txt /*easy-align-alignment-options-in-interactive-mode*
easy-align-alignments-over-multiple-occurrences-of-delimiters easy_align.txt /*easy-align-alignments-over-multiple-occurrences-of-delimiters*
easy-align-author easy_align.txt /*easy-align-author*
easy-align-concept-of-alignment-rule easy_align.txt /*easy-align-concept-of-alignment-rule*
easy-align-demo easy_align.txt /*easy-align-demo*
easy-align-disabling-foldmethod-during-alignment easy_align.txt /*easy-align-disabling-foldmethod-during-alignment*
easy-align-examples easy_align.txt /*easy-align-examples*
easy-align-execution-models easy_align.txt /*easy-align-execution-models*
easy-align-extending-alignment-rules easy_align.txt /*easy-align-extending-alignment-rules*
easy-align-features easy_align.txt /*easy-align-features*
easy-align-filtering-lines easy_align.txt /*easy-align-filtering-lines*
easy-align-ignoring-delimiters-in-comments-or-strings easy_align.txt /*easy-align-ignoring-delimiters-in-comments-or-strings*
easy-align-ignoring-unmatched-lines easy_align.txt /*easy-align-ignoring-unmatched-lines*
easy-align-installation easy_align.txt /*easy-align-installation*
easy-align-interactive-mode easy_align.txt /*easy-align-interactive-mode*
easy-align-left-right-center-mode-switch-in-interactive-mode easy_align.txt /*easy-align-left-right-center-mode-switch-in-interactive-mode*
easy-align-license easy_align.txt /*easy-align-license*
easy-align-list-of-options easy_align.txt /*easy-align-list-of-options*
easy-align-live-interactive-mode easy_align.txt /*easy-align-live-interactive-mode*
easy-align-non-interactive-mode easy_align.txt /*easy-align-non-interactive-mode*
easy-align-other-options easy_align.txt /*easy-align-other-options*
easy-align-partial-alignment-in-blockwise-visual-mode easy_align.txt /*easy-align-partial-alignment-in-blockwise-visual-mode*
easy-align-predefined-alignment-rules easy_align.txt /*easy-align-predefined-alignment-rules*
easy-align-related-work easy_align.txt /*easy-align-related-work*
easy-align-tldr-one-minute-guide easy_align.txt /*easy-align-tldr-one-minute-guide*
easy-align-toc easy_align.txt /*easy-align-toc*
easy-align-usage easy_align.txt /*easy-align-usage*
easy-align-using-regular-expressions easy_align.txt /*easy-align-using-regular-expressions*
easyalign easy_align.txt /*easyalign*
g:easy_align_bang_interactive_modes easy_align.txt /*g:easy_align_bang_interactive_modes*
g:easy_align_bypass_fold easy_align.txt /*g:easy_align_bypass_fold*
g:easy_align_delimiter_align easy_align.txt /*g:easy_align_delimiter_align*
g:easy_align_delimiters easy_align.txt /*g:easy_align_delimiters*
g:easy_align_ignore_groups easy_align.txt /*g:easy_align_ignore_groups*
g:easy_align_ignore_unmatched easy_align.txt /*g:easy_align_ignore_unmatched*
g:easy_align_indentation easy_align.txt /*g:easy_align_indentation*
g:easy_align_interactive_modes easy_align.txt /*g:easy_align_interactive_modes*
vim-easy-align easy_align.txt /*vim-easy-align*

View File

@ -1,142 +0,0 @@
" Copyright (c) 2014 Junegunn Choi
"
" MIT License
"
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be
" included in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
if exists("g:loaded_easy_align_plugin")
finish
endif
let g:loaded_easy_align_plugin = 1
command! -nargs=* -range -bang EasyAlign <line1>,<line2>call easy_align#align(<bang>0, 0, 'command', <q-args>)
command! -nargs=* -range -bang LiveEasyAlign <line1>,<line2>call easy_align#align(<bang>0, 1, 'command', <q-args>)
let s:last_command = 'EasyAlign'
function! s:abs(v)
return a:v >= 0 ? a:v : - a:v
endfunction
function! s:remember_visual(mode)
let s:last_visual = [a:mode, s:abs(line("'>") - line("'<")), s:abs(col("'>") - col("'<"))]
endfunction
function! s:repeat_visual()
let [mode, ldiff, cdiff] = s:last_visual
let cmd = 'normal! '.mode
if ldiff > 0
let cmd .= ldiff . 'j'
endif
let ve_save = &virtualedit
try
if mode == "\<C-V>"
if cdiff > 0
let cmd .= cdiff . 'l'
endif
set virtualedit+=block
endif
execute cmd.":\<C-r>=g:easy_align_last_command\<Enter>\<Enter>"
call s:set_repeat()
finally
if ve_save != &virtualedit
let &virtualedit = ve_save
endif
endtry
endfunction
function! s:repeat_in_visual()
if exists('g:easy_align_last_command')
call s:remember_visual(visualmode())
call s:repeat_visual()
endif
endfunction
function! s:set_repeat()
silent! call repeat#set("\<Plug>(EasyAlignRepeat)")
endfunction
function! s:generic_easy_align_op(type, vmode, live)
if !&modifiable
if a:vmode
normal! gv
endif
return
endif
let sel_save = &selection
let &selection = "inclusive"
if a:vmode
let vmode = a:type
let [l1, l2] = ["'<", "'>"]
call s:remember_visual(vmode)
else
let vmode = ''
let [l1, l2] = [line("'["), line("']")]
unlet! s:last_visual
endif
try
let range = l1.','.l2
if get(g:, 'easy_align_need_repeat', 0)
execute range . g:easy_align_last_command
else
execute range . "call easy_align#align(0, a:live, vmode, '')"
end
call s:set_repeat()
finally
let &selection = sel_save
endtry
endfunction
function! s:easy_align_op(type, ...)
call s:generic_easy_align_op(a:type, a:0, 0)
endfunction
function! s:live_easy_align_op(type, ...)
call s:generic_easy_align_op(a:type, a:0, 1)
endfunction
function! s:easy_align_repeat()
if exists('s:last_visual')
call s:repeat_visual()
else
try
let g:easy_align_need_repeat = 1
normal! .
finally
unlet! g:easy_align_need_repeat
endtry
endif
endfunction
nnoremap <silent> <Plug>(EasyAlign) :set opfunc=<SID>easy_align_op<Enter>g@
vnoremap <silent> <Plug>(EasyAlign) :<C-U>call <SID>easy_align_op(visualmode(), 1)<Enter>
nnoremap <silent> <Plug>(LiveEasyAlign) :set opfunc=<SID>live_easy_align_op<Enter>g@
vnoremap <silent> <Plug>(LiveEasyAlign) :<C-U>call <SID>live_easy_align_op(visualmode(), 1)<Enter>
" vim-repeat support
nnoremap <silent> <Plug>(EasyAlignRepeat) :call <SID>easy_align_repeat()<Enter>
vnoremap <silent> <Plug>(EasyAlignRepeat) :<C-U>call <SID>repeat_in_visual()<Enter>
" Backward-compatibility (deprecated)
nnoremap <silent> <Plug>(EasyAlignOperator) :set opfunc=<SID>easy_align_op<Enter>g@

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2021 Junegunn Choi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,443 +0,0 @@
fzf :heart: vim
===============
Things you can do with [fzf][fzf] and Vim.
Rationale
---------
[fzf][fzf] itself is not a Vim plugin, and the official repository only
provides the [basic wrapper function][run] for Vim. It's up to the users to
write their own Vim commands with it. However, I've learned that many users of
fzf are not familiar with Vimscript and are looking for the "default"
implementation of the features they can find in the alternative Vim plugins.
Why you should use fzf on Vim
-----------------------------
Because you can and you love fzf.
fzf runs asynchronously and can be orders of magnitude faster than similar Vim
plugins. However, the benefit may not be noticeable if the size of the input
is small, which is the case for many of the commands provided here.
Nevertheless I wrote them anyway since it's really easy to implement custom
selector with fzf.
Installation
------------
fzf.vim depends on the basic Vim plugin of [the main fzf
repository][fzf-main], which means you need to **set up both "fzf" and
"fzf.vim" on Vim**. To learn more about fzf/Vim integration, see
[README-VIM][README-VIM].
[fzf-main]: https://github.com/junegunn/fzf
[README-VIM]: https://github.com/junegunn/fzf/blob/master/README-VIM.md
### Using [vim-plug](https://github.com/junegunn/vim-plug)
```vim
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
```
`fzf#install()` makes sure that you have the latest binary, but it's optional,
so you can omit it if you use a plugin manager that doesn't support hooks.
### Dependencies
- [fzf][fzf-main] 0.41.1 or above
- For syntax-highlighted preview, install [bat](https://github.com/sharkdp/bat)
- If [delta](https://github.com/dandavison/delta) is available, `GF?`,
`Commits` and `BCommits` will use it to format `git diff` output.
- `Ag` requires [The Silver Searcher (ag)][ag]
- `Rg` requires [ripgrep (rg)][rg]
- `Tags` and `Helptags` require Perl
Commands
--------
| Command | List |
| --- | --- |
| `:Files [PATH]` | Files (runs `$FZF_DEFAULT_COMMAND` if defined) |
| `:GFiles [OPTS]` | Git files (`git ls-files`) |
| `:GFiles?` | Git files (`git status`) |
| `:Buffers` | Open buffers |
| `:Colors` | Color schemes |
| `:Ag [PATTERN]` | [ag][ag] search result (`ALT-A` to select all, `ALT-D` to deselect all) |
| `:Rg [PATTERN]` | [rg][rg] search result (`ALT-A` to select all, `ALT-D` to deselect all) |
| `:RG [PATTERN]` | [rg][rg] search result; relaunch ripgrep on every keystroke |
| `:Lines [QUERY]` | Lines in loaded buffers |
| `:BLines [QUERY]` | Lines in the current buffer |
| `:Tags [QUERY]` | Tags in the project (`ctags -R`) |
| `:BTags [QUERY]` | Tags in the current buffer |
| `:Changes` | Changelist across all open buffers |
| `:Marks` | Marks |
| `:Jumps` | Jumps |
| `:Windows` | Windows |
| `:Locate PATTERN` | `locate` command output |
| `:History` | `v:oldfiles` and open buffers |
| `:History:` | Command history |
| `:History/` | Search history |
| `:Snippets` | Snippets ([UltiSnips][us]) |
| `:Commits [LOG_OPTS]` | Git commits (requires [fugitive.vim][f]) |
| `:BCommits [LOG_OPTS]` | Git commits for the current buffer; visual-select lines to track changes in the range |
| `:Commands` | Commands |
| `:Maps` | Normal mode mappings |
| `:Helptags` | Help tags <sup id="a1">[1](#helptags)</sup> |
| `:Filetypes` | File types
- Most commands support `CTRL-T` / `CTRL-X` / `CTRL-V` key
bindings to open in a new tab, a new split, or in a new vertical split
- Bang-versions of the commands (e.g. `Ag!`) will open fzf in fullscreen
- You can set `g:fzf_vim.command_prefix` to give the same prefix to the commands
- e.g. `let g:fzf_vim.command_prefix = 'Fzf'` and you have `FzfFiles`, etc.
(<a name="helptags">1</a>: `Helptags` will shadow the command of the same name
from [pathogen][pat]. But its functionality is still available via `call
pathogen#helptags()`. [](#a1))
[pat]: https://github.com/tpope/vim-pathogen
[f]: https://github.com/tpope/vim-fugitive
Customization
-------------
### Configuration options of the base plugin
Every command in fzf.vim internally calls `fzf#wrap` function of the main
repository which supports a set of global option variables. So please read
through [README-VIM][README-VIM] to learn more about them.
### Configuration options for fzf.vim
All configuration values for this plugin are stored in `g:fzf_vim` dictionary,
so **make sure to initialize it before assigning any configuration values to
it**.
```vim
" Initialize configuration dictionary
let g:fzf_vim = {}
```
#### Preview window
Some commands will show the preview window on the right. You can customize the
behavior with `g:fzf_vim.preview_window`. Here are some examples:
```vim
" This is the default option:
" - Preview window on the right with 50% width
" - CTRL-/ will toggle preview window.
" - Note that this array is passed as arguments to fzf#vim#with_preview function.
" - To learn more about preview window options, see `--preview-window` section of `man fzf`.
let g:fzf_vim.preview_window = ['right,50%', 'ctrl-/']
" Preview window is hidden by default. You can toggle it with ctrl-/.
" It will show on the right with 50% width, but if the width is smaller
" than 70 columns, it will show above the candidate list
let g:fzf_vim.preview_window = ['hidden,right,50%,<70(up,40%)', 'ctrl-/']
" Empty value to disable preview window altogether
let g:fzf_vim.preview_window = []
" fzf.vim needs bash to display the preview window.
" On Windows, fzf.vim will first see if bash is in $PATH, then if
" Git bash (C:\Program Files\Git\bin\bash.exe) is available.
" If you want it to use a different bash, set this variable.
" let g:fzf_vim = {}
" let g:fzf_vim.preview_bash = 'C:\Git\bin\bash.exe'
```
#### Command-level options
```vim
" [Buffers] Jump to the existing window if possible
let g:fzf_vim.buffers_jump = 1
" [[B]Commits] Customize the options used by 'git log':
let g:fzf_vim.commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
" [Tags] Command to generate tags file
let g:fzf_vim.tags_command = 'ctags -R'
" [Commands] --expect expression for directly executing the command
let g:fzf_vim.commands_expect = 'alt-enter,ctrl-x'
```
#### List type to handle multiple selections
The following commands will fill the quickfix list when multiple entries are
selected.
* `Ag`
* `Rg` / `RG`
* `Lines` / `BLines`
* `Tags` / `BTags`
By setting `g:fzf_vim.listproc`, you can make them use location list instead.
```vim
" Default: Use quickfix list
let g:fzf_vim.listproc = { list -> fzf#vim#listproc#quickfix(list) }
" Use location list instead of quickfix list
let g:fzf_vim.listproc = { list -> fzf#vim#listproc#location(list) }
```
You can customize the list type per command by defining variables named
`g:fzf_vim.listproc_{command_name_in_lowercase}`.
```vim
" Command-wise customization
let g:fzf_vim.listproc_ag = { list -> fzf#vim#listproc#quickfix(list) }
let g:fzf_vim.listproc_rg = { list -> fzf#vim#listproc#location(list) }
```
You can further customize the behavior by providing a custom function to
process the list instead of using the predefined `fzf#vim#listproc#quickfix`
or `fzf#vim#listproc#location`.
```vim
" A customized version of fzf#vim#listproc#quickfix.
" The last two lines are commented out not to move to the first entry.
function! g:fzf_vim.listproc(list)
call setqflist(a:list)
copen
wincmd p
" cfirst
" normal! zvzz
endfunction
```
### Advanced customization
#### Vim functions
Each command in fzf.vim is backed by a Vim function. You can override
a command or define a variation of it by calling its corresponding function.
| Command | Vim function |
| --- | --- |
| `Files` | `fzf#vim#files(dir, [spec dict], [fullscreen bool])` |
| `GFiles` | `fzf#vim#gitfiles(git_options, [spec dict], [fullscreen bool])` |
| `GFiles?` | `fzf#vim#gitfiles('?', [spec dict], [fullscreen bool])` |
| `Buffers` | `fzf#vim#buffers([query string], [bufnrs list], [spec dict], [fullscreen bool])` |
| `Colors` | `fzf#vim#colors([spec dict], [fullscreen bool])` |
| `Rg` | `fzf#vim#grep(command, [spec dict], [fullscreen bool])` |
| `RG` | `fzf#vim#grep2(command_prefix, query, [spec dict], [fullscreen bool])` |
| ... | ... |
(We can see that the last two optional arguments of each function are
identical. They are directly passed to `fzf#wrap` function. If you haven't
read [README-VIM][README-VIM] already, please read it before proceeding.)
#### Example: Customizing `Files` command
This is the default definition of `Files` command:
```vim
command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, <bang>0)
```
Let's say you want to a variation of it called `ProjectFiles` that only
searches inside `~/projects` directory. Then you can do it like this:
```vim
command! -bang ProjectFiles call fzf#vim#files('~/projects', <bang>0)
```
Or, if you want to override the command with different fzf options, just pass
a custom spec to the function.
```vim
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline']}, <bang>0)
```
Want a preview window?
```vim
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline', '--preview', 'cat {}']}, <bang>0)
```
It kind of works, but you probably want a nicer previewer program than `cat`.
fzf.vim ships [a versatile preview script](bin/preview.sh) you can readily
use. It internally executes [bat](https://github.com/sharkdp/bat) for syntax
highlighting, so make sure to install it.
```vim
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh {}']}, <bang>0)
```
However, it's not ideal to hard-code the path to the script which can be
different in different circumstances. So in order to make it easier to set up
the previewer, fzf.vim provides `fzf#vim#with_preview` helper function.
Similarly to `fzf#wrap`, it takes a spec dictionary and returns a copy of it
with additional preview options.
```vim
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0)
```
You can just omit the spec argument if you only want the previewer.
```vim
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
```
#### Example: `git grep` wrapper
The following example implements `GGrep` command that works similarly to
predefined `Ag` or `Rg` using `fzf#vim#grep`.
- We set the base directory to git root by setting `dir` attribute in spec
dictionary.
- [The preview script](bin/preview.sh) supports `grep` format
(`FILE_PATH:LINE_NO:...`), so we can just wrap the spec with
`fzf#vim#with_preview` as before to enable previewer.
```vim
command! -bang -nargs=* GGrep
\ call fzf#vim#grep(
\ 'git grep --line-number -- '.fzf#shellescape(<q-args>),
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
```
Mappings
--------
| Mapping | Description |
| --- | --- |
| `<plug>(fzf-maps-n)` | Normal mode mappings |
| `<plug>(fzf-maps-i)` | Insert mode mappings |
| `<plug>(fzf-maps-x)` | Visual mode mappings |
| `<plug>(fzf-maps-o)` | Operator-pending mappings |
| `<plug>(fzf-complete-word)` | `cat /usr/share/dict/words` |
| `<plug>(fzf-complete-path)` | Path completion using `find` (file + dir) |
| `<plug>(fzf-complete-file)` | File completion using `find` |
| `<plug>(fzf-complete-line)` | Line completion (all open buffers) |
| `<plug>(fzf-complete-buffer-line)` | Line completion (current buffer only) |
```vim
" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-l> <plug>(fzf-complete-line)
```
Completion functions
--------------------
| Function | Description |
| --- | --- |
| `fzf#vim#complete#path(command, [spec])` | Path completion |
| `fzf#vim#complete#word([spec])` | Word completion |
| `fzf#vim#complete#line([spec])` | Line completion (all open buffers) |
| `fzf#vim#complete#buffer_line([spec])` | Line completion (current buffer only) |
```vim
" Path completion with custom source command
inoremap <expr> <c-x><c-f> fzf#vim#complete#path('fd')
inoremap <expr> <c-x><c-f> fzf#vim#complete#path('rg --files')
" Word completion with custom spec with popup layout option
inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'window': { 'width': 0.2, 'height': 0.9, 'xoffset': 1 }})
```
Custom completion
-----------------
`fzf#vim#complete` is a helper function for creating custom fuzzy completion
using fzf. If the first parameter is a command string or a Vim list, it will
be used as the source.
```vim
" Replace the default dictionary completion with fzf-based fuzzy completion
inoremap <expr> <c-x><c-k> fzf#vim#complete('cat /usr/share/dict/words')
```
For advanced uses, you can pass an options dictionary to the function. The set
of options is pretty much identical to that for `fzf#run` only with the
following exceptions:
- `reducer` (funcref)
- Reducer transforms the output lines of fzf into a single string value
- `prefix` (string or funcref; default: `\k*$`)
- Regular expression pattern to extract the completion prefix
- Or a function to extract completion prefix
- Both `source` and `options` can be given as funcrefs that take the
completion prefix as the argument and return the final value
- `sink` or `sink*` are ignored
```vim
" Global line completion (not just open buffers. ripgrep required.)
inoremap <expr> <c-x><c-l> fzf#vim#complete(fzf#wrap({
\ 'prefix': '^.*$',
\ 'source': 'rg -n ^ --color always',
\ 'options': '--ansi --delimiter : --nth 3..',
\ 'reducer': { lines -> join(split(lines[0], ':\zs')[2:], '') }}))
```
### Reducer example
```vim
function! s:make_sentence(lines)
return substitute(join(a:lines), '^.', '\=toupper(submatch(0))', '').'.'
endfunction
inoremap <expr> <c-x><c-s> fzf#vim#complete({
\ 'source': 'cat /usr/share/dict/words',
\ 'reducer': function('<sid>make_sentence'),
\ 'options': '--multi --reverse --margin 15%,0',
\ 'left': 20})
```
Status line of terminal buffer
------------------------------
When fzf starts in a terminal buffer (see [fzf/README-VIM.md][termbuf]), you
may want to customize the statusline of the containing buffer.
[termbuf]: https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzf-inside-terminal-buffer
### Hide statusline
```vim
autocmd! FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
```
### Custom statusline
```vim
function! s:fzf_statusline()
" Override statusline as you like
highlight fzf1 ctermfg=161 ctermbg=251
highlight fzf2 ctermfg=23 ctermbg=251
highlight fzf3 ctermfg=237 ctermbg=251
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction
autocmd! User FzfStatusLine call <SID>fzf_statusline()
```
License
-------
MIT
[fzf]: https://github.com/junegunn/fzf
[run]: https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzfrun
[ag]: https://github.com/ggreer/the_silver_searcher
[rg]: https://github.com/BurntSushi/ripgrep
[us]: https://github.com/SirVer/ultisnips

File diff suppressed because it is too large Load Diff

View File

@ -1,164 +0,0 @@
" Copyright (c) 2015 Junegunn Choi
"
" MIT License
"
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be
" included in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
let s:cpo_save = &cpo
set cpo&vim
let s:is_win = has('win32') || has('win64')
function! s:extend(base, extra)
let base = copy(a:base)
if has_key(a:extra, 'options')
let extra = copy(a:extra)
let extra.extra_options = remove(extra, 'options')
return extend(base, extra)
endif
return extend(base, a:extra)
endfunction
if v:version >= 704
function! s:function(name)
return function(a:name)
endfunction
else
function! s:function(name)
" By Ingo Karkat
return function(substitute(a:name, '^s:', matchstr(expand('<sfile>'), '<SNR>\d\+_\zefunction$'), ''))
endfunction
endif
function! fzf#vim#complete#word(...)
let sources = empty(&dictionary) ? ['/usr/share/dict/words'] : split(&dictionary, ',')
return fzf#vim#complete(s:extend({
\ 'source': 'cat ' . join(map(sources, 'fzf#shellescape(v:val)'))},
\ get(a:000, 0, fzf#wrap())))
endfunction
" ----------------------------------------------------------------------------
" <plug>(fzf-complete-path)
" <plug>(fzf-complete-file)
" <plug>(fzf-complete-file-ag)
" ----------------------------------------------------------------------------
function! s:file_split_prefix(prefix)
let expanded = expand(a:prefix)
let slash = (s:is_win && !&shellslash) ? '\\' : '/'
return isdirectory(expanded) ?
\ [expanded,
\ substitute(a:prefix, '[/\\]*$', slash, ''),
\ ''] :
\ [fnamemodify(expanded, ':h'),
\ substitute(fnamemodify(a:prefix, ':h'), '[/\\]*$', slash, ''),
\ fnamemodify(expanded, ':t')]
endfunction
function! s:file_source(prefix)
let [dir, head, tail] = s:file_split_prefix(a:prefix)
return printf(
\ "cd %s && ".s:file_cmd." | sed %s",
\ fzf#shellescape(dir), fzf#shellescape('s:^:'.(empty(a:prefix) || a:prefix == tail ? '' : head).':'))
endfunction
function! s:file_options(prefix)
let [_, head, tail] = s:file_split_prefix(a:prefix)
return ['--prompt', head, '--query', tail]
endfunction
function! s:fname_prefix(str)
let isf = &isfname
let white = []
let black = []
if isf =~ ',,,'
call add(white, ',')
let isf = substitute(isf, ',,,', ',', 'g')
endif
if isf =~ ',^,,'
call add(black, ',')
let isf = substitute(isf, ',^,,', ',', 'g')
endif
for token in split(isf, ',')
let target = white
if token[0] == '^'
let target = black
let token = token[1:]
endif
let ends = matchlist(token, '\(.\+\)-\(.\+\)')
if empty(ends)
call add(target, token)
else
let ends = map(ends[1:2], "len(v:val) == 1 ? char2nr(v:val) : str2nr(v:val)")
for i in range(ends[0], ends[1])
call add(target, nr2char(i))
endfor
endif
endfor
let prefix = a:str
for offset in range(1, len(a:str))
let char = a:str[len(a:str) - offset]
if (char =~ '\w' || index(white, char) >= 0) && index(black, char) < 0
continue
endif
let prefix = strpart(a:str, len(a:str) - offset + 1)
break
endfor
return prefix
endfunction
function! fzf#vim#complete#path(command, ...)
let s:file_cmd = a:command
return fzf#vim#complete(s:extend({
\ 'prefix': s:function('s:fname_prefix'),
\ 'source': s:function('s:file_source'),
\ 'options': s:function('s:file_options')}, get(a:000, 0, fzf#wrap())))
endfunction
" ----------------------------------------------------------------------------
" <plug>(fzf-complete-line)
" <plug>(fzf-complete-buffer-line)
" ----------------------------------------------------------------------------
function! s:reduce_line(lines)
return join(split(a:lines[0], '\t\zs')[3:], '')
endfunction
function! fzf#vim#complete#line(...)
let [display_bufnames, lines] = fzf#vim#_lines(0)
let nth = display_bufnames ? 4 : 3
return fzf#vim#complete(s:extend({
\ 'prefix': '^.*$',
\ 'source': lines,
\ 'options': '--tiebreak=index --ansi --nth '.nth.'.. --tabstop=1',
\ 'reducer': s:function('s:reduce_line')}, get(a:000, 0, fzf#wrap())))
endfunction
function! fzf#vim#complete#buffer_line(...)
return fzf#vim#complete(s:extend({
\ 'prefix': '^.*$',
\ 'source': fzf#vim#_uniq(getline(1, '$'))}, get(a:000, 0, fzf#wrap())))
endfunction
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -1,38 +0,0 @@
" Copyright (c) 2023 Junegunn Choi
"
" MIT License
"
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be
" included in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
function! fzf#vim#listproc#quickfix(list)
call setqflist(a:list)
copen
wincmd p
cfirst
normal! zvzz
endfunction
function! fzf#vim#listproc#location(list)
call setloclist(0, a:list)
lopen
wincmd p
lfirst
normal! zvzz
endfunction

View File

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
puts 'preview.rb is deprecated. Use preview.sh instead.'

View File

@ -1,86 +0,0 @@
#!/usr/bin/env bash
REVERSE="\x1b[7m"
RESET="\x1b[m"
if [[ $# -lt 1 ]]; then
echo "usage: $0 [--tag] FILENAME[:LINENO][:IGNORED]"
exit 1
fi
if [[ $1 = --tag ]]; then
shift
"$(dirname "${BASH_SOURCE[0]}")/tagpreview.sh" "$@"
exit $?
fi
# Ignore if an empty path is given
[[ -z $1 ]] && exit
IFS=':' read -r -a INPUT <<< "$1"
FILE=${INPUT[0]}
CENTER=${INPUT[1]}
if [[ "$1" =~ ^[A-Za-z]:\\ ]]; then
FILE=$FILE:${INPUT[1]}
CENTER=${INPUT[2]}
fi
if [[ -n "$CENTER" && ! "$CENTER" =~ ^[0-9] ]]; then
exit 1
fi
CENTER=${CENTER/[^0-9]*/}
# MS Win support
if [[ "$FILE" =~ '\' ]]; then
if [ -z "$MSWINHOME" ]; then
MSWINHOME="$HOMEDRIVE$HOMEPATH"
fi
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null ; then
MSWINHOME="${MSWINHOME//\\/\\\\}"
FILE="${FILE/#\~\\/$MSWINHOME\\}"
FILE=$(wslpath -u "$FILE")
elif [ -n "$MSWINHOME" ]; then
FILE="${FILE/#\~\\/$MSWINHOME\\}"
fi
fi
FILE="${FILE/#\~\//$HOME/}"
if [ ! -r "$FILE" ]; then
echo "File not found ${FILE}"
exit 1
fi
if [ -z "$CENTER" ]; then
CENTER=0
fi
# Sometimes bat is installed as batcat.
if command -v batcat > /dev/null; then
BATNAME="batcat"
elif command -v bat > /dev/null; then
BATNAME="bat"
fi
if [ -z "$FZF_PREVIEW_COMMAND" ] && [ "${BATNAME:+x}" ]; then
${BATNAME} --style="${BAT_STYLE:-numbers}" --color=always --pager=never \
--highlight-line=$CENTER -- "$FILE"
exit $?
fi
FILE_LENGTH=${#FILE}
MIME=$(file --dereference --mime -- "$FILE")
if [[ "${MIME:FILE_LENGTH}" =~ binary ]]; then
echo "$MIME"
exit 0
fi
DEFAULT_COMMAND="highlight -O ansi -l {} || coderay {} || rougify {} || cat {}"
CMD=${FZF_PREVIEW_COMMAND:-$DEFAULT_COMMAND}
CMD=${CMD//{\}/$(printf %q "$FILE")}
eval "$CMD" 2> /dev/null | awk "{ \
if (NR == $CENTER) \
{ gsub(/\x1b[[0-9;]*m/, \"&$REVERSE\"); printf(\"$REVERSE%s\n$RESET\", \$0); } \
else printf(\"$RESET%s\n\", \$0); \
}"

View File

@ -1,73 +0,0 @@
#!/usr/bin/env bash
REVERSE="\x1b[7m"
RESET="\x1b[m"
if [ -z "$1" ]; then
echo "usage: $0 FILENAME:TAGFILE:EXCMD"
exit 1
fi
IFS=':' read -r FILE TAGFILE EXCMD <<< "$*"
# Complete file paths which are relative to the given tag file
if [ "${FILE:0:1}" != "/" ]; then
FILE="$(dirname "${TAGFILE}")/${FILE}"
fi
if [ ! -r "$FILE" ]; then
echo "File not found ${FILE}"
exit 1
fi
# If users aren't using vim, they are probably using neovim
if command -v vim > /dev/null; then
VIMNAME="vim"
elif command -v nvim > /dev/null; then
VIMNAME="nvim"
else
echo "Cannot preview tag: vim or nvim unavailable"
exit 1
fi
CENTER="$("${VIMNAME}" -R -i NONE -u NONE -e -m -s "${FILE}" \
-c "set nomagic" \
-c "${EXCMD}" \
-c 'let l=line(".") | new | put =l | print | qa!')" || exit
START_LINE="$(( CENTER - FZF_PREVIEW_LINES / 2 ))"
if (( START_LINE <= 0 )); then
START_LINE=1
fi
END_LINE="$(( START_LINE + FZF_PREVIEW_LINES - 1 ))"
# Sometimes bat is installed as batcat.
if command -v batcat > /dev/null; then
BATNAME="batcat"
elif command -v bat > /dev/null; then
BATNAME="bat"
fi
if [ -z "$FZF_PREVIEW_COMMAND" ] && [ "${BATNAME:+x}" ]; then
${BATNAME} --style="${BAT_STYLE:-numbers}" \
--color=always \
--pager=never \
--wrap=never \
--terminal-width="${FZF_PREVIEW_COLUMNS}" \
--line-range="${START_LINE}:${END_LINE}" \
--highlight-line="${CENTER}" \
"$FILE"
exit $?
fi
DEFAULT_COMMAND="highlight -O ansi -l {} || coderay {} || rougify {} || cat {}"
CMD=${FZF_PREVIEW_COMMAND:-$DEFAULT_COMMAND}
CMD=${CMD//{\}/$(printf %q "$FILE")}
eval "$CMD" 2> /dev/null | awk "{ \
if (NR >= $START_LINE && NR <= $END_LINE) { \
if (NR == $CENTER) \
{ gsub(/\x1b[[0-9;]*m/, \"&$REVERSE\"); printf(\"$REVERSE%s\n$RESET\", \$0); } \
else printf(\"$RESET%s\n\", \$0); \
} \
}"

View File

@ -1,15 +0,0 @@
#!/usr/bin/env perl
use strict;
foreach my $file (@ARGV) {
open my $lines, $file;
while (<$lines>) {
unless (/^\!/) {
s/^[^\t]*/sprintf("%-24s", $&)/e;
s/$/\t$file/;
print;
}
}
close $lines;
}

View File

@ -1,515 +0,0 @@
fzf-vim.txt fzf-vim Last change: October 14 2023
FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
==============================================================================
fzf :heart: vim |fzf-vim-fzfheart-vim|
Rationale |fzf-vim-rationale|
Why you should use fzf on Vim |fzf-vim-why-you-should-use-fzf-on-vim|
Installation |fzf-vim-installation|
Using vim-plug |fzf-vim-using-vim-plug|
Dependencies |fzf-vim-dependencies|
Commands |fzf-vim-commands|
Customization |fzf-vim-customization|
Configuration options of the base plugin |fzf-vim-configuration-options-of-the-base-plugin|
Configuration options for fzf.vim |fzf-vim-configuration-options-for-fzf-vim|
Preview window |fzf-vim-preview-window|
Command-level options |fzf-vim-command-level-options|
List type to handle multiple selections |fzf-vim-list-type-to-handle-multiple-selections|
Advanced customization |fzf-vim-advanced-customization|
Vim functions |fzf-vim-vim-functions|
Example: Customizing Files command |fzf-vim-example-customizing-files-command|
Example: git grep wrapper |fzf-vim-example-git-grep-wrapper|
Mappings |fzf-vim-mappings|
Completion functions |fzf-vim-completion-functions|
Custom completion |fzf-vim-custom-completion|
Reducer example |fzf-vim-reducer-example|
Status line of terminal buffer |fzf-vim-status-line-of-terminal-buffer|
Hide statusline |fzf-vim-hide-statusline|
Custom statusline |fzf-vim-custom-statusline|
License |fzf-vim-license|
FZF :HEART: VIM *fzf-vim-fzfheart-vim*
==============================================================================
Things you can do with {fzf}{1} and Vim.
{1} https://github.com/junegunn/fzf
RATIONALE *fzf-vim-rationale*
==============================================================================
{fzf}{1} itself is not a Vim plugin, and the official repository only provides
the {basic wrapper function}{2} for Vim. It's up to the users to write their
own Vim commands with it. However, I've learned that many users of fzf are not
familiar with Vimscript and are looking for the "default" implementation of
the features they can find in the alternative Vim plugins.
{1} https://github.com/junegunn/fzf
{2} https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzfrun
WHY YOU SHOULD USE FZF ON VIM *fzf-vim-why-you-should-use-fzf-on-vim*
==============================================================================
Because you can and you love fzf.
fzf runs asynchronously and can be orders of magnitude faster than similar Vim
plugins. However, the benefit may not be noticeable if the size of the input
is small, which is the case for many of the commands provided here.
Nevertheless I wrote them anyway since it's really easy to implement custom
selector with fzf.
INSTALLATION *fzf-vim-installation*
==============================================================================
fzf.vim depends on the basic Vim plugin of {the main fzf repository}{1}, which
means you need to set up both "fzf" and "fzf.vim" on Vim. To learn more about
fzf/Vim integration, see {README-VIM}{3}.
{1} https://github.com/junegunn/fzf
{3} https://github.com/junegunn/fzf/blob/master/README-VIM.md
< Using vim-plug >____________________________________________________________~
*fzf-vim-using-vim-plug*
>
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
<
`fzf#install()` makes sure that you have the latest binary, but it's optional,
so you can omit it if you use a plugin manager that doesn't support hooks.
< Dependencies >______________________________________________________________~
*fzf-vim-dependencies*
- {fzf}{1} 0.41.1 or above
- For syntax-highlighted preview, install {bat}{4}
- If {delta}{5} is available, `GF?`, `Commits` and `BCommits` will use it to
format `git diff` output.
- `Ag` requires {The Silver Searcher (ag)}{6}
- `Rg` requires {ripgrep (rg)}{7}
- `Tags` and `Helptags` require Perl
{1} https://github.com/junegunn/fzf
{4} https://github.com/sharkdp/bat
{5} https://github.com/dandavison/delta
{6} https://github.com/ggreer/the_silver_searcher
{7} https://github.com/BurntSushi/ripgrep
COMMANDS *fzf-vim-commands*
==============================================================================
*:Files* *:GFiles* *:Buffers* *:Colors* *:Ag* *:Rg* *:RG* *:Lines* *:BLines* *:Tags* *:BTags*
*:Changes* *:Marks* *:Jumps* *:Windows* *:Locate* *:History* *:Snippets* *:Commits* *:BCommits*
*:Commands* *:Maps* *:Helptags* *:Filetypes*
-----------------------+--------------------------------------------------------------------------------------
Command | List ~
-----------------------+--------------------------------------------------------------------------------------
`:Files [PATH]` | Files (runs `$FZF_DEFAULT_COMMAND` if defined)
`:GFiles [OPTS]` | Git files ( `git ls-files` )
`:GFiles?` | Git files ( `git status` )
`:Buffers` | Open buffers
`:Colors` | Color schemes
`:Ag [PATTERN]` | {ag}{6} search result ( `ALT-A` to select all, `ALT-D` to deselect all)
`:Rg [PATTERN]` | {rg}{7} search result ( `ALT-A` to select all, `ALT-D` to deselect all)
`:RG [PATTERN]` | {rg}{7} search result; relaunch ripgrep on every keystroke
`:Lines [QUERY]` | Lines in loaded buffers
`:BLines [QUERY]` | Lines in the current buffer
`:Tags [QUERY]` | Tags in the project ( `ctags -R` )
`:BTags [QUERY]` | Tags in the current buffer
`:Changes` | Changelist across all open buffers
`:Marks` | Marks
`:Jumps` | Jumps
`:Windows` | Windows
`:Locate PATTERN` | `locate` command output
`:History` | `v:oldfiles` and open buffers
`:History:` | Command history
`:History/` | Search history
`:Snippets` | Snippets ({UltiSnips}{8})
`:Commits [LOG_OPTS]` | Git commits (requires {fugitive.vim}{9})
`:BCommits [LOG_OPTS]` | Git commits for the current buffer; visual-select lines to track changes in the range
`:Commands` | Commands
`:Maps` | Normal mode mappings
`:Helptags` | Help tags [1]
`:Filetypes` | File types
-----------------------+--------------------------------------------------------------------------------------
*g:fzf_vim.command_prefix*
- Most commands support CTRL-T / CTRL-X / CTRL-V key bindings to open in a new
tab, a new split, or in a new vertical split
- Bang-versions of the commands (e.g. `Ag!`) will open fzf in fullscreen
- You can set `g:fzf_vim.command_prefix` to give the same prefix to the commands
- e.g. `let g:fzf_vim.command_prefix = 'Fzf'` and you have `FzfFiles`, etc.
(1: `Helptags` will shadow the command of the same name from {pathogen}{10}.
But its functionality is still available via `call pathogen#helptags()`. [↩])
{6} https://github.com/ggreer/the_silver_searcher
{7} https://github.com/BurntSushi/ripgrep
{7} https://github.com/BurntSushi/ripgrep
{8} https://github.com/SirVer/ultisnips
{9} https://github.com/tpope/vim-fugitive
{10} https://github.com/tpope/vim-pathogen
CUSTOMIZATION *fzf-vim-customization*
==============================================================================
< Configuration options of the base plugin >__________________________________~
*fzf-vim-configuration-options-of-the-base-plugin*
Every command in fzf.vim internally calls `fzf#wrap` function of the main
repository which supports a set of global option variables. So please read
through {README-VIM}{3} to learn more about them.
{3} https://github.com/junegunn/fzf/blob/master/README-VIM.md
< Configuration options for fzf.vim >_________________________________________~
*fzf-vim-configuration-options-for-fzf-vim*
*g:fzf_vim*
All configuration values for this plugin are stored in `g:fzf_vim` dictionary,
so make sure to initialize it before assigning any configuration values to it.
>
" Initialize configuration dictionary
let g:fzf_vim = {}
<
Preview window~
*fzf-vim-preview-window*
*g:fzf_vim.preview_window*
Some commands will show the preview window on the right. You can customize the
behavior with `g:fzf_vim.preview_window`. Here are some examples:
*g:fzf_vim.preview_bash*
>
" This is the default option:
" - Preview window on the right with 50% width
" - CTRL-/ will toggle preview window.
" - Note that this array is passed as arguments to fzf#vim#with_preview function.
" - To learn more about preview window options, see `--preview-window` section of `man fzf`.
let g:fzf_vim.preview_window = ['right,50%', 'ctrl-/']
" Preview window is hidden by default. You can toggle it with ctrl-/.
" It will show on the right with 50% width, but if the width is smaller
" than 70 columns, it will show above the candidate list
let g:fzf_vim.preview_window = ['hidden,right,50%,<70(up,40%)', 'ctrl-/']
" Empty value to disable preview window altogether
let g:fzf_vim.preview_window = []
" fzf.vim needs bash to display the preview window.
" On Windows, fzf.vim will first see if bash is in $PATH, then if
" Git bash (C:\Program Files\Git\bin\bash.exe) is available.
" If you want it to use a different bash, set this variable.
" let g:fzf_vim = {}
" let g:fzf_vim.preview_bash = 'C:\Git\bin\bash.exe'
<
Command-level options~
*fzf-vim-command-level-options*
*g:fzf_vim.commands_expect* *g:fzf_vim.tags_command* *g:fzf_vim.commits_log_options*
*g:fzf_vim.buffers_jump*
>
" [Buffers] Jump to the existing window if possible
let g:fzf_vim.buffers_jump = 1
" [[B]Commits] Customize the options used by 'git log':
let g:fzf_vim.commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
" [Tags] Command to generate tags file
let g:fzf_vim.tags_command = 'ctags -R'
" [Commands] --expect expression for directly executing the command
let g:fzf_vim.commands_expect = 'alt-enter,ctrl-x'
<
List type to handle multiple selections~
*fzf-vim-list-type-to-handle-multiple-selections*
The following commands will fill the quickfix list when multiple entries are
selected.
- `Ag`
- `Rg` / `RG`
- `Lines` / `BLines`
- `Tags` / `BTags`
*g:fzf_vim.listproc*
By setting `g:fzf_vim.listproc`, you can make them use location list instead.
>
" Default: Use quickfix list
let g:fzf_vim.listproc = { list -> fzf#vim#listproc#quickfix(list) }
" Use location list instead of quickfix list
let g:fzf_vim.listproc = { list -> fzf#vim#listproc#location(list) }
<
You can customize the list type per command by defining variables named
`g:fzf_vim.listproc_{command_name_in_lowercase}`.
*g:fzf_vim.listproc_rg* *g:fzf_vim.listproc_ag*
>
" Command-wise customization
let g:fzf_vim.listproc_ag = { list -> fzf#vim#listproc#quickfix(list) }
let g:fzf_vim.listproc_rg = { list -> fzf#vim#listproc#location(list) }
<
You can further customize the behavior by providing a custom function to
process the list instead of using the predefined `fzf#vim#listproc#quickfix`
or `fzf#vim#listproc#location`.
>
" A customized version of fzf#vim#listproc#quickfix.
" The last two lines are commented out not to move to the first entry.
function! g:fzf_vim.listproc(list)
call setqflist(a:list)
copen
wincmd p
" cfirst
" normal! zvzz
endfunction
<
< Advanced customization >____________________________________________________~
*fzf-vim-advanced-customization*
Vim functions~
*fzf-vim-vim-functions*
Each command in fzf.vim is backed by a Vim function. You can override a
command or define a variation of it by calling its corresponding function.
----------+---------------------------------------------------------------------------------
Command | Vim function ~
----------+---------------------------------------------------------------------------------
`Files` | `fzf#vim#files(dir, [spec dict], [fullscreen bool])`
`GFiles` | `fzf#vim#gitfiles(git_options, [spec dict], [fullscreen bool])`
`GFiles?` | `fzf#vim#gitfiles('?', [spec dict], [fullscreen bool])`
`Buffers` | `fzf#vim#buffers([query string], [bufnrs list], [spec dict], [fullscreen bool])`
`Colors` | `fzf#vim#colors([spec dict], [fullscreen bool])`
`Rg` | `fzf#vim#grep(command, [spec dict], [fullscreen bool])`
`RG` | `fzf#vim#grep2(command_prefix, query, [spec dict], [fullscreen bool])`
... | ...
----------+---------------------------------------------------------------------------------
(We can see that the last two optional arguments of each function are
identical. They are directly passed to `fzf#wrap` function. If you haven't
read {README-VIM}{3} already, please read it before proceeding.)
{3} https://github.com/junegunn/fzf/blob/master/README-VIM.md
Example: Customizing Files command~
*fzf-vim-example-customizing-files-command*
This is the default definition of `Files` command:
>
command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, <bang>0)
<
Let's say you want to a variation of it called `ProjectFiles` that only
searches inside `~/projects` directory. Then you can do it like this:
>
command! -bang ProjectFiles call fzf#vim#files('~/projects', <bang>0)
<
Or, if you want to override the command with different fzf options, just pass
a custom spec to the function.
>
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline']}, <bang>0)
<
Want a preview window?
>
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline', '--preview', 'cat {}']}, <bang>0)
<
It kind of works, but you probably want a nicer previewer program than `cat`.
fzf.vim ships {a versatile preview script}{11} you can readily use. It
internally executes {bat}{4} for syntax highlighting, so make sure to install
it.
>
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, {'options': ['--layout=reverse', '--info=inline', '--preview', '~/.vim/plugged/fzf.vim/bin/preview.sh {}']}, <bang>0)
<
However, it's not ideal to hard-code the path to the script which can be
different in different circumstances. So in order to make it easier to set up
the previewer, fzf.vim provides `fzf#vim#with_preview` helper function.
Similarly to `fzf#wrap`, it takes a spec dictionary and returns a copy of it
with additional preview options.
>
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0)
<
You can just omit the spec argument if you only want the previewer.
>
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
<
{11} bin/preview.sh
{4} https://github.com/sharkdp/bat
Example: git grep wrapper~
*fzf-vim-example-git-grep-wrapper*
The following example implements `GGrep` command that works similarly to
predefined `Ag` or `Rg` using `fzf#vim#grep`.
*:LINE*
- We set the base directory to git root by setting `dir` attribute in spec
dictionary.
- {The preview script}{11} supports `grep` format (`FILE_PATH:LINE_NO:...`), so
we can just wrap the spec with `fzf#vim#with_preview` as before to enable
previewer.
>
command! -bang -nargs=* GGrep
\ call fzf#vim#grep(
\ 'git grep --line-number -- '.fzf#shellescape(<q-args>),
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
<
{11} bin/preview.sh
MAPPINGS *fzf-vim-mappings*
==============================================================================
---------------------------------+------------------------------------------
Mapping | Description ~
---------------------------------+------------------------------------------
<plug>(fzf-maps-n) | Normal mode mappings
<plug>(fzf-maps-i) | Insert mode mappings
<plug>(fzf-maps-x) | Visual mode mappings
<plug>(fzf-maps-o) | Operator-pending mappings
<plug>(fzf-complete-word) | `cat /usr/share/dict/words`
<plug>(fzf-complete-path) | Path completion using `find` (file + dir)
<plug>(fzf-complete-file) | File completion using `find`
<plug>(fzf-complete-line) | Line completion (all open buffers)
<plug>(fzf-complete-buffer-line) | Line completion (current buffer only)
---------------------------------+------------------------------------------
>
" Mapping selecting mappings
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
" Insert mode completion
imap <c-x><c-k> <plug>(fzf-complete-word)
imap <c-x><c-f> <plug>(fzf-complete-path)
imap <c-x><c-l> <plug>(fzf-complete-line)
<
COMPLETION FUNCTIONS *fzf-vim-completion-functions*
==============================================================================
-----------------------------------------+--------------------------------------
Function | Description ~
-----------------------------------------+--------------------------------------
`fzf#vim#complete#path(command, [spec])` | Path completion
`fzf#vim#complete#word([spec])` | Word completion
`fzf#vim#complete#line([spec])` | Line completion (all open buffers)
`fzf#vim#complete#buffer_line([spec])` | Line completion (current buffer only)
-----------------------------------------+--------------------------------------
>
" Path completion with custom source command
inoremap <expr> <c-x><c-f> fzf#vim#complete#path('fd')
inoremap <expr> <c-x><c-f> fzf#vim#complete#path('rg --files')
" Word completion with custom spec with popup layout option
inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'window': { 'width': 0.2, 'height': 0.9, 'xoffset': 1 }})
<
CUSTOM COMPLETION *fzf-vim-custom-completion*
==============================================================================
`fzf#vim#complete` is a helper function for creating custom fuzzy completion
using fzf. If the first parameter is a command string or a Vim list, it will
be used as the source.
>
" Replace the default dictionary completion with fzf-based fuzzy completion
inoremap <expr> <c-x><c-k> fzf#vim#complete('cat /usr/share/dict/words')
<
For advanced uses, you can pass an options dictionary to the function. The set
of options is pretty much identical to that for `fzf#run` only with the
following exceptions:
- `reducer` (funcref)
- Reducer transforms the output lines of fzf into a single string value
- `prefix` (string or funcref; default: `\k*$`)
- Regular expression pattern to extract the completion prefix
- Or a function to extract completion prefix
- Both `source` and `options` can be given as funcrefs that take the completion
prefix as the argument and return the final value
- `sink` or `sink*` are ignored
>
" Global line completion (not just open buffers. ripgrep required.)
inoremap <expr> <c-x><c-l> fzf#vim#complete(fzf#wrap({
\ 'prefix': '^.*$',
\ 'source': 'rg -n ^ --color always',
\ 'options': '--ansi --delimiter : --nth 3..',
\ 'reducer': { lines -> join(split(lines[0], ':\zs')[2:], '') }}))
<
< Reducer example >___________________________________________________________~
*fzf-vim-reducer-example*
>
function! s:make_sentence(lines)
return substitute(join(a:lines), '^.', '\=toupper(submatch(0))', '').'.'
endfunction
inoremap <expr> <c-x><c-s> fzf#vim#complete({
\ 'source': 'cat /usr/share/dict/words',
\ 'reducer': function('<sid>make_sentence'),
\ 'options': '--multi --reverse --margin 15%,0',
\ 'left': 20})
<
STATUS LINE OF TERMINAL BUFFER *fzf-vim-status-line-of-terminal-buffer*
==============================================================================
When fzf starts in a terminal buffer (see {fzf/README-VIM.md}{12}), you may
want to customize the statusline of the containing buffer.
{12} https://github.com/junegunn/fzf/blob/master/README-VIM.md#fzf-inside-terminal-buffer
< Hide statusline >___________________________________________________________~
*fzf-vim-hide-statusline*
>
autocmd! FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
<
< Custom statusline >_________________________________________________________~
*fzf-vim-custom-statusline*
>
function! s:fzf_statusline()
" Override statusline as you like
highlight fzf1 ctermfg=161 ctermbg=251
highlight fzf2 ctermfg=23 ctermbg=251
highlight fzf3 ctermfg=237 ctermbg=251
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endfunction
autocmd! User FzfStatusLine call <SID>fzf_statusline()
<
LICENSE *fzf-vim-license*
==============================================================================
MIT
==============================================================================
vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:

View File

@ -1,63 +0,0 @@
:Ag fzf-vim.txt /*:Ag*
:BCommits fzf-vim.txt /*:BCommits*
:BLines fzf-vim.txt /*:BLines*
:BTags fzf-vim.txt /*:BTags*
:Buffers fzf-vim.txt /*:Buffers*
:Changes fzf-vim.txt /*:Changes*
:Colors fzf-vim.txt /*:Colors*
:Commands fzf-vim.txt /*:Commands*
:Commits fzf-vim.txt /*:Commits*
:Files fzf-vim.txt /*:Files*
:Filetypes fzf-vim.txt /*:Filetypes*
:GFiles fzf-vim.txt /*:GFiles*
:Helptags fzf-vim.txt /*:Helptags*
:History fzf-vim.txt /*:History*
:Jumps fzf-vim.txt /*:Jumps*
:LINE fzf-vim.txt /*:LINE*
:Lines fzf-vim.txt /*:Lines*
:Locate fzf-vim.txt /*:Locate*
:Maps fzf-vim.txt /*:Maps*
:Marks fzf-vim.txt /*:Marks*
:RG fzf-vim.txt /*:RG*
:Rg fzf-vim.txt /*:Rg*
:Snippets fzf-vim.txt /*:Snippets*
:Tags fzf-vim.txt /*:Tags*
:Windows fzf-vim.txt /*:Windows*
fzf-vim fzf-vim.txt /*fzf-vim*
fzf-vim-advanced-customization fzf-vim.txt /*fzf-vim-advanced-customization*
fzf-vim-command-level-options fzf-vim.txt /*fzf-vim-command-level-options*
fzf-vim-commands fzf-vim.txt /*fzf-vim-commands*
fzf-vim-completion-functions fzf-vim.txt /*fzf-vim-completion-functions*
fzf-vim-configuration-options-for-fzf-vim fzf-vim.txt /*fzf-vim-configuration-options-for-fzf-vim*
fzf-vim-configuration-options-of-the-base-plugin fzf-vim.txt /*fzf-vim-configuration-options-of-the-base-plugin*
fzf-vim-custom-completion fzf-vim.txt /*fzf-vim-custom-completion*
fzf-vim-custom-statusline fzf-vim.txt /*fzf-vim-custom-statusline*
fzf-vim-customization fzf-vim.txt /*fzf-vim-customization*
fzf-vim-dependencies fzf-vim.txt /*fzf-vim-dependencies*
fzf-vim-example-customizing-files-command fzf-vim.txt /*fzf-vim-example-customizing-files-command*
fzf-vim-example-git-grep-wrapper fzf-vim.txt /*fzf-vim-example-git-grep-wrapper*
fzf-vim-fzfheart-vim fzf-vim.txt /*fzf-vim-fzfheart-vim*
fzf-vim-hide-statusline fzf-vim.txt /*fzf-vim-hide-statusline*
fzf-vim-installation fzf-vim.txt /*fzf-vim-installation*
fzf-vim-license fzf-vim.txt /*fzf-vim-license*
fzf-vim-list-type-to-handle-multiple-selections fzf-vim.txt /*fzf-vim-list-type-to-handle-multiple-selections*
fzf-vim-mappings fzf-vim.txt /*fzf-vim-mappings*
fzf-vim-preview-window fzf-vim.txt /*fzf-vim-preview-window*
fzf-vim-rationale fzf-vim.txt /*fzf-vim-rationale*
fzf-vim-reducer-example fzf-vim.txt /*fzf-vim-reducer-example*
fzf-vim-status-line-of-terminal-buffer fzf-vim.txt /*fzf-vim-status-line-of-terminal-buffer*
fzf-vim-toc fzf-vim.txt /*fzf-vim-toc*
fzf-vim-using-vim-plug fzf-vim.txt /*fzf-vim-using-vim-plug*
fzf-vim-vim-functions fzf-vim.txt /*fzf-vim-vim-functions*
fzf-vim-why-you-should-use-fzf-on-vim fzf-vim.txt /*fzf-vim-why-you-should-use-fzf-on-vim*
g:fzf_vim fzf-vim.txt /*g:fzf_vim*
g:fzf_vim.buffers_jump fzf-vim.txt /*g:fzf_vim.buffers_jump*
g:fzf_vim.command_prefix fzf-vim.txt /*g:fzf_vim.command_prefix*
g:fzf_vim.commands_expect fzf-vim.txt /*g:fzf_vim.commands_expect*
g:fzf_vim.commits_log_options fzf-vim.txt /*g:fzf_vim.commits_log_options*
g:fzf_vim.listproc fzf-vim.txt /*g:fzf_vim.listproc*
g:fzf_vim.listproc_ag fzf-vim.txt /*g:fzf_vim.listproc_ag*
g:fzf_vim.listproc_rg fzf-vim.txt /*g:fzf_vim.listproc_rg*
g:fzf_vim.preview_bash fzf-vim.txt /*g:fzf_vim.preview_bash*
g:fzf_vim.preview_window fzf-vim.txt /*g:fzf_vim.preview_window*
g:fzf_vim.tags_command fzf-vim.txt /*g:fzf_vim.tags_command*

View File

@ -1,163 +0,0 @@
" Copyright (c) 2015 Junegunn Choi
"
" MIT License
"
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be
" included in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
if exists('g:loaded_fzf_vim')
finish
endif
let g:loaded_fzf_vim = 1
let s:cpo_save = &cpo
set cpo&vim
let s:is_win = has('win32') || has('win64')
function! s:conf(name, default)
let conf = get(g:, 'fzf_vim', {})
let val = get(conf, a:name, get(g:, 'fzf_' . a:name, a:default))
return val
endfunction
function! s:defs(commands)
let prefix = s:conf('command_prefix', '')
if prefix =~# '^[^A-Z]'
echoerr 'g:fzf_command_prefix must start with an uppercase letter'
return
endif
for command in a:commands
let name = ':'.prefix.matchstr(command, '\C[A-Z]\S\+')
if 2 != exists(name)
execute substitute(command, '\ze\C[A-Z]', prefix, '')
endif
endfor
endfunction
call s:defs([
\'command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)',
\'command! -bang -nargs=? GitFiles call fzf#vim#gitfiles(<q-args>, fzf#vim#with_preview(<q-args> == "?" ? { "placeholder": "" } : {}), <bang>0)',
\'command! -bang -nargs=? GFiles call fzf#vim#gitfiles(<q-args>, fzf#vim#with_preview(<q-args> == "?" ? { "placeholder": "" } : {}), <bang>0)',
\'command! -bar -bang -nargs=? -complete=buffer Buffers call fzf#vim#buffers(<q-args>, fzf#vim#with_preview({ "placeholder": "{1}" }), <bang>0)',
\'command! -bang -nargs=* Lines call fzf#vim#lines(<q-args>, <bang>0)',
\'command! -bang -nargs=* BLines call fzf#vim#buffer_lines(<q-args>, <bang>0)',
\'command! -bar -bang Colors call fzf#vim#colors(<bang>0)',
\'command! -bang -nargs=+ -complete=dir Locate call fzf#vim#locate(<q-args>, fzf#vim#with_preview(), <bang>0)',
\'command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, fzf#vim#with_preview(), <bang>0)',
\'command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case -- ".fzf#shellescape(<q-args>), fzf#vim#with_preview(), <bang>0)',
\'command! -bang -nargs=* RG call fzf#vim#grep2("rg --column --line-number --no-heading --color=always --smart-case -- ", <q-args>, fzf#vim#with_preview(), <bang>0)',
\'command! -bang -nargs=* Tags call fzf#vim#tags(<q-args>, fzf#vim#with_preview({ "placeholder": "--tag {2}:{-1}:{3..}" }), <bang>0)',
\'command! -bang -nargs=* BTags call fzf#vim#buffer_tags(<q-args>, fzf#vim#with_preview({ "placeholder": "{2}:{3..}" }), <bang>0)',
\'command! -bar -bang Snippets call fzf#vim#snippets(<bang>0)',
\'command! -bar -bang Commands call fzf#vim#commands(<bang>0)',
\'command! -bar -bang Jumps call fzf#vim#jumps(<bang>0)',
\'command! -bar -bang Marks call fzf#vim#marks(<bang>0)',
\'command! -bar -bang Changes call fzf#vim#changes(<bang>0)',
\'command! -bar -bang Helptags call fzf#vim#helptags(fzf#vim#with_preview({ "placeholder": "--tag {2}:{3}:{4}" }), <bang>0)',
\'command! -bar -bang Windows call fzf#vim#windows(fzf#vim#with_preview({ "placeholder": "{2}" }), <bang>0)',
\'command! -bar -bang -nargs=* -range=% -complete=file Commits let b:fzf_winview = winsaveview() | <line1>,<line2>call fzf#vim#commits(<q-args>, fzf#vim#with_preview({ "placeholder": "" }), <bang>0)',
\'command! -bar -bang -nargs=* -range=% BCommits let b:fzf_winview = winsaveview() | <line1>,<line2>call fzf#vim#buffer_commits(<q-args>, fzf#vim#with_preview({ "placeholder": "" }), <bang>0)',
\'command! -bar -bang Maps call fzf#vim#maps("n", <bang>0)',
\'command! -bar -bang Filetypes call fzf#vim#filetypes(<bang>0)',
\'command! -bang -nargs=* History call s:history(<q-args>, fzf#vim#with_preview(), <bang>0)'])
function! s:history(arg, extra, bang)
let bang = a:bang || a:arg[len(a:arg)-1] == '!'
if a:arg[0] == ':'
call fzf#vim#command_history(bang)
elseif a:arg[0] == '/'
call fzf#vim#search_history(bang)
else
call fzf#vim#history(a:extra, bang)
endif
endfunction
function! fzf#complete(...)
return call('fzf#vim#complete', a:000)
endfunction
if (has('nvim') || has('terminal') && has('patch-8.0.995')) && (s:conf('statusline', 1) || s:conf('nvim_statusline', 1))
function! s:fzf_restore_colors()
if exists('#User#FzfStatusLine')
doautocmd User FzfStatusLine
else
if $TERM !~ "256color"
highlight default fzf1 ctermfg=1 ctermbg=8 guifg=#E12672 guibg=#565656
highlight default fzf2 ctermfg=2 ctermbg=8 guifg=#BCDDBD guibg=#565656
highlight default fzf3 ctermfg=7 ctermbg=8 guifg=#D9D9D9 guibg=#565656
else
highlight default fzf1 ctermfg=161 ctermbg=238 guifg=#E12672 guibg=#565656
highlight default fzf2 ctermfg=151 ctermbg=238 guifg=#BCDDBD guibg=#565656
highlight default fzf3 ctermfg=252 ctermbg=238 guifg=#D9D9D9 guibg=#565656
endif
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
endif
endfunction
function! s:fzf_vim_term()
if get(w:, 'airline_active', 0)
let w:airline_disabled = 1
autocmd BufWinLeave <buffer> let w:airline_disabled = 0
endif
autocmd WinEnter,ColorScheme <buffer> call s:fzf_restore_colors()
setlocal nospell
call s:fzf_restore_colors()
endfunction
augroup _fzf_statusline
autocmd!
autocmd FileType fzf call s:fzf_vim_term()
augroup END
endif
if !exists('g:fzf#vim#buffers')
let g:fzf#vim#buffers = {}
endif
augroup fzf_buffers
autocmd!
if exists('*reltimefloat')
autocmd BufWinEnter,WinEnter * let g:fzf#vim#buffers[bufnr('')] = reltimefloat(reltime())
else
autocmd BufWinEnter,WinEnter * let g:fzf#vim#buffers[bufnr('')] = localtime()
endif
autocmd BufDelete * silent! call remove(g:fzf#vim#buffers, expand('<abuf>'))
augroup END
inoremap <expr> <plug>(fzf-complete-word) fzf#vim#complete#word()
if s:is_win
inoremap <expr> <plug>(fzf-complete-path) fzf#vim#complete#path('dir /s/b')
inoremap <expr> <plug>(fzf-complete-file) fzf#vim#complete#path('dir /s/b/a:-d')
else
inoremap <expr> <plug>(fzf-complete-path) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -print \| sed '1d;s:^..::'")
inoremap <expr> <plug>(fzf-complete-file) fzf#vim#complete#path("find . -path '*/\.*' -prune -o -type f -print -o -type l -print \| sed 's:^..::'")
endif
inoremap <expr> <plug>(fzf-complete-file-ag) fzf#vim#complete#path('ag -l -g ""')
inoremap <expr> <plug>(fzf-complete-line) fzf#vim#complete#line()
inoremap <expr> <plug>(fzf-complete-buffer-line) fzf#vim#complete#buffer_line()
nnoremap <silent> <plug>(fzf-maps-n) :<c-u>call fzf#vim#maps('n', 0)<cr>
inoremap <silent> <plug>(fzf-maps-i) <c-o>:call fzf#vim#maps('i', 0)<cr>
xnoremap <silent> <plug>(fzf-maps-x) :<c-u>call fzf#vim#maps('x', 0)<cr>
onoremap <silent> <plug>(fzf-maps-o) <c-c>:<c-u>call fzf#vim#maps('o', 0)<cr>
let &cpo = s:cpo_save
unlet s:cpo_save

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
vim-lucius
==========
This repository has the Lucius color scheme for Vim. It is already organized
under a "colors" directory, so you can clone the repo into your own vimfiles
(or under bundle, if you use Pathogen).
The color scheme is available for other applications, as well. They can be
found here:
https://github.com/jonathanfilip/lucius
Some sample screenshots of the different configurations:
### Dark
![LuciusDark](http://i.imgur.com/LsZbF.png "LuciusDark (default)")
### Dark High Contrast
![LuciusDarkHighContrast](http://i.imgur.com/e70i9.png "LuciusDarkHighContrast")
### Dark Low Contrast
![LuciusDarkLowContrast](http://i.imgur.com/Hmw8s.png "LuciusDarkLowContrast")
### Black
![LuciusBlack](http://i.imgur.com/iD4ri.png "LuciusBlack")
### Black High Contrast
![LuciusBlackHighContrast](http://i.imgur.com/lHvTJ.png "LuciusBlackHighContrast")
### Black Low Contrast
![LuciusBlackLowContrast](http://i.imgur.com/oZLkg.png "LuciusBlackLowContrast")
### Light
![LuciusLight](http://i.imgur.com/soYD8.png "LuciusLight (light default)")
### Light Low Contrast
![LuciusLightLowContrast](http://i.imgur.com/95I86.png "LuciusLightLowContrast")
### White
![LuciusWhite](http://i.imgur.com/wDzkz.png "LuciusWhite")
### White Low Contrast
![LuciusWhiteLowContrast](http://i.imgur.com/jlUf4.png "LuciusWhiteLowContrast")

View File

@ -1,805 +0,0 @@
" ============================================================================
" Name: Lucius vim color scheme
" Author: Jonathan Filip <jfilip1024@gmail.com>
" Version: 8.1.7
" ----------------------------------------------------------------------------
"
" Light and dark color scheme for GUI and 256 color terminal.
"
" There are several options available to customize the color scheme to your
" own tastes. This is particularly useful when you have to work in different
" environments at different times (home, work, day, night, etc).
"
" The GUI and 256 color terminal versions of this color scheme are identical.
"
" You can set up the color scheme by manually setting the options you want or
" by choosing one of the presets defined. These presets are loaded after you
" first source the color scheme file and are all commands that start with
" 'Lucius'.
"
" I have also started to create color schemes for different applications. I
" have been using them for PuTTY, iTerm2, and Visual Studio, but will keep
" adding more as I go along. You can find the files for these on Github:
"
" https://github.com/jonathanfilip/lucius
"
" You can also clone the following repository if you use Pathogen or something
" similar. It holds the vim color scheme in a 'colors' directory:
"
" https://github.com/jonathanfilip/vim-lucius
"
"
"
" Presets:
"
" There are several presets available that will set all the options for you.
" There are screenshots of each preset below:
"
" * LuciusDark (dark default): http://i.imgur.com/LsZbF.png
" * LuciusDarkHighContrast: http://i.imgur.com/e70i9.png
" * LuciusDarkLowContrast: http://i.imgur.com/Hmw8s.png
" * LuciusBlack: http://i.imgur.com/iD4ri.png
" * LuciusBlackHighContrast: http://i.imgur.com/lHvTJ.png
" * LuciusBlackLowContrast: http://i.imgur.com/oZLkg.png
"
" * LuciusLight (light default): http://i.imgur.com/soYD8.png
" * LuciusLightLowContrast: http://i.imgur.com/95I86.png
" * LuciusWhite: http://i.imgur.com/wDzkz.png
" * LuciusWhiteLowContrast: http://i.imgur.com/jlUf4.png
"
" To use the presets, you just need to set the color scheme first. In your
" vimrc, you can just do this:
"
" colorscheme lucius
" LuciusBlack
"
" You can still just set the background variable and then set the color
" scheme. This will default to LuciusDark for 'dark' and LuciusLight for
" 'light'.
"
"
" Options:
"
" The presets available cover most of the options. You can, however, customize
" things by setting the following variables yourself:
"
" g:lucius_style (default: 'dark')
"
" Set this option to either 'light' or 'dark' for your desired color scheme.
" It has the same effect as setting the background.
"
" g:lucius_contrast (default: 'normal')
"
" This option determines the contrast to use for text/ui elements. It can be
" set to 'low', 'normal', or 'high'. At this time there is no 'high' for the
" light scheme.
"
" g:lucius_contrast_bg (default: 'normal')
"
" Setting this option makes the background a higher contrast. Current settings
" are 'normal' and 'high'.
"
" g:lucius_use_bold (default: 1)
"
" Setting this will cause the color scheme to use bold fonts for some items.
"
" g:lucius_use_underline (default: 1)
"
" Setting this will cause the color scheme to use underlined fonts for some
" items.
"
" g:lucius_no_term_bg (default: 0)
"
" Setting this will cause the color scheme to not set a background color in
" the terminal (useful for transparency or terminals with different background
" colors).
"
" License:
"
" Copyright (c) 2015 Jonathan Filip
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to deal
" in the Software without restriction, including without limitation the rights
" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
" copies of the Software, and to permit persons to whom the Software is
" furnished to do so, subject to the following conditions:
"
" The above copyright notice and this permission notice shall be included in
" all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
" THE SOFTWARE.
"
" ============================================================================
" ============================================================================
" Options:
" ============================================================================
unlet! g:colors_name
hi clear
if exists("syntax_on")
syntax reset
endif
if exists("g:lucius_style")
let s:style = g:lucius_style
else
let s:style = &background
endif
if exists("g:lucius_contrast")
let s:contrast = g:lucius_contrast
else
let s:contrast = "normal"
endif
if exists("g:lucius_contrast_bg")
let s:contrast_bg = g:lucius_contrast_bg
else
let s:contrast_bg = "normal"
endif
if exists("g:lucius_use_bold")
let s:use_bold = g:lucius_use_bold
else
let s:use_bold = 1
endif
if exists("g:lucius_use_underline")
let s:use_underline = g:lucius_use_underline
else
let s:use_underline = 1
endif
if exists("g:lucius_no_term_bg")
let s:no_term_bg = g:lucius_no_term_bg
else
let s:no_term_bg = 0
endif
" ============================================================================
" Color Map:
" ============================================================================
let s:color_map = {
\ 'bg': 'bg', 'fg': 'fg', 'NONE': 'NONE',
\ '#000000': '16', '#00005f': '17', '#000087': '18', '#0000af': '19',
\ '#0000d7': '20', '#0000ff': '21', '#005f00': '22', '#005f5f': '23',
\ '#005f87': '24', '#005faf': '25', '#005fd7': '26', '#005fff': '27',
\ '#008700': '28', '#00875f': '29', '#008787': '30', '#0087af': '31',
\ '#0087d7': '32', '#0087ff': '33', '#00af00': '34', '#00af5f': '35',
\ '#00af87': '36', '#00afaf': '37', '#00afd7': '38', '#00afff': '39',
\ '#00d700': '40', '#00d75f': '41', '#00d787': '42', '#00d7af': '43',
\ '#00d7d7': '44', '#00d7ff': '45', '#00ff00': '46', '#00ff5f': '47',
\ '#00ff87': '48', '#00ffaf': '49', '#00ffd7': '50', '#00ffff': '51',
\ '#5f0000': '52', '#5f005f': '53', '#5f0087': '54', '#5f00af': '55',
\ '#5f00d7': '56', '#5f00ff': '57', '#5f5f00': '58', '#5f5f5f': '59',
\ '#5f5f87': '60', '#5f5faf': '61', '#5f5fd7': '62', '#5f5fff': '63',
\ '#5f8700': '64', '#5f875f': '65', '#5f8787': '66', '#5f87af': '67',
\ '#5f87d7': '68', '#5f87ff': '69', '#5faf00': '70', '#5faf5f': '71',
\ '#5faf87': '72', '#5fafaf': '73', '#5fafd7': '74', '#5fafff': '75',
\ '#5fd700': '76', '#5fd75f': '77', '#5fd787': '78', '#5fd7af': '79',
\ '#5fd7d7': '80', '#5fd7ff': '81', '#5fff00': '82', '#5fff5f': '83',
\ '#5fff87': '84', '#5fffaf': '85', '#5fffd7': '86', '#5fffff': '87',
\ '#870000': '88', '#87005f': '89', '#870087': '90', '#8700af': '91',
\ '#8700d7': '92', '#8700ff': '93', '#875f00': '94', '#875f5f': '95',
\ '#875f87': '96', '#875faf': '97', '#875fd7': '98', '#875fff': '99',
\ '#878700': '100', '#87875f': '101', '#878787': '102', '#8787af': '103',
\ '#8787d7': '104', '#8787ff': '105', '#87af00': '106', '#87af5f': '107',
\ '#87af87': '108', '#87afaf': '109', '#87afd7': '110', '#87afff': '111',
\ '#87d700': '112', '#87d75f': '113', '#87d787': '114', '#87d7af': '115',
\ '#87d7d7': '116', '#87d7ff': '117', '#87ff00': '118', '#87ff5f': '119',
\ '#87ff87': '120', '#87ffaf': '121', '#87ffd7': '122', '#87ffff': '123',
\ '#af0000': '124', '#af005f': '125', '#af0087': '126', '#af00af': '127',
\ '#af00d7': '128', '#af00ff': '129', '#af5f00': '130', '#af5f5f': '131',
\ '#af5f87': '132', '#af5faf': '133', '#af5fd7': '134', '#af5fff': '135',
\ '#af8700': '136', '#af875f': '137', '#af8787': '138', '#af87af': '139',
\ '#af87d7': '140', '#af87ff': '141', '#afaf00': '142', '#afaf5f': '143',
\ '#afaf87': '144', '#afafaf': '145', '#afafd7': '146', '#afafff': '147',
\ '#afd700': '148', '#afd75f': '149', '#afd787': '150', '#afd7af': '151',
\ '#afd7d7': '152', '#afd7ff': '153', '#afff00': '154', '#afff5f': '155',
\ '#afff87': '156', '#afffaf': '157', '#afffd7': '158', '#afffff': '159',
\ '#d70000': '160', '#d7005f': '161', '#d70087': '162', '#d700af': '163',
\ '#d700d7': '164', '#d700ff': '165', '#d75f00': '166', '#d75f5f': '167',
\ '#d75f87': '168', '#d75faf': '169', '#d75fd7': '170', '#d75fff': '171',
\ '#d78700': '172', '#d7875f': '173', '#d78787': '174', '#d787af': '175',
\ '#d787d7': '176', '#d787ff': '177', '#d7af00': '178', '#d7af5f': '179',
\ '#d7af87': '180', '#d7afaf': '181', '#d7afd7': '182', '#d7afff': '183',
\ '#d7d700': '184', '#d7d75f': '185', '#d7d787': '186', '#d7d7af': '187',
\ '#d7d7d7': '188', '#d7d7ff': '189', '#d7ff00': '190', '#d7ff5f': '191',
\ '#d7ff87': '192', '#d7ffaf': '193', '#d7ffd7': '194', '#d7ffff': '195',
\ '#ff0000': '196', '#ff005f': '197', '#ff0087': '198', '#ff00af': '199',
\ '#ff00d7': '200', '#ff00ff': '201', '#ff5f00': '202', '#ff5f5f': '203',
\ '#ff5f87': '204', '#ff5faf': '205', '#ff5fd7': '206', '#ff5fff': '207',
\ '#ff8700': '208', '#ff875f': '209', '#ff8787': '210', '#ff87af': '211',
\ '#ff87d7': '212', '#ff87ff': '213', '#ffaf00': '214', '#ffaf5f': '215',
\ '#ffaf87': '216', '#ffafaf': '217', '#ffafd7': '218', '#ffafff': '219',
\ '#ffd700': '220', '#ffd75f': '221', '#ffd787': '222', '#ffd7af': '223',
\ '#ffd7d7': '224', '#ffd7ff': '225', '#ffff00': '226', '#ffff5f': '227',
\ '#ffff87': '228', '#ffffaf': '229', '#ffffd7': '230', '#ffffff': '231',
\ '#080808': '232', '#121212': '233', '#1c1c1c': '234', '#262626': '235',
\ '#303030': '236', '#3a3a3a': '237', '#444444': '238', '#4e4e4e': '239',
\ '#585858': '240', '#626262': '241', '#6c6c6c': '242', '#767676': '243',
\ '#808080': '244', '#8a8a8a': '245', '#949494': '246', '#9e9e9e': '247',
\ '#a8a8a8': '248', '#b2b2b2': '249', '#bcbcbc': '250', '#c6c6c6': '251',
\ '#d0d0d0': '252', '#dadada': '253', '#e4e4e4': '254', '#eeeeee': '255',
\ }
" ============================================================================
" Functions:
" ============================================================================
function! s:AddCterm(name)
exec "let l:gfg = synIDattr(synIDtrans(hlID('" . a:name .
\ "')), 'fg', 'gui')"
exec "let l:gbg = synIDattr(synIDtrans(hlID('" . a:name .
\ "')), 'bg', 'gui')"
let l:gfg = l:gfg == "" ? "NONE" : l:gfg
let l:gbg = l:gbg == "" ? "NONE" : l:gbg
exec "hi " . a:name . " ctermfg=" . s:color_map[l:gfg] .
\ " ctermbg=" . s:color_map[l:gbg]
endfunction
function! s:AddSpCterm(name)
exec "let l:gsp = synIDattr(synIDtrans(hlID('" . a:name .
\ "')), 'sp', 'gui')"
let l:gsp = l:gsp == "" ? "NONE" : l:gsp
exec "hi " . a:name . " ctermfg=" . s:color_map[l:gsp]
endfunction
" ============================================================================
" Text Groups:
" ============================================================================
let s:normal_items = [
\ "ColorColumn", "Comment", "Conceal", "Constant", "Cursor", "CursorColumn",
\ "CursorIM", "CursorLine", "CursorLineNr", "DiffAdd", "DiffChange",
\ "DiffDelete", "Directory", "Error", "ErrorMsg", "Identifier",
\ "IncSearch", "LineNr", "MatchParen", "ModeMsg", "MoreMsg",
\ "NonText", "Pmenu", "PmenuSbar", "PmenuSel",
\ "PmenuThumb", "PreProc", "Question", "Search", "SignColumn",
\ "Special", "SpecialKey", "Statement", "StatusLineNC", "TabLine",
\ "TabLineFill", "Todo", "Type", "VertSplit", "Visual",
\ "WarningMsg", "WildMenu",
\ ]
let s:bold_items = [
\ "DiffText", "FoldColumn", "Folded", "StatusLine", "TabLineSel",
\ "Title", "CursorLineNr",
\ ]
let s:underline_items = [
\ "Underlined", "VisualNOS"
\ ]
let s:undercurl_items = [
\ "SpellBad", "SpellCap", "SpellLocal", "SpellRare"
\ ]
" ============================================================================
" Color Definitions:
" ============================================================================
" ----------------------------------------------------------------------------
" 'Normal' Colors:
" ----------------------------------------------------------------------------
hi clear Normal
hi Normal gui=none cterm=none term=none
if s:style == "light"
if s:contrast == "high"
hi Normal guifg=#000000
elseif s:contrast == "low"
hi Normal guifg=#626262
else
hi Normal guifg=#444444
endif
else
if s:contrast == "high"
hi Normal guifg=#eeeeee
elseif s:contrast == "low"
hi Normal guifg=#bcbcbc
else
hi Normal guifg=#d7d7d7
endif
endif
if s:style == "light"
if s:contrast_bg == "high"
hi Normal guibg=#ffffff
else
hi Normal guibg=#eeeeee
endif
else
if s:contrast_bg == "high"
hi Normal guibg=#121212
else
hi Normal guibg=#303030
endif
endif
call s:AddCterm("Normal")
" ----------------------------------------------------------------------------
" Extra setup
" ----------------------------------------------------------------------------
exec "set background=" . s:style
" Clear default settings
for s:item in s:normal_items + s:bold_items + s:underline_items + s:undercurl_items
exec "hi " . s:item . " guifg=NONE guibg=NONE gui=none"
\ . " ctermfg=NONE ctermbg=NONE cterm=none term=none"
endfor
let g:colors_name="lucius"
" ----------------------------------------------------------------------------
" Text Markup:
" ----------------------------------------------------------------------------
if s:style == "light"
hi NonText guifg=#afafd7
hi SpecialKey guifg=#afd7af
if s:contrast == "low"
hi Comment guifg=#9e9e9e
hi Conceal guifg=#9e9e9e
hi Constant guifg=#d78700
hi Directory guifg=#00af87
hi Identifier guifg=#00af00
hi PreProc guifg=#00afaf
hi Special guifg=#af00af
hi Statement guifg=#0087d7
hi Title guifg=#0087d7
hi Type guifg=#0087af
else
hi Comment guifg=#808080
hi Conceal guifg=#808080
hi Constant guifg=#af5f00
hi Directory guifg=#00875f
hi Identifier guifg=#008700
hi PreProc guifg=#008787
hi Special guifg=#870087
hi Statement guifg=#005faf
hi Title guifg=#005faf
hi Type guifg=#005f87
endif
else
hi NonText guifg=#5f5f87
hi SpecialKey guifg=#5f875f
if s:contrast == "low"
hi Comment guifg=#6c6c6c
hi Conceal guifg=#6c6c6c
hi Constant guifg=#afaf87
hi Directory guifg=#87af87
hi Identifier guifg=#87af5f
hi PreProc guifg=#5faf87
hi Special guifg=#af87af
hi Statement guifg=#5fafd7
hi Title guifg=#00afd7
hi Type guifg=#5fafaf
elseif s:contrast == "high"
hi Comment guifg=#8a8a8a
hi Conceal guifg=#8a8a8a
hi Constant guifg=#ffffd7
hi Directory guifg=#d7ffd7
hi Identifier guifg=#d7ffaf
hi PreProc guifg=#afffd7
hi Special guifg=#ffd7ff
hi Statement guifg=#afffff
hi Title guifg=#87d7ff
hi Type guifg=#afffff
else
hi Comment guifg=#808080
hi Conceal guifg=#808080
hi Constant guifg=#d7d7af
hi Directory guifg=#afd7af
hi Identifier guifg=#afd787
hi PreProc guifg=#87d7af
hi Special guifg=#d7afd7
hi Statement guifg=#87d7ff
hi Title guifg=#5fafd7
hi Type guifg=#87d7d7
endif
endif
" ----------------------------------------------------------------------------
" Highlighting:
" ----------------------------------------------------------------------------
hi Cursor guifg=bg
hi CursorColumn guifg=NONE
hi CursorIM guifg=bg
hi CursorLine guifg=NONE
hi Visual guifg=NONE
hi VisualNOS guifg=fg guibg=NONE
if s:style == "light"
hi CursorColumn guibg=#dadada
hi CursorLine guibg=#dadada
hi IncSearch guifg=fg guibg=#5fd7d7
hi MatchParen guifg=NONE guibg=#5fd7d7
hi Search guifg=fg guibg=#ffaf00
hi Visual guibg=#afd7ff
if s:contrast == "low"
hi Cursor guibg=#87afd7
hi CursorIM guibg=#87afd7
hi Error guifg=#d70000 guibg=#ffd7d7
hi Todo guifg=#af8700 guibg=#ffffaf
else
hi Cursor guibg=#5f87af
hi CursorIM guibg=#5f87af
hi Error guifg=#af0000 guibg=#d7afaf
hi Todo guifg=#875f00 guibg=#ffffaf
endif
else
hi CursorColumn guibg=#444444
hi CursorLine guibg=#444444
hi IncSearch guifg=bg
hi MatchParen guifg=fg guibg=#87af00
hi Search guifg=bg
hi Visual guibg=#005f87
if s:contrast == "low"
hi Cursor guibg=#5f87af
hi CursorIM guibg=#5f87af
hi Error guifg=#d75f5f guibg=#870000
hi IncSearch guibg=#00afaf
hi Search guibg=#d78700
hi Todo guifg=#afaf00 guibg=#5f5f00
elseif s:contrast == "high"
hi Cursor guibg=#afd7ff
hi CursorIM guibg=#afd7ff
hi Error guifg=#ffafaf guibg=#af0000
hi IncSearch guibg=#87ffff
hi Search guibg=#ffaf5f
hi Todo guifg=#ffff87 guibg=#87875f
else
hi Cursor guibg=#87afd7
hi CursorIM guibg=#87afd7
hi Error guifg=#ff8787 guibg=#870000
hi IncSearch guibg=#5fd7d7
hi Search guibg=#d78700
hi Todo guifg=#d7d75f guibg=#5f5f00
endif
endif
" ----------------------------------------------------------------------------
" Messages:
" ----------------------------------------------------------------------------
hi Question guifg=fg
if s:style == "light"
if s:contrast == "low"
hi ErrorMsg guifg=#d70000
hi ModeMsg guifg=#0087ff
hi MoreMsg guifg=#0087ff
hi WarningMsg guifg=#d78700
else
hi ErrorMsg guifg=#af0000
hi ModeMsg guifg=#005faf
hi MoreMsg guifg=#005faf
hi WarningMsg guifg=#af5f00
endif
else
if s:contrast == "low"
hi ErrorMsg guifg=#d75f5f
hi ModeMsg guifg=#87afaf
hi MoreMsg guifg=#87afaf
hi WarningMsg guifg=#af875f
elseif s:contrast == "high"
hi ErrorMsg guifg=#ff8787
hi ModeMsg guifg=#afffff
hi MoreMsg guifg=#afffff
hi WarningMsg guifg=#ffaf87
else
hi ErrorMsg guifg=#ff5f5f
hi ModeMsg guifg=#afd7d7
hi MoreMsg guifg=#afd7d7
hi WarningMsg guifg=#d7875f
endif
endif
" ----------------------------------------------------------------------------
" UI:
" ----------------------------------------------------------------------------
hi ColorColumn guifg=NONE
hi Pmenu guifg=bg
hi PmenuSel guifg=fg
hi PmenuThumb guifg=fg
hi StatusLine guifg=bg
hi TabLine guifg=bg
hi TabLineSel guifg=fg
hi WildMenu guifg=fg
if s:style == "light"
hi ColorColumn guibg=#e4e4e4
hi CursorLineNr guifg=#626262 guibg=#dadada
hi FoldColumn guibg=#bcbcbc
hi Folded guibg=#bcbcbc
hi LineNr guifg=#9e9e9e guibg=#dadada
hi PmenuSel guibg=#afd7ff
hi SignColumn guibg=#d0d0d0
hi StatusLineNC guifg=#dadada
hi TabLineFill guifg=#dadada
hi VertSplit guifg=#e4e4e4
hi WildMenu guibg=#afd7ff
if s:contrast == "low"
hi FoldColumn guifg=#808080
hi Folded guifg=#808080
hi Pmenu guibg=#9e9e9e
hi PmenuSbar guifg=#9e9e9e guibg=#626262
hi PmenuThumb guibg=#9e9e9e
hi SignColumn guifg=#808080
hi StatusLine guibg=#9e9e9e
hi StatusLineNC guibg=#9e9e9e
hi TabLine guibg=#9e9e9e
hi TabLineFill guibg=#9e9e9e
hi TabLineSel guibg=#afd7ff
hi VertSplit guibg=#9e9e9e
else
hi FoldColumn guifg=#626262
hi Folded guifg=#626262
hi Pmenu guibg=#808080
hi PmenuSbar guifg=#808080 guibg=#444444
hi PmenuThumb guibg=#9e9e9e
hi SignColumn guifg=#626262
hi StatusLine guibg=#808080
hi StatusLineNC guibg=#808080
hi TabLine guibg=#808080
hi TabLineFill guibg=#808080
hi TabLineSel guibg=#afd7ff
hi VertSplit guibg=#808080
endif
else
hi ColorColumn guibg=#3a3a3a
hi CursorLineNr guifg=#9e9e9e guibg=#444444
hi FoldColumn guibg=#4e4e4e
hi Folded guibg=#4e4e4e
hi LineNr guifg=#626262 guibg=#444444
hi PmenuSel guibg=#005f87
hi SignColumn guibg=#4e4e4e
hi StatusLineNC guifg=#4e4e4e
hi TabLineFill guifg=#4e4e4e
hi VertSplit guifg=#626262
hi WildMenu guibg=#005f87
if s:contrast == "low"
hi FoldColumn guifg=#a8a8a8
hi Folded guifg=#a8a8a8
hi Pmenu guibg=#8a8a8a
hi PmenuSbar guifg=#8a8a8a guibg=#bcbcbc
hi PmenuThumb guibg=#585858
hi SignColumn guifg=#8a8a8a
hi StatusLine guibg=#8a8a8a
hi StatusLineNC guibg=#8a8a8a
hi TabLine guibg=#8a8a8a
hi TabLineFill guibg=#8a8a8a
hi TabLineSel guibg=#005f87
hi VertSplit guibg=#8a8a8a
elseif s:contrast == "high"
hi FoldColumn guifg=#c6c6c6
hi Folded guifg=#c6c6c6
hi Pmenu guibg=#bcbcbc
hi PmenuSbar guifg=#bcbcbc guibg=#dadada
hi PmenuThumb guibg=#8a8a8a
hi SignColumn guifg=#bcbcbc
hi StatusLine guibg=#bcbcbc
hi StatusLineNC guibg=#bcbcbc
hi TabLine guibg=#bcbcbc
hi TabLineFill guibg=#bcbcbc
hi TabLineSel guibg=#0087af
hi VertSplit guibg=#bcbcbc
else
hi FoldColumn guifg=#bcbcbc
hi Folded guifg=#bcbcbc
hi Pmenu guibg=#b2b2b2
hi PmenuSbar guifg=#b2b2b2 guibg=#d0d0d0
hi PmenuThumb guibg=#808080
hi SignColumn guifg=#b2b2b2
hi StatusLine guibg=#b2b2b2
hi StatusLineNC guibg=#b2b2b2
hi TabLine guibg=#b2b2b2
hi TabLineFill guibg=#b2b2b2
hi TabLineSel guibg=#005f87
hi VertSplit guibg=#b2b2b2
endif
endif
" ----------------------------------------------------------------------------
" Diff:
" ----------------------------------------------------------------------------
hi DiffAdd guifg=fg
hi DiffChange guifg=fg
hi DiffDelete guifg=fg
if s:style == "light"
hi DiffAdd guibg=#afd7af
hi DiffChange guibg=#d7d7af
hi DiffDelete guibg=#d7afaf
hi DiffText guibg=#d7d7af
if s:contrast == "low"
hi DiffText guifg=#ff8700
else
hi DiffText guifg=#d75f00
endif
else
hi DiffAdd guibg=#5f875f
hi DiffChange guibg=#87875f
hi DiffDelete guibg=#875f5f
hi DiffText guibg=#87875f
if s:contrast == "low"
hi DiffText guifg=#d7d75f
else
hi DiffText guifg=#ffff87
endif
endif
" ----------------------------------------------------------------------------
" Spelling:
" ----------------------------------------------------------------------------
if s:style == "light"
hi SpellBad guisp=#d70000
hi SpellCap guisp=#00afd7
hi SpellLocal guisp=#d7af00
hi SpellRare guisp=#5faf00
else
hi SpellBad guisp=#ff5f5f
hi SpellCap guisp=#5fafd7
hi SpellLocal guisp=#d7af5f
hi SpellRare guisp=#5faf5f
endif
" ----------------------------------------------------------------------------
" Miscellaneous:
" ----------------------------------------------------------------------------
hi Ignore guifg=bg
hi Underlined guifg=fg
" ============================================================================
" Text Emphasis:
" ============================================================================
if s:use_bold == 1
for s:item in s:bold_items
exec "hi " . s:item . " gui=bold cterm=bold term=none"
endfor
endif
if s:use_underline == 1
for s:item in s:underline_items
exec "hi " . s:item . " gui=underline cterm=underline term=none"
endfor
for s:item in s:undercurl_items
exec "hi " . s:item . " cterm=underline"
endfor
endif
for s:item in s:undercurl_items
exec "hi " . s:item . " gui=undercurl term=none"
endfor
" ============================================================================
" Cterm Colors:
" ============================================================================
for s:item in s:normal_items + s:bold_items + s:underline_items
call s:AddCterm(s:item)
endfor
for s:item in s:undercurl_items
call s:AddSpCterm(s:item)
endfor
if s:no_term_bg == 1
hi Normal ctermbg=NONE
endif
" ============================================================================
" Alternative Bold Definitions:
" ============================================================================
let s:alternative_bold_items = ["Identifier", "PreProc", "Statement",
\ "Special", "Constant", "Type"]
for s:item in s:alternative_bold_items
exec "let s:temp_gui_fg = synIDattr(synIDtrans(hlID('" . s:item .
\ "')), 'fg', 'gui')"
exec "let s:temp_cterm_fg = synIDattr(synIDtrans(hlID('" . s:item .
\ "')), 'fg', 'cterm')"
exec "hi B" . s:item . " guifg=" . s:temp_gui_fg . " ctermfg=" .
\ s:temp_cterm_fg . " gui=bold cterm=bold term=none"
endfor
" ============================================================================
" Plugin Specific Colors:
" ============================================================================
" Tagbar:
hi link TagbarAccessPublic Constant
hi link TagbarAccessProtected Type
hi link TagbarAccessPrivate PreProc
" Vimwiki:
hi link VimwikiHeader1 BIdentifier
hi link VimwikiHeader2 BPreProc
hi link VimwikiHeader3 BStatement
hi link VimwikiHeader4 BSpecial
hi link VimwikiHeader5 BConstant
hi link VimwikiHeader6 BType
" CoC:
hi link CocErrorSign ErrorMsg
hi link CocErrorFloat Pmenu
hi link CocWarningSign WarningMsg
hi link CocWarningFloat Pmenu
hi link CocInfoSign MoreMsg
hi link CocInfoFloat Pmenu
hi link CocHintFloat Directory
hi link CocHintFloat Pmenu
" ============================================================================
" Preset Commands:
" ============================================================================
function! SetLucius(style, contrast, contrast_bg)
let g:lucius_style = a:style
let g:lucius_contrast = a:contrast
let g:lucius_contrast_bg = a:contrast_bg
endfunction
command! LuciusLight call SetLucius("light", "normal", "normal")
\ | colorscheme lucius
command! LuciusLightLowContrast call SetLucius("light", "low", "normal")
\ | colorscheme lucius
command! LuciusLightHighContrast call SetLucius("light", "high", "normal")
\ | colorscheme lucius
command! LuciusWhite call SetLucius("light", "normal", "high")
\ | colorscheme lucius
command! LuciusWhiteLowContrast call SetLucius("light", "low", "high")
\ | colorscheme lucius
command! LuciusWhiteHighContrast call SetLucius("light", "high", "high")
\ | colorscheme lucius
command! LuciusDark call SetLucius("dark", "normal", "normal")
\ | colorscheme lucius
command! LuciusDarkLowContrast call SetLucius("dark", "low", "normal")
\ | colorscheme lucius
command! LuciusDarkHighContrast call SetLucius("dark", "high", "normal")
\ | colorscheme lucius
command! LuciusBlack call SetLucius("dark", "normal", "high")
\ | colorscheme lucius
command! LuciusBlackLowContrast call SetLucius("dark", "low", "high")
\ | colorscheme lucius
command! LuciusBlackHighContrast call SetLucius("dark", "high", "high")
\ | colorscheme lucius
" vim: tw=78

View File

@ -1,38 +0,0 @@
setl wrap " softwrap the text
setl linebreak " don't break in the middle of the word
"setl nolist " list disables linebreak
setl textwidth=72
setl formatprg=par\ -B+.,\\-\\!\\?\\\"\\\'\\*\\<\ -w72qie
setl enc=utf-8
setl nojs
setl nosmartindent
setl spell
setl comments=n:>
setl formatoptions=
setl fo+=r " Insert the current comment leader after hitting <Enter> in Insert mode.
setl fo+=o " Insert the current comment leader after hitting 'o' or 'O' in Normal mode.
setl fo+=q " Allow formatting of comments with "gq".
setl fo+=w " Trailing white space indicates a paragraph continues in the next line.
setl fo+=b " Like 'v', but only auto-wrap if you enter a blank at or before the wrap margin.
setl fo+=j " Where it makes sense, remove a comment leader when joining lines.
match ErrorMsg '\s\s\+$'
syn match quote0 "^>"
syn match quote1 "^> *>"
syn match quote2 "^> *> *>"
syn match quote3 "^> *> *> *>"
syn match quote4 "^> *> *> *> *>"
syn match quote5 "^> *> *> *> *> *>"
syn match quote6 "^> *> *> *> *> *> *>"
syn match quote7 "^> *> *> *> *> *> *> *>"
hi quote0 ctermfg=magenta
hi quote1 ctermfg=cyan
hi quote2 ctermfg=blue
hi quote3 ctermfg=yellow
hi quote4 ctermfg=magenta
hi quote5 ctermfg=cyan
hi quote6 ctermfg=blue
hi quote7 ctermfg=yellow

View File

@ -1,35 +0,0 @@
" These are the mappings for snipMate.vim. Putting it here ensures that it
" will be mapped after other plugins such as supertab.vim.
if !exists('loaded_snips') || exists('s:did_snips_mappings')
finish
endif
let s:did_snips_mappings = 1
ino <silent> <tab> <c-r>=TriggerSnippet()<cr>
snor <silent> <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
ino <silent> <s-tab> <c-r>=BackwardsSnippet()<cr>
snor <silent> <s-tab> <esc>i<right><c-r>=BackwardsSnippet()<cr>
ino <silent> <c-r><tab> <c-r>=ShowAvailableSnips()<cr>
" The default mappings for these are annoying & sometimes break snipMate.
" You can change them back if you want, I've put them here for convenience.
snor <bs> b<bs>
snor <right> <esc>a
snor <left> <esc>bi
snor ' b<bs>'
snor ` b<bs>`
snor % b<bs>%
snor U b<bs>U
snor ^ b<bs>^
snor \ b<bs>\
snor <c-x> b<bs><c-x>
" By default load snippets in snippets_dir
if empty(snippets_dir)
finish
endif
call GetSnippets(snippets_dir, '_') " Get global snippets
au FileType * if &ft != 'help' | call GetSnippets(snippets_dir, &ft) | endif
" vim:noet:sw=4:ts=4:ft=vim

View File

@ -1,433 +0,0 @@
fun! Filename(...)
let filename = expand('%:t:r')
if filename == '' | return a:0 == 2 ? a:2 : '' | endif
return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
endf
fun s:RemoveSnippet()
unl! g:snipPos s:curPos s:snipLen s:endCol s:endLine s:prevLen
\ s:lastBuf s:oldWord
if exists('s:update')
unl s:startCol s:origWordLen s:update
if exists('s:oldVars') | unl s:oldVars s:oldEndCol | endif
endif
aug! snipMateAutocmds
endf
fun snipMate#expandSnip(snip, col)
let lnum = line('.') | let col = a:col
let snippet = s:ProcessSnippet(a:snip)
" Avoid error if eval evaluates to nothing
if snippet == '' | return '' | endif
" Expand snippet onto current position with the tab stops removed
let snipLines = split(substitute(snippet, '$\d\+\|${\d\+.\{-}}', '', 'g'), "\n", 1)
let line = getline(lnum)
let afterCursor = strpart(line, col - 1)
" Keep text after the cursor
if afterCursor != "\t" && afterCursor != ' '
let line = strpart(line, 0, col - 1)
let snipLines[-1] .= afterCursor
else
let afterCursor = ''
" For some reason the cursor needs to move one right after this
if line != '' && col == 1 && &ve != 'all' && &ve != 'onemore'
let col += 1
endif
endif
call setline(lnum, line.snipLines[0])
" Autoindent snippet according to previous indentation
let indent = matchend(line, '^.\{-}\ze\(\S\|$\)') + 1
call append(lnum, map(snipLines[1:], "'".strpart(line, 0, indent - 1)."'.v:val"))
" Open any folds snippet expands into
if &fen | sil! exe lnum.','.(lnum + len(snipLines) - 1).'foldopen' | endif
let [g:snipPos, s:snipLen] = s:BuildTabStops(snippet, lnum, col - indent, indent)
if s:snipLen
aug snipMateAutocmds
au CursorMovedI * call s:UpdateChangedSnip(0)
au InsertEnter * call s:UpdateChangedSnip(1)
aug END
let s:lastBuf = bufnr(0) " Only expand snippet while in current buffer
let s:curPos = 0
let s:endCol = g:snipPos[s:curPos][1]
let s:endLine = g:snipPos[s:curPos][0]
call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
let s:prevLen = [line('$'), col('$')]
if g:snipPos[s:curPos][2] != -1 | return s:SelectWord() | endif
else
unl g:snipPos s:snipLen
" Place cursor at end of snippet if no tab stop is given
let newlines = len(snipLines) - 1
call cursor(lnum + newlines, indent + len(snipLines[-1]) - len(afterCursor)
\ + (newlines ? 0: col - 1))
endif
return ''
endf
" Prepare snippet to be processed by s:BuildTabStops
fun s:ProcessSnippet(snip)
let snippet = a:snip
" Evaluate eval (`...`) expressions.
" Using a loop here instead of a regex fixes a bug with nested "\=".
if stridx(snippet, '`') != -1
while match(snippet, '`.\{-}`') != -1
let snippet = substitute(snippet, '`.\{-}`',
\ substitute(eval(matchstr(snippet, '`\zs.\{-}\ze`')),
\ "\n\\%$", '', ''), '')
endw
let snippet = substitute(snippet, "\r", "\n", 'g')
endif
" Place all text after a colon in a tab stop after the tab stop
" (e.g. "${#:foo}" becomes "${:foo}foo").
" This helps tell the position of the tab stops later.
let snippet = substitute(snippet, '${\d\+:\(.\{-}\)}', '&\1', 'g')
" Update the a:snip so that all the $# become the text after
" the colon in their associated ${#}.
" (e.g. "${1:foo}" turns all "$1"'s into "foo")
let i = 1
while stridx(snippet, '${'.i) != -1
let s = matchstr(snippet, '${'.i.':\zs.\{-}\ze}')
if s != ''
let snippet = substitute(snippet, '$'.i, s.'&', 'g')
endif
let i += 1
endw
if &et " Expand tabs to spaces if 'expandtab' is set.
return substitute(snippet, '\t', repeat(' ', &sts ? &sts : &sw), 'g')
endif
return snippet
endf
" Counts occurences of haystack in needle
fun s:Count(haystack, needle)
let counter = 0
let index = stridx(a:haystack, a:needle)
while index != -1
let index = stridx(a:haystack, a:needle, index+1)
let counter += 1
endw
return counter
endf
" Builds a list of a list of each tab stop in the snippet containing:
" 1.) The tab stop's line number.
" 2.) The tab stop's column number
" (by getting the length of the string between the last "\n" and the
" tab stop).
" 3.) The length of the text after the colon for the current tab stop
" (e.g. "${1:foo}" would return 3). If there is no text, -1 is returned.
" 4.) If the "${#:}" construct is given, another list containing all
" the matches of "$#", to be replaced with the placeholder. This list is
" composed the same way as the parent; the first item is the line number,
" and the second is the column.
fun s:BuildTabStops(snip, lnum, col, indent)
let snipPos = []
let i = 1
let withoutVars = substitute(a:snip, '$\d\+', '', 'g')
while stridx(a:snip, '${'.i) != -1
let beforeTabStop = matchstr(withoutVars, '^.*\ze${'.i.'\D')
let withoutOthers = substitute(withoutVars, '${\('.i.'\D\)\@!\d\+.\{-}}', '', 'g')
let j = i - 1
call add(snipPos, [0, 0, -1])
let snipPos[j][0] = a:lnum + s:Count(beforeTabStop, "\n")
let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze${'.i.'\D'))
if snipPos[j][0] == a:lnum | let snipPos[j][1] += a:col | endif
" Get all $# matches in another list, if ${#:name} is given
if stridx(withoutVars, '${'.i.':') != -1
let snipPos[j][2] = len(matchstr(withoutVars, '${'.i.':\zs.\{-}\ze}'))
let dots = repeat('.', snipPos[j][2])
call add(snipPos[j], [])
let withoutOthers = substitute(a:snip, '${\d\+.\{-}}\|$'.i.'\@!\d\+', '', 'g')
while match(withoutOthers, '$'.i.'\(\D\|$\)') != -1
let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.'$'.i.'\(\D\|$\)')
call add(snipPos[j][3], [0, 0])
let snipPos[j][3][-1][0] = a:lnum + s:Count(beforeMark, "\n")
let snipPos[j][3][-1][1] = a:indent + (snipPos[j][3][-1][0] > a:lnum
\ ? len(matchstr(beforeMark, '.*\n\zs.*'))
\ : a:col + len(beforeMark))
let withoutOthers = substitute(withoutOthers, '$'.i.'\ze\(\D\|$\)', '', '')
endw
endif
let i += 1
endw
return [snipPos, i - 1]
endf
fun snipMate#jumpTabStop(backwards)
let leftPlaceholder = exists('s:origWordLen')
\ && s:origWordLen != g:snipPos[s:curPos][2]
if leftPlaceholder && exists('s:oldEndCol')
let startPlaceholder = s:oldEndCol + 1
endif
if exists('s:update')
call s:UpdatePlaceholderTabStops()
else
call s:UpdateTabStops()
endif
" Don't reselect placeholder if it has been modified
if leftPlaceholder && g:snipPos[s:curPos][2] != -1
if exists('startPlaceholder')
let g:snipPos[s:curPos][1] = startPlaceholder
else
let g:snipPos[s:curPos][1] = col('.')
let g:snipPos[s:curPos][2] = 0
endif
endif
let s:curPos += a:backwards ? -1 : 1
" Loop over the snippet when going backwards from the beginning
if s:curPos < 0 | let s:curPos = s:snipLen - 1 | endif
if s:curPos == s:snipLen
let sMode = s:endCol == g:snipPos[s:curPos-1][1]+g:snipPos[s:curPos-1][2]
call s:RemoveSnippet()
return sMode ? "\<tab>" : TriggerSnippet()
endif
call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
let s:endLine = g:snipPos[s:curPos][0]
let s:endCol = g:snipPos[s:curPos][1]
let s:prevLen = [line('$'), col('$')]
return g:snipPos[s:curPos][2] == -1 ? '' : s:SelectWord()
endf
fun s:UpdatePlaceholderTabStops()
let changeLen = s:origWordLen - g:snipPos[s:curPos][2]
unl s:startCol s:origWordLen s:update
if !exists('s:oldVars') | return | endif
" Update tab stops in snippet if text has been added via "$#"
" (e.g., in "${1:foo}bar$1${2}").
if changeLen != 0
let curLine = line('.')
for pos in g:snipPos
if pos == g:snipPos[s:curPos] | continue | endif
let changed = pos[0] == curLine && pos[1] > s:oldEndCol
let changedVars = 0
let endPlaceholder = pos[2] - 1 + pos[1]
" Subtract changeLen from each tab stop that was after any of
" the current tab stop's placeholders.
for [lnum, col] in s:oldVars
if lnum > pos[0] | break | endif
if pos[0] == lnum
if pos[1] > col || (pos[2] == -1 && pos[1] == col)
let changed += 1
elseif col < endPlaceholder
let changedVars += 1
endif
endif
endfor
let pos[1] -= changeLen * changed
let pos[2] -= changeLen * changedVars " Parse variables within placeholders
" e.g., "${1:foo} ${2:$1bar}"
if pos[2] == -1 | continue | endif
" Do the same to any placeholders in the other tab stops.
for nPos in pos[3]
let changed = nPos[0] == curLine && nPos[1] > s:oldEndCol
for [lnum, col] in s:oldVars
if lnum > nPos[0] | break | endif
if nPos[0] == lnum && nPos[1] > col
let changed += 1
endif
endfor
let nPos[1] -= changeLen * changed
endfor
endfor
endif
unl s:endCol s:oldVars s:oldEndCol
endf
fun s:UpdateTabStops()
let changeLine = s:endLine - g:snipPos[s:curPos][0]
let changeCol = s:endCol - g:snipPos[s:curPos][1]
if exists('s:origWordLen')
let changeCol -= s:origWordLen
unl s:origWordLen
endif
let lnum = g:snipPos[s:curPos][0]
let col = g:snipPos[s:curPos][1]
" Update the line number of all proceeding tab stops if <cr> has
" been inserted.
if changeLine != 0
let changeLine -= 1
for pos in g:snipPos
if pos[0] >= lnum
if pos[0] == lnum | let pos[1] += changeCol | endif
let pos[0] += changeLine
endif
if pos[2] == -1 | continue | endif
for nPos in pos[3]
if nPos[0] >= lnum
if nPos[0] == lnum | let nPos[1] += changeCol | endif
let nPos[0] += changeLine
endif
endfor
endfor
elseif changeCol != 0
" Update the column of all proceeding tab stops if text has
" been inserted/deleted in the current line.
for pos in g:snipPos
if pos[1] >= col && pos[0] == lnum
let pos[1] += changeCol
endif
if pos[2] == -1 | continue | endif
for nPos in pos[3]
if nPos[0] > lnum | break | endif
if nPos[0] == lnum && nPos[1] >= col
let nPos[1] += changeCol
endif
endfor
endfor
endif
endf
fun s:SelectWord()
let s:origWordLen = g:snipPos[s:curPos][2]
let s:oldWord = strpart(getline('.'), g:snipPos[s:curPos][1] - 1,
\ s:origWordLen)
let s:prevLen[1] -= s:origWordLen
if !empty(g:snipPos[s:curPos][3])
let s:update = 1
let s:endCol = -1
let s:startCol = g:snipPos[s:curPos][1] - 1
endif
if !s:origWordLen | return '' | endif
let l = col('.') != 1 ? 'l' : ''
if &sel == 'exclusive'
return "\<esc>".l.'v'.s:origWordLen."l\<c-g>"
endif
return s:origWordLen == 1 ? "\<esc>".l.'gh'
\ : "\<esc>".l.'v'.(s:origWordLen - 1)."l\<c-g>"
endf
" This updates the snippet as you type when text needs to be inserted
" into multiple places (e.g. in "${1:default text}foo$1bar$1",
" "default text" would be highlighted, and if the user types something,
" UpdateChangedSnip() would be called so that the text after "foo" & "bar"
" are updated accordingly)
"
" It also automatically quits the snippet if the cursor is moved out of it
" while in insert mode.
fun s:UpdateChangedSnip(entering)
if exists('g:snipPos') && bufnr(0) != s:lastBuf
call s:RemoveSnippet()
elseif exists('s:update') " If modifying a placeholder
if !exists('s:oldVars') && s:curPos + 1 < s:snipLen
" Save the old snippet & word length before it's updated
" s:startCol must be saved too, in case text is added
" before the snippet (e.g. in "foo$1${2}bar${1:foo}").
let s:oldEndCol = s:startCol
let s:oldVars = deepcopy(g:snipPos[s:curPos][3])
endif
let col = col('.') - 1
if s:endCol != -1
let changeLen = col('$') - s:prevLen[1]
let s:endCol += changeLen
else " When being updated the first time, after leaving select mode
if a:entering | return | endif
let s:endCol = col - 1
endif
" If the cursor moves outside the snippet, quit it
if line('.') != g:snipPos[s:curPos][0] || col < s:startCol ||
\ col - 1 > s:endCol
unl! s:startCol s:origWordLen s:oldVars s:update
return s:RemoveSnippet()
endif
call s:UpdateVars()
let s:prevLen[1] = col('$')
elseif exists('g:snipPos')
if !a:entering && g:snipPos[s:curPos][2] != -1
let g:snipPos[s:curPos][2] = -2
endif
let col = col('.')
let lnum = line('.')
let changeLine = line('$') - s:prevLen[0]
if lnum == s:endLine
let s:endCol += col('$') - s:prevLen[1]
let s:prevLen = [line('$'), col('$')]
endif
if changeLine != 0
let s:endLine += changeLine
let s:endCol = col
endif
" Delete snippet if cursor moves out of it in insert mode
if (lnum == s:endLine && (col > s:endCol || col < g:snipPos[s:curPos][1]))
\ || lnum > s:endLine || lnum < g:snipPos[s:curPos][0]
call s:RemoveSnippet()
endif
endif
endf
" This updates the variables in a snippet when a placeholder has been edited.
" (e.g., each "$1" in "${1:foo} $1bar $1bar")
fun s:UpdateVars()
let newWordLen = s:endCol - s:startCol + 1
let newWord = strpart(getline('.'), s:startCol, newWordLen)
if newWord == s:oldWord || empty(g:snipPos[s:curPos][3])
return
endif
let changeLen = g:snipPos[s:curPos][2] - newWordLen
let curLine = line('.')
let startCol = col('.')
let oldStartSnip = s:startCol
let updateTabStops = changeLen != 0
let i = 0
for [lnum, col] in g:snipPos[s:curPos][3]
if updateTabStops
let start = s:startCol
if lnum == curLine && col <= start
let s:startCol -= changeLen
let s:endCol -= changeLen
endif
for nPos in g:snipPos[s:curPos][3][(i):]
" This list is in ascending order, so quit if we've gone too far.
if nPos[0] > lnum | break | endif
if nPos[0] == lnum && nPos[1] > col
let nPos[1] -= changeLen
endif
endfor
if lnum == curLine && col > start
let col -= changeLen
let g:snipPos[s:curPos][3][i][1] = col
endif
let i += 1
endif
" "Very nomagic" is used here to allow special characters.
call setline(lnum, substitute(getline(lnum), '\%'.col.'c\V'.
\ escape(s:oldWord, '\'), escape(newWord, '\&'), ''))
endfor
if oldStartSnip != s:startCol
call cursor(0, startCol + s:startCol - oldStartSnip)
endif
let s:oldWord = newWord
let g:snipPos[s:curPos][2] = newWordLen
endf
" vim:noet:sw=4:ts=4:ft=vim

View File

@ -1,286 +0,0 @@
*snipMate.txt* Plugin for using TextMate-style snippets in Vim.
snipMate *snippet* *snippets* *snipMate*
Last Change: July 13, 2009
|snipMate-description| Description
|snipMate-syntax| Snippet syntax
|snipMate-usage| Usage
|snipMate-settings| Settings
|snipMate-features| Features
|snipMate-disadvantages| Disadvantages to TextMate
|snipMate-contact| Contact
For Vim version 7.0 or later.
This plugin only works if 'compatible' is not set.
{Vi does not have any of these features.}
==============================================================================
DESCRIPTION *snipMate-description*
snipMate.vim implements some of TextMate's snippets features in Vim. A
snippet is a piece of often-typed text that you can insert into your
document using a trigger word followed by a <tab>.
For instance, in a C file using the default installation of snipMate.vim, if
you type "for<tab>" in insert mode, it will expand a typical for loop in C: >
for (i = 0; i < count; i++) {
}
To go to the next item in the loop, simply <tab> over to it; if there is
repeated code, such as the "i" variable in this example, you can simply
start typing once it's highlighted and all the matches specified in the
snippet will be updated. To go in reverse, use <shift-tab>.
==============================================================================
SYNTAX *snippet-syntax*
Snippets can be defined in two ways. They can be in their own file, named
after their trigger in 'snippets/<filetype>/<trigger>.snippet', or they can be
defined together in a 'snippets/<filetype>.snippets' file. Note that dotted
'filetype' syntax is supported -- e.g., you can use >
:set ft=html.eruby
to activate snippets for both HTML and eRuby for the current file.
The syntax for snippets in *.snippets files is the following: >
snippet trigger
expanded text
more expanded text
Note that the first hard tab after the snippet trigger is required, and not
expanded in the actual snippet. The syntax for *.snippet files is the same,
only without the trigger declaration and starting indentation.
Also note that snippets must be defined using hard tabs. They can be expanded
to spaces later if desired (see |snipMate-indenting|).
"#" is used as a line-comment character in *.snippets files; however, they can
only be used outside of a snippet declaration. E.g.: >
# this is a correct comment
snippet trigger
expanded text
snippet another_trigger
# this isn't a comment!
expanded text
<
This should hopefully be obvious with the included syntax highlighting.
*snipMate-${#}*
Tab stops ~
By default, the cursor is placed at the end of a snippet. To specify where the
cursor is to be placed next, use "${#}", where the # is the number of the tab
stop. E.g., to place the cursor first on the id of a <div> tag, and then allow
the user to press <tab> to go to the middle of it:
>
snippet div
<div id="${1}">
${2}
</div>
<
*snipMate-placeholders* *snipMate-${#:}* *snipMate-$#*
Placeholders ~
Placeholder text can be supplied using "${#:text}", where # is the number of
the tab stop. This text then can be copied throughout the snippet using "$#",
given # is the same number as used before. So, to make a C for loop: >
snippet for
for (${2:i}; $2 < ${1:count}; $1++) {
${4}
}
This will cause "count" to first be selected and change if the user starts
typing. When <tab> is pressed, the "i" in ${2}'s position will be selected;
all $2 variables will default to "i" and automatically be updated if the user
starts typing.
NOTE: "$#" syntax is used only for variables, not for tab stops as in TextMate.
Variables within variables are also possible. For instance: >
snippet opt
<option value="${1:option}">${2:$1}</option>
Will, as usual, cause "option" to first be selected and update all the $1
variables if the user starts typing. Since one of these variables is inside of
${2}, this text will then be used as a placeholder for the next tab stop,
allowing the user to change it if he wishes.
To copy a value throughout a snippet without supplying default text, simply
use the "${#:}" construct without the text; e.g.: >
snippet foo
${1:}bar$1
< *snipMate-commands*
Interpolated Vim Script ~
Snippets can also contain Vim script commands that are executed (via |eval()|)
when the snippet is inserted. Commands are given inside backticks (`...`); for
TextMates's functionality, use the |system()| function. E.g.: >
snippet date
`system("date +%Y-%m-%d")`
will insert the current date, assuming you are on a Unix system. Note that you
can also (and should) use |strftime()| for this example.
Filename([{expr}] [, {defaultText}]) *snipMate-filename* *Filename()*
Since the current filename is used often in snippets, a default function
has been defined for it in snipMate.vim, appropriately called Filename().
With no arguments, the default filename without an extension is returned;
the first argument specifies what to place before or after the filename,
and the second argument supplies the default text to be used if the file
has not been named. "$1" in the first argument is replaced with the filename;
if you only want the filename to be returned, the first argument can be left
blank. Examples: >
snippet filename
`Filename()`
snippet filename_with_default
`Filename('', 'name')`
snippet filename_foo
`filename('$1_foo')`
The first example returns the filename if it the file has been named, and an
empty string if it hasn't. The second returns the filename if it's been named,
and "name" if it hasn't. The third returns the filename followed by "_foo" if
it has been named, and an empty string if it hasn't.
*multi_snip*
To specify that a snippet can have multiple matches in a *.snippets file, use
this syntax: >
snippet trigger A description of snippet #1
expand this text
snippet trigger A description of snippet #2
expand THIS text!
In this example, when "trigger<tab>" is typed, a numbered menu containing all
of the descriptions of the "trigger" will be shown; when the user presses the
corresponding number, that snippet will then be expanded.
To create a snippet with multiple matches using *.snippet files,
simply place all the snippets in a subdirectory with the trigger name:
'snippets/<filetype>/<trigger>/<name>.snippet'.
==============================================================================
USAGE *snipMate-usage*
*'snippets'* *g:snippets_dir*
Snippets are by default looked for any 'snippets' directory in your
'runtimepath'. Typically, it is located at '~/.vim/snippets/' on *nix or
'$HOME\vimfiles\snippets\' on Windows. To change that location or add another
one, change the g:snippets_dir variable in your |.vimrc| to your preferred
directory, or use the |ExtractSnips()|function. This will be used by the
|globpath()| function, and so accepts the same syntax as it (e.g.,
comma-separated paths).
ExtractSnipsFile({directory}, {filetype}) *ExtractSnipsFile()* *.snippets*
ExtractSnipsFile() extracts the specified *.snippets file for the given
filetype. A .snippets file contains multiple snippet declarations for the
filetype. It is further explained above, in |snippet-syntax|.
ExtractSnips({directory}, {filetype}) *ExtractSnips()* *.snippet*
ExtractSnips() extracts *.snippet files from the specified directory and
defines them as snippets for the given filetype. The directory tree should
look like this: 'snippets/<filetype>/<trigger>.snippet'. If the snippet has
multiple matches, it should look like this:
'snippets/<filetype>/<trigger>/<name>.snippet' (see |multi_snip|).
*ResetSnippets()*
The ResetSnippets() function removes all snippets from memory. This is useful
to put at the top of a snippet setup file for if you would like to |:source|
it multiple times.
*list-snippets* *i_CTRL-R_<Tab>*
If you would like to see what snippets are available, simply type <c-r><tab>
in the current buffer to show a list via |popupmenu-completion|.
==============================================================================
SETTINGS *snipMate-settings* *g:snips_author*
The g:snips_author string (similar to $TM_FULLNAME in TextMate) should be set
to your name; it can then be used in snippets to automatically add it. E.g.: >
let g:snips_author = 'Hubert Farnsworth'
snippet name
`g:snips_author`
<
*snipMate-expandtab* *snipMate-indenting*
If you would like your snippets to be expanded using spaces instead of tabs,
just enable 'expandtab' and set 'softtabstop' to your preferred amount of
spaces. If 'softtabstop' is not set, 'shiftwidth' is used instead.
*snipMate-remap*
snipMate does not come with a setting to customize the trigger key, but you
can remap it easily in the two lines it's defined in the 'after' directory
under 'plugin/snipMate.vim'. For instance, to change the trigger key
to CTRL-J, just change this: >
ino <tab> <c-r>=TriggerSnippet()<cr>
snor <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
to this: >
ino <c-j> <c-r>=TriggerSnippet()<cr>
snor <c-j> <esc>i<right><c-r>=TriggerSnippet()<cr>
==============================================================================
FEATURES *snipMate-features*
snipMate.vim has the following features among others:
- The syntax of snippets is very similar to TextMate's, allowing
easy conversion.
- The position of the snippet is kept transparently (i.e. it does not use
markers/placeholders written to the buffer), which allows you to escape
out of an incomplete snippet, something particularly useful in Vim.
- Variables in snippets are updated as-you-type.
- Snippets can have multiple matches.
- Snippets can be out of order. For instance, in a do...while loop, the
condition can be added before the code.
- [New] File-based snippets are supported.
- [New] Triggers after non-word delimiters are expanded, e.g. "foo"
in "bar.foo".
- [New] <shift-tab> can now be used to jump tab stops in reverse order.
==============================================================================
DISADVANTAGES *snipMate-disadvantages*
snipMate.vim currently has the following disadvantages to TextMate's snippets:
- There is no $0; the order of tab stops must be explicitly stated.
- Placeholders within placeholders are not possible. E.g.: >
'<div${1: id="${2:some_id}}">${3}</div>'
<
In TextMate this would first highlight ' id="some_id"', and if
you hit delete it would automatically skip ${2} and go to ${3}
on the next <tab>, but if you didn't delete it it would highlight
"some_id" first. You cannot do this in snipMate.vim.
- Regex cannot be performed on variables, such as "${1/.*/\U&}"
- Placeholders cannot span multiple lines.
- Activating snippets in different scopes of the same file is
not possible.
Perhaps some of these features will be added in a later release.
==============================================================================
CONTACT *snipMate-contact* *snipMate-author*
To contact the author (Michael Sanders), please email:
msanders42+snipmate <at> gmail <dot> com
I greatly appreciate any suggestions or improvements offered for the script.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,33 +0,0 @@
'snippets' snipMate.txt /*'snippets'*
.snippet snipMate.txt /*.snippet*
.snippets snipMate.txt /*.snippets*
ExtractSnips() snipMate.txt /*ExtractSnips()*
ExtractSnipsFile() snipMate.txt /*ExtractSnipsFile()*
Filename() snipMate.txt /*Filename()*
ResetSnippets() snipMate.txt /*ResetSnippets()*
g:snippets_dir snipMate.txt /*g:snippets_dir*
g:snips_author snipMate.txt /*g:snips_author*
i_CTRL-R_<Tab> snipMate.txt /*i_CTRL-R_<Tab>*
list-snippets snipMate.txt /*list-snippets*
multi_snip snipMate.txt /*multi_snip*
snipMate snipMate.txt /*snipMate*
snipMate-$# snipMate.txt /*snipMate-$#*
snipMate-${#:} snipMate.txt /*snipMate-${#:}*
snipMate-${#} snipMate.txt /*snipMate-${#}*
snipMate-author snipMate.txt /*snipMate-author*
snipMate-commands snipMate.txt /*snipMate-commands*
snipMate-contact snipMate.txt /*snipMate-contact*
snipMate-description snipMate.txt /*snipMate-description*
snipMate-disadvantages snipMate.txt /*snipMate-disadvantages*
snipMate-expandtab snipMate.txt /*snipMate-expandtab*
snipMate-features snipMate.txt /*snipMate-features*
snipMate-filename snipMate.txt /*snipMate-filename*
snipMate-indenting snipMate.txt /*snipMate-indenting*
snipMate-placeholders snipMate.txt /*snipMate-placeholders*
snipMate-remap snipMate.txt /*snipMate-remap*
snipMate-settings snipMate.txt /*snipMate-settings*
snipMate-usage snipMate.txt /*snipMate-usage*
snipMate.txt snipMate.txt /*snipMate.txt*
snippet snipMate.txt /*snippet*
snippet-syntax snipMate.txt /*snippet-syntax*
snippets snipMate.txt /*snippets*

View File

@ -1,10 +0,0 @@
" Helper function for (x)html snippets
if exists('s:did_snip_helper') || &cp || !exists('loaded_snips')
finish
endif
let s:did_snip_helper = 1
" Automatically closes tag if in xhtml
fun! Close()
return stridx(&ft, 'xhtml') == -1 ? '' : ' /'
endf

View File

@ -1,247 +0,0 @@
" File: snipMate.vim
" Author: Michael Sanders
" Last Updated: July 13, 2009
" Version: 0.83
" Description: snipMate.vim implements some of TextMate's snippets features in
" Vim. A snippet is a piece of often-typed text that you can
" insert into your document using a trigger word followed by a "<tab>".
"
" For more help see snipMate.txt; you can do this by using:
" :helptags ~/.vim/doc
" :h snipMate.txt
if exists('loaded_snips') || &cp || version < 700
finish
endif
let loaded_snips = 1
if !exists('snips_author') | let snips_author = 'Me' | endif
au BufRead,BufNewFile *.snippets\= set ft=snippet
au FileType snippet setl noet fdm=indent
let s:snippets = {} | let s:multi_snips = {}
if !exists('snippets_dir')
let snippets_dir = substitute(globpath(&rtp, 'snippets/'), "\n", ',', 'g')
endif
fun! MakeSnip(scope, trigger, content, ...)
let multisnip = a:0 && a:1 != ''
let var = multisnip ? 's:multi_snips' : 's:snippets'
if !has_key({var}, a:scope) | let {var}[a:scope] = {} | endif
if !has_key({var}[a:scope], a:trigger)
let {var}[a:scope][a:trigger] = multisnip ? [[a:1, a:content]] : a:content
elseif multisnip | let {var}[a:scope][a:trigger] += [[a:1, a:content]]
else
echom 'Warning in snipMate.vim: Snippet '.a:trigger.' is already defined.'
\ .' See :h multi_snip for help on snippets with multiple matches.'
endif
endf
fun! ExtractSnips(dir, ft)
for path in split(globpath(a:dir, '*'), "\n")
if isdirectory(path)
let pathname = fnamemodify(path, ':t')
for snipFile in split(globpath(path, '*.snippet'), "\n")
call s:ProcessFile(snipFile, a:ft, pathname)
endfor
elseif fnamemodify(path, ':e') == 'snippet'
call s:ProcessFile(path, a:ft)
endif
endfor
endf
" Processes a single-snippet file; optionally add the name of the parent
" directory for a snippet with multiple matches.
fun s:ProcessFile(file, ft, ...)
let keyword = fnamemodify(a:file, ':t:r')
if keyword == '' | return | endif
try
let text = join(readfile(a:file), "\n")
catch /E484/
echom "Error in snipMate.vim: couldn't read file: ".a:file
endtry
return a:0 ? MakeSnip(a:ft, a:1, text, keyword)
\ : MakeSnip(a:ft, keyword, text)
endf
fun! ExtractSnipsFile(file, ft)
if !filereadable(a:file) | return | endif
let text = readfile(a:file)
let inSnip = 0
for line in text + ["\n"]
if inSnip && (line[0] == "\t" || line == '')
let content .= strpart(line, 1)."\n"
continue
elseif inSnip
call MakeSnip(a:ft, trigger, content[:-2], name)
let inSnip = 0
endif
if line[:6] == 'snippet'
let inSnip = 1
let trigger = strpart(line, 8)
let name = ''
let space = stridx(trigger, ' ') + 1
if space " Process multi snip
let name = strpart(trigger, space)
let trigger = strpart(trigger, 0, space - 1)
endif
let content = ''
endif
endfor
endf
fun! ResetSnippets()
let s:snippets = {} | let s:multi_snips = {} | let g:did_ft = {}
endf
let g:did_ft = {}
fun! GetSnippets(dir, filetypes)
for ft in split(a:filetypes, '\.')
if has_key(g:did_ft, ft) | continue | endif
call s:DefineSnips(a:dir, ft, ft)
if ft == 'objc' || ft == 'cpp' || ft == 'cs'
call s:DefineSnips(a:dir, 'c', ft)
elseif ft == 'xhtml'
call s:DefineSnips(a:dir, 'html', 'xhtml')
endif
let g:did_ft[ft] = 1
endfor
endf
" Define "aliasft" snippets for the filetype "realft".
fun s:DefineSnips(dir, aliasft, realft)
for path in split(globpath(a:dir, a:aliasft.'/')."\n".
\ globpath(a:dir, a:aliasft.'-*/'), "\n")
call ExtractSnips(path, a:realft)
endfor
for path in split(globpath(a:dir, a:aliasft.'.snippets')."\n".
\ globpath(a:dir, a:aliasft.'-*.snippets'), "\n")
call ExtractSnipsFile(path, a:realft)
endfor
endf
fun! TriggerSnippet()
if exists('g:SuperTabMappingForward')
if g:SuperTabMappingForward == "<tab>"
let SuperTabKey = "\<c-n>"
elseif g:SuperTabMappingBackward == "<tab>"
let SuperTabKey = "\<c-p>"
endif
endif
if pumvisible() " Update snippet if completion is used, or deal with supertab
if exists('SuperTabKey')
call feedkeys(SuperTabKey) | return ''
endif
call feedkeys("\<esc>a", 'n') " Close completion menu
call feedkeys("\<tab>") | return ''
endif
if exists('g:snipPos') | return snipMate#jumpTabStop(0) | endif
let word = matchstr(getline('.'), '\S\+\%'.col('.').'c')
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
let [trigger, snippet] = s:GetSnippet(word, scope)
" If word is a trigger for a snippet, delete the trigger & expand
" the snippet.
if snippet != ''
let col = col('.') - len(trigger)
sil exe 's/\V'.escape(trigger, '/.').'\%#//'
return snipMate#expandSnip(snippet, col)
endif
endfor
if exists('SuperTabKey')
call feedkeys(SuperTabKey)
return ''
endif
return "\<tab>"
endf
fun! BackwardsSnippet()
if exists('g:snipPos') | return snipMate#jumpTabStop(1) | endif
if exists('g:SuperTabMappingForward')
if g:SuperTabMappingBackward == "<s-tab>"
let SuperTabKey = "\<c-p>"
elseif g:SuperTabMappingForward == "<s-tab>"
let SuperTabKey = "\<c-n>"
endif
endif
if exists('SuperTabKey')
call feedkeys(SuperTabKey)
return ''
endif
return "\<s-tab>"
endf
" Check if word under cursor is snippet trigger; if it isn't, try checking if
" the text after non-word characters is (e.g. check for "foo" in "bar.foo")
fun s:GetSnippet(word, scope)
let word = a:word | let snippet = ''
while snippet == ''
if exists('s:snippets["'.a:scope.'"]["'.escape(word, '\"').'"]')
let snippet = s:snippets[a:scope][word]
elseif exists('s:multi_snips["'.a:scope.'"]["'.escape(word, '\"').'"]')
let snippet = s:ChooseSnippet(a:scope, word)
if snippet == '' | break | endif
else
if match(word, '\W') == -1 | break | endif
let word = substitute(word, '.\{-}\W', '', '')
endif
endw
if word == '' && a:word != '.' && stridx(a:word, '.') != -1
let [word, snippet] = s:GetSnippet('.', a:scope)
endif
return [word, snippet]
endf
fun s:ChooseSnippet(scope, trigger)
let snippet = []
let i = 1
for snip in s:multi_snips[a:scope][a:trigger]
let snippet += [i.'. '.snip[0]]
let i += 1
endfor
if i == 2 | return s:multi_snips[a:scope][a:trigger][0][1] | endif
let num = inputlist(snippet) - 1
return num == -1 ? '' : s:multi_snips[a:scope][a:trigger][num][1]
endf
fun! ShowAvailableSnips()
let line = getline('.')
let col = col('.')
let word = matchstr(getline('.'), '\S\+\%'.col.'c')
let words = [word]
if stridx(word, '.')
let words += split(word, '\.', 1)
endif
let matchlen = 0
let matches = []
for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
let triggers = has_key(s:snippets, scope) ? keys(s:snippets[scope]) : []
if has_key(s:multi_snips, scope)
let triggers += keys(s:multi_snips[scope])
endif
for trigger in triggers
for word in words
if word == ''
let matches += [trigger] " Show all matches if word is empty
elseif trigger =~ '^'.word
let matches += [trigger]
let len = len(word)
if len > matchlen | let matchlen = len | endif
endif
endfor
endfor
endfor
" This is to avoid a bug with Vim when using complete(col - matchlen, matches)
" (Issue#46 on the Google Code snipMate issue tracker).
call setline(line('.'), substitute(line, repeat('.', matchlen).'\%'.col.'c', '', ''))
call complete(col, matches)
return ''
endf
" vim:noet:sw=4:ts=4:ft=vim

View File

@ -1,35 +0,0 @@
# Global snippets
# (c) holds no legal value ;)
snippet c)
`&enc[:2] == "utf" ? "©" : "(c)"` Copyright `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2}
snippet date
`strftime("%Y-%m-%d")`
snippet mfg
Mit freundlichen Grüßen,
Stefan Hagen
snippet mailf
Sehr geehrte Frau ${1:Name},
${2:Text}
Mit freundlichen Grüßen,
Stefan Hagen
snippet mailh
Sehr geehrter Herr ${1:Name},
${2:Text}
Mit freundlichen Grüßen,
Stefan Hagen
snippet sig
--
Stefan Hagen
T: +49 (0)176 64292517
M: sh@codevoid.de
snippet je
`strftime("%A %d.%m.%d %H:%M")`:
snippet tel
017664292517
snippet worktel
015162345601

View File

@ -1,110 +0,0 @@
# main()
snippet main
int main(int argc, const char *argv[])
{
${1}
return 0;
}
# #include <...>
snippet inc
#include <${1:stdio}.h>${2}
# #include "..."
snippet Inc
#include "${1:`Filename("$1.h")`}"${2}
# #ifndef ... #define ... #endif
snippet Def
#ifndef $1
#define ${1:SYMBOL} ${2:value}
#endif${3}
snippet def
#define
snippet ifdef
#ifdef ${1:FOO}
${2:#define }
#endif
snippet #if
#if ${1:FOO}
${2}
#endif
# Header Include-Guard
# (the randomizer code is taken directly from TextMate; it could probably be
# cleaner, I don't know how to do it in vim script)
snippet once
#ifndef ${1:`toupper(Filename('', 'UNTITLED').'_'.system("/usr/bin/ruby -e 'print (rand * 2821109907455).round.to_s(36)'"))`}
#define $1
${2}
#endif /* end of include guard: $1 */
# If Condition
snippet if
if (${1:/* condition */}) {
${2:/* code */}
}
snippet el
else {
${1}
}
# Tertiary conditional
snippet t
${1:/* condition */} ? ${2:a} : ${3:b}
# Do While Loop
snippet do
do {
${2:/* code */}
} while (${1:/* condition */});
# While Loop
snippet wh
while (${1:/* condition */}) {
${2:/* code */}
}
# For Loop
snippet for
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4:/* code */}
}
# Custom For Loop
snippet forr
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
${5:/* code */}
}
# Function
snippet fun
${1:void} ${2:function_name}(${3})
{
${4:/* code */}
}
# Function Declaration
snippet fund
${1:void} ${2:function_name}(${3});${4}
# Typedef
snippet td
typedef ${1:int} ${2:MyCustomType};${3}
# Struct
snippet st
struct ${1:`Filename('$1_t', 'name')`} {
${2:/* data */}
}${3: /* optional variable list */};${4}
# Typedef struct
snippet tds
typedef struct ${2:_$1 }{
${3:/* data */}
} ${1:`Filename('$1_t', 'name')`};
# Typdef enum
snippet tde
typedef enum {
${1:/* data */}
} ${2:foo};
# printf
# unfortunately version this isn't as nice as TextMates's, given the lack of a
# dynamic `...`
snippet pr
printf("${1:%s}\n"${2});${3}
# fprintf (again, this isn't as nice as TextMate's version, but it works)
snippet fpr
fprintf(${1:stderr}, "${2:%s}\n"${3});${4}
snippet .
[${1}]${2}
snippet un
unsigned

View File

@ -1,30 +0,0 @@
# Read File Into Vector
snippet readfile
std::vector<char> v;
if (FILE *${2:fp} = fopen(${1:"filename"}, "r")) {
char buf[1024];
while (size_t len = fread(buf, 1, sizeof(buf), $2))
v.insert(v.end(), buf, buf + len);
fclose($2);
}${3}
# std::map
snippet map
std::map<${1:key}, ${2:value}> map${3};
# std::vector
snippet vector
std::vector<${1:char}> v${2};
# Namespace
snippet ns
namespace ${1:`Filename('', 'my')`} {
${2}
} /* $1 */
# Class
snippet cl
class ${1:`Filename('$1_t', 'name')`} {
public:
$1 (${2:arguments});
virtual ~$1 ();
private:
${3:/* data */}
};

View File

@ -1,190 +0,0 @@
# Some useful Unicode entities
# Non-Breaking Space
snippet nbs
&nbsp;
# ←
snippet left
&#x2190;
# →
snippet right
&#x2192;
# ↑
snippet up
&#x2191;
# ↓
snippet down
&#x2193;
# ↩
snippet return
&#x21A9;
# ⇤
snippet backtab
&#x21E4;
# ⇥
snippet tab
&#x21E5;
# ⇧
snippet shift
&#x21E7;
# ⌃
snippet control
&#x2303;
# ⌅
snippet enter
&#x2305;
# ⌘
snippet command
&#x2318;
# ⌥
snippet option
&#x2325;
# ⌦
snippet delete
&#x2326;
# ⌫
snippet backspace
&#x232B;
# ⎋
snippet escape
&#x238B;
# Generic Doctype
snippet doctype HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""
"http://www.w3.org/TR/html4/strict.dtd">
snippet doctype HTML 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""
"http://www.w3.org/TR/html4/loose.dtd">
snippet doctype HTML 5
<!DOCTYPE HTML>
snippet doctype XHTML 1.0 Frameset
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
snippet doctype XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
snippet doctype XHTML 1.0 Transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
snippet doctype XHTML 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
# HTML Doctype 4.01 Strict
snippet docts
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""
"http://www.w3.org/TR/html4/strict.dtd">
# HTML Doctype 4.01 Transitional
snippet doct
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""
"http://www.w3.org/TR/html4/loose.dtd">
# HTML Doctype 5
snippet doct5
<!DOCTYPE HTML>
# XHTML Doctype 1.0 Frameset
snippet docxf
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
# XHTML Doctype 1.0 Strict
snippet docxs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
# XHTML Doctype 1.0 Transitional
snippet docxt
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
# XHTML Doctype 1.1
snippet docx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
snippet html
<html>
${1}
</html>
snippet xhtml
<html xmlns="http://www.w3.org/1999/xhtml">
${1}
</html>
snippet body
<body>
${1}
</body>
snippet head
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"`Close()`>
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2}
</head>
snippet title
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>${2}
snippet script
<script type="text/javascript" charset="utf-8">
${1}
</script>${2}
snippet scriptsrc
<script src="${1}.js" type="text/javascript" charset="utf-8"></script>${2}
snippet style
<style type="text/css" media="${1:screen}">
${2}
</style>${3}
snippet base
<base href="${1}" target="${2}"`Close()`>
snippet r
<br`Close()[1:]`>
snippet div
<div id="${1:name}">
${2}
</div>
# Embed QT Movie
snippet movie
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="src" value="$1"`Close()`>
<param name="controller" value="$4"`Close()`>
<param name="autoplay" value="$5"`Close()`>
<embed src="${1:movie.mov}"
width="${2:320}" height="${3:240}"
controller="${4:true}" autoplay="${5:true}"
scale="tofit" cache="true"
pluginspage="http://www.apple.com/quicktime/download/"
`Close()[1:]`>
</object>${6}
snippet fieldset
<fieldset id="$1">
<legend>${1:name}</legend>
${3}
</fieldset>
snippet form
<form action="${1:`Filename('$1_submit')`}" method="${2:get}" accept-charset="utf-8">
${3}
<p><input type="submit" value="Continue &rarr;"`Close()`></p>
</form>
snippet h1
<h1 id="${1:heading}">${2:$1}</h1>
snippet input
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="${3}"`Close()`>${4}
snippet label
<label for="${2:$1}">${1:name}</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="${5}" id="${6:$2}"`Close()`>${7}
snippet link
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" charset="utf-8"`Close()`>${4}
snippet mailto
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
snippet meta
<meta name="${1:name}" content="${2:content}"`Close()`>${3}
snippet opt
<option value="${1:option}">${2:$1}</option>${3}
snippet optt
<option>${1:option}</option>${2}
snippet select
<select name="${1:some_name}" id="${2:$1}">
<option value="${3:option}">${4:$3}</option>
</select>${5}
snippet table
<table border="${1:0}">
<tr><th>${2:Header}</th></tr>
<tr><th>${3:Data}</th></tr>
</table>${4}
snippet textarea
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">${4}</textarea>${5}

View File

@ -1,78 +0,0 @@
snippet main
public static void main (String [] args)
{
${1:/* code */}
}
snippet pu
public
snippet po
protected
snippet pr
private
snippet st
static
snippet fi
final
snippet ab
abstract
snippet re
return
snippet br
break;
snippet de
default:
${1}
snippet ca
catch(${1:Exception} ${2:e}) ${3}
snippet th
throw
snippet sy
synchronized
snippet im
import
snippet j.u
java.util
snippet j.i
java.io.
snippet j.b
java.beans.
snippet j.n
java.net.
snippet j.m
java.math.
snippet if
if (${1}) ${2}
snippet el
else
snippet elif
else if (${1}) ${2}
snippet wh
while (${1}) ${2}
snippet for
for (${1}; ${2}; ${3}) ${4}
snippet fore
for (${1} : ${2}) ${3}
snippet sw
switch (${1}) ${2}
snippet cs
case ${1}:
${2}
${3}
snippet tc
public class ${1:`Filename()`} extends ${2:TestCase}
snippet t
public void test${1:Name}() throws Exception ${2}
snippet cl
class ${1:`Filename("", "untitled")`} ${2}
snippet in
interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3}
snippet m
${1:void} ${2:method}(${3}) ${4:throws }${5}
snippet v
${1:String} ${2:var}${3: = null}${4};${5}
snippet co
static public final ${1:String} ${2:var} = ${3};${4}
snippet cos
static public final String ${1:var} = "${2}";${3}
snippet as
assert ${1:test} : "${2:Failure message}";${3}

View File

@ -1,74 +0,0 @@
# Prototype
snippet proto
${1:class_name}.prototype.${2:method_name} =
function(${3:first_argument}) {
${4:// body...}
};
# Function
snippet fun
function ${1:function_name} (${2:argument}) {
${3:// body...}
}
# Anonymous Function
snippet f
function(${1}) {${2}};
# if
snippet if
if (${1:true}) {${2}};
# if ... else
snippet ife
if (${1:true}) {${2}}
else{${3}};
# tertiary conditional
snippet t
${1:/* condition */} ? ${2:a} : ${3:b}
# switch
snippet switch
switch(${1:expression}) {
case '${3:case}':
${4:// code}
break;
${5}
default:
${2:// code}
}
# case
snippet case
case '${1:case}':
${2:// code}
break;
${3}
# for (...) {...}
snippet for
for (var ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) {
${4:$1[$2]}
};
# for (...) {...} (Improved Native For-Loop)
snippet forr
for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2${3:--}) {
${4:$1[$2]}
};
# while (...) {...}
snippet wh
while (${1:/* condition */}) {
${2:/* code */}
}
# do...while
snippet do
do {
${2:/* code */}
} while (${1:/* condition */});
# Object Method
snippet :f
${1:method_name}: function(${2:attribute}) {
${4}
}${3:,}
# setTimeout function
snippet timeout
setTimeout(function() {${3}}${2}, ${1:10};
# Get Elements
snippet get
getElementsBy${1:TagName}('${2}')${3}
# Get Element
snippet gett
getElementBy${1:Id}('${2}')${3}

View File

@ -1,91 +0,0 @@
# #!/usr/bin/perl
snippet #!
#!/usr/bin/perl
# Hash Pointer
snippet .
=>
# Function
snippet sub
sub ${1:function_name} {
${2:#body ...}
}
# Conditional
snippet if
if (${1}) {
${2:# body...}
}
# Conditional if..else
snippet ife
if (${1}) {
${2:# body...}
} else {
${3:# else...}
}
# Conditional if..elsif..else
snippet ifee
if (${1}) {
${2:# body...}
} elsif (${3}) {
${4:# elsif...}
} else {
${5:# else...}
}
# Conditional One-line
snippet xif
${1:expression} if ${2:condition};${3}
# Unless conditional
snippet unless
unless (${1}) {
${2:# body...}
}
# Unless conditional One-line
snippet xunless
${1:expression} unless ${2:condition};${3}
# Try/Except
snippet eval
eval {
${1:# do something risky...}
};
if ($@) {
${2:# handle failure...}
}
# While Loop
snippet wh
while (${1}) {
${2:# body...}
}
# While Loop One-line
snippet xwh
${1:expression} while ${2:condition};${3}
# For Loop
snippet for
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4:# body...}
}
# Foreach Loop
snippet fore
foreach my $${1:x} (@${2:array}) {
${3:# body...}
}
# Foreach Loop One-line
snippet xfore
${1:expression} foreach @${2:array};${3}
# Package
snippet cl
package ${1:ClassName};
use base qw(${2:ParentClass});
sub new {
my $class = shift;
$class = ref $class if ref $class;
my $self = bless {}, $class;
$self;
}
1;${3}
# Read File
snippet slurp
my $${1:var};
{ local $/ = undef; local *FILE; open FILE, "<${2:file}"; $$1 = <FILE>; close FILE }${3}

View File

@ -1,216 +0,0 @@
snippet php
<?php
${1}
?>
snippet ec
echo "${1:string}"${2};
snippet inc
include '${1:file}';${2}
snippet inc1
include_once '${1:file}';${2}
snippet req
require '${1:file}';${2}
snippet req1
require_once '${1:file}';${2}
# $GLOBALS['...']
snippet globals
$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5}
snippet $_ COOKIE['...']
$_COOKIE['${1:variable}']${2}
snippet $_ ENV['...']
$_ENV['${1:variable}']${2}
snippet $_ FILES['...']
$_FILES['${1:variable}']${2}
snippet $_ Get['...']
$_GET['${1:variable}']${2}
snippet $_ POST['...']
$_POST['${1:variable}']${2}
snippet $_ REQUEST['...']
$_REQUEST['${1:variable}']${2}
snippet $_ SERVER['...']
$_SERVER['${1:variable}']${2}
snippet $_ SESSION['...']
$_SESSION['${1:variable}']${2}
# Start Docblock
snippet /*
/**
* ${1}
**/
# Class - post doc
snippet doc_cp
/**
* ${1:undocumented class}
*
* @package ${2:default}
* @author ${3:`g:snips_author`}
**/${4}
# Class Variable - post doc
snippet doc_vp
/**
* ${1:undocumented class variable}
*
* @var ${2:string}
**/${3}
# Class Variable
snippet doc_v
/**
* ${3:undocumented class variable}
*
* @var ${4:string}
**/
${1:var} $${2};${5}
# Class
snippet doc_c
/**
* ${3:undocumented class}
*
* @packaged ${4:default}
* @author ${5:`g:snips_author`}
**/
${1:}class ${2:}
{${6}
} // END $1class $2
# Constant Definition - post doc
snippet doc_dp
/**
* ${1:undocumented constant}
**/${2}
# Constant Definition
snippet doc_d
/**
* ${3:undocumented constant}
**/
define(${1}, ${2});${4}
# Function - post doc
snippet doc_fp
/**
* ${1:undocumented function}
*
* @return ${2:void}
* @author ${3:`g:snips_author`}
**/${4}
# Function signature
snippet doc_s
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
**/
${1}function ${2}(${3});${7}
# Function
snippet doc_f
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
**/
${1}function ${2}(${3})
{${7}
}
# Header
snippet doc_h
/**
* ${1}
*
* @author ${2:`g:snips_author`}
* @version ${3:$Id$}
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
* @package ${5:default}
**/
/**
* Define DocBlock
*//
# Interface
snippet doc_i
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
**/
interface ${1:}
{${5}
} // END interface $1
# class ...
snippet class
/**
* ${1}
**/
class ${2:ClassName}
{
${3}
function ${4:__construct}(${5:argument})
{
${6:// code...}
}
}
# define(...)
snippet def
define('${1}'${2});${3}
# defined(...)
snippet def?
${1}defined('${2}')${3}
snippet wh
while (${1:/* condition */}) {
${2:// code...}
}
# do ... while
snippet do
do {
${2:// code... }
} while (${1:/* condition */});
snippet if
if (${1:/* condition */}) {
${2:// code...}
}
snippet ife
if (${1:/* condition */}) {
${2:// code...}
} else {
${3:// code...}
}
${4}
snippet else
else {
${1:// code...}
}
snippet elseif
elseif (${1:/* condition */}) {
${2:// code...}
}
# Tertiary conditional
snippet t
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
snippet switch
switch ($${1:variable}) {
case '${2:value}':
${3:// code...}
break;
${5}
default:
${4:// code...}
break;
}
snippet case
case '${1:value}':
${2:// code...}
break;${3}
snippet for
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4: // code...}
}
snippet foreach
foreach ($${1:variable} as $${2:key}) {
${3:// code...}
}
snippet fun
${1:public }function ${2:FunctionName}(${3})
{
${4:// code...}
}
# $... = array (...)
snippet array
$${1:arrayName} = array('${2}' => ${3});${4}

View File

@ -1,86 +0,0 @@
snippet #!
#!/usr/bin/python
snippet imp
import ${1:module}
# Module Docstring
snippet docs
'''
File: ${1:`Filename('$1.py', 'foo.py')`}
Author: ${2:`g:snips_author`}
Description: ${3}
'''
snippet wh
while ${1:condition}:
${2:# code...}
snippet for
for ${1:needle} in ${2:haystack}:
${3:# code...}
# New Class
snippet cl
class ${1:ClassName}(${2:object}):
"""${3:docstring for $1}"""
def __init__(self, ${4:arg}):
${5:super($1, self).__init__()}
self.$4 = $4
${6}
# New Function
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${4:pass}
snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${3}
# New Method
snippet defs
def ${1:mname}(self, ${2:arg}):
${3:pass}
# New Property
snippet property
def ${1:foo}():
doc = "${2:The $1 property.}"
def fget(self):
${3:return self._$1}
def fset(self, value):
${4:self._$1 = value}
# Lambda
snippet ld
${1:var} = lambda ${2:vars} : ${3:action}
snippet .
self.
snippet try Try/Except
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
snippet try Try/Except/Else
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:pass}
snippet try Try/Except/Finally
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
finally:
${5:pass}
snippet try Try/Except/Else/Finally
try:
${1:pass}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:pass}
finally:
${6:pass}
# if __name__ == '__main__':
snippet ifmain
if __name__ == '__main__':
${1:main()}
# __magic__
snippet _
__${1:init}__${2}

View File

@ -1,420 +0,0 @@
# #!/usr/bin/ruby
snippet #!
#!/usr/bin/ruby
# New Block
snippet =b
=begin rdoc
${1}
=end
snippet y
:yields: ${1:arguments}
snippet rb
#!/usr/bin/env ruby -wKU
snippet req
require "${1}"${2}
snippet #
# =>
snippet end
__END__
snippet case
case ${1:object}
when ${2:condition}
${3}
end
snippet when
when ${1:condition}
${2}
snippet def
def ${1:method_name}
${2}
end
snippet deft
def test_${1:case_name}
${2}
end
snippet if
if ${1:condition}
${2}
end
snippet ife
if ${1:condition}
${2}
else
${3}
end
snippet elsif
elsif ${1:condition}
${2}
snippet unless
unless ${1:condition}
${2}
end
snippet while
while ${1:condition}
${2}
end
snippet until
until ${1:condition}
${2}
end
snippet cla class .. end
class ${1:`substitute(Filename(), '^.', '\u&', '')`}
${2}
end
snippet cla class .. initialize .. end
class ${1:`substitute(Filename(), '^.', '\u&', '')`}
def initialize(${2:args})
${3}
end
end
snippet cla class .. < ParentClass .. initialize .. end
class ${1:`substitute(Filename(), '^.', '\u&', '')`} < ${2:ParentClass}
def initialize(${3:args})
${4}
end
end
snippet cla ClassName = Struct .. do .. end
${1:`substitute(Filename(), '^.', '\u&', '')`} = Struct.new(:${2:attr_names}) do
def ${3:method_name}
${4}
end
end
snippet cla class BlankSlate .. initialize .. end
class ${1:BlankSlate}
instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
snippet cla class << self .. end
class << ${1:self}
${2}
end
# class .. < DelegateClass .. initialize .. end
snippet cla-
class ${1:`substitute(Filename(), '^.', '\u&', '')`} < DelegateClass(${2:ParentClass})
def initialize(${3:args})
super(${4:del_obj})
${5}
end
end
snippet mod module .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`}
${2}
end
snippet mod module .. module_function .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`}
module_function
${2}
end
snippet mod module .. ClassMethods .. end
module ${1:`substitute(Filename(), '^.', '\u&', '')`}
module ClassMethods
${2}
end
module InstanceMethods
end
def self.included(receiver)
receiver.extend ClassMethods
receiver.send :include, InstanceMethods
end
end
# attr_reader
snippet r
attr_reader :${1:attr_names}
# attr_writer
snippet w
attr_writer :${1:attr_names}
# attr_accessor
snippet rw
attr_accessor :${1:attr_names}
# include Enumerable
snippet Enum
include Enumerable
def each(&block)
${1}
end
# include Comparable
snippet Comp
include Comparable
def <=>(other)
${1}
end
# extend Forwardable
snippet Forw-
extend Forwardable
# def self
snippet defs
def self.${1:class_method_name}
${2}
end
# def method_missing
snippet defmm
def method_missing(meth, *args, &blk)
${1}
end
snippet defd
def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name}
snippet defds
def_delegators :${1:@del_obj}, :${2:del_methods}
snippet am
alias_method :${1:new_name}, :${2:old_name}
snippet app
if __FILE__ == $PROGRAM_NAME
${1}
end
# usage_if()
snippet usai
if ARGV.${1}
abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3}
end
# usage_unless()
snippet usau
unless ARGV.${1}
abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3}
end
snippet array
Array.new(${1:10}) { |${2:i}| ${3} }
snippet hash
Hash.new { |${1:hash}, ${2:key}| $1[$2] = ${3} }
snippet file File.foreach() { |line| .. }
File.foreach(${1:"path/to/file"}) { |${2:line}| ${3} }
snippet file File.read()
File.read(${1:"path/to/file"})${2}
snippet Dir Dir.global() { |file| .. }
Dir.glob(${1:"dir/glob/*"}) { |${2:file}| ${3} }
snippet Dir Dir[".."]
Dir[${1:"glob/**/*.rb"}]${2}
snippet dir
Filename.dirname(__FILE__)
snippet deli
delete_if { |${1:e}| ${2} }
snippet fil
fill(${1:range}) { |${2:i}| ${3} }
# flatten_once()
snippet flao
inject(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2)}${3}
snippet zip
zip(${1:enums}) { |${2:row}| ${3} }
# downto(0) { |n| .. }
snippet dow
downto(${1:0}) { |${2:n}| ${3} }
snippet ste
step(${1:2}) { |${2:n}| ${3} }
snippet tim
times { |${1:n}| ${2} }
snippet upt
upto(${1:1.0/0.0}) { |${2:n}| ${3} }
snippet loo
loop { ${1} }
snippet ea
each { |${1:e}| ${2} }
snippet eab
each_byte { |${1:byte}| ${2} }
snippet eac- each_char { |chr| .. }
each_char { |${1:chr}| ${2} }
snippet eac- each_cons(..) { |group| .. }
each_cons(${1:2}) { |${2:group}| ${3} }
snippet eai
each_index { |${1:i}| ${2} }
snippet eak
each_key { |${1:key}| ${2} }
snippet eal
each_line { |${1:line}| ${2} }
snippet eap
each_pair { |${1:name}, ${2:val}| ${3} }
snippet eas-
each_slice(${1:2}) { |${2:group}| ${3} }
snippet eav
each_value { |${1:val}| ${2} }
snippet eawi
each_with_index { |${1:e}, ${2:i}| ${3} }
snippet reve
reverse_each { |${1:e}| ${2} }
snippet inj
inject(${1:init}) { |${2:mem}, ${3:var}| ${4} }
snippet map
map { |${1:e}| ${2} }
snippet mapwi-
enum_with_index.map { |${1:e}, ${2:i}| ${3} }
snippet sor
sort { |a, b| ${1} }
snippet sorb
sort_by { |${1:e}| ${2} }
snippet ran
sort_by { rand }
snippet all
all? { |${1:e}| ${2} }
snippet any
any? { |${1:e}| ${2} }
snippet cl
classify { |${1:e}| ${2} }
snippet col
collect { |${1:e}| ${2} }
snippet det
detect { |${1:e}| ${2} }
snippet fet
fetch(${1:name}) { |${2:key}| ${3} }
snippet fin
find { |${1:e}| ${2} }
snippet fina
find_all { |${1:e}| ${2} }
snippet gre
grep(${1:/pattern/}) { |${2:match}| ${3} }
snippet sub
${1:g}sub(${2:/pattern/}) { |${3:match}| ${4} }
snippet sca
scan(${1:/pattern/}) { |${2:match}| ${3} }
snippet max
max { |a, b|, ${1} }
snippet min
min { |a, b|, ${1} }
snippet par
partition { |${1:e}|, ${2} }
snippet rej
reject { |${1:e}|, ${2} }
snippet sel
select { |${1:e}|, ${2} }
snippet lam
lambda { |${1:args}| ${2} }
snippet do
do |${1:variable}|
${2}
end
snippet :
:${1:key} => ${2:"value"}${3}
snippet ope
open(${1:"path/or/url/or/pipe"}, "${2:w}") { |${3:io}| ${4} }
# path_from_here()
snippet patfh
File.join(File.dirname(__FILE__), *%2[${1:rel path here}])${2}
# unix_filter {}
snippet unif
ARGF.each_line${1} do |${2:line}|
${3}
end
# option_parse {}
snippet optp
require "optparse"
options = {${1:default => "args"}}
ARGV.options do |opts|
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)}
snippet opt
opts.on( "-${1:o}", "--${2:long-option-name}", ${3:String},
"${4:Option description.}") do |${5:opt}|
${6}
end
snippet tc
require "test/unit"
require "${1:library_file_name}"
class Test${2:$1} < Test::Unit::TestCase
def test_${3:case_name}
${4}
end
end
snippet ts
require "test/unit"
require "tc_${1:test_case_file}"
require "tc_${2:test_case_file}"${3}
snippet as
assert(${1:test}, "${2:Failure message.}")${3}
snippet ase
assert_equal(${1:expected}, ${2:actual})${3}
snippet asne
assert_not_equal(${1:unexpected}, ${2:actual})${3}
snippet asid
assert_in_delta(${1:expected_float}, ${2:actual_float}, ${3:2 ** -20})${4}
snippet asio
assert_instance_of(${1:ExpectedClass}, ${2:actual_instance})${3}
snippet asko
assert_kind_of(${1:ExpectedKind}, ${2:actual_instance})${3}
snippet asn
assert_nil(${1:instance})${2}
snippet asnn
assert_not_nil(${1:instance})${2}
snippet asm
assert_match(/${1:expected_pattern}/, ${2:actual_string})${3}
snippet asnm
assert_no_match(/${1:unexpected_pattern}/, ${2:actual_string})${3}
snippet aso
assert_operator(${1:left}, :${2:operator}, ${3:right})${4}
snippet asr
assert_raise(${1:Exception}) { ${2} }
snippet asnr
assert_nothing_raised(${1:Exception}) { ${2} }
snippet asrt
assert_respond_to(${1:object}, :${2:method})${3}
snippet ass assert_same(..)
assert_same(${1:expected}, ${2:actual})${3}
snippet ass assert_send(..)
assert_send([${1:object}, :${2:message}, ${3:args}])${4}
snippet asns
assert_not_same(${1:unexpected}, ${2:actual})${3}
snippet ast
assert_throws(:${1:expected}) { ${2} }
snippet asnt
assert_nothing_thrown { ${1} }
snippet fl
flunk("${1:Failure message.}")${2}
# Benchmark.bmbm do .. end
snippet bm-
TESTS = ${1:10_000}
Benchmark.bmbm do |results|
${2}
end
snippet rep
results.report("${1:name}:") { TESTS.times { ${2} }}
# Marshal.dump(.., file)
snippet Md
File.open(${1:"path/to/file.dump"}, "wb") { |${2:file}| Marshal.dump(${3:obj}, $2) }${4}
# Mashal.load(obj)
snippet Ml
File.open(${1:"path/to/file.dump"}, "rb") { |${2:file}| Marshal.load($2) }${3}
# deep_copy(..)
snippet deec
Marshal.load(Marshal.dump(${1:obj_to_copy}))${2}
snippet Pn-
PStore.new(${1:"file_name.pstore"})${2}
snippet tra
transaction(${1:true}) { ${2} }
# xmlread(..)
snippet xml-
REXML::Document.new(File.read(${1:"path/to/file"}))${2}
# xpath(..) { .. }
snippet xpa
elements.each(${1:"//Xpath"}) do |${2:node}|
${3}
end
# class_from_name()
snippet clafn
split("::").inject(Object) { |par, const| par.const_get(const) }
# singleton_class()
snippet sinc
class << self; self end
snippet nam
namespace :${1:`Filename()`} do
${2}
end
snippet tas
desc "${1:Task description\}"
task :${2:task_name => [:dependent, :tasks]} do
${3}
end

View File

@ -1,39 +0,0 @@
# #!/bin/sh
snippet #!
#!/bin/sh
snippet if
if [[ ${1:condition} ]]; then
${2:#statements}
fi
snippet elif
elif [[ ${1:condition} ]]; then
${2:#statements}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
${3:#statements}
done
snippet wh
while [[ ${1:condition} ]]; do
${2:#statements}
done
snippet until
until [[ ${1:condition} ]]; do
${2:#statements}
done
snippet case
case ${1:word} in
${2:pattern})
${3};;
esac
snippet getopt
while getopts ao: name
do
case $name in
a) flag=1 ;;
o) oarg=$OPTARG ;;
?) echo "Usage: ..."; exit 2 ;;
esac
done
shift $(($OPTIND - 1))
echo "Non-option arguments: " "$@"

View File

@ -1,7 +0,0 @@
# snippets for making snippets :)
snippet snip
snippet ${1:trigger}
${2}
snippet msnip
snippet ${1:trigger} ${2:description}
${3}

View File

@ -1,92 +0,0 @@
# #!/usr/bin/tclsh
snippet #!
#!/usr/bin/tclsh
# Process
snippet pro
proc ${1:function_name} {${2:args}} {
${3:#body ...}
}
#xif
snippet xif
${1:expr}? ${2:true} : ${3:false}
# Conditional
snippet if
if {${1}} {
${2:# body...}
}
# Conditional if..else
snippet ife
if {${1}} {
${2:# body...}
} else {
${3:# else...}
}
# Conditional if..elsif..else
snippet ifee
if {${1}} {
${2:# body...}
} elseif {${3}} {
${4:# elsif...}
} else {
${5:# else...}
}
# If catch then
snippet ifc
if { [catch {${1:#do something...}} ${2:err}] } {
${3:# handle failure...}
}
# Catch
snippet catch
catch {${1}} ${2:err} ${3:options}
# While Loop
snippet wh
while {${1}} {
${2:# body...}
}
# For Loop
snippet for
for {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} {
${4:# body...}
}
# Foreach Loop
snippet fore
foreach ${1:x} {${2:#list}} {
${3:# body...}
}
# after ms script...
snippet af
after ${1:ms} ${2:#do something}
# after cancel id
snippet afc
after cancel ${1:id or script}
# after idle
snippet afi
after idle ${1:script}
# after info id
snippet afin
after info ${1:id}
# Expr
snippet exp
expr {${1:#expression here}}
# Switch
snippet sw
switch ${1:var} {
${3:pattern 1} {
${4:#do something}
}
default {
${2:#do something}
}
}
# Case
snippet ca
${1:pattern} {
${2:#do something}
}${3}
# Namespace eval
snippet ns
namespace eval ${1:path} {${2:#script...}}
# Namespace current
snippet nsc
namespace current

View File

@ -1,115 +0,0 @@
# \begin{}...\end{}
snippet begin
\begin{${1:env}}
${2}
\end{$1}
# Tabular
snippet tab
\begin{${1:tabular}}{${2:c}}
${3}
\end{$1}
# Align(ed)
snippet ali
\begin{align${1:ed}}
${2}
\end{align$1}
# Gather(ed)
snippet gat
\begin{gather${1:ed}}
${2}
\end{gather$1}
# Equation
snippet eq
\begin{equation}
${1}
\end{equation}
# Unnumbered Equation
snippet \
\\[
${1}
\\]
# Enumerate
snippet enum
\begin{enumerate}
\item ${1}
\end{enumerate}
# Itemize
snippet item
\begin{itemize}
\item ${1}
\end{itemize}
# Description
snippet desc
\begin{description}
\item[${1}] ${2}
\end{description}
# Matrix
snippet mat
\begin{${1:p/b/v/V/B/small}matrix}
${2}
\end{$1matrix}
# Cases
snippet cas
\begin{cases}
${1:equation}, &\text{ if }${2:case}\\
${3}
\end{cases}
# Split
snippet spl
\begin{split}
${1}
\end{split}
# Part
snippet part
\part{${1:part name}} % (fold)
\label{prt:${2:$1}}
${3}
% part $2 (end)
# Chapter
snippet cha
\chapter{${1:chapter name}} % (fold)
\label{cha:${2:$1}}
${3}
% chapter $2 (end)
# Section
snippet sec
\section{${1:section name}} % (fold)
\label{sec:${2:$1}}
${3}
% section $2 (end)
# Sub Section
snippet sub
\subsection{${1:subsection name}} % (fold)
\label{sub:${2:$1}}
${3}
% subsection $2 (end)
# Sub Sub Section
snippet subs
\subsubsection{${1:subsubsection name}} % (fold)
\label{ssub:${2:$1}}
${3}
% subsubsection $2 (end)
# Paragraph
snippet par
\paragraph{${1:paragraph name}} % (fold)
\label{par:${2:$1}}
${3}
% paragraph $2 (end)
# Sub Paragraph
snippet subp
\subparagraph{${1:subparagraph name}} % (fold)
\label{subp:${2:$1}}
${3}
% subparagraph $2 (end)
snippet itd
\item[${1:description}] ${2:item}
snippet figure
${1:Figure}~\ref{${2:fig:}}${3}
snippet table
${1:Table}~\ref{${2:tab:}}${3}
snippet listing
${1:Listing}~\ref{${2:list}}${3}
snippet section
${1:Section}~\ref{${2:sec:}}${3}
snippet page
${1:page}~\pageref{${2}}${3}

View File

@ -1,32 +0,0 @@
snippet header
" File: ${1:`expand('%:t')`}
" Author: ${2:`g:snips_author`}
" Description: ${3}
${4:" Last Modified: `strftime("%B %d, %Y")`}
snippet guard
if exists('${1:did_`Filename()`}') || &cp${2: || version < 700}
finish
endif
let $1 = 1${3}
snippet f
fun ${1:function_name}(${2})
${3:" code}
endf
snippet for
for ${1:needle} in ${2:haystack}
${3:" code}
endfor
snippet wh
while ${1:condition}
${2:" code}
endw
snippet if
if ${1:condition}
${2:" code}
endif
snippet ife
if ${1:condition}
${2}
else
${3}
endif

View File

@ -1,19 +0,0 @@
" Syntax highlighting for snippet files (used for snipMate.vim)
" Hopefully this should make snippets a bit nicer to write!
syn match snipComment '^#.*'
syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand
syn match tabStop '\$\d\+'
syn match snipCommand '`.\{-}`'
syn match snippet '^snippet.*' transparent contains=multiSnipText,snipKeyword
syn match multiSnipText '\S\+ \zs.*' contained
syn match snipKeyword '^snippet'me=s+8 contained
syn match snipError "^[^#s\t].*$"
hi link snipComment Comment
hi link multiSnipText String
hi link snipKeyword Keyword
hi link snipComment Comment
hi link placeHolder Special
hi link tabStop Special
hi link snipCommand String
hi link snipError Error

File diff suppressed because it is too large Load Diff

View File

@ -1,62 +0,0 @@
function! tagbar#debug#start_debug(...) abort
let filename = a:0 > 0 ? a:1 : ''
if empty(filename)
let s:debug_file = 'tagbardebug.log'
else
let s:debug_file = filename
endif
" Clear log file and start it with version info
exe 'redir! > ' . s:debug_file
silent version
redir END
" Check whether the log file could be created
if !filewritable(s:debug_file)
echomsg 'Tagbar: Unable to create log file ' . s:debug_file
let s:debug_file = ''
return
endif
let s:debug_enabled = 1
endfunction
function! tagbar#debug#stop_debug() abort
let s:debug_enabled = 0
let s:debug_file = ''
endfunction
function! tagbar#debug#log(msg) abort
if s:debug_enabled
execute 'redir >> ' . s:debug_file
silent echon s:gettime() . ': ' . a:msg . "\n"
redir END
endif
endfunction
function! tagbar#debug#log_ctags_output(output) abort
if s:debug_enabled
exe 'redir! > ' . s:debug_file . '.ctags_out'
silent echon a:output
redir END
endif
endfunction
function! tagbar#debug#enabled() abort
return s:debug_enabled
endfunction
if has('reltime')
function! s:gettime() abort
let time = split(reltimestr(reltime()), '\.')
return strftime('%Y-%m-%d %H:%M:%S.', time[0]) . time[1]
endfunction
else
function! s:gettime() abort
return strftime('%Y-%m-%d %H:%M:%S')
endfunction
endif
let s:debug_enabled = 0
let s:debug_file = ''

View File

@ -1,237 +0,0 @@
let s:visibility_symbols = {
\ 'public' : '+',
\ 'protected' : '#',
\ 'private' : '-'
\ }
function! tagbar#prototypes#basetag#new(name) abort
let newobj = {}
let newobj.name = a:name
let newobj.fields = {}
let newobj.fields.line = 0
let newobj.fields.column = 0
let newobj.prototype = ''
let newobj.path = ''
let newobj.fullpath = a:name
let newobj.depth = 0
let newobj.parent = {}
let newobj.tline = -1
let newobj.fileinfo = {}
let newobj.typeinfo = {}
let newobj._childlist = []
let newobj._childdict = {}
let newobj.isNormalTag = function(s:add_snr('s:isNormalTag'))
let newobj.isPseudoTag = function(s:add_snr('s:isPseudoTag'))
let newobj.isSplitTag = function(s:add_snr('s:isSplitTag'))
let newobj.isKindheader = function(s:add_snr('s:isKindheader'))
let newobj.getPrototype = function(s:add_snr('s:getPrototype'))
let newobj._getPrefix = function(s:add_snr('s:_getPrefix'))
let newobj.initFoldState = function(s:add_snr('s:initFoldState'))
let newobj.getClosedParentTline = function(s:add_snr('s:getClosedParentTline'))
let newobj.isFoldable = function(s:add_snr('s:isFoldable'))
let newobj.isFolded = function(s:add_snr('s:isFolded'))
let newobj.openFold = function(s:add_snr('s:openFold'))
let newobj.closeFold = function(s:add_snr('s:closeFold'))
let newobj.setFolded = function(s:add_snr('s:setFolded'))
let newobj.openParents = function(s:add_snr('s:openParents'))
let newobj.addChild = function(s:add_snr('s:addChild'))
let newobj.getChildren = function(s:add_snr('s:getChildren'))
let newobj.getChildrenByName = function(s:add_snr('s:getChildrenByName'))
let newobj.removeChild = function(s:add_snr('s:removeChild'))
return newobj
endfunction
" s:isNormalTag() {{{1
function! s:isNormalTag() abort dict
return 0
endfunction
" s:isPseudoTag() {{{1
function! s:isPseudoTag() abort dict
return 0
endfunction
" s:isSplitTag {{{1
function! s:isSplitTag() abort dict
return 0
endfunction
" s:isKindheader() {{{1
function! s:isKindheader() abort dict
return 0
endfunction
" s:getPrototype() {{{1
function! s:getPrototype(short) abort dict
return self.prototype
endfunction
" s:_getPrefix() {{{1
function! s:_getPrefix() abort dict
let fileinfo = self.fileinfo
if !empty(self._childlist)
if fileinfo.tagfolds[self.fields.kind][self.fullpath]
let prefix = g:tagbar#icon_closed
else
let prefix = g:tagbar#icon_open
endif
else
let prefix = ' '
endif
" Visibility is called 'access' in the ctags output
if g:tagbar_show_visibility
if has_key(self.fields, 'access')
let prefix .= get(s:visibility_symbols, self.fields.access, ' ')
elseif has_key(self.fields, 'file')
let prefix .= s:visibility_symbols.private
else
let prefix .= ' '
endif
endif
return prefix
endfunction
" s:initFoldState() {{{1
function! s:initFoldState(known_files) abort dict
let fileinfo = self.fileinfo
if a:known_files.has(fileinfo.fpath) &&
\ has_key(fileinfo, '_tagfolds_old') &&
\ has_key(fileinfo._tagfolds_old[self.fields.kind], self.fullpath)
" The file has been updated and the tag was there before, so copy its
" old fold state
let fileinfo.tagfolds[self.fields.kind][self.fullpath] =
\ fileinfo._tagfolds_old[self.fields.kind][self.fullpath]
elseif self.depth >= fileinfo.foldlevel
let fileinfo.tagfolds[self.fields.kind][self.fullpath] = 1
else
let fileinfo.tagfolds[self.fields.kind][self.fullpath] =
\ fileinfo.kindfolds[self.fields.kind]
endif
endfunction
" s:getClosedParentTline() {{{1
function! s:getClosedParentTline() abort dict
let tagline = self.tline
" Find the first closed parent, starting from the top of the hierarchy.
let parents = []
let curparent = self.parent
while !empty(curparent)
call add(parents, curparent)
let curparent = curparent.parent
endwhile
for parent in reverse(parents)
if parent.isFolded()
let tagline = parent.tline
break
endif
endfor
return tagline
endfunction
" s:isFoldable() {{{1
function! s:isFoldable() abort dict
return !empty(self._childlist)
endfunction
" s:isFolded() {{{1
function! s:isFolded() abort dict
return self.fileinfo.tagfolds[self.fields.kind][self.fullpath]
endfunction
" s:openFold() {{{1
function! s:openFold() abort dict
if self.isFoldable()
let self.fileinfo.tagfolds[self.fields.kind][self.fullpath] = 0
endif
endfunction
" s:closeFold() {{{1
function! s:closeFold() abort dict
let newline = line('.')
if !empty(self.parent) && self.parent.isKindheader()
" Tag is child of generic 'kind'
call self.parent.closeFold()
let newline = self.parent.tline
elseif self.isFoldable() && !self.isFolded()
" Tag is parent of a scope and is not folded
let self.fileinfo.tagfolds[self.fields.kind][self.fullpath] = 1
let newline = self.tline
elseif !empty(self.parent)
" Tag is normal child, so close parent
let parent = self.parent
let self.fileinfo.tagfolds[parent.fields.kind][parent.fullpath] = 1
let newline = parent.tline
endif
return newline
endfunction
" s:setFolded() {{{1
function! s:setFolded(folded) abort dict
let self.fileinfo.tagfolds[self.fields.kind][self.fullpath] = a:folded
endfunction
" s:openParents() {{{1
function! s:openParents() abort dict
let parent = self.parent
while !empty(parent)
call parent.openFold()
let parent = parent.parent
endwhile
endfunction
" s:addChild() {{{1
function! s:addChild(tag) abort dict
call add(self._childlist, a:tag)
if has_key(self._childdict, a:tag.name)
call add(self._childdict[a:tag.name], a:tag)
else
let self._childdict[a:tag.name] = [a:tag]
endif
endfunction
" s:getChildren() {{{1
function! s:getChildren() dict abort
return self._childlist
endfunction
" s:getChildrenByName() {{{1
function! s:getChildrenByName(tagname) dict abort
return get(self._childdict, a:tagname, [])
endfunction
" s:removeChild() {{{1
function! s:removeChild(tag) dict abort
let idx = index(self._childlist, a:tag)
if idx >= 0
call remove(self._childlist, idx)
endif
let namelist = get(self._childdict, a:tag.name, [])
let idx = index(namelist, a:tag)
if idx >= 0
call remove(namelist, idx)
endif
endfunction
" s:add_snr() {{{1
function! s:add_snr(funcname) abort
if !exists('s:snr')
let s:snr = matchstr(expand('<sfile>'), '<SNR>\d\+_\zeget_snr$')
endif
return s:snr . a:funcname
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,146 +0,0 @@
function! tagbar#prototypes#fileinfo#new(fname, ftype, typeinfo) abort
let newobj = {}
" The complete file path
let newobj.fpath = a:fname
let newobj.bufnr = bufnr(a:fname)
" File modification time
let newobj.mtime = getftime(a:fname)
" The vim file type
let newobj.ftype = a:ftype
" List of the tags that are present in the file, sorted according to the
" value of 'g:tagbar_sort'
let newobj._taglist = []
let newobj._tagdict = {}
" Dictionary of the tags, indexed by line number in the file
let newobj.fline = {}
" Dictionary of the tags, indexed by line number in the tagbar
let newobj.tline = {}
" Dictionary of the folding state of 'kind's, indexed by short name
let newobj.kindfolds = {}
let newobj.typeinfo = a:typeinfo
" copy the default fold state from the type info
for kind in a:typeinfo.kinds
let newobj.kindfolds[kind.short] =
\ g:tagbar_foldlevel == 0 ? 1 : kind.fold
endfor
" Dictionary of dictionaries of the folding state of individual tags,
" indexed by kind and full path
let newobj.tagfolds = {}
for kind in a:typeinfo.kinds
let newobj.tagfolds[kind.short] = {}
endfor
" The current foldlevel of the file
let newobj.foldlevel = g:tagbar_foldlevel
let newobj.addTag = function(s:add_snr('s:addTag'))
let newobj.getTags = function(s:add_snr('s:getTags'))
let newobj.getTagsByName = function(s:add_snr('s:getTagsByName'))
let newobj.removeTag = function(s:add_snr('s:removeTag'))
let newobj.reset = function(s:add_snr('s:reset'))
let newobj.clearOldFolds = function(s:add_snr('s:clearOldFolds'))
let newobj.sortTags = function(s:add_snr('s:sortTags'))
let newobj.openKindFold = function(s:add_snr('s:openKindFold'))
let newobj.closeKindFold = function(s:add_snr('s:closeKindFold'))
return newobj
endfunction
" s:addTag() {{{1
function! s:addTag(tag) abort dict
call add(self._taglist, a:tag)
if has_key(self._tagdict, a:tag.name)
call add(self._tagdict[a:tag.name], a:tag)
else
let self._tagdict[a:tag.name] = [a:tag]
endif
endfunction
" s:getTags() {{{1
function! s:getTags() dict abort
return self._taglist
endfunction
" s:getTagsByName() {{{1
function! s:getTagsByName(tagname) dict abort
return get(self._tagdict, a:tagname, [])
endfunction
" s:removeTag() {{{1
function! s:removeTag(tag) dict abort
let idx = index(self._taglist, a:tag)
if idx >= 0
call remove(self._taglist, idx)
endif
let namelist = get(self._tagdict, a:tag.name, [])
let idx = index(namelist, a:tag)
if idx >= 0
call remove(namelist, idx)
endif
endfunction
" s:reset() {{{1
" Reset stuff that gets regenerated while processing a file and save the old
" tag folds
function! s:reset() abort dict
let self.mtime = getftime(self.fpath)
let self._taglist = []
let self._tagdict = {}
let self.fline = {}
let self.tline = {}
let self._tagfolds_old = self.tagfolds
let self.tagfolds = {}
for kind in self.typeinfo.kinds
let self.tagfolds[kind.short] = {}
endfor
endfunction
" s:clearOldFolds() {{{1
function! s:clearOldFolds() abort dict
if exists('self._tagfolds_old')
unlet self._tagfolds_old
endif
endfunction
" s:sortTags() {{{1
function! s:sortTags(compare_typeinfo) abort dict
if get(a:compare_typeinfo, 'sort', g:tagbar_sort)
call tagbar#sorting#sort(self._taglist, 'kind', a:compare_typeinfo)
else
call tagbar#sorting#sort(self._taglist, 'line', a:compare_typeinfo)
endif
endfunction
" s:openKindFold() {{{1
function! s:openKindFold(kind) abort dict
let self.kindfolds[a:kind.short] = 0
endfunction
" s:closeKindFold() {{{1
function! s:closeKindFold(kind) abort dict
let self.kindfolds[a:kind.short] = 1
endfunction
" s:add_snr() {{{1
function! s:add_snr(funcname) abort
if !exists('s:snr')
let s:snr = matchstr(expand('<sfile>'), '<SNR>\d\+_\zeget_snr$')
endif
return s:snr . a:funcname
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,61 +0,0 @@
function! tagbar#prototypes#kindheadertag#new(name) abort
let newobj = tagbar#prototypes#basetag#new(a:name)
let newobj.isKindheader = function(s:add_snr('s:isKindheader'))
let newobj.getPrototype = function(s:add_snr('s:getPrototype'))
let newobj.isFoldable = function(s:add_snr('s:isFoldable'))
let newobj.isFolded = function(s:add_snr('s:isFolded'))
let newobj.openFold = function(s:add_snr('s:openFold'))
let newobj.closeFold = function(s:add_snr('s:closeFold'))
let newobj.toggleFold = function(s:add_snr('s:toggleFold'))
return newobj
endfunction
" s:isKindheader() {{{1
function! s:isKindheader() abort dict
return 1
endfunction
" s:getPrototype() {{{1
function! s:getPrototype(short) abort dict
return self.name . ': ' .
\ self.numtags . ' ' . (self.numtags > 1 ? 'tags' : 'tag')
endfunction
" s:isFoldable() {{{1
function! s:isFoldable() abort dict
return 1
endfunction
" s:isFolded() {{{1
function! s:isFolded() abort dict
return self.fileinfo.kindfolds[self.short]
endfunction
" s:openFold() {{{1
function! s:openFold() abort dict
let self.fileinfo.kindfolds[self.short] = 0
endfunction
" s:closeFold() {{{1
function! s:closeFold() abort dict
let self.fileinfo.kindfolds[self.short] = 1
return line('.')
endfunction
" s:toggleFold() {{{1
function! s:toggleFold(fileinfo) abort dict
let a:fileinfo.kindfolds[self.short] = !a:fileinfo.kindfolds[self.short]
endfunction
" s:add_snr() {{{1
function! s:add_snr(funcname) abort
if !exists('s:snr')
let s:snr = matchstr(expand('<sfile>'), '<SNR>\d\+_\zeget_snr$')
endif
return s:snr . a:funcname
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,119 +0,0 @@
function! tagbar#prototypes#normaltag#new(name) abort
let newobj = tagbar#prototypes#basetag#new(a:name)
let newobj.isNormalTag = function(s:add_snr('s:isNormalTag'))
let newobj.strfmt = function(s:add_snr('s:strfmt'))
let newobj.str = function(s:add_snr('s:str'))
let newobj.getPrototype = function(s:add_snr('s:getPrototype'))
return newobj
endfunction
" s:isNormalTag() {{{1
function! s:isNormalTag() abort dict
return 1
endfunction
" s:strfmt() {{{1
function! s:strfmt() abort dict
let typeinfo = self.typeinfo
let suffix = get(self.fields, 'signature', '')
if has_key(self.fields, 'type')
let suffix .= ' : ' . self.fields.type
elseif has_key(get(typeinfo, 'kind2scope', {}), self.fields.kind)
let suffix .= ' : ' . typeinfo.kind2scope[self.fields.kind]
endif
return self._getPrefix() . self.name . suffix
endfunction
" s:str() {{{1
function! s:str(longsig, full) abort dict
if a:full && self.path !=# ''
let str = self.path . self.typeinfo.sro . self.name
else
let str = self.name
endif
if has_key(self.fields, 'signature')
if a:longsig
let str .= self.fields.signature
else
let str .= '()'
endif
endif
return str
endfunction
" s:getPrototype() {{{1
function! s:getPrototype(short) abort dict
if self.prototype !=# ''
let prototype = self.prototype
else
let bufnr = self.fileinfo.bufnr
if self.fields.line == 0 || !bufloaded(bufnr)
" No linenumber available or buffer not loaded (probably due to
" 'nohidden'), try the pattern instead
return substitute(self.pattern, '^\\M\\^\\C\s*\(.*\)\\$$', '\1', '')
endif
let line = getbufline(bufnr, self.fields.line)[0]
let list = split(line, '\zs')
let start = index(list, '(')
if start == -1
return substitute(line, '^\s\+', '', '')
endif
let opening = count(list, '(', 0, start)
let closing = count(list, ')', 0, start)
if closing >= opening
return substitute(line, '^\s\+', '', '')
endif
let balance = opening - closing
let prototype = line
let curlinenr = self.fields.line + 1
while balance > 0
let curline = getbufline(bufnr, curlinenr)[0]
let curlist = split(curline, '\zs')
let balance += count(curlist, '(')
let balance -= count(curlist, ')')
let prototype .= "\n" . curline
let curlinenr += 1
endwhile
let self.prototype = prototype
endif
if a:short
" join all lines and remove superfluous spaces
let prototype = substitute(prototype, '^\s\+', '', '')
let prototype = substitute(prototype, '\_s\+', ' ', 'g')
let prototype = substitute(prototype, '(\s\+', '(', 'g')
let prototype = substitute(prototype, '\s\+)', ')', 'g')
" Avoid hit-enter prompts
let maxlen = &columns - 12
if len(prototype) > maxlen
let prototype = prototype[:maxlen - 1 - 3]
let prototype .= '...'
endif
endif
return prototype
endfunction
" s:add_snr() {{{1
function! s:add_snr(funcname) abort
if !exists('s:snr')
let s:snr = matchstr(expand('<sfile>'), '<SNR>\d\+_\zeget_snr$')
endif
return s:snr . a:funcname
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,36 +0,0 @@
function! tagbar#prototypes#pseudotag#new(name) abort
let newobj = tagbar#prototypes#basetag#new(a:name)
let newobj.isPseudoTag = function(s:add_snr('s:isPseudoTag'))
let newobj.strfmt = function(s:add_snr('s:strfmt'))
return newobj
endfunction
" s:isPseudoTag() {{{1
function! s:isPseudoTag() abort dict
return 1
endfunction
" s:strfmt() {{{1
function! s:strfmt() abort dict
let typeinfo = self.typeinfo
let suffix = get(self.fields, 'signature', '')
if has_key(typeinfo.kind2scope, self.fields.kind)
let suffix .= ' : ' . typeinfo.kind2scope[self.fields.kind]
endif
return self._getPrefix() . self.name . '*' . suffix
endfunction
" s:add_snr() {{{1
function! s:add_snr(funcname) abort
if !exists('s:snr')
let s:snr = matchstr(expand('<sfile>'), '<SNR>\d\+_\zeget_snr$')
endif
return s:snr . a:funcname
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,26 +0,0 @@
" A tag that was created because of a tag name that covers multiple scopes
" Inherits the fields of the "main" tag it was split from.
" May be replaced during tag processing if it appears as a normal tag later,
" just like a pseudo tag.
function! tagbar#prototypes#splittag#new(name) abort
let newobj = tagbar#prototypes#normaltag#new(a:name)
let newobj.isSplitTag = function(s:add_snr('s:isSplitTag'))
return newobj
endfunction
function! s:isSplitTag() abort dict
return 1
endfunction
function! s:add_snr(funcname) abort
if !exists('s:snr')
let s:snr = matchstr(expand('<sfile>'), '<SNR>\d\+_\zeget_snr$')
endif
return s:snr . a:funcname
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,42 +0,0 @@
function! tagbar#prototypes#typeinfo#new(...) abort
let newobj = {}
let newobj.kinddict = {}
if a:0 > 0
call extend(newobj, a:1)
endif
let newobj.getKind = function(s:add_snr('s:getKind'))
let newobj.createKinddict = function(s:add_snr('s:createKinddict'))
return newobj
endfunction
" s:getKind() {{{1
function! s:getKind(kind) abort dict
let idx = self.kinddict[a:kind]
return self.kinds[idx]
endfunction
" s:createKinddict() {{{1
" Create a dictionary of the kind order for fast access in sorting functions
function! s:createKinddict() abort dict
let i = 0
for kind in self.kinds
let self.kinddict[kind.short] = i
let i += 1
endfor
let self.kinddict['?'] = i
endfunction
" s:add_snr() {{{1
function! s:add_snr(funcname) abort
if !exists('s:snr')
let s:snr = matchstr(expand('<sfile>'), '<SNR>\d\+_\zeget_snr$')
endif
return s:snr . a:funcname
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,57 +0,0 @@
" Script-local variable needed since compare functions can't
" take additional arguments
let s:compare_typeinfo = {}
function! tagbar#sorting#sort(tags, compareby, compare_typeinfo) abort
let s:compare_typeinfo = a:compare_typeinfo
let comparemethod =
\ a:compareby ==# 'kind' ? 's:compare_by_kind' : 's:compare_by_line'
call sort(a:tags, comparemethod)
for tag in a:tags
if !empty(tag.getChildren())
call tagbar#sorting#sort(tag.getChildren(), a:compareby,
\ a:compare_typeinfo)
endif
endfor
endfunction
function! s:compare_by_kind(tag1, tag2) abort
let typeinfo = s:compare_typeinfo
if typeinfo.kinddict[a:tag1.fields.kind] <#
\ typeinfo.kinddict[a:tag2.fields.kind]
return -1
elseif typeinfo.kinddict[a:tag1.fields.kind] >#
\ typeinfo.kinddict[a:tag2.fields.kind]
return 1
else
" Ignore '~' prefix for C++ destructors to sort them directly under
" the constructors
if a:tag1.name[0] ==# '~'
let name1 = a:tag1.name[1:]
else
let name1 = a:tag1.name
endif
if a:tag2.name[0] ==# '~'
let name2 = a:tag2.name[1:]
else
let name2 = a:tag2.name
endif
let ci = g:tagbar_case_insensitive
if (((!ci) && (name1 <=# name2)) || (ci && (name1 <=? name2)))
return -1
else
return 1
endif
endif
endfunction
function! s:compare_by_line(tag1, tag2) abort
return a:tag1.fields.line - a:tag2.fields.line
endfunction
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,51 +0,0 @@
function! tagbar#state#get_current_file(force_current) abort
return s:get().getCurrent(a:force_current)
endfunction
function! tagbar#state#set_current_file(fileinfo) abort
call s:get().setCurrentFile(a:fileinfo)
endfunction
function! tagbar#state#set_paused() abort
call s:get().setPaused()
endfunction
function! s:get() abort
if !exists('t:tagbar_state')
let t:tagbar_state = s:State.New()
endif
return t:tagbar_state
endfunction
let s:State = {
\ '_current' : {},
\ '_paused' : {},
\ }
" s:state.New() {{{1
function! s:State.New() abort dict
return deepcopy(self)
endfunction
" s:state.getCurrent() {{{1
function! s:State.getCurrent(force_current) abort dict
if !tagbar#is_paused() || a:force_current
return self._current
else
return self._paused
endif
endfunction
" s:state.setCurrentFile() {{{1
function! s:State.setCurrentFile(fileinfo) abort dict
let self._current = a:fileinfo
endfunction
" s:state.setPaused() {{{1
function! s:State.setPaused() abort dict
let self._paused = self._current
endfunction
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,773 +0,0 @@
" Type definitions for standard Exuberant Ctags
function! tagbar#types#ctags#init(supported_types) abort
let types = {}
" Ant {{{1
let type_ant = tagbar#prototypes#typeinfo#new()
let type_ant.ctagstype = 'ant'
let type_ant.kinds = [
\ {'short' : 'p', 'long' : 'projects', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'targets', 'fold' : 0, 'stl' : 1}
\ ]
let types.ant = type_ant
" Asm {{{1
let type_asm = tagbar#prototypes#typeinfo#new()
let type_asm.ctagstype = 'asm'
let type_asm.kinds = [
\ {'short' : 'm', 'long' : 'macros', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'types', 'fold' : 0, 'stl' : 1},
\ {'short' : 'd', 'long' : 'defines', 'fold' : 0, 'stl' : 1},
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1}
\ ]
let types.asm = type_asm
" ASP {{{1
let type_aspvbs = tagbar#prototypes#typeinfo#new()
let type_aspvbs.ctagstype = 'asp'
let type_aspvbs.kinds = [
\ {'short' : 'd', 'long' : 'constants', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1}
\ ]
let types.aspvbs = type_aspvbs
" Asymptote {{{1
" Asymptote gets parsed well using filetype = c
let type_asy = tagbar#prototypes#typeinfo#new()
let type_asy.ctagstype = 'c'
let type_asy.kinds = [
\ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0},
\ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1, 'stl' : 0},
\ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0},
\ {'short' : 't', 'long' : 'typedefs', 'fold' : 0, 'stl' : 0},
\ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'u', 'long' : 'unions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 0},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}
\ ]
let type_asy.sro = '::'
let type_asy.kind2scope = {
\ 'g' : 'enum',
\ 's' : 'struct',
\ 'u' : 'union'
\ }
let type_asy.scope2kind = {
\ 'enum' : 'g',
\ 'struct' : 's',
\ 'union' : 'u'
\ }
let types.asy = type_asy
" Awk {{{1
let type_awk = tagbar#prototypes#typeinfo#new()
let type_awk.ctagstype = 'awk'
let type_awk.kinds = [
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}
\ ]
let types.awk = type_awk
" Basic {{{1
let type_basic = tagbar#prototypes#typeinfo#new()
let type_basic.ctagstype = 'basic'
let type_basic.kinds = [
\ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 1},
\ {'short' : 'g', 'long' : 'enumerations', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'types', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1}
\ ]
let types.basic = type_basic
" BETA {{{1
let type_beta = tagbar#prototypes#typeinfo#new()
let type_beta.ctagstype = 'beta'
let type_beta.kinds = [
\ {'short' : 'f', 'long' : 'fragments', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'slots', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'patterns', 'fold' : 0, 'stl' : 1}
\ ]
let types.beta = type_beta
" C {{{1
let type_c = tagbar#prototypes#typeinfo#new()
let type_c.ctagstype = 'c'
let type_c.kinds = [
\ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0},
\ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1, 'stl' : 0},
\ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0},
\ {'short' : 't', 'long' : 'typedefs', 'fold' : 0, 'stl' : 0},
\ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'u', 'long' : 'unions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 0},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}
\ ]
let type_c.sro = '::'
let type_c.kind2scope = {
\ 'g' : 'enum',
\ 's' : 'struct',
\ 'u' : 'union'
\ }
let type_c.scope2kind = {
\ 'enum' : 'g',
\ 'struct' : 's',
\ 'union' : 'u'
\ }
let types.c = type_c
" C++ {{{1
let type_cpp = tagbar#prototypes#typeinfo#new()
let type_cpp.ctagstype = 'c++'
let type_cpp.kinds = [
\ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0},
\ {'short' : 'p', 'long' : 'prototypes', 'fold' : 1, 'stl' : 0},
\ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0},
\ {'short' : 't', 'long' : 'typedefs', 'fold' : 0, 'stl' : 0},
\ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'u', 'long' : 'unions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 0},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0}
\ ]
let type_cpp.sro = '::'
let type_cpp.kind2scope = {
\ 'g' : 'enum',
\ 'n' : 'namespace',
\ 'c' : 'class',
\ 's' : 'struct',
\ 'u' : 'union'
\ }
let type_cpp.scope2kind = {
\ 'enum' : 'g',
\ 'namespace' : 'n',
\ 'class' : 'c',
\ 'struct' : 's',
\ 'union' : 'u'
\ }
let types.cpp = type_cpp
let types.cuda = type_cpp
" C# {{{1
let type_cs = tagbar#prototypes#typeinfo#new()
let type_cs.ctagstype = 'c#'
let type_cs.kinds = [
\ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0},
\ {'short' : 'f', 'long' : 'fields', 'fold' : 0, 'stl' : 1},
\ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0},
\ {'short' : 't', 'long' : 'typedefs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'E', 'long' : 'events', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'properties', 'fold' : 0, 'stl' : 1}
\ ]
let type_cs.sro = '.'
let type_cs.kind2scope = {
\ 'n' : 'namespace',
\ 'i' : 'interface',
\ 'c' : 'class',
\ 's' : 'struct',
\ 'g' : 'enum'
\ }
let type_cs.scope2kind = {
\ 'namespace' : 'n',
\ 'interface' : 'i',
\ 'class' : 'c',
\ 'struct' : 's',
\ 'enum' : 'g'
\ }
let types.cs = type_cs
" COBOL {{{1
let type_cobol = tagbar#prototypes#typeinfo#new()
let type_cobol.ctagstype = 'cobol'
let type_cobol.kinds = [
\ {'short' : 'd', 'long' : 'data items', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'file descriptions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'g', 'long' : 'group items', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'paragraphs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'P', 'long' : 'program ids', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'sections', 'fold' : 0, 'stl' : 1}
\ ]
let types.cobol = type_cobol
" DOS Batch {{{1
let type_dosbatch = tagbar#prototypes#typeinfo#new()
let type_dosbatch.ctagstype = 'dosbatch'
let type_dosbatch.kinds = [
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1}
\ ]
let types.dosbatch = type_dosbatch
" Eiffel {{{1
let type_eiffel = tagbar#prototypes#typeinfo#new()
let type_eiffel.ctagstype = 'eiffel'
let type_eiffel.kinds = [
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'features', 'fold' : 0, 'stl' : 1}
\ ]
let type_eiffel.sro = '.' " Not sure, is nesting even possible?
let type_eiffel.kind2scope = {
\ 'c' : 'class',
\ 'f' : 'feature'
\ }
let type_eiffel.scope2kind = {
\ 'class' : 'c',
\ 'feature' : 'f'
\ }
let types.eiffel = type_eiffel
" Erlang {{{1
let type_erlang = tagbar#prototypes#typeinfo#new()
let type_erlang.ctagstype = 'erlang'
let type_erlang.kinds = [
\ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1},
\ {'short' : 'd', 'long' : 'macro definitions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'r', 'long' : 'record definitions', 'fold' : 0, 'stl' : 1}
\ ]
let type_erlang.sro = '.' " Not sure, is nesting even possible?
let type_erlang.kind2scope = {
\ 'm' : 'module'
\ }
let type_erlang.scope2kind = {
\ 'module' : 'm'
\ }
let types.erlang = type_erlang
" Flex {{{1
" Vim doesn't support Flex out of the box, this is based on rough
" guesses and probably requires
" http://www.vim.org/scripts/script.php?script_id=2909
" Improvements welcome!
let type_as = tagbar#prototypes#typeinfo#new()
let type_as.ctagstype = 'flex'
let type_as.kinds = [
\ {'short' : 'v', 'long' : 'global variables', 'fold' : 0, 'stl' : 0},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'properties', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'x', 'long' : 'mxtags', 'fold' : 0, 'stl' : 0}
\ ]
let type_as.sro = '.'
let type_as.kind2scope = {
\ 'c' : 'class'
\ }
let type_as.scope2kind = {
\ 'class' : 'c'
\ }
let types.mxml = type_as
let types.actionscript = type_as
" Fortran {{{1
let type_fortran = tagbar#prototypes#typeinfo#new()
let type_fortran.ctagstype = 'fortran'
let type_fortran.kinds = [
\ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'programs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'k', 'long' : 'components', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'derived types and structures', 'fold' : 0,
\ 'stl' : 1},
\ {'short' : 'c', 'long' : 'common blocks', 'fold' : 0, 'stl' : 1},
\ {'short' : 'b', 'long' : 'block data', 'fold' : 0, 'stl' : 0},
\ {'short' : 'e', 'long' : 'entry points', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1},
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1},
\ {'short' : 'n', 'long' : 'namelists', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0}
\ ]
let type_fortran.sro = '.' " Not sure, is nesting even possible?
let type_fortran.kind2scope = {
\ 'm' : 'module',
\ 'p' : 'program',
\ 'f' : 'function',
\ 's' : 'subroutine'
\ }
let type_fortran.scope2kind = {
\ 'module' : 'm',
\ 'program' : 'p',
\ 'function' : 'f',
\ 'subroutine' : 's'
\ }
let types.fortran = type_fortran
" Go {{{1
let type_go = tagbar#prototypes#typeinfo#new()
let type_go.ctagstype = 'go'
let type_go.kinds = [
\ {'short' : 'p', 'long' : 'packages', 'fold' : 0, 'stl' : 0},
\ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0, 'stl' : 0},
\ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 0},
\ {'short' : 's', 'long' : 'structs', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'struct members', 'fold' : 0, 'stl' : 0},
\ {'short' : 't', 'long' : 'types', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0}
\ ]
let type_go.sro = '.'
let type_go.kind2scope = {
\ 's' : 'struct'
\ }
let type_go.scope2kind = {
\ 'struct' : 's'
\ }
let types.go = type_go
" HTML {{{1
let type_html = tagbar#prototypes#typeinfo#new()
let type_html.ctagstype = 'html'
let type_html.kinds = [
\ {'short' : 'f', 'long' : 'JavaScript functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'a', 'long' : 'named anchors', 'fold' : 0, 'stl' : 1}
\ ]
let types.html = type_html
" Java {{{1
let type_java = tagbar#prototypes#typeinfo#new()
let type_java.ctagstype = 'java'
let type_java.kinds = [
\ {'short' : 'p', 'long' : 'packages', 'fold' : 1, 'stl' : 0},
\ {'short' : 'f', 'long' : 'fields', 'fold' : 0, 'stl' : 0},
\ {'short' : 'g', 'long' : 'enum types', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'enum constants', 'fold' : 0, 'stl' : 0},
\ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1}
\ ]
let type_java.sro = '.'
let type_java.kind2scope = {
\ 'g' : 'enum',
\ 'i' : 'interface',
\ 'c' : 'class'
\ }
let type_java.scope2kind = {
\ 'enum' : 'g',
\ 'interface' : 'i',
\ 'class' : 'c'
\ }
let types.java = type_java
" JavaScript {{{1
let type_javascript = tagbar#prototypes#typeinfo#new()
let type_javascript.ctagstype = 'javascript'
let type_javascript.kinds = [
\ {'short': 'v', 'long': 'global variables', 'fold': 0, 'stl': 0},
\ {'short': 'c', 'long': 'classes', 'fold': 0, 'stl': 1},
\ {'short': 'p', 'long': 'properties', 'fold': 0, 'stl': 0},
\ {'short': 'm', 'long': 'methods', 'fold': 0, 'stl': 1},
\ {'short': 'f', 'long': 'functions', 'fold': 0, 'stl': 1},
\ ]
let type_javascript.sro = '.'
let type_javascript.kind2scope = {
\ 'c' : 'class',
\ 'f' : 'function',
\ 'm' : 'method',
\ 'p' : 'property',
\ }
let type_javascript.scope2kind = {
\ 'class' : 'c',
\ 'function' : 'f',
\ }
let types.javascript = type_javascript
" Lisp {{{1
let type_lisp = tagbar#prototypes#typeinfo#new()
let type_lisp.ctagstype = 'lisp'
let type_lisp.kinds = [
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}
\ ]
let types.lisp = type_lisp
let types.clojure = type_lisp
" Lua {{{1
let type_lua = tagbar#prototypes#typeinfo#new()
let type_lua.ctagstype = 'lua'
let type_lua.kinds = [
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}
\ ]
let types.lua = type_lua
" Make {{{1
let type_make = tagbar#prototypes#typeinfo#new()
let type_make.ctagstype = 'make'
let type_make.kinds = [
\ {'short' : 'm', 'long' : 'macros', 'fold' : 0, 'stl' : 1}
\ ]
let types.make = type_make
" Matlab {{{1
let type_matlab = tagbar#prototypes#typeinfo#new()
let type_matlab.ctagstype = 'matlab'
let type_matlab.kinds = [
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}
\ ]
let types.matlab = type_matlab
" ObjectiveC {{{1
let type_objc = tagbar#prototypes#typeinfo#new()
let type_objc.ctagstype = 'objectivec'
let type_objc.kinds = [
\ {'short' : 'M', 'long' : 'preprocessor macros', 'fold' : 1, 'stl' : 0},
\ {'short' : 'v', 'long' : 'global variables', 'fold' : 0, 'stl' : 0},
\ {'short' : 'i', 'long' : 'class interfaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'I', 'long' : 'class implementations', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'class methods', 'fold' : 0, 'stl' : 1},
\ {'short' : 'F', 'long' : 'object fields', 'fold' : 0, 'stl' : 0},
\ {'short' : 'm', 'long' : 'object methods', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'type structures', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'type aliases', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'enumerations', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'properties', 'fold' : 0, 'stl' : 0},
\ ]
let type_objc.sro = ':'
let type_objc.kind2scope = {
\ 'i' : 'interface',
\ 'I' : 'implementation',
\ 's' : 'struct',
\ }
let type_objc.scope2kind = {
\ 'interface' : 'i',
\ 'implementation' : 'I',
\ 'struct' : 's',
\ }
let types.objc = type_objc
let types.objcpp = type_objc
" Ocaml {{{1
let type_ocaml = tagbar#prototypes#typeinfo#new()
let type_ocaml.ctagstype = 'ocaml'
let type_ocaml.kinds = [
\ {'short' : 'M', 'long' : 'modules or functors', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'global variables', 'fold' : 0, 'stl' : 0},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'C', 'long' : 'constructors', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'exceptions', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'type names', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'r', 'long' : 'structure fields', 'fold' : 0, 'stl' : 0}
\ ]
let type_ocaml.sro = '.' " Not sure, is nesting even possible?
let type_ocaml.kind2scope = {
\ 'M' : 'Module',
\ 'c' : 'class',
\ 't' : 'type'
\ }
let type_ocaml.scope2kind = {
\ 'Module' : 'M',
\ 'class' : 'c',
\ 'type' : 't'
\ }
let types.ocaml = type_ocaml
" Pascal {{{1
let type_pascal = tagbar#prototypes#typeinfo#new()
let type_pascal.ctagstype = 'pascal'
let type_pascal.kinds = [
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1}
\ ]
let types.pascal = type_pascal
" Perl {{{1
let type_perl = tagbar#prototypes#typeinfo#new()
let type_perl.ctagstype = 'perl'
let type_perl.kinds = [
\ {'short' : 'p', 'long' : 'packages', 'fold' : 1, 'stl' : 0},
\ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'formats', 'fold' : 0, 'stl' : 0},
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1}
\ ]
let types.perl = type_perl
" PHP {{{1
let type_php = tagbar#prototypes#typeinfo#new()
let type_php.ctagstype = 'php'
let type_php.kinds = [
\ {'short' : 'i', 'long' : 'interfaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'd', 'long' : 'constant definitions', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0},
\ {'short' : 'j', 'long' : 'javascript functions', 'fold' : 0, 'stl' : 1}
\ ]
let types.php = type_php
" Python {{{1
let type_python = tagbar#prototypes#typeinfo#new()
let type_python.ctagstype = 'python'
let type_python.kinds = [
\ {'short' : 'i', 'long' : 'imports', 'fold' : 1, 'stl' : 0},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0}
\ ]
let type_python.sro = '.'
let type_python.kind2scope = {
\ 'c' : 'class',
\ 'f' : 'function',
\ 'm' : 'function'
\ }
let type_python.scope2kind = {
\ 'class' : 'c',
\ 'function' : 'f'
\ }
let types.python = type_python
let types.pyrex = type_python
let types.cython = type_python
" REXX {{{1
let type_rexx = tagbar#prototypes#typeinfo#new()
let type_rexx.ctagstype = 'rexx'
let type_rexx.kinds = [
\ {'short' : 's', 'long' : 'subroutines', 'fold' : 0, 'stl' : 1}
\ ]
let types.rexx = type_rexx
" Ruby {{{1
let type_ruby = tagbar#prototypes#typeinfo#new()
let type_ruby.ctagstype = 'ruby'
let type_ruby.kinds = [
\ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'methods', 'fold' : 0, 'stl' : 1},
\ {'short' : 'F', 'long' : 'singleton methods', 'fold' : 0, 'stl' : 1}
\ ]
let type_ruby.sro = '.'
let type_ruby.kind2scope = {
\ 'c' : 'class',
\ 'm' : 'class',
\ 'f' : 'class'
\ }
let type_ruby.scope2kind = {
\ 'class' : 'c'
\ }
let types.ruby = type_ruby
" Scheme {{{1
let type_scheme = tagbar#prototypes#typeinfo#new()
let type_scheme.ctagstype = 'scheme'
let type_scheme.kinds = [
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'sets', 'fold' : 0, 'stl' : 1}
\ ]
let types.scheme = type_scheme
let types.racket = type_scheme
" Shell script {{{1
let type_sh = tagbar#prototypes#typeinfo#new()
let type_sh.ctagstype = 'sh'
let type_sh.kinds = [
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}
\ ]
let types.sh = type_sh
let types.csh = type_sh
let types.zsh = type_sh
" SLang {{{1
let type_slang = tagbar#prototypes#typeinfo#new()
let type_slang.ctagstype = 'slang'
let type_slang.kinds = [
\ {'short' : 'n', 'long' : 'namespaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1}
\ ]
let types.slang = type_slang
" SML {{{1
let type_sml = tagbar#prototypes#typeinfo#new()
let type_sml.ctagstype = 'sml'
let type_sml.kinds = [
\ {'short' : 'e', 'long' : 'exception declarations', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'function definitions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'functor definitions', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'signature declarations', 'fold' : 0, 'stl' : 0},
\ {'short' : 'r', 'long' : 'structure declarations', 'fold' : 0, 'stl' : 0},
\ {'short' : 't', 'long' : 'type definitions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'value bindings', 'fold' : 0, 'stl' : 0}
\ ]
let types.sml = type_sml
" SQL {{{1
" The SQL ctags parser seems to be buggy for me, so this just uses the
" normal kinds even though scopes should be available. Improvements
" welcome!
let type_sql = tagbar#prototypes#typeinfo#new()
let type_sql.ctagstype = 'sql'
let type_sql.kinds = [
\ {'short' : 'P', 'long' : 'packages', 'fold' : 1, 'stl' : 1},
\ {'short' : 'd', 'long' : 'prototypes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'cursors', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'F', 'long' : 'record fields', 'fold' : 0, 'stl' : 1},
\ {'short' : 'L', 'long' : 'block label', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'subtypes', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'tables', 'fold' : 0, 'stl' : 1},
\ {'short' : 'T', 'long' : 'triggers', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 1},
\ {'short' : 'i', 'long' : 'indexes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'events', 'fold' : 0, 'stl' : 1},
\ {'short' : 'U', 'long' : 'publications', 'fold' : 0, 'stl' : 1},
\ {'short' : 'R', 'long' : 'services', 'fold' : 0, 'stl' : 1},
\ {'short' : 'D', 'long' : 'domains', 'fold' : 0, 'stl' : 1},
\ {'short' : 'V', 'long' : 'views', 'fold' : 0, 'stl' : 1},
\ {'short' : 'n', 'long' : 'synonyms', 'fold' : 0, 'stl' : 1},
\ {'short' : 'x', 'long' : 'MobiLink Table Scripts', 'fold' : 0, 'stl' : 1},
\ {'short' : 'y', 'long' : 'MobiLink Conn Scripts', 'fold' : 0, 'stl' : 1},
\ {'short' : 'z', 'long' : 'MobiLink Properties', 'fold' : 0, 'stl' : 1}
\ ]
let types.sql = type_sql
" Tcl {{{1
let type_tcl = tagbar#prototypes#typeinfo#new()
let type_tcl.ctagstype = 'tcl'
let type_tcl.kinds = [
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'methods', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1}
\ ]
let types.tcl = type_tcl
" LaTeX {{{1
let type_tex = tagbar#prototypes#typeinfo#new()
let type_tex.ctagstype = 'tex'
let type_tex.kinds = [
\ {'short' : 'i', 'long' : 'includes', 'fold' : 1, 'stl' : 0},
\ {'short' : 'p', 'long' : 'parts', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'chapters', 'fold' : 0, 'stl' : 1},
\ {'short' : 's', 'long' : 'sections', 'fold' : 0, 'stl' : 1},
\ {'short' : 'u', 'long' : 'subsections', 'fold' : 0, 'stl' : 1},
\ {'short' : 'b', 'long' : 'subsubsections', 'fold' : 0, 'stl' : 1},
\ {'short' : 'P', 'long' : 'paragraphs', 'fold' : 0, 'stl' : 0},
\ {'short' : 'G', 'long' : 'subparagraphs', 'fold' : 0, 'stl' : 0},
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 0}
\ ]
let type_tex.sro = '""'
let type_tex.kind2scope = {
\ 'p' : 'part',
\ 'c' : 'chapter',
\ 's' : 'section',
\ 'u' : 'subsection',
\ 'b' : 'subsubsection'
\ }
let type_tex.scope2kind = {
\ 'part' : 'p',
\ 'chapter' : 'c',
\ 'section' : 's',
\ 'subsection' : 'u',
\ 'subsubsection' : 'b'
\ }
let type_tex.sort = 0
let types.tex = type_tex
" Vala {{{1
" Vala is supported by the ctags fork provided by Anjuta, so only add the
" type if the fork is used to prevent error messages otherwise
if has_key(a:supported_types, 'vala') || executable('anjuta-tags')
let type_vala = tagbar#prototypes#typeinfo#new()
let type_vala.ctagstype = 'vala'
let type_vala.kinds = [
\ {'short' : 'e', 'long' : 'Enumerations', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'Enumeration values', 'fold' : 0, 'stl' : 0},
\ {'short' : 's', 'long' : 'Structures', 'fold' : 0, 'stl' : 1},
\ {'short' : 'i', 'long' : 'Interfaces', 'fold' : 0, 'stl' : 1},
\ {'short' : 'd', 'long' : 'Delegates', 'fold' : 0, 'stl' : 1},
\ {'short' : 'c', 'long' : 'Classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'Properties', 'fold' : 0, 'stl' : 0},
\ {'short' : 'f', 'long' : 'Fields', 'fold' : 0, 'stl' : 0},
\ {'short' : 'm', 'long' : 'Methods', 'fold' : 0, 'stl' : 1},
\ {'short' : 'E', 'long' : 'Error domains', 'fold' : 0, 'stl' : 1},
\ {'short' : 'r', 'long' : 'Error codes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'S', 'long' : 'Signals', 'fold' : 0, 'stl' : 1}
\ ]
let type_vala.sro = '.'
" 'enum' doesn't seem to be used as a scope, but it can't hurt to have
" it here
let type_vala.kind2scope = {
\ 's' : 'struct',
\ 'i' : 'interface',
\ 'c' : 'class',
\ 'e' : 'enum'
\ }
let type_vala.scope2kind = {
\ 'struct' : 's',
\ 'interface' : 'i',
\ 'class' : 'c',
\ 'enum' : 'e'
\ }
let types.vala = type_vala
endif
if !has_key(a:supported_types, 'vala') && executable('anjuta-tags')
let types.vala.ctagsbin = 'anjuta-tags'
endif
" Vera {{{1
" Why are variables 'virtual'?
let type_vera = tagbar#prototypes#typeinfo#new()
let type_vera.ctagstype = 'vera'
let type_vera.kinds = [
\ {'short' : 'd', 'long' : 'macros', 'fold' : 1, 'stl' : 0},
\ {'short' : 'g', 'long' : 'enums', 'fold' : 0, 'stl' : 1},
\ {'short' : 'T', 'long' : 'typedefs', 'fold' : 0, 'stl' : 0},
\ {'short' : 'c', 'long' : 'classes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'enumerators', 'fold' : 0, 'stl' : 0},
\ {'short' : 'm', 'long' : 'members', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'tasks', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 0, 'stl' : 0},
\ {'short' : 'p', 'long' : 'programs', 'fold' : 0, 'stl' : 1}
\ ]
let type_vera.sro = '.' " Nesting doesn't seem to be possible
let type_vera.kind2scope = {
\ 'g' : 'enum',
\ 'c' : 'class',
\ 'v' : 'virtual'
\ }
let type_vera.scope2kind = {
\ 'enum' : 'g',
\ 'class' : 'c',
\ 'virtual' : 'v'
\ }
let types.vera = type_vera
" Verilog {{{1
let type_verilog = tagbar#prototypes#typeinfo#new()
let type_verilog.ctagstype = 'verilog'
let type_verilog.kinds = [
\ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 0},
\ {'short' : 'e', 'long' : 'events', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'm', 'long' : 'modules', 'fold' : 0, 'stl' : 1},
\ {'short' : 'n', 'long' : 'net data types', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'ports', 'fold' : 0, 'stl' : 1},
\ {'short' : 'r', 'long' : 'register data types', 'fold' : 0, 'stl' : 1},
\ {'short' : 't', 'long' : 'tasks', 'fold' : 0, 'stl' : 1}
\ ]
let types.verilog = type_verilog
" VHDL {{{1
" The VHDL ctags parser unfortunately doesn't generate proper scopes
let type_vhdl = tagbar#prototypes#typeinfo#new()
let type_vhdl.ctagstype = 'vhdl'
let type_vhdl.kinds = [
\ {'short' : 'P', 'long' : 'packages', 'fold' : 1, 'stl' : 0},
\ {'short' : 'c', 'long' : 'constants', 'fold' : 0, 'stl' : 0},
\ {'short' : 't', 'long' : 'types', 'fold' : 0, 'stl' : 1},
\ {'short' : 'T', 'long' : 'subtypes', 'fold' : 0, 'stl' : 1},
\ {'short' : 'r', 'long' : 'records', 'fold' : 0, 'stl' : 1},
\ {'short' : 'e', 'long' : 'entities', 'fold' : 0, 'stl' : 1},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'p', 'long' : 'procedures', 'fold' : 0, 'stl' : 1}
\ ]
let types.vhdl = type_vhdl
" Vim {{{1
let type_vim = tagbar#prototypes#typeinfo#new()
let type_vim.ctagstype = 'vim'
let type_vim.kinds = [
\ {'short' : 'n', 'long' : 'vimball filenames', 'fold' : 0, 'stl' : 1},
\ {'short' : 'v', 'long' : 'variables', 'fold' : 1, 'stl' : 0},
\ {'short' : 'f', 'long' : 'functions', 'fold' : 0, 'stl' : 1},
\ {'short' : 'a', 'long' : 'autocommand groups', 'fold' : 1, 'stl' : 1},
\ {'short' : 'c', 'long' : 'commands', 'fold' : 0, 'stl' : 0},
\ {'short' : 'm', 'long' : 'maps', 'fold' : 1, 'stl' : 0}
\ ]
let types.vim = type_vim
" YACC {{{1
let type_yacc = tagbar#prototypes#typeinfo#new()
let type_yacc.ctagstype = 'yacc'
let type_yacc.kinds = [
\ {'short' : 'l', 'long' : 'labels', 'fold' : 0, 'stl' : 1}
\ ]
let types.yacc = type_yacc
" }}}1
for [type, typeinfo] in items(types)
let typeinfo.ftype = type
endfor
for typeinfo in values(types)
call typeinfo.createKinddict()
endfor
return types
endfunction
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,62 +0,0 @@
:TagbarClose tagbar.txt /*:TagbarClose*
:TagbarCurrentTag tagbar.txt /*:TagbarCurrentTag*
:TagbarDebug tagbar.txt /*:TagbarDebug*
:TagbarDebugEnd tagbar.txt /*:TagbarDebugEnd*
:TagbarGetTypeConfig tagbar.txt /*:TagbarGetTypeConfig*
:TagbarOpen tagbar.txt /*:TagbarOpen*
:TagbarOpenAutoClose tagbar.txt /*:TagbarOpenAutoClose*
:TagbarSetFoldlevel tagbar.txt /*:TagbarSetFoldlevel*
:TagbarShowTag tagbar.txt /*:TagbarShowTag*
:TagbarToggle tagbar.txt /*:TagbarToggle*
:TagbarTogglePause tagbar.txt /*:TagbarTogglePause*
g:tagbar_autoclose tagbar.txt /*g:tagbar_autoclose*
g:tagbar_autofocus tagbar.txt /*g:tagbar_autofocus*
g:tagbar_autopreview tagbar.txt /*g:tagbar_autopreview*
g:tagbar_autoshowtag tagbar.txt /*g:tagbar_autoshowtag*
g:tagbar_case_insensitive tagbar.txt /*g:tagbar_case_insensitive*
g:tagbar_compact tagbar.txt /*g:tagbar_compact*
g:tagbar_ctags_bin tagbar.txt /*g:tagbar_ctags_bin*
g:tagbar_ctags_options tagbar.txt /*g:tagbar_ctags_options*
g:tagbar_expand tagbar.txt /*g:tagbar_expand*
g:tagbar_foldlevel tagbar.txt /*g:tagbar_foldlevel*
g:tagbar_hide_nonpublic tagbar.txt /*g:tagbar_hide_nonpublic*
g:tagbar_iconchars tagbar.txt /*g:tagbar_iconchars*
g:tagbar_indent tagbar.txt /*g:tagbar_indent*
g:tagbar_left tagbar.txt /*g:tagbar_left*
g:tagbar_previewwin_pos tagbar.txt /*g:tagbar_previewwin_pos*
g:tagbar_show_balloon tagbar.txt /*g:tagbar_show_balloon*
g:tagbar_show_linenumbers tagbar.txt /*g:tagbar_show_linenumbers*
g:tagbar_show_visibility tagbar.txt /*g:tagbar_show_visibility*
g:tagbar_silent tagbar.txt /*g:tagbar_silent*
g:tagbar_singleclick tagbar.txt /*g:tagbar_singleclick*
g:tagbar_sort tagbar.txt /*g:tagbar_sort*
g:tagbar_status_func tagbar.txt /*g:tagbar_status_func*
g:tagbar_systemenc tagbar.txt /*g:tagbar_systemenc*
g:tagbar_updateonsave_maxlines tagbar.txt /*g:tagbar_updateonsave_maxlines*
g:tagbar_vertical tagbar.txt /*g:tagbar_vertical*
g:tagbar_width tagbar.txt /*g:tagbar_width*
g:tagbar_zoomwidth tagbar.txt /*g:tagbar_zoomwidth*
tagbar tagbar.txt /*tagbar*
tagbar#StopAutoUpdate() tagbar.txt /*tagbar#StopAutoUpdate()*
tagbar-autoopen tagbar.txt /*tagbar-autoopen*
tagbar-commands tagbar.txt /*tagbar-commands*
tagbar-configuration tagbar.txt /*tagbar-configuration*
tagbar-contents tagbar.txt /*tagbar-contents*
tagbar-credits tagbar.txt /*tagbar-credits*
tagbar-extend tagbar.txt /*tagbar-extend*
tagbar-features tagbar.txt /*tagbar-features*
tagbar-functions tagbar.txt /*tagbar-functions*
tagbar-highlight tagbar.txt /*tagbar-highlight*
tagbar-history tagbar.txt /*tagbar-history*
tagbar-ignore tagbar.txt /*tagbar-ignore*
tagbar-installation tagbar.txt /*tagbar-installation*
tagbar-intro tagbar.txt /*tagbar-intro*
tagbar-issues tagbar.txt /*tagbar-issues*
tagbar-keys tagbar.txt /*tagbar-keys*
tagbar-other tagbar.txt /*tagbar-other*
tagbar-pseudotags tagbar.txt /*tagbar-pseudotags*
tagbar-requirements tagbar.txt /*tagbar-requirements*
tagbar-statusline tagbar.txt /*tagbar-statusline*
tagbar-todo tagbar.txt /*tagbar-todo*
tagbar-usage tagbar.txt /*tagbar-usage*
tagbar.txt tagbar.txt /*tagbar.txt*

View File

@ -1,153 +0,0 @@
" ============================================================================
" File: tagbar.vim
" Description: List the current file's tags in a sidebar, ordered by class etc
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.7
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
" Yegappan Lakshmanan and uses a small amount of code from it.
"
" Original taglist copyright notice:
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
" taglist.vim is provided *as is* and comes with no warranty of
" any kind, either expressed or implied. In no event will the
" copyright holder be liable for any damamges resulting from the
" use of this software.
" ============================================================================
scriptencoding utf-8
if &compatible || exists('g:loaded_tagbar')
finish
endif
" Basic init {{{1
if v:version < 700
echohl WarningMsg
echomsg 'Tagbar: Vim version is too old, Tagbar requires at least 7.0'
echohl None
finish
endif
if v:version == 700 && !has('patch167')
echohl WarningMsg
echomsg 'Tagbar: Vim versions lower than 7.0.167 have a bug'
\ 'that prevents this version of Tagbar from working.'
\ 'Please use the alternate version posted on the website.'
echohl None
finish
endif
function! s:init_var(var, value) abort
if !exists('g:tagbar_' . a:var)
execute 'let g:tagbar_' . a:var . ' = ' . string(a:value)
endif
endfunction
function! s:setup_options() abort
if !exists('g:tagbar_vertical') || g:tagbar_vertical == 0
let previewwin_pos = 'topleft'
else
let previewwin_pos = 'rightbelow vertical'
endif
let options = [
\ ['autoclose', 0],
\ ['autofocus', 0],
\ ['autopreview', 0],
\ ['autoshowtag', 0],
\ ['case_insensitive', 0],
\ ['compact', 0],
\ ['expand', 0],
\ ['foldlevel', 99],
\ ['hide_nonpublic', 0],
\ ['indent', 2],
\ ['left', 0],
\ ['previewwin_pos', previewwin_pos],
\ ['show_balloon', 1],
\ ['show_visibility', 1],
\ ['show_linenumbers', 0],
\ ['singleclick', 0],
\ ['sort', 1],
\ ['systemenc', &encoding],
\ ['vertical', 0],
\ ['width', 40],
\ ['zoomwidth', 1],
\ ['silent', 0],
\ ]
for [opt, val] in options
call s:init_var(opt, val)
endfor
endfunction
call s:setup_options()
if !exists('g:tagbar_iconchars')
if has('multi_byte') && has('unix') && &encoding ==# 'utf-8' &&
\ (!exists('+termencoding') || empty(&termencoding) || &termencoding ==# 'utf-8')
let g:tagbar_iconchars = ['▶', '▼']
else
let g:tagbar_iconchars = ['+', '-']
endif
endif
function! s:setup_keymaps() abort
let keymaps = [
\ ['jump', '<CR>'],
\ ['preview', 'p'],
\ ['previewwin', 'P'],
\ ['nexttag', '<C-N>'],
\ ['prevtag', '<C-P>'],
\ ['showproto', '<Space>'],
\ ['hidenonpublic', 'v'],
\
\ ['openfold', ['+', '<kPlus>', 'zo']],
\ ['closefold', ['-', '<kMinus>', 'zc']],
\ ['togglefold', ['o', 'za']],
\ ['openallfolds', ['*', '<kMultiply>', 'zR']],
\ ['closeallfolds', ['=', 'zM']],
\ ['incrementfolds', ['zr']],
\ ['decrementfolds', ['zm']],
\ ['nextfold', 'zj'],
\ ['prevfold', 'zk'],
\
\ ['togglesort', 's'],
\ ['togglecaseinsensitive', 'i'],
\ ['toggleautoclose', 'c'],
\ ['togglepause', 't'],
\ ['zoomwin', 'x'],
\ ['close', 'q'],
\ ['help', ['<F1>', '?']],
\ ]
for [map, key] in keymaps
call s:init_var('map_' . map, key)
unlet key
endfor
endfunction
call s:setup_keymaps()
augroup TagbarSession
autocmd!
autocmd SessionLoadPost * nested call tagbar#RestoreSession()
augroup END
" Commands {{{1
command! -nargs=0 Tagbar call tagbar#ToggleWindow()
command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>)
command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fcj')
command! -nargs=0 TagbarClose call tagbar#CloseWindow()
command! -nargs=1 -bang TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>, <bang>0)
command! -nargs=0 TagbarShowTag call tagbar#highlighttag(1, 1)
command! -nargs=? TagbarCurrentTag echo tagbar#currenttag('%s', 'No current tag', <f-args>)
command! -nargs=1 TagbarGetTypeConfig call tagbar#gettypeconfig(<f-args>)
command! -nargs=? TagbarDebug call tagbar#debug#start_debug(<f-args>)
command! -nargs=0 TagbarDebugEnd call tagbar#debug#stop_debug()
command! -nargs=0 TagbarTogglePause call tagbar#toggle_pause()
" Modeline {{{1
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,64 +0,0 @@
" File: tagbar.vim
" Description: Tagbar syntax settings
" Author: Jan Larres <jan@majutsushi.net>
" Licence: Vim licence
" Website: http://majutsushi.github.com/tagbar/
" Version: 2.7
scriptencoding utf-8
if exists('b:current_syntax')
finish
endif
let s:ics = escape(join(g:tagbar_iconchars, ''), ']^\-')
let s:pattern = '\(^[' . s:ics . '] \?\)\@3<=[^-+: ]\+[^:]\+$'
execute "syntax match TagbarKind '" . s:pattern . "'"
let s:pattern = '\(\S\@<![' . s:ics . '][-+# ]\?\)\@<=[^*(]\+\(\*\?\(([^)]\+)\)\? :\)\@='
execute "syntax match TagbarScope '" . s:pattern . "'"
let s:pattern = '\S\@<![' . s:ics . ']\([-+# ]\?\)\@='
execute "syntax match TagbarFoldIcon '" . s:pattern . "'"
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=+\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityPublic '" . s:pattern . "'"
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=#\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityProtected '" . s:pattern . "'"
let s:pattern = '\(\S\@<![' . s:ics . ' ]\)\@<=-\([^-+# ]\)\@='
execute "syntax match TagbarVisibilityPrivate '" . s:pattern . "'"
unlet s:pattern
syntax match TagbarHelp '^".*' contains=TagbarHelpKey,TagbarHelpTitle
syntax match TagbarHelpKey '" \zs.*\ze:' contained
syntax match TagbarHelpTitle '" \zs-\+ \w\+ -\+' contained
syntax match TagbarNestedKind '^\s\+\[[^]]\+\]$'
syntax match TagbarType ' : \zs.*'
syntax match TagbarSignature '(.*)'
syntax match TagbarPseudoID '\*\ze :'
highlight default link TagbarHelp Comment
highlight default link TagbarHelpKey Identifier
highlight default link TagbarHelpTitle PreProc
highlight default link TagbarKind Identifier
highlight default link TagbarNestedKind TagbarKind
highlight default link TagbarScope Title
highlight default link TagbarType Type
highlight default link TagbarSignature SpecialKey
highlight default link TagbarPseudoID NonText
highlight default link TagbarFoldIcon Statement
highlight default link TagbarHighlight Search
highlight default TagbarAccessPublic guifg=Green ctermfg=Green
highlight default TagbarAccessProtected guifg=Blue ctermfg=Blue
highlight default TagbarAccessPrivate guifg=Red ctermfg=Red
highlight default link TagbarVisibilityPublic TagbarAccessPublic
highlight default link TagbarVisibilityProtected TagbarAccessProtected
highlight default link TagbarVisibilityPrivate TagbarAccessPrivate
let b:current_syntax = 'tagbar'
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1

View File

@ -1,7 +1,3 @@
" load plugins
execute pathogen#infect()
Helptags
set nocompatible
" mouse support
@ -42,9 +38,6 @@ let &softtabstop=&shiftwidth
set expandtab
set smarttab
set timeoutlen=100 ttimeoutlen=0
set textwidth=72
" set colorcolumn=72
set formatprg=par\ -w72q
@ -53,25 +46,10 @@ set list
set listchars=tab:>_,trail:>
set fillchars=vert:\|,eob:\
" autocomplete
set wildmenu
set wildmode=longest:full,full
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val, "lnum": 1 }'))
copen
cc
endfunction
" let g:fzf_history_dir = '~/.local/vim/fzf-history'
let g:fzf_layout = { 'down': '40%' }
nnoremap <c-p> :FZF -i -e --layout=reverse<CR>
nnoremap <c-b> :Buffers<CR>
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
@ -81,6 +59,47 @@ function! CleverTab()
endfunction
inoremap <tab> <C-R>=CleverTab()<CR>
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val, "lnum": 1 }'))
copen
cc
endfunction
let g:fzf_layout = { 'down': '40%' }
nnoremap <c-o> :Files<CR>
nnoremap <c-b> :Buffers<CR>
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'vsplit' }
let g:fzf_vim = {}
let g:fzf_vim.tags_command = 'ectags -R'
let g:mapleader = ","
nnoremap <leader>f :Files<CR>
nnoremap <leader>o :Buffers<CR>
nnoremap <leader>l :Lines<CR>
nnoremap <leader>t :Tags<CR>
let g:tagbar_ctags_bin = "ectags"
noremap <leader>tt :TagbarToggle<CR>
" TAGS FILE
set tags=".tags"
"nnoremap gt :cs find 1 <C-R>=expand("<cword>")<CR><CR>
"nnoremap gs :cs find 4 <C-R>=expand("<cword>")<CR><CR>
"nnoremap gb <c-o>
"nnoremap gh :FSHere<CR>
let g:fzf_tags_prompt = "Gd "
noreabbrev <expr> ts getcmdtype() == ":" && getcmdline() == 'ts' ? 'FZFTselect' : 'ts'
nmap gt <Plug>(fzf_tags)
let g:autotagTagsFile = ".tags"
let g:autotagCtagsCmd = "ectags"
" HIGHLIGHT SPECIAL WORDS
match ErrorMsg '\(TODO:\|FIXME\|XXX\|workaround\|WTF\|: error:.*\|\s\+$\| \+\ze\t\)'
@ -96,6 +115,11 @@ set backupdir=~/.local/vim/backup//
set directory=~/.local/vim/swapfiles//
silent execute '!mkdir -p ~/.local/vim/backup ~/.local/vim/undo ~/.local/vim/swapfiles'
" PLUGIN: EASY ALIGN
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
augroup mystuff
au!
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g'\"" | endif