@@ -0,0 +1,570 @@ | |||
"============================================================================= | |||
" Copyright (c) 2009-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if exists('g:loaded_autoload_l9') | |||
finish | |||
endif | |||
let g:loaded_autoload_l9 = 1 | |||
" }}}1 | |||
"============================================================================= | |||
" COMPATIBILITY TEST {{{1 | |||
" | |||
let s:L9_VERSION_CURRENT = 101 | |||
let s:L9_VERSION_PASSABLE = 101 | |||
" returns true if given version is compatible. | |||
function l9#isCompatible(ver) | |||
return | |||
endfunction | |||
let s:VERSION_FACTOR = str2float('0.01') | |||
" returns false if the caller script should finish. | |||
" a:vimVersion: if 0, don't check vim version | |||
" a:l9Version: same rule as v:version | |||
function l9#guardScriptLoading(path, vimVersion, l9Version, exprs) | |||
let loadedVarName = 'g:loaded_' . substitute(a:path, '\W', '_', 'g') | |||
if exists(loadedVarName) | |||
return 0 | |||
elseif a:vimVersion > 0 && a:vimVersion > v:version | |||
echoerr a:path . ' requires Vim version ' . string(a:vimVersion * s:VERSION_FACTOR) | |||
return 0 | |||
elseif a:l9Version > 0 && (a:l9Version > s:L9_VERSION_CURRENT || | |||
\ a:l9Version < s:L9_VERSION_PASSABLE) | |||
echoerr a:path . ' requires L9 library version ' . string(a:l9Version * s:VERSION_FACTOR) | |||
return 0 | |||
endif | |||
for expr in a:exprs | |||
if !eval(expr) | |||
echoerr a:path . ' requires: ' . expr | |||
return 0 | |||
endif | |||
endfor | |||
let {loadedVarName} = 1 | |||
return 1 | |||
endfunction | |||
" | |||
function l9#getVersion() | |||
return s:L9_VERSION_CURRENT | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LIST {{{1 | |||
" Removes duplicates (unstable) | |||
" This function doesn't change the list of argument. | |||
function l9#unique(items) | |||
let sorted = sort(a:items) | |||
if len(sorted) < 2 | |||
return sorted | |||
endif | |||
let last = remove(sorted, 0) | |||
let result = [last] | |||
for item in sorted | |||
if item != last | |||
call add(result, item) | |||
let last = item | |||
endif | |||
endfor | |||
return result | |||
endfunction | |||
" Removes duplicates (stable) | |||
" This function doesn't change the list of argument. | |||
function l9#uniqueStably(items) | |||
let result = [] | |||
for item in a:items | |||
if count(result, item, &ignorecase) == 0 | |||
call add(result, item) | |||
endif | |||
endfor | |||
return result | |||
endfunction | |||
" [ [0], [1,2], [3] ] -> [ 0, 1, 2, 3 ] | |||
" This function doesn't change the list of argument. | |||
function l9#concat(items) | |||
let result = [] | |||
for l in a:items | |||
let result += l | |||
endfor | |||
return result | |||
endfunction | |||
" [ [0,1,2], [3,4], [5,6,7,8] ] -> [ [0,3,5],[1,4,6] ] | |||
" This function doesn't change the list of argument. | |||
function l9#zip(items) | |||
let result = [] | |||
for i in range(min(map(copy(a:items), 'len(v:val)'))) | |||
call add(result, map(copy(a:items), 'v:val[i]')) | |||
endfor | |||
return result | |||
endfunction | |||
" filter() with the maximum number of items | |||
" This function doesn't change the list of argument. | |||
function l9#filterWithLimit(items, expr, limit) | |||
if a:limit <= 0 | |||
return filter(copy(a:items), a:expr) | |||
endif | |||
let result = [] | |||
let stride = a:limit * 3 / 2 " x1.5 | |||
for i in range(0, len(a:items) - 1, stride) | |||
let result += filter(a:items[i : i + stride - 1], a:expr) | |||
if len(result) >= a:limit | |||
return remove(result, 0, a:limit - 1) | |||
endif | |||
endfor | |||
return result | |||
endfunction | |||
" Removes if a:expr is evaluated as non-zero and returns removed items. | |||
" This function change the list of argument. | |||
function l9#removeIf(items, expr) | |||
let removed = filter(copy(a:items), a:expr) | |||
call filter(a:items, '!( ' . a:expr . ')') | |||
return removed | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" NUMERIC {{{1 | |||
" }}}1 | |||
"============================================================================= | |||
" STRING {{{1 | |||
" Snips a:str and add a:mask if the length of a:str is more than a:len | |||
function l9#snipHead(str, len, mask) | |||
if a:len >= len(a:str) | |||
return a:str | |||
elseif a:len <= len(a:mask) | |||
return a:mask | |||
endif | |||
return a:mask . a:str[-a:len + len(a:mask):] | |||
endfunction | |||
" Snips a:str and add a:mask if the length of a:str is more than a:len | |||
function l9#snipTail(str, len, mask) | |||
if a:len >= len(a:str) | |||
return a:str | |||
elseif a:len <= len(a:mask) | |||
return a:mask | |||
endif | |||
return a:str[:a:len - 1 - len(a:mask)] . a:mask | |||
endfunction | |||
" Snips a:str and add a:mask if the length of a:str is more than a:len | |||
function l9#snipMid(str, len, mask) | |||
if a:len >= len(a:str) | |||
return a:str | |||
elseif a:len <= len(a:mask) | |||
return a:mask | |||
endif | |||
let len_head = (a:len - len(a:mask)) / 2 | |||
let len_tail = a:len - len(a:mask) - len_head | |||
return (len_head > 0 ? a:str[: len_head - 1] : '') . a:mask . | |||
\ (len_tail > 0 ? a:str[-len_tail :] : '') | |||
endfunction | |||
" | |||
function l9#hash224(str) | |||
let a = 0x00000800 " shift 11 bit (if unsigned) | |||
let b = 0x001fffff " extract 11 bit (if unsigned) | |||
let nHash = 7 | |||
let hashes = repeat([0], nHash) | |||
for i in range(len(a:str)) | |||
let iHash = i % nHash | |||
let hashes[iHash] = hashes[iHash] * a + hashes[iHash] / b | |||
let hashes[iHash] += char2nr(a:str[i]) | |||
endfor | |||
return join(map(hashes, 'printf("%08x", v:val)'), '') | |||
endfunction | |||
" wildcard -> regexp | |||
function l9#convertWildcardToRegexp(expr) | |||
let re = escape(a:expr, '\') | |||
for [pat, sub] in [ [ '*', '\\.\\*' ], [ '?', '\\.' ], [ '[', '\\[' ], ] | |||
let re = substitute(re, pat, sub, 'g') | |||
endfor | |||
return '\V' . re | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LINES {{{1 | |||
" Removes from the line matching with a:begin first to the line matching with | |||
" a:end next and returns removed lines. | |||
" If matching range is not found, returns [] | |||
function l9#removeLinesBetween(lines, begin, end) | |||
for i in range(len(a:lines) - 1) | |||
if a:lines[i] =~ a:begin | |||
break | |||
endif | |||
endfor | |||
for j in range(i + 1, len(a:lines) - 1) | |||
if a:lines[j] =~ a:end | |||
let g:l0 += [a:lines[i : j]] | |||
return remove(a:lines, i, j) | |||
endif | |||
endfor | |||
return [] | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" PATH {{{1 | |||
" returns the path separator charactor. | |||
function l9#getPathSeparator() | |||
return (!&shellslash && (has('win32') || has('win64')) ? '\' : '/') | |||
endfunction | |||
" [ 'a', 'b/', '/c' ] -> 'a/b/c' | |||
function l9#concatPaths(paths) | |||
let result = '' | |||
for p in a:paths | |||
if empty(p) | |||
continue | |||
elseif empty(result) | |||
let result = p | |||
else | |||
let result = substitute(result, '[/\\]$', '', '') . l9#getPathSeparator() | |||
\ . substitute(p, '^[/\\]', '', '') | |||
endif | |||
endfor | |||
return result | |||
endfunction | |||
" path: '/a/b/c/d', dir: '/a/b' => 'c/d' | |||
function l9#modifyPathRelativeToDir(path, dir) | |||
let pathFull = fnamemodify(a:path, ':p') | |||
let dirFull = fnamemodify(a:dir, ':p') | |||
if len(pathFull) < len(dirFull) || pathFull[:len(dirFull) - 1] !=# dirFull | |||
return pathFull | |||
endif | |||
return pathFull[len(dirFull):] | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" FILE {{{1 | |||
" Almost same as readfile(). | |||
function l9#readFile(...) | |||
let args = copy(a:000) | |||
let args[0] = expand(args[0]) | |||
try | |||
return call('readfile', args) | |||
catch | |||
endtry | |||
return [] | |||
endfunction | |||
" Almost same as writefile(). | |||
function l9#writeFile(...) | |||
let args = copy(a:000) | |||
let args[1] = expand(args[1]) | |||
let dir = fnamemodify(args[1], ':h') | |||
try | |||
if !isdirectory(dir) | |||
call mkdir(dir, 'p') | |||
endif | |||
return call('writefile', args) | |||
catch | |||
endtry | |||
return -1 " -1 is error code. | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" BUFFER {{{1 | |||
" :wall/:wall! wrapper. Useful for writing readonly buffers. | |||
function l9#writeAll() | |||
try | |||
silent update " NOTE: avoiding a problem with a buftype=acwrite buffer. | |||
silent wall | |||
catch /^Vim/ " E45, E505 | |||
if l9#inputHl('Question', v:exception . "\nWrite readonly files? (Y/N) : ", 'Y') ==? 'y' | |||
redraw | |||
:wall! | |||
endif | |||
endtry | |||
endfunction | |||
" Loads given files with :edit command | |||
function l9#loadFilesToBuffers(files) | |||
for file in filter(copy(a:files), '!bufloaded(v:val)') | |||
execute 'edit ' . fnameescape(file) | |||
if !exists('bufNrFirst') | |||
let bufNrFirst = bufnr('%') | |||
endif | |||
endfor | |||
if exists('bufNrFirst') | |||
execute bufNrFirst . 'buffer' | |||
endif | |||
endfunction | |||
" Deletes all buffers except given files with :bdelete command | |||
function l9#deleteAllBuffersExcept(files) | |||
let bufNrExcepts = map(copy(a:files), 'bufnr("^" . v:val . "$")') | |||
for bufNr in filter(range(1, bufnr('$')), 'bufloaded(v:val)') | |||
if count(bufNrExcepts, bufNr) == 0 | |||
execute bufNr . 'bdelete' | |||
endif | |||
endfor | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" WINDOW {{{1 | |||
" move current window to next tabpage. | |||
function l9#shiftWinNextTabpage() | |||
if tabpagenr('$') < 2 | |||
return | |||
endif | |||
let bufnr = bufnr('%') | |||
tabnext | |||
execute bufnr . 'sbuffer' | |||
tabprevious | |||
if winnr('$') > 1 | |||
close | |||
tabnext | |||
else | |||
close " if tabpage is closed, next tabpage will become current | |||
endif | |||
endfunction | |||
" move current window to previous tabpage. | |||
function l9#shiftWinPrevTabpage() | |||
if tabpagenr('$') < 2 | |||
return | |||
endif | |||
let bufnr = bufnr('%') | |||
tabprevious | |||
execute bufnr . 'sbuffer' | |||
tabnext | |||
close | |||
tabprevious | |||
endfunction | |||
" move to a window containing specified buffer. | |||
" returns 0 if the buffer is not found. | |||
function l9#moveToBufferWindowInCurrentTabpage(bufNr) | |||
if bufnr('%') == a:bufNr | |||
return 1 | |||
elseif count(tabpagebuflist(), a:bufNr) == 0 | |||
return 0 | |||
endif | |||
execute bufwinnr(a:bufNr) . 'wincmd w' | |||
return 1 | |||
endfunction | |||
" returns 0 if the buffer is not found. | |||
function s:moveToOtherTabpageOpeningBuffer(bufNr) | |||
for tabNr in range(1, tabpagenr('$')) | |||
if tabNr != tabpagenr() && count(tabpagebuflist(tabNr), a:bufNr) > 0 | |||
execute 'tabnext ' . tabNr | |||
return 1 | |||
endif | |||
endfor | |||
return 0 | |||
endfunction | |||
" move to a window containing specified buffer. | |||
" returns 0 if the buffer is not found. | |||
function l9#moveToBufferWindowInOtherTabpage(bufNr) | |||
if !s:moveToOtherTabpageOpeningBuffer(a:bufNr) | |||
return 0 | |||
endif | |||
return l9#moveToBufferWindowInCurrentTabpage(a:bufNr) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" COMMAND LINE {{{1 | |||
" echo/echomsg with highlighting. | |||
function l9#echoHl(hl, msg, prefix, addingHistory) | |||
let echoCmd = (a:addingHistory ? 'echomsg' : 'echo') | |||
execute "echohl " . a:hl | |||
try | |||
for l in (type(a:msg) == type([]) ? a:msg : split(a:msg, "\n")) | |||
execute echoCmd . ' a:prefix . l' | |||
endfor | |||
finally | |||
echohl None | |||
endtry | |||
endfunction | |||
" input() with highlighting. | |||
" This function can take list as {completion} argument. | |||
function l9#inputHl(hl, ...) | |||
execute "echohl " . a:hl | |||
try | |||
let args = copy(a:000) | |||
if len(args) > 2 && type(args[2]) == type([]) | |||
let s:candidatesForInputHl = args[2] | |||
let args[2] = 'custom,l9#completeForInputHl' | |||
endif | |||
let s = call('input', args) | |||
unlet! s:candidatesForInputHl | |||
finally | |||
echohl None | |||
endtry | |||
redraw " needed to show following echo to next line. | |||
return s | |||
endfunction | |||
" only called by l9#inputHl() for completion. | |||
function l9#completeForInputHl(lead, line, pos) | |||
return join(s:candidatesForInputHl, "\n") | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" VISUAL MODE {{{1 | |||
" returns last selected text in Visual mode. | |||
function l9#getSelectedText() | |||
let reg_ = [@", getregtype('"')] | |||
let regA = [@a, getregtype('a')] | |||
if mode() =~# "[vV\<C-v>]" | |||
silent normal! "aygv | |||
else | |||
let pos = getpos('.') | |||
silent normal! gv"ay | |||
call setpos('.', pos) | |||
endif | |||
let text = @a | |||
call setreg('"', reg_[0], reg_[1]) | |||
call setreg('a', regA[0], regA[1]) | |||
return text | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" EVAL {{{1 | |||
" loads given text as Vim script with :source command | |||
function l9#loadScript(text) | |||
let lines = (type(a:text) == type([]) ? a:text : split(a:text, "\n")) | |||
let fname = tempname() | |||
call writefile(lines, fname) | |||
source `=fname` | |||
call delete(fname) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" VARIABLES {{{1 | |||
" | |||
function l9#defineVariableDefault(name, default) | |||
if !exists(a:name) | |||
let {a:name} = a:default | |||
endif | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" GREP {{{1 | |||
" Execute :vimgrep and opens the quickfix window if matches are found. | |||
" | |||
" a:pattern: search pattern. If ommitted, last search pattern (@/) is used. | |||
" a:files: List of files | |||
function l9#grepFiles(pattern, files) | |||
let target = join(map(a:files, 'escape(v:val, " ")'), ' ') | |||
let pattern = (a:pattern[0] ==# '/' ? a:pattern[1:] : a:pattern) | |||
let pattern = (empty(pattern) ? @/ : pattern) | |||
try | |||
execute printf('vimgrep/%s/j %s', pattern, target) | |||
catch /^Vim/ | |||
call setqflist([]) | |||
endtry | |||
call l9#quickfix#sort() | |||
call l9#quickfix#openIfNotEmpty(1, 0) | |||
endfunction | |||
" Execute :vimgrep for buffers using l9#grepFiles() | |||
" See also: :L9GrepBuffer :L9GrepBufferAll | |||
function l9#grepBuffers(pattern, bufNrs) | |||
let files = map(filter(a:bufNrs, 'bufloaded(v:val)'), 'bufname(v:val)') | |||
call l9#grepFiles(a:pattern, files) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" SIGN {{{1 | |||
" Highlights lines using :sign define and :sign place. | |||
" | |||
" a:linehl, a:text, a:texthl: See |signs|. Ignored if empty string. | |||
" a:locations: List of [{buffer number}, {line number}] for highlighting | |||
function l9#placeSign(linehl, text, texthl, locations) | |||
let argLinehl = (empty(a:linehl) ? '' : 'linehl=' . a:linehl) | |||
let argText = (empty(a:text) ? '' : 'text=' . a:text) | |||
let argTexthl = (empty(a:texthl) ? '' : 'texthl=' . a:texthl) | |||
let name = 'l9--' . a:linehl . '--' . a:text . '--' . a:texthl | |||
execute printf('sign define %s linehl=%s text=%s texthl=%s', | |||
\ name, a:linehl, a:text, a:texthl) | |||
for [bufNr, lnum] in a:locations | |||
execute printf('sign place 1 line=%d name=%s buffer=%d', lnum, name, bufNr) | |||
endfor | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" NOTIFY EXTERNALLY {{{1 | |||
" Notify a message using an external program. | |||
" Currently supports Balloonly, Screen, and Tmux. | |||
function l9#notifyExternally(msg) | |||
return l9#notifyBalloonly(a:msg) | |||
\ || l9#notifyScreen(a:msg) | |||
\ || l9#notifyTmux(a:msg) | |||
endfunction | |||
" | |||
function l9#notifyBalloonly(msg) | |||
if !(has('win32') || has('win64')) || !executable(g:l9_balloonly) | |||
return 0 | |||
endif | |||
execute 'silent !start ' . shellescape(g:l9_balloonly) . ' 4000 "l9" ' . shellescape(a:msg) | |||
return 1 | |||
endfunction | |||
" | |||
function l9#notifyScreen(msg) | |||
if !has('unix') || has('gui_running') || $WINDOW !~ '\d' || !executable('screen') | |||
return 0 | |||
endif | |||
call system('screen -X wall ' . shellescape('l9: ' . a:msg)) | |||
return 1 | |||
endfunction | |||
" | |||
function l9#notifyTmux(msg) | |||
if !has('unix') || has('gui_running') || empty($TMUX) || !executable('tmux') | |||
return 0 | |||
endif | |||
call system('tmux display-message ' . shellescape('l9: ' . a:msg)) | |||
return 1 | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,92 @@ | |||
#!/usr/bin/env python | |||
from __future__ import with_statement | |||
import vim | |||
import os | |||
import subprocess | |||
import threading | |||
import Queue | |||
class Asyncer: | |||
def __init__(self): | |||
self._workers = {} | |||
def execute(self, var_key, var_command, var_cwd, var_input, var_appends): | |||
key = vim.eval(var_key) | |||
command = vim.eval(var_command) | |||
cwd = vim.eval(var_cwd) | |||
input = vim.eval(var_input) | |||
appends = vim.eval(var_appends) | |||
if key not in self._workers: | |||
self._workers[key] = Worker() | |||
self._workers[key].start() | |||
self._workers[key].put(Executor(command, cwd, input, appends)) | |||
def print_output(self, var_key): | |||
key = vim.eval(var_key) | |||
if key not in self._workers: | |||
return | |||
for l in self._workers[key].copy_outputs(): | |||
print l, | |||
def print_worker_keys(self): | |||
for k in self._workers.keys(): | |||
print k | |||
def print_active_worker_keys(self): | |||
for k in self._workers.keys(): | |||
print k | |||
class Worker(threading.Thread): | |||
def __init__(self): | |||
threading.Thread.__init__(self) | |||
self._queue = Queue.Queue() | |||
self._lines = [] | |||
self._lock = threading.Lock() | |||
def run(self): | |||
while True: | |||
self._queue.get().execute(self) | |||
self._queue.task_done() | |||
def put(self, executor): | |||
self._queue.put(executor) | |||
def clear_outputs(self): | |||
with self._lock: | |||
self._lines = [] | |||
def record_output(self, line): | |||
with self._lock: | |||
self._lines.append(line) | |||
def copy_outputs(self): | |||
with self._lock: | |||
return self._lines[:] | |||
class Executor: | |||
def __init__(self, command, cwd, input, appends): | |||
self._command = command | |||
self._cwd = cwd | |||
self._input = input | |||
self._appends = appends | |||
def execute(self, worker): | |||
if not self._appends: | |||
worker.clear_outputs() | |||
os.chdir(self._cwd) | |||
p = subprocess.Popen(self._command, shell=True, stdin=subprocess.PIPE, | |||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | |||
p.stdin.write(self._input) | |||
line = p.stdout.readline() | |||
while line: | |||
worker.record_output(line) | |||
line = p.stdout.readline() | |||
@@ -0,0 +1,67 @@ | |||
"============================================================================= | |||
" Copyright (C) 2009-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, ['has("python")']) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" ASYNC EXECUTE {{{1 | |||
" | |||
function s:checkKey(key) | |||
if a:key =~ '\n' || a:key !~ '\S' | |||
throw "Asyncer: Invalid key: " . a:key | |||
endif | |||
endfunction | |||
" | |||
function l9#async#execute(key, cmd, cwd, input, appends) | |||
call s:checkKey(a:key) | |||
python asyncer.execute('a:key', 'a:cmd', 'a:cwd', 'a:input', 'a:appends') | |||
endfunction | |||
" | |||
function l9#async#read(key) | |||
call s:checkKey(a:key) | |||
redir => result | |||
silent python asyncer.print_output('a:key') | |||
redir END | |||
" NOTE: "\n" is somehow inserted by redir. | |||
return (result[0] ==# "\n" ? result[1:] : result) | |||
endfunction | |||
" | |||
function l9#async#listWorkers() | |||
redir => result | |||
silent python asyncer.print_worker_keys() | |||
redir END | |||
return split(result, "\n") | |||
endfunction | |||
" | |||
function l9#async#listActiveWorkers() | |||
redir => result | |||
silent python asyncer.print_active_worker_keys() | |||
redir END | |||
return split(result, "\n") | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" INITIALIZATION {{{1 | |||
let s:ASYNC_PY_PATH = fnamemodify(expand('<sfile>:p:h'), ':p') . 'async.py' | |||
pyfile `=s:ASYNC_PY_PATH` | |||
python asyncer = Asyncer() | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: | |||
@@ -0,0 +1,107 @@ | |||
"============================================================================= | |||
" Copyright (C) 2009-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" QUICKFIX {{{1 | |||
" Returns non-zero if quickfix window is opened. | |||
function l9#quickfix#isWindowOpened() | |||
return count(map(range(1, winnr('$')), 'getwinvar(v:val, "&buftype")'), 'quickfix') > 0 | |||
endfunction | |||
" Opens quickfix window if quickfix is not empty, and echo the number of errors. | |||
" | |||
" a:onlyRecognized: if non-zero, opens only if quickfix has recognized errors. | |||
" a:holdCursor: if non-zero, the cursor won't move to quickfix window. | |||
function l9#quickfix#openIfNotEmpty(onlyRecognized, holdCursor) | |||
let numErrors = len(filter(getqflist(), 'v:val.valid')) | |||
let numOthers = len(getqflist()) - numErrors | |||
if numErrors > 0 || (!a:onlyRecognized && numOthers > 0) | |||
copen | |||
if a:holdCursor | |||
wincmd p | |||
endif | |||
else | |||
cclose | |||
endif | |||
redraw | |||
if numOthers > 0 | |||
echo printf('Quickfix: %d(+%d)', numErrors, numOthers) | |||
else | |||
echo printf('Quickfix: %d', numErrors) | |||
endif | |||
endfunction | |||
" Toggles Quickfix window | |||
function l9#quickfix#toggleWindow() | |||
if l9#quickfix#isWindowOpened() | |||
cclose | |||
else | |||
call l9#quickfix#openIfNotEmpty(0, 0) | |||
endif | |||
endfunction | |||
" Creates quickfix list form given lines and opens the quickfix window if | |||
" errors exists. | |||
" | |||
" a:lines: | |||
" a:jump: if non-zero, jump to the first error. | |||
function l9#quickfix#setMakeResult(lines) | |||
cexpr a:lines | |||
call l9#quickfix#openIfNotEmpty(0, 1) | |||
endfunction | |||
" Compares quickfix entries for sorting. | |||
function l9#quickfix#compareEntries(e0, e1) | |||
if a:e0.bufnr != a:e1.bufnr | |||
let i0 = bufname(a:e0.bufnr) | |||
let i1 = bufname(a:e1.bufnr) | |||
elseif a:e0.lnum != a:e1.lnum | |||
let i0 = a:e0.lnum | |||
let i1 = a:e1.lnum | |||
elseif a:e0.col != a:e1.col | |||
let i0 = a:e0.col | |||
let i1 = a:e1.col | |||
else | |||
return 0 | |||
endif | |||
return (i0 > i1 ? +1 : -1) | |||
endfunction | |||
" Sorts quickfix | |||
function l9#quickfix#sort() | |||
call setqflist(sort(getqflist(), 'l9#quickfix#compareEntries'), 'r') | |||
endfunction | |||
" Highlights Quickfix lines by :sign. | |||
" Inspired by errormarker plugin. | |||
" | |||
" You can customize the highlighting via L9ErrorLine and L9WarningLine | |||
" highlight groups. | |||
function l9#quickfix#placeSign() | |||
let warnings = [] | |||
let errors = [] | |||
for e in filter(getqflist(), 'v:val.valid') | |||
let warning = (e.type ==? 'w' || e.text =~? '^\s*warning:') | |||
call add((warning ? warnings : errors), [e.bufnr, e.lnum]) | |||
endfor | |||
sign unplace * | |||
call l9#placeSign('L9WarningLine', '>>', '', warnings) | |||
call l9#placeSign('L9ErrorLine', '>>', '', errors) | |||
endfunction | |||
highlight default L9ErrorLine ctermfg=white ctermbg=52 guibg=#5F0000 | |||
highlight default L9WarningLine ctermfg=white ctermbg=17 guibg=#00005F | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: | |||
@@ -0,0 +1,112 @@ | |||
"============================================================================= | |||
" Copyright (C) 2009-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" TEMPORARY BUFFER {{{1 | |||
" each key is a buffer name. | |||
let s:dataMap = {} | |||
" | |||
function s:onBufDelete(bufname) | |||
if exists('s:dataMap[a:bufname].listener.onClose') | |||
call s:dataMap[a:bufname].listener.onClose(s:dataMap[a:bufname].written) | |||
endif | |||
if bufnr('%') == s:dataMap[a:bufname].bufNr && winnr('#') != 0 | |||
" if winnr('#') returns 0, "wincmd p" causes ringing the bell. | |||
wincmd p | |||
endif | |||
endfunction | |||
" | |||
function s:onBufWriteCmd(bufname) | |||
if !exists('s:dataMap[a:bufname].listener.onWrite') || | |||
\ s:dataMap[a:bufname].listener.onWrite(getline(1, '$')) | |||
setlocal nomodified | |||
let s:dataMap[a:bufname].written = 1 | |||
call l9#tempbuffer#close(a:bufname) | |||
else | |||
endif | |||
endfunction | |||
" a:bufname: | |||
" a:height: Window height. If 0, default height is used. | |||
" If less than 0, the window becomes full-screen. | |||
" a:listener: | |||
" a:listener.onClose(written) | |||
function l9#tempbuffer#openScratch(bufname, filetype, lines, topleft, vertical, height, listener) | |||
let openCmdPrefix = (a:topleft ? 'topleft ' : '') | |||
\ . (a:vertical ? 'vertical ' : '') | |||
\ . (a:height > 0 ? a:height : '') | |||
if !exists('s:dataMap[a:bufname]') || !bufexists(s:dataMap[a:bufname].bufNr) | |||
execute openCmdPrefix . 'new' | |||
else | |||
call l9#tempbuffer#close(a:bufname) | |||
execute openCmdPrefix . 'split' | |||
execute 'silent ' . s:dataMap[a:bufname].bufNr . 'buffer' | |||
endif | |||
if a:height < 0 | |||
only | |||
endif | |||
setlocal buflisted noswapfile bufhidden=delete modifiable noreadonly buftype=nofile | |||
let &l:filetype = a:filetype | |||
silent file `=a:bufname` | |||
call setline(1, a:lines) | |||
setlocal nomodified | |||
augroup L9TempBuffer | |||
autocmd! * <buffer> | |||
execute printf('autocmd BufDelete <buffer> call s:onBufDelete (%s)', string(a:bufname)) | |||
execute printf('autocmd BufWriteCmd <buffer> nested call s:onBufWriteCmd(%s)', string(a:bufname)) | |||
augroup END | |||
let s:dataMap[a:bufname] = { | |||
\ 'bufNr': bufnr('%'), | |||
\ 'written': 0, | |||
\ 'listener': a:listener, | |||
\ } | |||
endfunction | |||
" | |||
function l9#tempbuffer#openReadOnly(bufname, filetype, lines, topleft, vertical, height, listener) | |||
call l9#tempbuffer#openScratch(a:bufname, a:filetype, a:lines, a:topleft, a:vertical, a:height, a:listener) | |||
setlocal nomodifiable readonly | |||
endfunction | |||
" a:listener: | |||
" a:listener.onClose(written) | |||
" a:listener.onWrite(lines) | |||
function l9#tempbuffer#openWritable(bufname, filetype, lines, topleft, vertical, height, listener) | |||
call l9#tempbuffer#openScratch(a:bufname, a:filetype, a:lines, a:topleft, a:vertical, a:height, a:listener) | |||
setlocal buftype=acwrite | |||
endfunction | |||
" makes specified temp buffer current. | |||
function l9#tempbuffer#moveTo(bufname) | |||
return l9#moveToBufferWindowInCurrentTabpage(s:dataMap[a:bufname].bufNr) || | |||
\ l9#moveToBufferWindowInOtherTabpage(s:dataMap[a:bufname].bufNr) | |||
endfunction | |||
" | |||
function l9#tempbuffer#close(bufname) | |||
if !l9#tempbuffer#isOpen(a:bufname) | |||
return | |||
endif | |||
execute printf('%dbdelete!', s:dataMap[a:bufname].bufNr) | |||
endfunction | |||
" | |||
function l9#tempbuffer#isOpen(bufname) | |||
return exists('s:dataMap[a:bufname]') && bufloaded(s:dataMap[a:bufname].bufNr) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: | |||
@@ -0,0 +1,60 @@ | |||
"============================================================================= | |||
" Copyright (C) 2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" TEMPORARY VARIABLES {{{1 | |||
" | |||
let s:origMap = {} | |||
" set temporary variables | |||
function l9#tempvariables#set(group, name, value) | |||
if !exists('s:origMap[a:group]') | |||
let s:origMap[a:group] = {} | |||
endif | |||
if !exists('s:origMap[a:group][a:name]') | |||
let s:origMap[a:group][a:name] = eval(a:name) | |||
endif | |||
execute 'let ' . a:name . ' = a:value' | |||
endfunction | |||
" set temporary variables | |||
function l9#tempvariables#setList(group, variables) | |||
for [name, value] in a:variables | |||
call l9#tempvariables#set(a:group, name, value) | |||
unlet value " to avoid E706 | |||
endfor | |||
endfunction | |||
" get temporary variables | |||
function l9#tempvariables#getList(group) | |||
if !exists('s:origMap[a:group]') | |||
return [] | |||
endif | |||
return map(keys(s:origMap[a:group]), '[v:val, eval(v:val)]') | |||
endfunction | |||
" restore original variables and clean up. | |||
function l9#tempvariables#end(group) | |||
if !exists('s:origMap[a:group]') | |||
return | |||
endif | |||
for [name, value] in items(s:origMap[a:group]) | |||
execute 'let ' . name . ' = value' | |||
unlet value " to avoid E706 | |||
endfor | |||
unlet s:origMap[a:group] | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: | |||
@@ -0,0 +1,55 @@ | |||
*l9.txt* Vimスクリプトライブラリ | |||
Copyright (c) 2009-2010 Takeshi NISHIDA | |||
l9 *l9* | |||
概要 |l9-introduction| | |||
インストール |l9-installation| | |||
使い方 |l9-usage| | |||
CHANGELOG |l9-changelog| | |||
あばうと |l9-about| | |||
============================================================================== | |||
概要 *l9-introduction* | |||
l9はVimスクリプトの関数やコマンドを提供するライブラリです。 | |||
============================================================================== | |||
インストール *l9-installation* | |||
ZIPファイルをランタイムディレクトリに展開します。 | |||
以下のようにファイルが配置されるはずです。 | |||
> | |||
<your runtime directory>/plugin/l9.vim | |||
<your runtime directory>/doc/l9.txt | |||
... | |||
< | |||
もしランタイムディレクトリが多数のプラグインでごちゃごちゃになるのが嫌なら、各 | |||
プラグインを個別のディレクトリに配置し、そのディレクトリのパスを 'runtimepath' | |||
に追加してください。アンインストールも楽になります。 | |||
その後、ヘルプを有効にするためにタグファイルを更新してください。詳しくは | |||
|add-local-help|を参照してください。 | |||
============================================================================== | |||
使い方 *l9-usage* | |||
ソースコードを参照してください。 | |||
============================================================================== | |||
あばうと *l9-about* *l9-contact* *l9-author* | |||
作者: Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com> | |||
ライセンス: MIT Licence | |||
URL: http://www.vim.org/scripts/script.php?script_id=3252 | |||
http://bitbucket.org/ns9tks/vim-l9/ | |||
バグや要望など ~ | |||
こちらへどうぞ: http://bitbucket.org/ns9tks/vim-l9/issues/ | |||
============================================================================== | |||
vim:tw=78:ts=8:ft=help:norl: |
@@ -0,0 +1,73 @@ | |||
*l9.txt* Vim-script library | |||
Copyright (c) 2009-2010 Takeshi NISHIDA | |||
l9 *l9* | |||
INTRODUCTION |l9-introduction| | |||
INSTALLATION |l9-installation| | |||
USAGE |l9-usage| | |||
CHANGELOG |l9-changelog| | |||
ABOUT |l9-about| | |||
============================================================================== | |||
INTRODUCTION *l9-introduction* | |||
l9 is a Vim-script library, which provides some utility functions and commands | |||
for programming in Vim. | |||
============================================================================== | |||
INSTALLATION *l9-installation* | |||
Put all files into your runtime directory. If you have the zip file, extract | |||
it to your runtime directory. | |||
You should place the files as follows: | |||
> | |||
<your runtime directory>/plugin/l9.vim | |||
<your runtime directory>/doc/l9.txt | |||
... | |||
< | |||
If you are disgusted to make your runtime directory confused with a lot of | |||
plugins, put each of the plugins into a directory individually and just add | |||
the directory path to 'runtimepath'. It's easy to uninstall the plugin. | |||
Then update your help tags files to enable fuzzyfinder help. See | |||
|add-local-help| for details. | |||
============================================================================== | |||
USAGE *l9-usage* | |||
See source code. | |||
============================================================================== | |||
CHANGELOG *l9-changelog* | |||
1.1: | |||
- Added l9#zip() | |||
- Added l9#tempvariables#getList() | |||
- Changed l9#guardScriptLoading() | |||
- Removed l9#tempvariables#swap() | |||
1.0.1: | |||
- Fixed a bug that floating point numbers weren't evaluated correctly and | |||
caused errors on some non-English locales. | |||
1.0: | |||
- First release. | |||
============================================================================== | |||
ABOUT *l9-about* *l9-contact* *l9-author* | |||
Author: Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com> | |||
Licence: MIT Licence | |||
URL: http://www.vim.org/scripts/script.php?script_id=3252 | |||
http://bitbucket.org/ns9tks/vim-l9/ | |||
Bugs/Issues/Suggestions/Improvements ~ | |||
Please submit to http://bitbucket.org/ns9tks/vim-l9/issues/ . | |||
============================================================================== | |||
vim:tw=78:ts=8:ft=help:norl: |
@@ -0,0 +1,9 @@ | |||
l9 l9.txt /*l9* | |||
l9-about l9.txt /*l9-about* | |||
l9-author l9.txt /*l9-author* | |||
l9-changelog l9.txt /*l9-changelog* | |||
l9-contact l9.txt /*l9-contact* | |||
l9-installation l9.txt /*l9-installation* | |||
l9-introduction l9.txt /*l9-introduction* | |||
l9-usage l9.txt /*l9-usage* | |||
l9.txt l9.txt /*l9.txt* |
@@ -0,0 +1,9 @@ | |||
!_TAG_FILE_ENCODING utf-8 // | |||
l9 l9.jax /*l9* | |||
l9-about l9.jax /*l9-about* | |||
l9-author l9.jax /*l9-author* | |||
l9-contact l9.jax /*l9-contact* | |||
l9-installation l9.jax /*l9-installation* | |||
l9-introduction l9.jax /*l9-introduction* | |||
l9-usage l9.jax /*l9-usage* | |||
l9.txt l9.jax /*l9.txt* |
@@ -0,0 +1,108 @@ | |||
"============================================================================= | |||
" Copyright (C) 2009-2010 Takeshi NISHIDA | |||
" | |||
" GetLatestVimScripts: 3252 1 :AutoInstall: L9 | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" OPTIONS: {{{1 | |||
call l9#defineVariableDefault('g:l9_balloonly', 'balloonly.exe') | |||
" }}}1 | |||
"============================================================================= | |||
" ASSERTION: {{{1 | |||
" This command has effect only if $L9_DEBUG is non-zero. | |||
" Used as follows: | |||
" L9Assert a:i > 0 | |||
" This command can't interpret script-local variables directly. | |||
" NG: L9Assert s:a == 1 | |||
" OK: execute 'L9Assert ' . s:a . ' == 1' | |||
" | |||
if $L9_DEBUG | |||
command -nargs=* L9Assert call eval((<args>) ? 0 : s:handleFailedAssersion(<q-args>)) | |||
function s:handleFailedAssersion(expr) | |||
echoerr '[L9Assert] Assersion failure: ' . a:expr | |||
if input('[L9Assert] Continue? (Y/N) ', 'Y') !=? 'Y' | |||
throw 'L9Assert ' . a:expr | |||
endif | |||
endfunction | |||
else | |||
command -nargs=* L9Assert : | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" TIMER: {{{1 | |||
" These commands have effect only if $L9_TIMER is non-zero. | |||
" Used as follows: | |||
" L9Timer foo | |||
" ... (1) | |||
" L9Timer bar | |||
" ... (2) | |||
" L9TimerStop | |||
" ... | |||
" L9TimerDump <- shows each elapsed time of (1) and (2) | |||
" | |||
if $L9_TIMER | |||
command -nargs=1 L9Timer call s:timerBegin(<q-args>) | |||
command -nargs=0 L9TimerStop call s:timerStop() | |||
command -nargs=0 L9TimerDump call s:timerDump() | |||
let s:timerData = [] | |||
let s:timerTagMaxLen = 0 | |||
function s:timerBegin(tag) | |||
L9TimerStop | |||
let s:timerCurrent = {'tag': strftime('%c ') . a:tag . ' ', 'time': reltime()} | |||
let s:timerTagMaxLen = max([len(s:timerCurrent.tag), s:timerTagMaxLen]) | |||
endfunction | |||
function s:timerStop() | |||
if !exists('s:timerCurrent') | |||
return | |||
endif | |||
let s:timerCurrent.time = reltimestr(reltime(s:timerCurrent.time)) | |||
call add(s:timerData, s:timerCurrent) | |||
unlet s:timerCurrent | |||
endfunction | |||
function s:timerDump() | |||
L9TimerStop | |||
let lines = map(s:timerData, 'v:val.tag . repeat(" ", s:timerTagMaxLen - len(v:val.tag)) . v:val.time') | |||
call l9#tempbuffer#openReadOnly('[l9-timer]', '', lines, 0, 0, 0, {}) | |||
let s:timerData = [] | |||
let s:timerTagMaxLen = 0 | |||
endfunction | |||
else | |||
command -nargs=1 L9Timer : | |||
command -nargs=0 L9TimerStop : | |||
command -nargs=0 L9TimerDump : | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GREP BUFFER: {{{1 | |||
" Grep for current buffer by l9#grepBuffers() | |||
" Used as :L9GrepBuffer/pattern | |||
command -nargs=? L9GrepBuffer call l9#grepBuffers(<q-args>, [bufnr('%')]) | |||
" Grep for all buffers by l9#grepBuffers() | |||
" Used as :L9GrepBufferAll/pattern | |||
command -nargs=? L9GrepBufferAll call l9#grepBuffers(<q-args>, range(1, bufnr('$'))) | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,457 @@ | |||
" ScrollColors.vim - Colorsheme Scroller, Chooser, and Browser | |||
" | |||
" Author and maintainer: Yakov Lerner <iler_ml@fastmail.fm> | |||
" Last Change: 2006-07-18 | |||
" | |||
" SYNOPSIS: | |||
" This is colorscheme Scroller/Chooser/Browser. | |||
" With this plugin, you walk through installed | |||
" colorschemes using arrow keys. | |||
" | |||
" SHORT USAGE DESCRIPTION: | |||
" Drop ScrollColors.vim into your plugin directory. | |||
" Type :SCROLL | |||
" Use arrow keys to walk through colorschemes, ? for help, Esc to exit. | |||
" | |||
" DETAILED DESCRIPTION: | |||
" 1. source ScrollColors.vim " or drop ScrollColors.vim into | |||
" " your ~/.vim/plugins directory | |||
" 2. Type :SCROLL | |||
" 3. Use arrows to scroll thgough colorschemes. | |||
" 4. When done, press Esc to exit. You will be prompted | |||
" wether to | |||
" | |||
" You can download 140 colorschemes pack from: | |||
" http://www.vim.org/scripts/script.php?script_id=625 | |||
" Having 140 installed colorschemes is in no way prerequisite for | |||
" ScrollColors. But with ScrollColors you can preview 140 colorschemes | |||
" in couple of minutes. | |||
" | |||
" CUSTOM KEY MAPPINGS: | |||
" You can map two keys of your choice to NextColor and PrevColor actions. | |||
" Choose pair of shortcut keys (for example <F2> and <f3>, or \n and \p) | |||
" and map them as follows: | |||
" map <silent><F3> :NEXTCOLOR<cr> | |||
" map <silent><F2> :PREVCOLOR<cr> | |||
if exists("g:scroll_colors") | finish | endif | |||
let g:scroll_colors = 1 | |||
command! COLORSCROLL :call s:ColorScroller() | |||
command! SCROLLCOLOR :call s:ColorScroller() | |||
command! NEXTCOLOR :call s:NextColorscheme() | |||
command! PREVCOLOR :call s:PrevColorscheme() | |||
" Example of convenience mappings: | |||
"map <silent><F3> :NEXTCOLOR<cr> | |||
"map <silent><F2> :PREVCOLOR<cr> | |||
"map <silent><F4> :SCROLLCOLOR<cr> | |||
function! s:ScrollerHelp() | |||
echo " " | |||
echohl Title | |||
echo "Color Scroller Help:" | |||
echo "--------------------" | |||
echohl NONE | |||
echo "Arrows - change colorscheme" | |||
echo "Esc,q,Enter - exit" | |||
echo "h,j,k,l - change colorscheme" | |||
echo "0,g - go to first colorscheme" | |||
echo "$,G - go to last colorscheme" | |||
echo "L - list colorschemes" | |||
echo "PgUp,PgDown - jump by 10 colorschemes" | |||
echo "# - go to colorscheme by index (1-N)" | |||
echo "R - refresh colorscheme list" | |||
echo "? - this help text" | |||
echohl MoreMsg | |||
echo "Press any key to continue" | |||
echohl NONE | |||
call getchar() | |||
endfu | |||
function! s:Align(s, width) | |||
if strlen(a:s) >= a:width | |||
return a:s." " | |||
else | |||
let pad=" " | |||
let res=a:s | |||
while strlen(res) < a:width | |||
let chunk = (a:width - strlen(res) > strlen(pad) ? strlen(pad) : a:width - strlen(res)) | |||
let res = res . strpart(pad,0,chunk) | |||
endw | |||
return res | |||
endif | |||
endfu | |||
function! s:ListColors() | |||
echo " " | |||
let list=s:GetColorschemesList() | |||
let width=18 | |||
let pos=0 | |||
while list != '' | |||
let str=substitute(list,"\n.*","","") | |||
let list=substitute(list,"[^\n]*\n", "", "") | |||
let aligned = s:Align(str, width) | |||
if( pos+strlen(aligned)+1 >= &columns) | |||
echo " " | |||
let pos=0 | |||
endif | |||
echon aligned | |||
let pos = pos + strlen(aligned) | |||
endw | |||
echo "Press any key to continue" | |||
call getchar() | |||
endfu | |||
function! s:CurrentColor() | |||
return exists("g:colors_name") ? g:colors_name : "" | |||
endfu | |||
function! s:SetColor(name) | |||
exe "color ".a:name | |||
" if we do not assign a:colors_name, then | |||
" bad things happen if file colors/name.vim conmtains wrong assignment inside. | |||
" Wrong assignment inside happens when file was copied but | |||
" assignment inside not fixed. | |||
" Such wrong assignment cause up erratic switches unless | |||
" we do our own assignment to g:colors_name | |||
let g:colors_name=a:name | |||
endfu | |||
function! s:JumpByIndex(list,total) | |||
let ans = input("Enter colorscheme number (1-".a:total.") : ") | |||
let index = (ans<=0? 1 : 1+(ans-1)%a:total ) | |||
let name = s:EntryByIndex(a:list, index ) | |||
call s:SetColor(name) | |||
endfu | |||
function! s:JumpByIndex2(list,total, index) | |||
let mod = (a:index <= 0? 1 : 1+(a:index-1)%a:total ) | |||
let name = s:EntryByIndex(a:list, mod ) | |||
call s:SetColor(name) | |||
endfu | |||
function! s:ExitDialog(old, action) | |||
let ans = 0 | |||
if a:old == s:CurrentColor() | |||
let ans=1 | |||
elseif a:action == '' | |||
let ans = confirm("Keep this colorscheme ?", "&Yes\n&No\n&Cancel") | |||
elseif action == 'keep' | |||
ans = 1 | |||
elseif action == 'revert' | |||
ans = 2 | |||
endif | |||
if ans == 1 || ans==0 | |||
" exit, keep colorscheme | |||
let msg = (a:old == s:CurrentColor() ? '' : "(original: '".a:old."')") | |||
call s:FinalEcho( msg ) | |||
elseif ans == 2 | |||
" exit, revert colorscheme | |||
call s:SetColor(a:old) | |||
call s:FinalEcho('original color restored') | |||
elseif ans == 3 | |||
" do not exit, continue browsing | |||
return -1 | |||
endif | |||
endfu | |||
function! s:ColorScroller() | |||
let old = s:CurrentColor() | |||
let list = s:GetColorschemesList() | |||
let total = s:CountEntries(list) | |||
let loop=0 | |||
if line("$") == 1 && getline(1) == "" && bufnr('$')==1 | |||
" if buffer is empty, open something | |||
echo "We will open sample text with syntax highlighting." | |||
echo "Watch for the guiding prompt in the bottom line." | |||
echo "When the text will open, use Arrow keys to switch colorschemes, ? for help." | |||
echo " " | |||
echo "Press any key to continue" | |||
call getchar() | |||
:e $VIMRUNTIME/syntax/abc.vim | |||
:setlocal ro | |||
syntax on | |||
redraw | |||
endif | |||
if !exists("g:syntax_on") | |||
syntax on | |||
redraw | |||
endif | |||
while 1 | |||
redraw | |||
let index = s:FindIndex(list, s:CurrentColor()) | |||
echo "[" | |||
echohl Search | |||
echon s:CurrentColor() | |||
echohl NONE | |||
if loop == 0 | |||
echon "] ColorScroller: " | |||
echohl MoreMsg | echon "Arrows" | echohl NONE | echon "-next/prev; " | |||
echohl MoreMsg | echon "Esc" | echohl NONE | echon "-exit; " | |||
echohl MoreMsg | echon "?" | echohl NONE | echon "-help > " | |||
else | |||
echon "] " | |||
echon " " . index . "/" . total . " " | |||
echon s:Align("", 12-strlen(s:CurrentColor())) | |||
echon "> ColorScroll > " | |||
echon "Arrows,Esc,? > " | |||
endif | |||
let key = getchar() | |||
let c = nr2char(key) | |||
if key == "\<Left>" || key == "\<Up>" || c ==# 'h' || c ==# 'j' | |||
call s:PrevSilent() | |||
elseif key == "\<Down>" || key == "\<Right>" || c ==# 'l' || c==# 'k' || c==# ' ' | |||
call s:NextSilent() | |||
elseif c==# 'g' || c=='0' || c=='1' | |||
call s:SetColor( s:GetFirstColors() ) | |||
elseif c=='$' || c==# 'G' | |||
call s:SetColor( s:GetLastColors() ) | |||
elseif c ==# 'L' | |||
" command 'L' list colors | |||
call s:ListColors() | |||
elseif c=='Z' || c=='z' || key == 13 || c=='q' || c=='Q' || c==':' || key == 27 | |||
if s:ExitDialog(old, '') != -1 | |||
break | |||
endif | |||
elseif key == 12 " c=="\<C-L>" | |||
redraw | |||
elseif c == '#' | |||
call s:JumpByIndex(list,total) | |||
elseif key == "\<PageDown>" | |||
call s:JumpByIndex2(list,total, (index-10>=1 ? index-10 : index-10+total)) | |||
elseif key == "\<PageUp>" | |||
call s:JumpByIndex2(list,total, index+10) | |||
elseif c == '?' | |||
call s:ScrollerHelp() | |||
elseif c == 'R' | |||
call s:RefreshColorschemesList() | |||
echo "Colorscheme list refreshed. Press any key to continue." | |||
call getchar() | |||
else | |||
call s:ScrollerHelp() | |||
endif | |||
let loop = loop + 1 | |||
endw | |||
endfu | |||
" Get 1-based index of 'entry' in \n-separated 'list' | |||
function! s:FindIndex(list,entry) | |||
" we assume entry has no special chars or we could escape() it | |||
let str = substitute("\n" . a:list . "\n", "\n" . a:entry . "\n.*$", "", "") | |||
return 1 + s:CountEntries(str) | |||
endfu | |||
" Get list element by 1-based index | |||
function! s:EntryByIndex(list,index) | |||
let k=1 | |||
let tail=a:list | |||
while tail != '' && k < a:index | |||
let tail=substitute(tail, "^[^\n]*\n", "", "") | |||
let k = k + 1 | |||
endw | |||
let tail = substitute(tail, "\n.*$", "", "") | |||
return tail | |||
endfu | |||
function! s:MakeWellFormedList(list) | |||
" make sure last \n is present | |||
let str=a:list."\n" | |||
" make sure leading \n are not present | |||
let str=substitute(str, "^\n*", "", "") | |||
" make sure entries are separated by exactly one \n | |||
let str=substitute(str, "\n\\+", "\n", "g") | |||
return str | |||
endfu | |||
function! s:CountEntries(list) | |||
let str = s:MakeWellFormedList(a:list) | |||
let str=substitute(str, "[^\n]\\+\n", ".", "g") | |||
return strlen(str) | |||
endfu | |||
function! s:RemoveDuplicates(list) | |||
let sep = "\n" | |||
let res = s:MakeWellFormedList(a:list . "\n") | |||
let beg = 0 | |||
while beg < strlen(res) | |||
let end = matchend(res, sep, beg) | |||
let str1 = strpart( res, beg, end - beg) | |||
let res = strpart(res,0,end) . substitute("\n".strpart(res,end), "\n".str1,"\n","g") | |||
let res = substitute(res, "\n\\+", "\n", "g") | |||
let beg = end | |||
endw | |||
return res | |||
endfu | |||
if v:version >= 700 | |||
" s:SortVar(): sort components of string @var separated | |||
" by delimiter @sep, and returns the sorted string. | |||
" For example, s:SortVar("c\nb\na", "\n") returns "a\nb\nc\n" | |||
function! s:SortVar(list, sep) | |||
let list = split( a:list, a:sep ) | |||
let sorted = sort(list) | |||
let result = join( sorted, "\n" ) | |||
return result . "\n" | |||
endfun | |||
endif | |||
if v:version < 700 | |||
" s:SortVar(): sort components of string @var separated | |||
" by delimiter @sep, and returns the sorted string. | |||
" For example, s:SortVar("c\nb\na", "\n") returns "a\nb\nc\n" | |||
function! s:SortVar(list, sep) | |||
let res=s:MakeWellFormedList(a:list . "\n") | |||
while 1 | |||
let disorder=0 | |||
let index1=0 | |||
let len=strlen(res) | |||
while 1 | |||
let index2=matchend(res, a:sep, index1) | |||
if index2 == -1 || index2>=len | |||
break | |||
endif | |||
let index3=matchend(res, a:sep, index2) | |||
if index3 == -1 | |||
let index3=len | |||
endif | |||
let str1=strpart(res, index1, index2-index1) | |||
let str2=strpart(res, index2, index3-index2) | |||
if str1 > str2 | |||
let disorder=1 | |||
" swap str1 and str2 in res | |||
let res=strpart(res,0,index1).str2.str1.strpart(res,index3) | |||
let index1=index1 + strlen(str2) | |||
else | |||
let index1=index1 + strlen(str1) | |||
endif | |||
endw | |||
if !disorder | |||
break | |||
endif | |||
endw | |||
return res | |||
endfu | |||
endif " v:version < 700 | |||
let s:list = "" | |||
function! s:GetColorschemesList() | |||
if s:list == "" | |||
let s:list = s:RefreshColorschemesList() | |||
endif | |||
return s:list | |||
endfunction | |||
function! s:RefreshColorschemesList() | |||
let x=globpath(&rtp, "colors/*.vim") | |||
let y=substitute(x."\n","\\(^\\|\n\\)[^\n]*[/\\\\]", "\n", "g") | |||
let z=substitute(y,"\\.vim\n", "\n", "g") | |||
let sorted = s:SortVar(z, "\n") | |||
let s:list = s:RemoveDuplicates(sorted) | |||
return s:list | |||
endfun | |||
function! s:GetFirstColors() | |||
let list=s:GetColorschemesList() | |||
let trim=substitute(list, "^\n\\+", "", "") | |||
return substitute(trim, "\n.*", "", "") | |||
endfu | |||
function! s:GetLastColors() | |||
let list=s:GetColorschemesList() | |||
let trim=substitute(list, "\n\\+$", "", "") | |||
return substitute(trim, "^.*\n", "", "") | |||
endfu | |||
function! s:FinalEcho(suffix) | |||
let list = s:GetColorschemesList() | |||
let total = s:CountEntries(list) | |||
let index = s:FindIndex(list, s:CurrentColor()) | |||
redraw | |||
echon "[" | |||
echohl Search | |||
echon s:CurrentColor() | |||
echohl NONE | |||
echon "] colorscheme #".index ." of " . total.". " | |||
echon a:suffix | |||
endfu | |||
function! s:GetNextColor(color) | |||
let list=s:GetColorschemesList() | |||
if ("\n".list) =~ ("\n".s:CurrentColor()."\n") | |||
let next=substitute("\n".list."\n", ".*\n".a:color."\n", "", "") | |||
let next = substitute(next, "\n.*", "", "") | |||
return next=='' ? s:GetFirstColors() : next | |||
else | |||
return s:GetFirstColors() | |||
endif | |||
endfu | |||
function! s:GetPrevColor(color) | |||
let list=s:GetColorschemesList() | |||
if ("\n".list) =~ ("\n".a:color."\n") | |||
let prev=substitute("\n".list."\n", "\n".a:color."\n.*", "", "") | |||
let prev=substitute(prev, "^.*\n", "", "") | |||
return prev=='' ? s:GetLastColors() : prev | |||
else | |||
return s:GetLastColors() | |||
endif | |||
endfu | |||
function! s:NextSilent() | |||
let old = s:CurrentColor() | |||
let next = s:GetNextColor(s:CurrentColor()) | |||
call s:SetColor( next ) | |||
endfu | |||
function! s:PrevSilent() | |||
let old = s:CurrentColor() | |||
let prev = s:GetPrevColor(s:CurrentColor()) | |||
call s:SetColor( prev ) | |||
endfu | |||
function! s:NextColorscheme() | |||
let old = s:CurrentColor() | |||
let next = s:GetNextColor(s:CurrentColor()) | |||
call s:SetColor( next ) | |||
redraw | |||
call s:FinalEcho('previous: '.old) | |||
endfun | |||
function! s:PrevColorscheme() | |||
let old = s:CurrentColor() | |||
let prev = s:GetPrevColor(s:CurrentColor()) | |||
call s:SetColor( prev ) | |||
redraw | |||
call s:FinalEcho('previous: '.old) | |||
endfun | |||
command! CN :call s:NextColorscheme() | |||
command! CP :call s:PrevColorscheme() | |||
map \n :CN<cr> | |||
map \p :CP<cr> | |||
map \c :echo g:colors_name<cr> | |||
" 2006-07-18 fixed bug with Align() -> s:Align() (affected L command) | |||
" 2006-07-18 added colorlist cache (s:list) | |||
" 2006-07-18 added R key to refresh colorlist | |||
" 2006-07-19 for vim7, sort using builtin sort() (bubblesort is slow) |
@@ -0,0 +1,69 @@ | |||
" BufOnly.vim - Delete all the buffers except the current/named buffer. | |||
" | |||
" Copyright November 2003 by Christian J. Robinson <infynity@onewest.net> | |||
" | |||
" Distributed under the terms of the Vim license. See ":help license". | |||
" | |||
" Usage: | |||
" | |||
" :Bonly / :BOnly / :Bufonly / :BufOnly [buffer] | |||
" | |||
" Without any arguments the current buffer is kept. With an argument the | |||
" buffer name/number supplied is kept. | |||
command! -nargs=? -complete=buffer -bang Bonly | |||
\ :call BufOnly('<args>', '<bang>') | |||
command! -nargs=? -complete=buffer -bang BOnly | |||
\ :call BufOnly('<args>', '<bang>') | |||
command! -nargs=? -complete=buffer -bang Bufonly | |||
\ :call BufOnly('<args>', '<bang>') | |||
command! -nargs=? -complete=buffer -bang BufOnly | |||
\ :call BufOnly('<args>', '<bang>') | |||
function! BufOnly(buffer, bang) | |||
if a:buffer == '' | |||
" No buffer provided, use the current buffer. | |||
let buffer = bufnr('%') | |||
elseif (a:buffer + 0) > 0 | |||
" A buffer number was provided. | |||
let buffer = bufnr(a:buffer + 0) | |||
else | |||
" A buffer name was provided. | |||
let buffer = bufnr(a:buffer) | |||
endif | |||
if buffer == -1 | |||
echohl ErrorMsg | |||
echomsg "No matching buffer for" a:buffer | |||
echohl None | |||
return | |||
endif | |||
let last_buffer = bufnr('$') | |||
let delete_count = 0 | |||
let n = 1 | |||
while n <= last_buffer | |||
if n != buffer && buflisted(n) | |||
if a:bang == '' && getbufvar(n, '&modified') | |||
echohl ErrorMsg | |||
echomsg 'No write since last change for buffer' | |||
\ n '(add ! to override)' | |||
echohl None | |||
else | |||
silent exe 'bdel' . a:bang . ' ' . n | |||
if ! buflisted(n) | |||
let delete_count = delete_count+1 | |||
endif | |||
endif | |||
endif | |||
let n = n+1 | |||
endwhile | |||
if delete_count == 1 | |||
echomsg delete_count "buffer deleted" | |||
elseif delete_count > 1 | |||
echomsg delete_count "buffers deleted" | |||
endif | |||
endfunction |
@@ -0,0 +1,764 @@ | |||
function! colorschemedegradelib#RGB() | |||
let rv = {} | |||
let rv["snow"] = "#FFFAFA" | |||
let rv["ghost_white"] = "#F8F8FF" | |||
let rv["ghostwhite"] = "#F8F8FF" | |||
let rv["white_smoke"] = "#F5F5F5" | |||
let rv["whitesmoke"] = "#F5F5F5" | |||
let rv["gainsboro"] = "#DCDCDC" | |||
let rv["floral_white"] = "#FFFAF0" | |||
let rv["floralwhite"] = "#FFFAF0" | |||
let rv["old_lace"] = "#FDF5E6" | |||
let rv["oldlace"] = "#FDF5E6" | |||
let rv["linen"] = "#FAF0E6" | |||
let rv["antique_white"] = "#FAEBD7" | |||
let rv["antiquewhite"] = "#FAEBD7" | |||
let rv["papaya_whip"] = "#FFEFD5" | |||
let rv["papayawhip"] = "#FFEFD5" | |||
let rv["blanched_almond"] = "#FFEBCD" | |||
let rv["blanchedalmond"] = "#FFEBCD" | |||
let rv["bisque"] = "#FFE4C4" | |||
let rv["peach_puff"] = "#FFDAB9" | |||
let rv["peachpuff"] = "#FFDAB9" | |||
let rv["navajo_white"] = "#FFDEAD" | |||
let rv["navajowhite"] = "#FFDEAD" | |||
let rv["moccasin"] = "#FFE4B5" | |||
let rv["cornsilk"] = "#FFF8DC" | |||
let rv["ivory"] = "#FFFFF0" | |||
let rv["lemon_chiffon"] = "#FFFACD" | |||
let rv["lemonchiffon"] = "#FFFACD" | |||
let rv["seashell"] = "#FFF5EE" | |||
let rv["honeydew"] = "#F0FFF0" | |||
let rv["mint_cream"] = "#F5FFFA" | |||
let rv["mintcream"] = "#F5FFFA" | |||
let rv["azure"] = "#F0FFFF" | |||
let rv["alice_blue"] = "#F0F8FF" | |||
let rv["aliceblue"] = "#F0F8FF" | |||
let rv["lavender"] = "#E6E6FA" | |||
let rv["lavender_blush"] = "#FFF0F5" | |||
let rv["lavenderblush"] = "#FFF0F5" | |||
let rv["misty_rose"] = "#FFE4E1" | |||
let rv["mistyrose"] = "#FFE4E1" | |||
let rv["white"] = "#FFFFFF" | |||
let rv["black"] = "#000000" | |||
let rv["dark_slate_gray"] = "#2F4F4F" | |||
let rv["darkslategray"] = "#2F4F4F" | |||
let rv["dark_slate_grey"] = "#2F4F4F" | |||
let rv["darkslategrey"] = "#2F4F4F" | |||
let rv["dim_gray"] = "#696969" | |||
let rv["dimgray"] = "#696969" | |||
let rv["dim_grey"] = "#696969" | |||
let rv["dimgrey"] = "#696969" | |||
let rv["slate_gray"] = "#708090" | |||
let rv["slategray"] = "#708090" | |||
let rv["slate_grey"] = "#708090" | |||
let rv["slategrey"] = "#708090" | |||
let rv["light_slate_gray"] = "#778899" | |||
let rv["lightslategray"] = "#778899" | |||
let rv["light_slate_grey"] = "#778899" | |||
let rv["lightslategrey"] = "#778899" | |||
let rv["gray"] = "#BEBEBE" | |||
let rv["grey"] = "#BEBEBE" | |||
let rv["light_grey"] = "#D3D3D3" | |||
let rv["lightgrey"] = "#D3D3D3" | |||
let rv["light_gray"] = "#D3D3D3" | |||
let rv["lightgray"] = "#D3D3D3" | |||
let rv["midnight_blue"] = "#191970" | |||
let rv["midnightblue"] = "#191970" | |||
let rv["navy"] = "#000080" | |||
let rv["navy_blue"] = "#000080" | |||
let rv["navyblue"] = "#000080" | |||
let rv["cornflower_blue"] = "#6495ED" | |||
let rv["cornflowerblue"] = "#6495ED" | |||
let rv["dark_slate_blue"] = "#483D8B" | |||
let rv["darkslateblue"] = "#483D8B" | |||
let rv["slate_blue"] = "#6A5ACD" | |||
let rv["slateblue"] = "#6A5ACD" | |||
let rv["medium_slate_blue"] = "#7B68EE" | |||
let rv["mediumslateblue"] = "#7B68EE" | |||
let rv["light_slate_blue"] = "#8470FF" | |||
let rv["lightslateblue"] = "#8470FF" | |||
let rv["medium_blue"] = "#0000CD" | |||
let rv["mediumblue"] = "#0000CD" | |||
let rv["royal_blue"] = "#4169E1" | |||
let rv["royalblue"] = "#4169E1" | |||
let rv["blue"] = "#0000FF" | |||
let rv["dodger_blue"] = "#1E90FF" | |||
let rv["dodgerblue"] = "#1E90FF" | |||
let rv["deep_sky_blue"] = "#00BFFF" | |||
let rv["deepskyblue"] = "#00BFFF" | |||
let rv["sky_blue"] = "#87CEEB" | |||
let rv["skyblue"] = "#87CEEB" | |||
let rv["light_sky_blue"] = "#87CEFA" | |||
let rv["lightskyblue"] = "#87CEFA" | |||
let rv["steel_blue"] = "#4682B4" | |||
let rv["steelblue"] = "#4682B4" | |||
let rv["light_steel_blue"] = "#B0C4DE" | |||
let rv["lightsteelblue"] = "#B0C4DE" | |||
let rv["light_blue"] = "#ADD8E6" | |||
let rv["lightblue"] = "#ADD8E6" | |||
let rv["powder_blue"] = "#B0E0E6" | |||
let rv["powderblue"] = "#B0E0E6" | |||
let rv["pale_turquoise"] = "#AFEEEE" | |||
let rv["paleturquoise"] = "#AFEEEE" | |||
let rv["dark_turquoise"] = "#00CED1" | |||
let rv["darkturquoise"] = "#00CED1" | |||
let rv["medium_turquoise"] = "#48D1CC" | |||
let rv["mediumturquoise"] = "#48D1CC" | |||
let rv["turquoise"] = "#40E0D0" | |||
let rv["cyan"] = "#00FFFF" | |||
let rv["light_cyan"] = "#E0FFFF" | |||
let rv["lightcyan"] = "#E0FFFF" | |||
let rv["cadet_blue"] = "#5F9EA0" | |||
let rv["cadetblue"] = "#5F9EA0" | |||
let rv["medium_aquamarine"] = "#66CDAA" | |||
let rv["mediumaquamarine"] = "#66CDAA" | |||
let rv["aquamarine"] = "#7FFFD4" | |||
let rv["dark_green"] = "#006400" | |||
let rv["darkgreen"] = "#006400" | |||
let rv["dark_olive_green"] = "#556B2F" | |||
let rv["darkolivegreen"] = "#556B2F" | |||
let rv["dark_sea_green"] = "#8FBC8F" | |||
let rv["darkseagreen"] = "#8FBC8F" | |||
let rv["sea_green"] = "#2E8B57" | |||
let rv["seagreen"] = "#2E8B57" | |||
let rv["medium_sea_green"] = "#3CB371" | |||
let rv["mediumseagreen"] = "#3CB371" | |||
let rv["light_sea_green"] = "#20B2AA" | |||
let rv["lightseagreen"] = "#20B2AA" | |||
let rv["pale_green"] = "#98FB98" | |||
let rv["palegreen"] = "#98FB98" | |||
let rv["spring_green"] = "#00FF7F" | |||
let rv["springgreen"] = "#00FF7F" | |||
let rv["lawn_green"] = "#7CFC00" | |||
let rv["lawngreen"] = "#7CFC00" | |||
let rv["green"] = "#00FF00" | |||
let rv["chartreuse"] = "#7FFF00" | |||
let rv["medium_spring_green"] = "#00FA9A" | |||
let rv["mediumspringgreen"] = "#00FA9A" | |||
let rv["green_yellow"] = "#ADFF2F" | |||
let rv["greenyellow"] = "#ADFF2F" | |||
let rv["lime_green"] = "#32CD32" | |||
let rv["limegreen"] = "#32CD32" | |||
let rv["yellow_green"] = "#9ACD32" | |||
let rv["yellowgreen"] = "#9ACD32" | |||
let rv["forest_green"] = "#228B22" | |||
let rv["forestgreen"] = "#228B22" | |||
let rv["olive_drab"] = "#6B8E23" | |||
let rv["olivedrab"] = "#6B8E23" | |||
let rv["dark_khaki"] = "#BDB76B" | |||
let rv["darkkhaki"] = "#BDB76B" | |||
let rv["khaki"] = "#F0E68C" | |||
let rv["pale_goldenrod"] = "#EEE8AA" | |||
let rv["palegoldenrod"] = "#EEE8AA" | |||
let rv["light_goldenrod_yellow"] = "#FAFAD2" | |||
let rv["lightgoldenrodyellow"] = "#FAFAD2" | |||
let rv["light_yellow"] = "#FFFFE0" | |||
let rv["lightyellow"] = "#FFFFE0" | |||
let rv["yellow"] = "#FFFF00" | |||
let rv["gold"] = "#FFD700" | |||
let rv["light_goldenrod"] = "#EEDD82" | |||
let rv["lightgoldenrod"] = "#EEDD82" | |||
let rv["goldenrod"] = "#DAA520" | |||
let rv["dark_goldenrod"] = "#B8860B" | |||
let rv["darkgoldenrod"] = "#B8860B" | |||
let rv["rosy_brown"] = "#BC8F8F" | |||
let rv["rosybrown"] = "#BC8F8F" | |||
let rv["indian_red"] = "#CD5C5C" | |||
let rv["indianred"] = "#CD5C5C" | |||
let rv["saddle_brown"] = "#8B4513" | |||
let rv["saddlebrown"] = "#8B4513" | |||
let rv["sienna"] = "#A0522D" | |||
let rv["peru"] = "#CD853F" | |||
let rv["burlywood"] = "#DEB887" | |||
let rv["beige"] = "#F5F5DC" | |||
let rv["wheat"] = "#F5DEB3" | |||
let rv["sandy_brown"] = "#F4A460" | |||
let rv["sandybrown"] = "#F4A460" | |||
let rv["tan"] = "#D2B48C" | |||
let rv["chocolate"] = "#D2691E" | |||
let rv["firebrick"] = "#B22222" | |||
let rv["brown"] = "#A52A2A" | |||
let rv["dark_salmon"] = "#E9967A" | |||
let rv["darksalmon"] = "#E9967A" | |||
let rv["salmon"] = "#FA8072" | |||
let rv["light_salmon"] = "#FFA07A" | |||
let rv["lightsalmon"] = "#FFA07A" | |||
let rv["orange"] = "#FFA500" | |||
let rv["dark_orange"] = "#FF8C00" | |||
let rv["darkorange"] = "#FF8C00" | |||
let rv["coral"] = "#FF7F50" | |||
let rv["light_coral"] = "#F08080" | |||
let rv["lightcoral"] = "#F08080" | |||
let rv["tomato"] = "#FF6347" | |||
let rv["orange_red"] = "#FF4500" | |||
let rv["orangered"] = "#FF4500" | |||
let rv["red"] = "#FF0000" | |||
let rv["hot_pink"] = "#FF69B4" | |||
let rv["hotpink"] = "#FF69B4" | |||
let rv["deep_pink"] = "#FF1493" | |||
let rv["deeppink"] = "#FF1493" | |||
let rv["pink"] = "#FFC0CB" | |||
let rv["light_pink"] = "#FFB6C1" | |||
let rv["lightpink"] = "#FFB6C1" | |||
let rv["pale_violet_red"] = "#DB7093" | |||
let rv["palevioletred"] = "#DB7093" | |||
let rv["maroon"] = "#B03060" | |||
let rv["medium_violet_red"] = "#C71585" | |||
let rv["mediumvioletred"] = "#C71585" | |||
let rv["violet_red"] = "#D02090" | |||
let rv["violetred"] = "#D02090" | |||
let rv["magenta"] = "#FF00FF" | |||
let rv["violet"] = "#EE82EE" | |||
let rv["plum"] = "#DDA0DD" | |||
let rv["orchid"] = "#DA70D6" | |||
let rv["medium_orchid"] = "#BA55D3" | |||
let rv["mediumorchid"] = "#BA55D3" | |||
let rv["dark_orchid"] = "#9932CC" | |||
let rv["darkorchid"] = "#9932CC" | |||
let rv["dark_violet"] = "#9400D3" | |||
let rv["darkviolet"] = "#9400D3" | |||
let rv["blue_violet"] = "#8A2BE2" | |||
let rv["blueviolet"] = "#8A2BE2" | |||
let rv["purple"] = "#A020F0" | |||
let rv["medium_purple"] = "#9370DB" | |||
let rv["mediumpurple"] = "#9370DB" | |||
let rv["thistle"] = "#D8BFD8" | |||
let rv["snow1"] = "#FFFAFA" | |||
let rv["snow2"] = "#EEE9E9" | |||
let rv["snow3"] = "#CDC9C9" | |||
let rv["snow4"] = "#8B8989" | |||
let rv["seashell1"] = "#FFF5EE" | |||
let rv["seashell2"] = "#EEE5DE" | |||
let rv["seashell3"] = "#CDC5BF" | |||
let rv["seashell4"] = "#8B8682" | |||
let rv["antiquewhite1"] = "#FFEFDB" | |||
let rv["antiquewhite2"] = "#EEDFCC" | |||
let rv["antiquewhite3"] = "#CDC0B0" | |||
let rv["antiquewhite4"] = "#8B8378" | |||
let rv["bisque1"] = "#FFE4C4" | |||
let rv["bisque2"] = "#EED5B7" | |||
let rv["bisque3"] = "#CDB79E" | |||
let rv["bisque4"] = "#8B7D6B" | |||
let rv["peachpuff1"] = "#FFDAB9" | |||
let rv["peachpuff2"] = "#EECBAD" | |||
let rv["peachpuff3"] = "#CDAF95" | |||
let rv["peachpuff4"] = "#8B7765" | |||
let rv["navajowhite1"] = "#FFDEAD" | |||
let rv["navajowhite2"] = "#EECFA1" | |||
let rv["navajowhite3"] = "#CDB38B" | |||
let rv["navajowhite4"] = "#8B795E" | |||
let rv["lemonchiffon1"] = "#FFFACD" | |||
let rv["lemonchiffon2"] = "#EEE9BF" | |||
let rv["lemonchiffon3"] = "#CDC9A5" | |||
let rv["lemonchiffon4"] = "#8B8970" | |||
let rv["cornsilk1"] = "#FFF8DC" | |||
let rv["cornsilk2"] = "#EEE8CD" | |||
let rv["cornsilk3"] = "#CDC8B1" | |||
let rv["cornsilk4"] = "#8B8878" | |||
let rv["ivory1"] = "#FFFFF0" | |||
let rv["ivory2"] = "#EEEEE0" | |||
let rv["ivory3"] = "#CDCDC1" | |||
let rv["ivory4"] = "#8B8B83" | |||
let rv["honeydew1"] = "#F0FFF0" | |||
let rv["honeydew2"] = "#E0EEE0" | |||
let rv["honeydew3"] = "#C1CDC1" | |||
let rv["honeydew4"] = "#838B83" | |||
let rv["lavenderblush1"] = "#FFF0F5" | |||
let rv["lavenderblush2"] = "#EEE0E5" | |||
let rv["lavenderblush3"] = "#CDC1C5" | |||
let rv["lavenderblush4"] = "#8B8386" | |||
let rv["mistyrose1"] = "#FFE4E1" | |||
let rv["mistyrose2"] = "#EED5D2" | |||
let rv["mistyrose3"] = "#CDB7B5" | |||
let rv["mistyrose4"] = "#8B7D7B" | |||
let rv["azure1"] = "#F0FFFF" | |||
let rv["azure2"] = "#E0EEEE" | |||
let rv["azure3"] = "#C1CDCD" | |||
let rv["azure4"] = "#838B8B" | |||
let rv["slateblue1"] = "#836FFF" | |||
let rv["slateblue2"] = "#7A67EE" | |||
let rv["slateblue3"] = "#6959CD" | |||
let rv["slateblue4"] = "#473C8B" | |||
let rv["royalblue1"] = "#4876FF" | |||
let rv["royalblue2"] = "#436EEE" | |||
let rv["royalblue3"] = "#3A5FCD" | |||
let rv["royalblue4"] = "#27408B" | |||
let rv["blue1"] = "#0000FF" | |||
let rv["blue2"] = "#0000EE" | |||
let rv["blue3"] = "#0000CD" | |||
let rv["blue4"] = "#00008B" | |||
let rv["dodgerblue1"] = "#1E90FF" | |||
let rv["dodgerblue2"] = "#1C86EE" | |||
let rv["dodgerblue3"] = "#1874CD" | |||
let rv["dodgerblue4"] = "#104E8B" | |||
let rv["steelblue1"] = "#63B8FF" | |||
let rv["steelblue2"] = "#5CACEE" | |||
let rv["steelblue3"] = "#4F94CD" | |||
let rv["steelblue4"] = "#36648B" | |||
let rv["deepskyblue1"] = "#00BFFF" | |||
let rv["deepskyblue2"] = "#00B2EE" | |||
let rv["deepskyblue3"] = "#009ACD" | |||
let rv["deepskyblue4"] = "#00688B" | |||
let rv["skyblue1"] = "#87CEFF" | |||
let rv["skyblue2"] = "#7EC0EE" | |||
let rv["skyblue3"] = "#6CA6CD" | |||
let rv["skyblue4"] = "#4A708B" | |||
let rv["lightskyblue1"] = "#B0E2FF" | |||
let rv["lightskyblue2"] = "#A4D3EE" | |||
let rv["lightskyblue3"] = "#8DB6CD" | |||
let rv["lightskyblue4"] = "#607B8B" | |||
let rv["slategray1"] = "#C6E2FF" | |||
let rv["slategray2"] = "#B9D3EE" | |||
let rv["slategray3"] = "#9FB6CD" | |||
let rv["slategray4"] = "#6C7B8B" | |||
let rv["lightsteelblue1"] = "#CAE1FF" | |||
let rv["lightsteelblue2"] = "#BCD2EE" | |||
let rv["lightsteelblue3"] = "#A2B5CD" | |||
let rv["lightsteelblue4"] = "#6E7B8B" | |||
let rv["lightblue1"] = "#BFEFFF" | |||
let rv["lightblue2"] = "#B2DFEE" | |||
let rv["lightblue3"] = "#9AC0CD" | |||
let rv["lightblue4"] = "#68838B" | |||
let rv["lightcyan1"] = "#E0FFFF" | |||
let rv["lightcyan2"] = "#D1EEEE" | |||
let rv["lightcyan3"] = "#B4CDCD" | |||
let rv["lightcyan4"] = "#7A8B8B" | |||
let rv["paleturquoise1"] = "#BBFFFF" | |||
let rv["paleturquoise2"] = "#AEEEEE" | |||
let rv["paleturquoise3"] = "#96CDCD" | |||
let rv["paleturquoise4"] = "#668B8B" | |||
let rv["cadetblue1"] = "#98F5FF" | |||
let rv["cadetblue2"] = "#8EE5EE" | |||
let rv["cadetblue3"] = "#7AC5CD" | |||
let rv["cadetblue4"] = "#53868B" | |||
let rv["turquoise1"] = "#00F5FF" | |||
let rv["turquoise2"] = "#00E5EE" | |||
let rv["turquoise3"] = "#00C5CD" | |||
let rv["turquoise4"] = "#00868B" | |||
let rv["cyan1"] = "#00FFFF" | |||
let rv["cyan2"] = "#00EEEE" | |||
let rv["cyan3"] = "#00CDCD" | |||
let rv["cyan4"] = "#008B8B" | |||
let rv["darkslategray1"] = "#97FFFF" | |||
let rv["darkslategray2"] = "#8DEEEE" | |||
let rv["darkslategray3"] = "#79CDCD" | |||
let rv["darkslategray4"] = "#528B8B" | |||
let rv["aquamarine1"] = "#7FFFD4" | |||
let rv["aquamarine2"] = "#76EEC6" | |||
let rv["aquamarine3"] = "#66CDAA" | |||
let rv["aquamarine4"] = "#458B74" | |||
let rv["darkseagreen1"] = "#C1FFC1" | |||
let rv["darkseagreen2"] = "#B4EEB4" | |||
let rv["darkseagreen3"] = "#9BCD9B" | |||
let rv["darkseagreen4"] = "#698B69" | |||
let rv["seagreen1"] = "#54FF9F" | |||
let rv["seagreen2"] = "#4EEE94" | |||
let rv["seagreen3"] = "#43CD80" | |||
let rv["seagreen4"] = "#2E8B57" | |||
let rv["palegreen1"] = "#9AFF9A" | |||
let rv["palegreen2"] = "#90EE90" | |||
let rv["palegreen3"] = "#7CCD7C" | |||
let rv["palegreen4"] = "#548B54" | |||
let rv["springgreen1"] = "#00FF7F" | |||
let rv["springgreen2"] = "#00EE76" | |||
let rv["springgreen3"] = "#00CD66" | |||
let rv["springgreen4"] = "#008B45" | |||
let rv["green1"] = "#00FF00" | |||
let rv["green2"] = "#00EE00" | |||
let rv["green3"] = "#00CD00" | |||
let rv["green4"] = "#008B00" | |||
let rv["chartreuse1"] = "#7FFF00" | |||
let rv["chartreuse2"] = "#76EE00" | |||
let rv["chartreuse3"] = "#66CD00" | |||
let rv["chartreuse4"] = "#458B00" | |||
let rv["olivedrab1"] = "#C0FF3E" | |||
let rv["olivedrab2"] = "#B3EE3A" | |||
let rv["olivedrab3"] = "#9ACD32" | |||
let rv["olivedrab4"] = "#698B22" | |||
let rv["darkolivegreen1"] = "#CAFF70" | |||
let rv["darkolivegreen2"] = "#BCEE68" | |||
let rv["darkolivegreen3"] = "#A2CD5A" | |||
let rv["darkolivegreen4"] = "#6E8B3D" | |||
let rv["khaki1"] = "#FFF68F" | |||
let rv["khaki2"] = "#EEE685" | |||
let rv["khaki3"] = "#CDC673" | |||
let rv["khaki4"] = "#8B864E" | |||
let rv["lightgoldenrod1"] = "#FFEC8B" | |||
let rv["lightgoldenrod2"] = "#EEDC82" | |||
let rv["lightgoldenrod3"] = "#CDBE70" | |||
let rv["lightgoldenrod4"] = "#8B814C" | |||
let rv["lightyellow1"] = "#FFFFE0" | |||
let rv["lightyellow2"] = "#EEEED1" | |||
let rv["lightyellow3"] = "#CDCDB4" | |||
let rv["lightyellow4"] = "#8B8B7A" | |||
let rv["yellow1"] = "#FFFF00" | |||
let rv["yellow2"] = "#EEEE00" | |||
let rv["yellow3"] = "#CDCD00" | |||
let rv["yellow4"] = "#8B8B00" | |||
let rv["gold1"] = "#FFD700" | |||
let rv["gold2"] = "#EEC900" | |||
let rv["gold3"] = "#CDAD00" | |||
let rv["gold4"] = "#8B7500" | |||
let rv["goldenrod1"] = "#FFC125" | |||
let rv["goldenrod2"] = "#EEB422" | |||
let rv["goldenrod3"] = "#CD9B1D" | |||
let rv["goldenrod4"] = "#8B6914" | |||
let rv["darkgoldenrod1"] = "#FFB90F" | |||
let rv["darkgoldenrod2"] = "#EEAD0E" | |||
let rv["darkgoldenrod3"] = "#CD950C" | |||
let rv["darkgoldenrod4"] = "#8B6508" | |||
let rv["rosybrown1"] = "#FFC1C1" | |||
let rv["rosybrown2"] = "#EEB4B4" | |||
let rv["rosybrown3"] = "#CD9B9B" | |||
let rv["rosybrown4"] = "#8B6969" | |||
let rv["indianred1"] = "#FF6A6A" | |||
let rv["indianred2"] = "#EE6363" | |||
let rv["indianred3"] = "#CD5555" | |||
let rv["indianred4"] = "#8B3A3A" | |||
let rv["sienna1"] = "#FF8247" | |||
let rv["sienna2"] = "#EE7942" | |||
let rv["sienna3"] = "#CD6839" | |||
let rv["sienna4"] = "#8B4726" | |||
let rv["burlywood1"] = "#FFD39B" | |||
let rv["burlywood2"] = "#EEC591" | |||
let rv["burlywood3"] = "#CDAA7D" | |||
let rv["burlywood4"] = "#8B7355" | |||
let rv["wheat1"] = "#FFE7BA" | |||
let rv["wheat2"] = "#EED8AE" | |||
let rv["wheat3"] = "#CDBA96" | |||
let rv["wheat4"] = "#8B7E66" | |||
let rv["tan1"] = "#FFA54F" | |||
let rv["tan2"] = "#EE9A49" | |||
let rv["tan3"] = "#CD853F" | |||
let rv["tan4"] = "#8B5A2B" | |||
let rv["chocolate1"] = "#FF7F24" | |||
let rv["chocolate2"] = "#EE7621" | |||
let rv["chocolate3"] = "#CD661D" | |||
let rv["chocolate4"] = "#8B4513" | |||
let rv["firebrick1"] = "#FF3030" | |||
let rv["firebrick2"] = "#EE2C2C" | |||
let rv["firebrick3"] = "#CD2626" | |||
let rv["firebrick4"] = "#8B1A1A" | |||
let rv["brown1"] = "#FF4040" | |||
let rv["brown2"] = "#EE3B3B" | |||
let rv["brown3"] = "#CD3333" | |||
let rv["brown4"] = "#8B2323" | |||
let rv["salmon1"] = "#FF8C69" | |||
let rv["salmon2"] = "#EE8262" | |||
let rv["salmon3"] = "#CD7054" | |||
let rv["salmon4"] = "#8B4C39" | |||
let rv["lightsalmon1"] = "#FFA07A" | |||
let rv["lightsalmon2"] = "#EE9572" | |||
let rv["lightsalmon3"] = "#CD8162" | |||
let rv["lightsalmon4"] = "#8B5742" | |||
let rv["orange1"] = "#FFA500" | |||
let rv["orange2"] = "#EE9A00" | |||
let rv["orange3"] = "#CD8500" | |||
let rv["orange4"] = "#8B5A00" | |||
let rv["darkorange1"] = "#FF7F00" | |||
let rv["darkorange2"] = "#EE7600" | |||
let rv["darkorange3"] = "#CD6600" | |||
let rv["darkorange4"] = "#8B4500" | |||
let rv["coral1"] = "#FF7256" | |||
let rv["coral2"] = "#EE6A50" | |||
let rv["coral3"] = "#CD5B45" | |||
let rv["coral4"] = "#8B3E2F" | |||
let rv["tomato1"] = "#FF6347" | |||
let rv["tomato2"] = "#EE5C42" | |||
let rv["tomato3"] = "#CD4F39" | |||
let rv["tomato4"] = "#8B3626" | |||
let rv["orangered1"] = "#FF4500" | |||
let rv["orangered2"] = "#EE4000" | |||
let rv["orangered3"] = "#CD3700" | |||
let rv["orangered4"] = "#8B2500" | |||
let rv["red1"] = "#FF0000" | |||
let rv["red2"] = "#EE0000" | |||
let rv["red3"] = "#CD0000" | |||
let rv["red4"] = "#8B0000" | |||
let rv["deeppink1"] = "#FF1493" | |||
let rv["deeppink2"] = "#EE1289" | |||
let rv["deeppink3"] = "#CD1076" | |||
let rv["deeppink4"] = "#8B0A50" | |||
let rv["hotpink1"] = "#FF6EB4" | |||
let rv["hotpink2"] = "#EE6AA7" | |||
let rv["hotpink3"] = "#CD6090" | |||
let rv["hotpink4"] = "#8B3A62" | |||
let rv["pink1"] = "#FFB5C5" | |||
let rv["pink2"] = "#EEA9B8" | |||
let rv["pink3"] = "#CD919E" | |||
let rv["pink4"] = "#8B636C" | |||
let rv["lightpink1"] = "#FFAEB9" | |||
let rv["lightpink2"] = "#EEA2AD" | |||
let rv["lightpink3"] = "#CD8C95" | |||
let rv["lightpink4"] = "#8B5F65" | |||
let rv["palevioletred1"] = "#FF82AB" | |||
let rv["palevioletred2"] = "#EE799F" | |||
let rv["palevioletred3"] = "#CD6889" | |||
let rv["palevioletred4"] = "#8B475D" | |||
let rv["maroon1"] = "#FF34B3" | |||
let rv["maroon2"] = "#EE30A7" | |||
let rv["maroon3"] = "#CD2990" | |||
let rv["maroon4"] = "#8B1C62" | |||
let rv["violetred1"] = "#FF3E96" | |||
let rv["violetred2"] = "#EE3A8C" | |||
let rv["violetred3"] = "#CD3278" | |||
let rv["violetred4"] = "#8B2252" | |||
let rv["magenta1"] = "#FF00FF" | |||
let rv["magenta2"] = "#EE00EE" | |||
let rv["magenta3"] = "#CD00CD" | |||
let rv["magenta4"] = "#8B008B" | |||
let rv["orchid1"] = "#FF83FA" | |||
let rv["orchid2"] = "#EE7AE9" | |||
let rv["orchid3"] = "#CD69C9" | |||
let rv["orchid4"] = "#8B4789" | |||
let rv["plum1"] = "#FFBBFF" | |||
let rv["plum2"] = "#EEAEEE" | |||
let rv["plum3"] = "#CD96CD" | |||
let rv["plum4"] = "#8B668B" | |||
let rv["mediumorchid1"] = "#E066FF" | |||
let rv["mediumorchid2"] = "#D15FEE" | |||
let rv["mediumorchid3"] = "#B452CD" | |||
let rv["mediumorchid4"] = "#7A378B" | |||
let rv["darkorchid1"] = "#BF3EFF" | |||
let rv["darkorchid2"] = "#B23AEE" | |||
let rv["darkorchid3"] = "#9A32CD" | |||
let rv["darkorchid4"] = "#68228B" | |||
let rv["purple1"] = "#9B30FF" | |||
let rv["purple2"] = "#912CEE" | |||
let rv["purple3"] = "#7D26CD" | |||
let rv["purple4"] = "#551A8B" | |||
let rv["mediumpurple1"] = "#AB82FF" | |||
let rv["mediumpurple2"] = "#9F79EE" | |||
let rv["mediumpurple3"] = "#8968CD" | |||
let rv["mediumpurple4"] = "#5D478B" | |||
let rv["thistle1"] = "#FFE1FF" | |||
let rv["thistle2"] = "#EED2EE" | |||
let rv["thistle3"] = "#CDB5CD" | |||
let rv["thistle4"] = "#8B7B8B" | |||
let rv["gray0"] = "#000000" | |||
let rv["grey0"] = "#000000" | |||
let rv["gray1"] = "#030303" | |||
let rv["grey1"] = "#030303" | |||
let rv["gray2"] = "#050505" | |||
let rv["grey2"] = "#050505" | |||
let rv["gray3"] = "#080808" | |||
let rv["grey3"] = "#080808" | |||
let rv["gray4"] = "#0A0A0A" | |||
let rv["grey4"] = "#0A0A0A" | |||
let rv["gray5"] = "#0D0D0D" | |||
let rv["grey5"] = "#0D0D0D" | |||
let rv["gray6"] = "#0F0F0F" | |||
let rv["grey6"] = "#0F0F0F" | |||
let rv["gray7"] = "#121212" | |||
let rv["grey7"] = "#121212" | |||
let rv["gray8"] = "#141414" | |||
let rv["grey8"] = "#141414" | |||
let rv["gray9"] = "#171717" | |||
let rv["grey9"] = "#171717" | |||
let rv["gray10"] = "#1A1A1A" | |||
let rv["grey10"] = "#1A1A1A" | |||
let rv["gray11"] = "#1C1C1C" | |||
let rv["grey11"] = "#1C1C1C" | |||
let rv["gray12"] = "#1F1F1F" | |||
let rv["grey12"] = "#1F1F1F" | |||
let rv["gray13"] = "#212121" | |||
let rv["grey13"] = "#212121" | |||
let rv["gray14"] = "#242424" | |||
let rv["grey14"] = "#242424" | |||
let rv["gray15"] = "#262626" | |||
let rv["grey15"] = "#262626" | |||
let rv["gray16"] = "#292929" | |||
let rv["grey16"] = "#292929" | |||
let rv["gray17"] = "#2B2B2B" | |||
let rv["grey17"] = "#2B2B2B" | |||
let rv["gray18"] = "#2E2E2E" | |||
let rv["grey18"] = "#2E2E2E" | |||
let rv["gray19"] = "#303030" | |||
let rv["grey19"] = "#303030" | |||
let rv["gray20"] = "#333333" | |||
let rv["grey20"] = "#333333" | |||
let rv["gray21"] = "#363636" | |||
let rv["grey21"] = "#363636" | |||
let rv["gray22"] = "#383838" | |||
let rv["grey22"] = "#383838" | |||
let rv["gray23"] = "#3B3B3B" | |||
let rv["grey23"] = "#3B3B3B" | |||
let rv["gray24"] = "#3D3D3D" | |||
let rv["grey24"] = "#3D3D3D" | |||
let rv["gray25"] = "#404040" | |||
let rv["grey25"] = "#404040" | |||
let rv["gray26"] = "#424242" | |||
let rv["grey26"] = "#424242" | |||
let rv["gray27"] = "#454545" | |||
let rv["grey27"] = "#454545" | |||
let rv["gray28"] = "#474747" | |||
let rv["grey28"] = "#474747" | |||
let rv["gray29"] = "#4A4A4A" | |||
let rv["grey29"] = "#4A4A4A" | |||
let rv["gray30"] = "#4D4D4D" | |||
let rv["grey30"] = "#4D4D4D" | |||
let rv["gray31"] = "#4F4F4F" | |||
let rv["grey31"] = "#4F4F4F" | |||
let rv["gray32"] = "#525252" | |||
let rv["grey32"] = "#525252" | |||
let rv["gray33"] = "#545454" | |||
let rv["grey33"] = "#545454" | |||
let rv["gray34"] = "#575757" | |||
let rv["grey34"] = "#575757" | |||
let rv["gray35"] = "#595959" | |||
let rv["grey35"] = "#595959" | |||
let rv["gray36"] = "#5C5C5C" | |||
let rv["grey36"] = "#5C5C5C" | |||
let rv["gray37"] = "#5E5E5E" | |||
let rv["grey37"] = "#5E5E5E" | |||
let rv["gray38"] = "#616161" | |||
let rv["grey38"] = "#616161" | |||
let rv["gray39"] = "#636363" | |||
let rv["grey39"] = "#636363" | |||
let rv["gray40"] = "#666666" | |||
let rv["grey40"] = "#666666" | |||
let rv["gray41"] = "#696969" | |||
let rv["grey41"] = "#696969" | |||
let rv["gray42"] = "#6B6B6B" | |||
let rv["grey42"] = "#6B6B6B" | |||
let rv["gray43"] = "#6E6E6E" | |||
let rv["grey43"] = "#6E6E6E" | |||
let rv["gray44"] = "#707070" | |||
let rv["grey44"] = "#707070" | |||
let rv["gray45"] = "#737373" | |||
let rv["grey45"] = "#737373" | |||
let rv["gray46"] = "#757575" | |||
let rv["grey46"] = "#757575" | |||
let rv["gray47"] = "#787878" | |||
let rv["grey47"] = "#787878" | |||
let rv["gray48"] = "#7A7A7A" | |||
let rv["grey48"] = "#7A7A7A" | |||
let rv["gray49"] = "#7D7D7D" | |||
let rv["grey49"] = "#7D7D7D" | |||
let rv["gray50"] = "#7F7F7F" | |||
let rv["grey50"] = "#7F7F7F" | |||
let rv["gray51"] = "#828282" | |||
let rv["grey51"] = "#828282" | |||
let rv["gray52"] = "#858585" | |||
let rv["grey52"] = "#858585" | |||
let rv["gray53"] = "#878787" | |||
let rv["grey53"] = "#878787" | |||
let rv["gray54"] = "#8A8A8A" | |||
let rv["grey54"] = "#8A8A8A" | |||
let rv["gray55"] = "#8C8C8C" | |||
let rv["grey55"] = "#8C8C8C" | |||
let rv["gray56"] = "#8F8F8F" | |||
let rv["grey56"] = "#8F8F8F" | |||
let rv["gray57"] = "#919191" | |||
let rv["grey57"] = "#919191" | |||
let rv["gray58"] = "#949494" | |||
let rv["grey58"] = "#949494" | |||
let rv["gray59"] = "#969696" | |||
let rv["grey59"] = "#969696" | |||
let rv["gray60"] = "#999999" | |||
let rv["grey60"] = "#999999" | |||
let rv["gray61"] = "#9C9C9C" | |||
let rv["grey61"] = "#9C9C9C" | |||
let rv["gray62"] = "#9E9E9E" | |||
let rv["grey62"] = "#9E9E9E" | |||
let rv["gray63"] = "#A1A1A1" | |||
let rv["grey63"] = "#A1A1A1" | |||
let rv["gray64"] = "#A3A3A3" | |||
let rv["grey64"] = "#A3A3A3" | |||
let rv["gray65"] = "#A6A6A6" | |||
let rv["grey65"] = "#A6A6A6" | |||
let rv["gray66"] = "#A8A8A8" | |||
let rv["grey66"] = "#A8A8A8" | |||
let rv["gray67"] = "#ABABAB" | |||
let rv["grey67"] = "#ABABAB" | |||
let rv["gray68"] = "#ADADAD" | |||
let rv["grey68"] = "#ADADAD" | |||
let rv["gray69"] = "#B0B0B0" | |||
let rv["grey69"] = "#B0B0B0" | |||
let rv["gray70"] = "#B3B3B3" | |||
let rv["grey70"] = "#B3B3B3" | |||
let rv["gray71"] = "#B5B5B5" | |||
let rv["grey71"] = "#B5B5B5" | |||
let rv["gray72"] = "#B8B8B8" | |||
let rv["grey72"] = "#B8B8B8" | |||
let rv["gray73"] = "#BABABA" | |||
let rv["grey73"] = "#BABABA" | |||
let rv["gray74"] = "#BDBDBD" | |||
let rv["grey74"] = "#BDBDBD" | |||
let rv["gray75"] = "#BFBFBF" | |||
let rv["grey75"] = "#BFBFBF" | |||
let rv["gray76"] = "#C2C2C2" | |||
let rv["grey76"] = "#C2C2C2" | |||
let rv["gray77"] = "#C4C4C4" | |||
let rv["grey77"] = "#C4C4C4" | |||
let rv["gray78"] = "#C7C7C7" | |||
let rv["grey78"] = "#C7C7C7" | |||
let rv["gray79"] = "#C9C9C9" | |||
let rv["grey79"] = "#C9C9C9" | |||
let rv["gray80"] = "#CCCCCC" | |||
let rv["grey80"] = "#CCCCCC" | |||
let rv["gray81"] = "#CFCFCF" | |||
let rv["grey81"] = "#CFCFCF" | |||
let rv["gray82"] = "#D1D1D1" | |||
let rv["grey82"] = "#D1D1D1" | |||
let rv["gray83"] = "#D4D4D4" | |||
let rv["grey83"] = "#D4D4D4" | |||
let rv["gray84"] = "#D6D6D6" | |||
let rv["grey84"] = "#D6D6D6" | |||
let rv["gray85"] = "#D9D9D9" | |||
let rv["grey85"] = "#D9D9D9" | |||
let rv["gray86"] = "#DBDBDB" | |||
let rv["grey86"] = "#DBDBDB" | |||
let rv["gray87"] = "#DEDEDE" | |||
let rv["grey87"] = "#DEDEDE" | |||
let rv["gray88"] = "#E0E0E0" | |||
let rv["grey88"] = "#E0E0E0" | |||
let rv["gray89"] = "#E3E3E3" | |||
let rv["grey89"] = "#E3E3E3" | |||
let rv["gray90"] = "#E5E5E5" | |||
let rv["grey90"] = "#E5E5E5" | |||
let rv["gray91"] = "#E8E8E8" | |||
let rv["grey91"] = "#E8E8E8" | |||
let rv["gray92"] = "#EBEBEB" | |||
let rv["grey92"] = "#EBEBEB" | |||
let rv["gray93"] = "#EDEDED" | |||
let rv["grey93"] = "#EDEDED" | |||
let rv["gray94"] = "#F0F0F0" | |||
let rv["grey94"] = "#F0F0F0" | |||
let rv["gray95"] = "#F2F2F2" | |||
let rv["grey95"] = "#F2F2F2" | |||
let rv["gray96"] = "#F5F5F5" | |||
let rv["grey96"] = "#F5F5F5" | |||
let rv["gray97"] = "#F7F7F7" | |||
let rv["grey97"] = "#F7F7F7" | |||
let rv["gray98"] = "#FAFAFA" | |||
let rv["grey98"] = "#FAFAFA" | |||
let rv["gray99"] = "#FCFCFC" | |||
let rv["grey99"] = "#FCFCFC" | |||
let rv["gray100"] = "#FFFFFF" | |||
let rv["grey100"] = "#FFFFFF" | |||
let rv["dark_grey"] = "#A9A9A9" | |||
let rv["darkgrey"] = "#A9A9A9" | |||
let rv["dark_gray"] = "#A9A9A9" | |||
let rv["darkgray"] = "#A9A9A9" | |||
let rv["dark_blue"] = "#00008B" | |||
let rv["darkblue"] = "#00008B" | |||
let rv["dark_cyan"] = "#008B8B" | |||
let rv["darkcyan"] = "#008B8B" | |||
let rv["dark_magenta"] = "#8B008B" | |||
let rv["darkmagenta"] = "#8B008B" | |||
let rv["dark_red"] = "#8B0000" | |||
let rv["darkred"] = "#8B0000" | |||
let rv["light_green"] = "#90EE90" | |||
let rv["lightgreen"] = "#90EE90" | |||
let rv["darkyellow"] = "#BBBB00" | |||
let rv["dark_yellow"] = "#BBBB00" | |||
let rv["lightred"] = "#FFA0A0" | |||
let rv["light_red"] = "#FFA0A0" | |||
let rv["lightmagenta"] = "#F0A0F0" | |||
let rv["light_magenta"] = "#F0A0F0" | |||
return rv | |||
endfunction |
@@ -0,0 +1,416 @@ | |||
" ColorschemeDegrade: Degrade gvim colorschemes to be suitable for a terminal | |||
" Maintainer: Matthew Wozniski (mjw@drexel.edu) | |||
" Date: Sun, 21 Oct 2007 21:04:33 -0400 | |||
" Version: 0.2 | |||
" History: TODO(History Link) | |||
" Installation: Drop this script into ~/.vim/plugin. | |||
" Whenever you change colorschemes using the :colorscheme command, this script | |||
" will be executed. If you're running in 256 color terminal or an 88 color | |||
" terminal, as reported by the command ":echo &t_Co" it will take the colors | |||
" that the scheme specified for use in the gui and use an approximation | |||
" algorithm to try to gracefully degrade them to the closest color available. | |||
" If you are running in a gui or if t_Co is reported as less than 88 colors, | |||
" no changes are made. | |||
" Abort if running in vi-compatible mode or the user doesn't want or need us. | |||
if &cp || has("gui_running") || ! has("gui") || exists('g:colorschemedegrade_loaded') | |||
if &cp && &verbose | |||
echomsg "Not loading ColorschemeDegrade in compatible mode." | |||
endif | |||
if has('gui_running') && &verbose | |||
echomsg "Not loading ColorschemeDegrade in gui mode." | |||
endif | |||
if ! has('gui') && &verbose | |||
echomsg "Unfortunately, ColorschemeDegrade needs gui support. Not loading." | |||
endif | |||
finish | |||
endif | |||
" A local copy of rgb.txt must be included, since I can't count on it being in | |||
" a standard location. But, we won't load it unless we need it. | |||
let s:rgb = {} | |||
let g:colorschemedegrade_loaded = 1 | |||
let s:savecpo = &cpo | |||
set cpo&vim | |||
" Script-local variables {{{1 | |||
" Script-local variables defining the rgb vals on a 256-color cube {{{2 | |||
" Every possible 256-color cube color is made up of 3 rgb values, all out of | |||
" this table. | |||
let s:vals_greys_256 = [ 0, 8, 18, 28, 38, | |||
\ 48, 58, 68, 78, 88, | |||
\ 95, 98, 108, 118, 128, | |||
\ 135, 138, 148, 158, 168, | |||
\ 175, 178, 188, 198, 208, | |||
\ 215, 218, 228, 238, 255 ] | |||
" Many of those colors can only be used for a grey (r == g == b). This subset | |||
" can be mix-and-matched. | |||
let s:vals_color_256 = [ 0, 95, 135, 175, 215, 255 ] | |||
" This table holds the midpoints between each of the possible grey values, as | |||
" well as one extra element higher than all, to be used in the approximation | |||
" algorithm. | |||
let s:mids_greys_256 = [ 4, 13, 23, 33, 43, | |||
\ 53, 63, 73, 83, 91, | |||
\ 96, 103, 113, 123, 131, | |||
\ 136, 143, 153, 163, 171, | |||
\ 176, 183, 193, 203, 211, | |||
\ 216, 223, 233, 246, 256 ] | |||
" This table is the same, only for the non-grey midpoints. | |||
let s:mids_color_256 = [ 48, 115, 155, 195, 235, 256 ] | |||
" Script-local variables defining the rgb vals on a 88-color cube {{{2 | |||
" Every possible 88-color cube color is made up of 3 rgb values, all out of | |||
" this table. | |||
let s:vals_greys_88 = [ 0, 46, 92, 115, 139, 162, | |||
\ 185, 205, 208, 231, 255 ] | |||
" Many of those colors can only be used for a grey (r == g == b). This subset | |||
" can be mix-and-matched. | |||
let s:vals_color_88 = [ 0, 139, 205, 255 ] | |||
" This table holds the midpoints between each of the possible grey values, as | |||
" well as one extra element higher than all, to be used in the approximation | |||
" algorithm. | |||
let s:mids_greys_88 = [ 23, 69, 103, 127, 150, 173, | |||
\ 195, 206, 219, 243, 256 ] | |||
" This table is the same, only for the non-grey midpoints. | |||
let s:mids_color_88 = [ 69, 172, 230, 256 ] | |||
" Function definitions {{{1 | |||
" Given 3 hex strings rr, gg, bb, return the closest color cube number. | |||
function! s:FindClosestCode(h1,h2,h3) | |||
let d1 = str2nr(a:h1, 16) | |||
let d2 = str2nr(a:h2, 16) | |||
let d3 = str2nr(a:h3, 16) | |||
let r = s:FindClosest(d1, s:vals_greys_{&t_Co}, s:mids_greys_{&t_Co}) | |||
let g = s:FindClosest(d2, s:vals_greys_{&t_Co}, s:mids_greys_{&t_Co}) | |||
let b = s:FindClosest(d3, s:vals_greys_{&t_Co}, s:mids_greys_{&t_Co}) | |||
if(r == g && g == b) | |||
return s:GreyComponentTo{&t_Co}Cube(r) | |||
else | |||
let r = s:FindClosest(d1, s:vals_color_{&t_Co}, s:mids_color_{&t_Co}) | |||
let g = s:FindClosest(d2, s:vals_color_{&t_Co}, s:mids_color_{&t_Co}) | |||
let b = s:FindClosest(d3, s:vals_color_{&t_Co}, s:mids_color_{&t_Co}) | |||
return s:RGBComponentsTo{&t_Co}Cube(r, g, b) | |||
endif | |||
endfunction | |||
" Given a number, an array of elements, and an array of midpts, find the index | |||
" of the least midpt that the number is strictly less than, and return the | |||
" corresponding element. | |||
function! s:FindClosest(num, elems, midpts) | |||
for i in range(len(a:elems)) | |||
if ( a:num < a:midpts[i] ) | |||
return a:elems[i] | |||
endif | |||
endfor | |||
endfunction | |||
" Expects a decimal value 'x' between 0 and 255, inclusive | |||
" Returns a 256-color colorcube number for the color at RGB=x,x,x | |||
function! s:GreyComponentTo256Cube(num) | |||
if(a:num % 10 == 8) | |||
return 232 + (a:num - 8) / 10 | |||
else | |||
" Not in the greyscale ramp, so we can use our normal processing | |||
return s:RGBComponentsTo256Cube(a:num, a:num, a:num) | |||
endif | |||
endfunction | |||
" Expects a decimal value 'x' between 0 and 255, inclusive | |||
" Returns an 88-color colorcube number for the color at RGB=x,x,x | |||
function! s:GreyComponentTo88Cube(num) | |||
if a:num == 46 | |||
return 80 | |||
elseif a:num == 92 | |||
return 81 | |||
elseif a:num == 115 | |||
return 82 | |||
elseif a:num == 139 | |||
return 83 | |||
elseif a:num == 162 | |||
return 84 | |||
elseif a:num == 185 | |||
return 85 | |||
elseif a:num == 208 | |||
return 86 | |||
elseif a:num == 231 | |||
return 87 | |||
else | |||
" Not in the greyscale ramp, so we can use our normal processing | |||
return s:RGBComponentsTo88Cube(a:num, a:num, a:num) | |||
endif | |||
endfunction | |||
" Expects 3 decimal values 'r', 'g', and 'b', each between 0 and 255 inclusive. | |||
" Returns a 256-color colorcube number for the color at RGB=r,g,b. | |||
" Will not use the greyscale ramp. | |||
function! s:RGBComponentsTo256Cube(r,g,b) | |||
let rc = index(s:vals_color_256, a:r) | |||
let gc = index(s:vals_color_256, a:g) | |||
let bc = index(s:vals_color_256, a:b) | |||
return (rc * 36 + gc * 6 + bc + 16) | |||
endfunction | |||
" Expects 3 decimal values 'r', 'g', and 'b', each between 0 and 255 inclusive. | |||
" Returns a 88-color colorcube number for the color at RGB=r,g,b. | |||
" Will not use the greyscale ramp. | |||
function! s:RGBComponentsTo88Cube(r,g,b) | |||
let rc = index(s:vals_color_88, a:r) | |||
let gc = index(s:vals_color_88, a:g) | |||
let bc = index(s:vals_color_88, a:b) | |||
return (rc * 16 + gc * 4 + bc + 16) | |||
endfunction | |||
" Check if the provided value is found in "g:colorschemedegrade_ignore", which | |||
" may either be a list or a comma or space separated string. If the variable | |||
" "g:colorschemedegrade_ignore" is not present, the default is "bold italic" | |||
function! s:ignoring(attr) | |||
if !exists("g:colorschemedegrade_ignore") | |||
let ignore = [ 'bold', 'italic' ] | |||
elseif type(g:colorschemedegrade_ignore) == type("") | |||
let ignore = split(g:colorschemedegrade_ignore, '[ ,]') | |||
elseif type(g:colorschemedegrade_ignore) == type([]) | |||
let ignore = g:colorschemedegrade_ignore | |||
else | |||
return 0 | |||
endif | |||
return index(ignore, a:attr) != -1 | |||
endfunction | |||
" Sets some settings, calls s:ColorschemeDegradeImpl to handle actually | |||
" degrading the colorscheme, then restores the settings. This wrapper | |||
" should make sure that we don't accidentally recurse, and that settings are | |||
" restored properly even if something throws. | |||
function! s:ColorschemeDegrade() | |||
if g:colors_name =~ ".*-rgb" | |||
return | |||
endif | |||
let saveei = &ei | |||
set ei+=ColorScheme | |||
if exists("g:colors_name") | |||
let colors_name = g:colors_name | |||
unlet g:colors_name | |||
endif | |||
let savelz = &lz | |||
set lz | |||
let rv = -1 | |||
try | |||
let rv = s:ColorschemeDegradeImpl() | |||
catch | |||
let ex = v:exception | |||
endtry | |||
let &lz = savelz | |||
if exists("colors_name") | |||
let g:colors_name = colors_name | |||
endif | |||
let &ei = saveei | |||
if exists("ex") | |||
echoerr 'ColorschemeDegrade failed: ' . substitute(ex, '.\{-}:', '', '') | |||
endif | |||
return rv | |||
endfunction | |||
" For every highlight group, sets the cterm values to the best approximation | |||
" of the gui values possible given the value of &t_Co. | |||
function! s:ColorschemeDegradeImpl() | |||
if has('gui_running') || (&t_Co != 256 && &t_Co != 88) | |||
return | |||
endif | |||
let g:highlights = "" | |||
redir => g:highlights | |||
" Normal must be set 1st for ctermfg=bg, etc, and resetting it doesn't hurt | |||
silent highlight Normal | |||
silent highlight | |||
redir END | |||
let hilines = split(g:highlights, '\n') | |||
" hilines[0] is Normal. If that doesn't use gui colors, we should probably | |||
" just give up. That way we don't muck up an already 256/88 color scheme. | |||
if hilines[0] !~ 'gui[fb]g' | |||
if &verbose | |||
echomsg "Not degrading colorscheme; doesn't set Normal group gui colors" | |||
endif | |||
return | |||
endif | |||
call filter(hilines, 'v:val !~ "links to" && v:val !~ "cleared"') | |||
let i = 0 | |||
let end = len(hilines) | |||
while i < end | |||
let line = hilines[i] | |||
let i += 1 | |||
while i < end && hilines[i] !~ '\<xxx\>' | |||
let line .= hilines[i] | |||
let i += 1 | |||
endwhile | |||
let line = substitute(line, '\<st\(art\|op\)=.\{-}\S\@!', '', 'g') | |||
let line = substitute(line, '\<c\=term.\{-}=.\{-}\S\@!', '', 'g') | |||
let line = substitute(line, '\<xxx\>', '', '') | |||
let line = substitute(line, '\<gui', 'cterm', 'g') | |||
let line = substitute(line, '\s\+', ' ', 'g') | |||
let items = split(line, '\%(\s\zecterm\|font\)\|=') | |||
let higrp = items[0] | |||
if len(items) % 2 != 1 | |||
echoerr "I cannot understand the highlight group " | |||
\ . string(items) . ' at line ' . hilines[i] | |||
endif | |||
" Start clean | |||
exe 'hi ' . higrp . ' term=NONE cterm=NONE ctermbg=NONE ctermfg=NONE' | |||
for j in range((len(items)-1)/2) | |||
" TODO Can we handle 16 color terminals? Probably, if we're in an xterm. | |||
let var = items[2*j+1] | |||
let val = items[2*j+2] | |||
if var == 'ctermsp' | |||
if exists('g:colorschemedegrade_sp_is_bg') && g:colorschemedegrade_sp_is_bg | |||
let var = 'ctermbg' | |||
else | |||
let var = 'ctermfg' | |||
endif | |||
endif | |||
if var == 'cterm' | |||
if s:ignoring('bold') | |||
let val = substitute(val, 'bold', '', '') | |||
endif | |||
if s:ignoring('underline') | |||
let val = substitute(val, 'underline', '', '') | |||
endif | |||
if s:ignoring('undercurl') | |||
let val = substitute(val, 'undercurl', '', '') | |||
endif | |||
if s:ignoring('reverse') || s:ignoring('inverse') | |||
let val = substitute(val, '\%(re\|in\)verse', '', '') | |||
endif | |||
if s:ignoring('italic') | |||
let val = substitute(val, 'italic', '', '') | |||
endif | |||
if s:ignoring('standout') | |||
let val = substitute(val, 'standout', '', '') | |||
endif | |||
let val = substitute(val, '\(^,*\|,*$\)', '', '') | |||
let val = substitute(val, ',\+', ',', 'g') | |||
let val = substitute(val, '^,*$', 'NONE', '') | |||
exe 'hi ' . higrp . ' ' . var . '=' . val | |||
elseif var =~ 'cterm[fb]g' | |||
if val =~ '[FBfb]g' | |||
let val = tolower(val) | |||
if var =~ val | |||
let val = "NONE" | |||
endif | |||
"echomsg 'higrp=' . higrp . ' var=' . var . ' val=' . val | |||
exe 'hi ' . higrp . ' ' . var . '=' . val | |||
continue | |||
elseif val !~ '^#' | |||
try | |||
" We do need our cooked rgb.txt | |||
if s:rgb == {} | |||
let s:rgb = colorschemedegradelib#RGB() | |||
endif | |||
let val = s:rgb[tolower(substitute(val, ' ', '_', 'g'))] | |||
catch | |||
echomsg "Cannot translate color \"" . val . "\"" | |||
continue | |||
endtry | |||
endif | |||
if v:termresponse =~ '>8[35];' | |||
\ && exists('g:colorschemedegrade_changecube') | |||
\ && g:colorschemedegrade_changecube | |||
if !exists("s:lastcubepos") | |||
let s:lastcubepos="15" | |||
let s:colors = {} | |||
endif | |||
let tisave = &t_ti | |||
let tesave = &t_te | |||
set t_ti= t_te= | |||
if has_key(s:colors, tolower(val)) | |||
let nr = s:colors[tolower(val)] | |||
else | |||
let s:lastcubepos = s:lastcubepos + 1 | |||
if s:lastcubepos >= &t_Co | |||
let s:lastcubepos = 16 | |||
endif | |||
let nr = s:lastcubepos | |||
let s:colors[tolower(val)] = nr | |||
if $STY == "" | |||
exe 'sil !echo -n -e "\\033]4;' . nr . ';\' . val . '\\a"' | |||
else | |||
exe 'sil !echo -n -e "\\033P\\033]4;' . nr . ';\' . val . '\\a\\033\\\\"' | |||
endif | |||
endif | |||
let &t_ti = tisave | |||
let &t_te = tesave | |||
exe 'hi' higrp var.'='.nr | |||
else | |||
let r = val[1] . val[2] | |||
let g = val[3] . val[4] | |||
let b = val[5] . val[6] | |||
exe 'hi ' . higrp . ' ' . var . '=' . s:FindClosestCode(r, g, b) | |||
endif | |||
endif | |||
endfor | |||
endwhile | |||
if exists("s:lastcubepos") | |||
unlet s:lastcubepos | |||
endif | |||
endfunction | |||
augroup ColorSchemeDegrade | |||
au! | |||
au ColorScheme * call s:ColorschemeDegrade() | |||
augroup END | |||
autocmd TermResponse * if exists("g:colors_name") | |||
\ | exe "colorscheme" g:colors_name | |||
\ | call s:ColorschemeDegrade() | |||
\ | endif | |||
if exists("g:colors_name") | |||
" Don't do anything unless :colorscheme has already been called | |||
call s:ColorschemeDegrade() | |||
endif | |||
let &cpo = s:savecpo | |||
unlet s:savecpo | |||
" vim:set sw=2 sts=2 fdm=marker: |
@@ -0,0 +1,105 @@ | |||
*fontzoom.txt* The fontsize controller in gVim. | |||
Version: 0.1.1 | |||
Modified: thinca <thinca+vim@gmail.com> | |||
License: Creative Commons Attribution 2.1 Japan License | |||
<http://creativecommons.org/licenses/by/2.1/jp/deed.en> | |||
============================================================================== | |||
CONTENTS *fontzoom-contents* | |||
INTRODUCTION |fontzoom-introduction| | |||
INTERFACE |fontzoom-interface| | |||
KEY MAPPINGS |fontzoom-key-mappings| | |||
COMMANDS |fontzoom-commands| | |||
SETTINGS |fontzoom-settings| | |||
LIMITATION |fontzoom-limitation| | |||
CHANGELOG |fontzoom-changelog| | |||
============================================================================== | |||
INTRODUCTION *fontzoom-introduction* | |||
*fontzoom* is a Vim plugin to control gui fontsize. You can change fontsize | |||
with + and - keys(when default setting). You can also use the [count]. | |||
This plugin remember 'guifont', 'lines', and 'columns' when you change | |||
fontsize first. And tries to keep the size of the window as much as possible. | |||
============================================================================== | |||
INTERFACE *fontzoom-interface* | |||
------------------------------------------------------------------------------ | |||
KEY MAPPINGS *fontzoom-key-mappings* | |||
<Plug>(fontzoom-learger) *<Plug>(fontzoom-learger)* | |||
Fontsize is made large [count] point. | |||
<Plug>(fontzoom-smaller) *<Plug>(fontzoom-smaller)* | |||
Fontsize is made small [count] point. | |||
*g:fontzoom_no_default_key_mappings* | |||
The following key mappings will be also available unless | |||
g:fontzoom_no_default_key_mappings is defined: | |||
{lhs} {rhs} | |||
-------- ----------------------------- | |||
+ <Plug>(fontzoom-larger) | |||
- <Plug>(fontzoom-smaller) | |||
<C-ScrollWheelUp> <Plug>(fontzoom-larger) | |||
<C-ScrollWheelDown> <Plug>(fontzoom-smaller) | |||
------------------------------------------------------------------------------ | |||
COMMANDS *fontzoom-commands* | |||
:Fontzoom *:Fontzoom* | |||
Show fontsize in current. | |||
:Fontzoom +[N] | |||
Fontsize is made large [N] point. | |||
:Fontzoom -[N] | |||
Fontsize is made small [N] point. | |||
:Fontzoom [N] | |||
Fontsize is changed into [N] points. | |||
:Fontzoom! | |||
Fontsize is changed into initial size. All arguments | |||
are ignored. | |||
============================================================================== | |||
SETTINGS *fontzoom-settings* | |||
g:fontzoom_pattern *g:fontzoom_pattern* | |||
Pick out the Fontsize from font name. The pattern | |||
must match to the Fontsize. |/\zs| and |/\ze| are | |||
convenient. | |||
============================================================================== | |||
LIMITATION *fontzoom-limitation* | |||
- 'guifont' should contain fontsize that matches to |g:fontzoom_pattern|. | |||
============================================================================== | |||
CHANGELOG *fontzoom-changelog* | |||
0.1.1 2011-02-24 | |||
- Added default key mappings. | |||
- <C-ScrollWheelUp> and <C-ScrollWheelDown>. | |||
0.1.0 2009-12-25 | |||
- Initial version. | |||
============================================================================== | |||
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl |
@@ -0,0 +1,15 @@ | |||
:Fontzoom fontzoom.txt /*:Fontzoom* | |||
<Plug>(fontzoom-learger) fontzoom.txt /*<Plug>(fontzoom-learger)* | |||
<Plug>(fontzoom-smaller) fontzoom.txt /*<Plug>(fontzoom-smaller)* | |||
fontzoom fontzoom.txt /*fontzoom* | |||
fontzoom-changelog fontzoom.txt /*fontzoom-changelog* | |||
fontzoom-commands fontzoom.txt /*fontzoom-commands* | |||
fontzoom-contents fontzoom.txt /*fontzoom-contents* | |||
fontzoom-interface fontzoom.txt /*fontzoom-interface* | |||
fontzoom-introduction fontzoom.txt /*fontzoom-introduction* | |||
fontzoom-key-mappings fontzoom.txt /*fontzoom-key-mappings* | |||
fontzoom-limitation fontzoom.txt /*fontzoom-limitation* | |||
fontzoom-settings fontzoom.txt /*fontzoom-settings* | |||
fontzoom.txt fontzoom.txt /*fontzoom.txt* | |||
g:fontzoom_no_default_key_mappings fontzoom.txt /*g:fontzoom_no_default_key_mappings* | |||
g:fontzoom_pattern fontzoom.txt /*g:fontzoom_pattern* |
@@ -0,0 +1,75 @@ | |||
" The fontsize controller in gVim. | |||
" Version: 0.1.1 | |||
" Author : thinca <thinca+vim@gmail.com> | |||
" License: Creative Commons Attribution 2.1 Japan License | |||
" <http://creativecommons.org/licenses/by/2.1/jp/deed.en> | |||
if exists('g:loaded_fontzoom') || !has('gui_running') | |||
finish | |||
endif | |||
let g:loaded_fontzoom = 1 | |||
let s:save_cpo = &cpo | |||
set cpo&vim | |||
function! s:fontzoom(size, reset) | |||
if a:reset | |||
if exists('s:keep') " Reset font size. | |||
let [&guifont, &lines, &columns] = s:keep | |||
unlet! s:keep | |||
endif | |||
elseif a:size == '' | |||
echo matchstr(&guifont, g:fontzoom_pattern) | |||
else | |||
let size = (a:size =~ '^[+-]' ? 'submatch(0)' : '') . a:size | |||
if !exists('s:keep') | |||
let s:keep = [&guifont, &lines, &columns] | |||
endif | |||
let &guifont = join(map(split(&guifont, '\\\@<!,'), | |||
\ printf('substitute(v:val, %s, %s, "g")', | |||
\ string(g:fontzoom_pattern), | |||
\ string('\=max([1,' . size . '])'))), ',') | |||
" Keep window size if possible. | |||
let [&lines, &columns] = s:keep[1:] | |||
endif | |||
endfunction | |||
if !exists('g:fontzoom_pattern') | |||
" TODO: X11 is not tested because I do not have the environment. | |||
let g:fontzoom_pattern = | |||
\ has('win32') || has('win64') || | |||
\ has('mac') || has('macunix') ? ':h\zs\d\+': | |||
\ has('gui_gtk') ? '\s\+\zs\d\+$': | |||
\ has('X11') ? '\v%([^-]*-){6}\zs\d+\ze%(-[^-]*){7}': | |||
\ '*Unknown system*' | |||
endif | |||
" Commands. | |||
command! -narg=? -bang -bar Fontzoom call s:fontzoom(<q-args>, <bang>0) | |||
" Key mappings. | |||
nnoremap <silent> <Plug>(fontzoom-larger) | |||
\ :<C-u>Fontzoom +<C-r>=v:count1<CR><CR> | |||
nnoremap <silent> <Plug>(fontzoom-smaller) | |||
\ :<C-u>Fontzoom -<C-r>=v:count1<CR><CR> | |||
inoremap <silent> <Plug>(fontzoom-larger) | |||
\ <C-O>:<C-u>Fontzoom +<C-r>=v:count1<CR><CR> | |||
inoremap <silent> <Plug>(fontzoom-smaller) | |||
\ <C-O>:<C-u>Fontzoom -<C-r>=v:count1<CR><CR> | |||
if !exists('g:fontzoom_no_default_key_mappings') | |||
\ || !g:fontzoom_no_default_key_mappings | |||
silent! nmap <unique> <silent> + <Plug>(fontzoom-larger) | |||
silent! nmap <unique> <silent> - <Plug>(fontzoom-smaller) | |||
silent! nmap <unique> <silent> <C-ScrollWheelUp> <Plug>(fontzoom-larger) | |||
silent! nmap <unique> <silent> <C-ScrollWheelDown> <Plug>(fontzoom-smaller) | |||
silent! imap <unique> <silent> <C-ScrollWheelUp> <Plug>(fontzoom-larger) | |||
silent! imap <unique> <silent> <C-ScrollWheelDown> <Plug>(fontzoom-smaller) | |||
endif | |||
let &cpo = s:save_cpo | |||
unlet s:save_cpo |
@@ -0,0 +1,163 @@ | |||
"============================================================================= | |||
" Copyright (c) 2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#bookmarkdir#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#bookmarkdir#getSwitchOrder() | |||
return g:fuf_bookmarkdir_switchOrder | |||
endfunction | |||
" | |||
function fuf#bookmarkdir#getEditableDataNames() | |||
return ['items'] | |||
endfunction | |||
" | |||
function fuf#bookmarkdir#renewCache() | |||
endfunction | |||
" | |||
function fuf#bookmarkdir#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#bookmarkdir#onInit() | |||
call fuf#defineLaunchCommand('FufBookmarkDir', s:MODE_NAME, '""', []) | |||
command! -bang -narg=? FufBookmarkDirAdd call s:bookmark(<q-args>) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
let s:OPEN_TYPE_DELETE = -1 | |||
" | |||
function s:bookmark(word) | |||
let item = { | |||
\ 'time' : localtime(), | |||
\ } | |||
let item.path = l9#inputHl('Question', '[fuf] Directory to bookmark:', | |||
\ fnamemodify(getcwd(), ':p:~'), 'dir') | |||
if item.path !~ '\S' | |||
call fuf#echoWarning('Canceled') | |||
return | |||
endif | |||
let item.word = l9#inputHl('Question', '[fuf] Bookmark as:', | |||
\ fnamemodify(getcwd(), ':p:~')) | |||
if item.word !~ '\S' | |||
call fuf#echoWarning('Canceled') | |||
return | |||
endif | |||
let items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
call insert(items, item) | |||
call fuf#saveDataFile(s:MODE_NAME, 'items', items) | |||
endfunction | |||
" | |||
function s:findItem(items, word) | |||
for item in a:items | |||
if item.word ==# a:word | |||
return item | |||
endif | |||
endfor | |||
return {} | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_bookmarkdir_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return 0 | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return [] | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
if a:mode ==# s:OPEN_TYPE_DELETE | |||
let items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
call filter(items, 'v:val.word !=# a:word') | |||
call fuf#saveDataFile(s:MODE_NAME, 'items', items) | |||
let self.reservedMode = self.getModeName() | |||
return | |||
else | |||
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word) | |||
if !empty(item) | |||
execute ':cd ' . fnameescape(item.path) | |||
endif | |||
endif | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
call fuf#defineKeyMappingInHandler(g:fuf_bookmarkdir_keyDelete, | |||
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')') | |||
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))') | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,199 @@ | |||
"============================================================================= | |||
" Copyright (c) 2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#bookmarkfile#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#bookmarkfile#getSwitchOrder() | |||
return g:fuf_bookmarkfile_switchOrder | |||
endfunction | |||
" | |||
function fuf#bookmarkfile#getEditableDataNames() | |||
return ['items'] | |||
endfunction | |||
" | |||
function fuf#bookmarkfile#renewCache() | |||
endfunction | |||
" | |||
function fuf#bookmarkfile#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#bookmarkfile#onInit() | |||
call fuf#defineLaunchCommand('FufBookmarkFile', s:MODE_NAME, '""', []) | |||
command! -bang -narg=? FufBookmarkFileAdd call s:bookmarkHere(<q-args>) | |||
command! -bang -narg=0 -range FufBookmarkFileAddAsSelectedText call s:bookmarkHere(l9#getSelectedText()) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
let s:OPEN_TYPE_DELETE = -1 | |||
" opens a:path and jumps to the line matching to a:pattern from a:lnum within | |||
" a:range. if not found, jumps to a:lnum. | |||
function s:jumpToBookmark(path, mode, pattern, lnum) | |||
call fuf#openFile(a:path, a:mode, g:fuf_reuseWindow) | |||
call cursor(s:getMatchingLineNumber(getline(1, '$'), a:pattern, a:lnum), 0) | |||
normal! zvzz | |||
endfunction | |||
" | |||
function s:getMatchingLineNumber(lines, pattern, lnumBegin) | |||
let l = min([a:lnumBegin, len(a:lines)]) | |||
for [l0, l1] in map(range(0, g:fuf_bookmarkfile_searchRange), | |||
\ '[l + v:val, l - v:val]') | |||
if l0 <= len(a:lines) && a:lines[l0 - 1] =~# a:pattern | |||
return l0 | |||
elseif l1 >= 0 && a:lines[l1 - 1] =~# a:pattern | |||
return l1 | |||
endif | |||
endfor | |||
return l | |||
endfunction | |||
" | |||
function s:getLinePattern(lnum) | |||
return '\C\V\^' . escape(getline(a:lnum), '\') . '\$' | |||
endfunction | |||
" | |||
function s:bookmarkHere(word) | |||
if !empty(&buftype) || expand('%') !~ '\S' | |||
call fuf#echoWarning('Can''t bookmark this buffer.') | |||
return | |||
endif | |||
let item = { | |||
\ 'word' : (a:word =~# '\S' ? substitute(a:word, '\n', ' ', 'g') | |||
\ : pathshorten(expand('%:p:~')) . '|' . line('.') . '| ' . getline('.')), | |||
\ 'path' : expand('%:p'), | |||
\ 'lnum' : line('.'), | |||
\ 'pattern' : s:getLinePattern(line('.')), | |||
\ 'time' : localtime(), | |||
\ } | |||
let item.word = l9#inputHl('Question', '[fuf] Bookmark as:', item.word) | |||
if item.word !~ '\S' | |||
call fuf#echoWarning('Canceled') | |||
return | |||
endif | |||
let items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
call insert(items, item) | |||
call fuf#saveDataFile(s:MODE_NAME, 'items', items) | |||
endfunction | |||
" | |||
function s:findItem(items, word) | |||
for item in a:items | |||
if item.word ==# a:word | |||
return item | |||
endif | |||
endfor | |||
return {} | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_bookmarkfile_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word) | |||
let lines = fuf#getFileLines(item.path) | |||
if empty(lines) | |||
return [] | |||
endif | |||
let index = s:getMatchingLineNumber(lines, item.pattern, item.lnum) - 1 | |||
return fuf#makePreviewLinesAround( | |||
\ lines, [index], a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
if a:mode ==# s:OPEN_TYPE_DELETE | |||
let items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
call filter(items, 'v:val.word !=# a:word') | |||
call fuf#saveDataFile(s:MODE_NAME, 'items', items) | |||
let self.reservedMode = self.getModeName() | |||
return | |||
else | |||
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word) | |||
if !empty(item) | |||
call s:jumpToBookmark(item.path, a:mode, item.pattern, item.lnum) | |||
endif | |||
endif | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
call fuf#defineKeyMappingInHandler(g:fuf_bookmarkfile_keyDelete, | |||
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')') | |||
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))') | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,189 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#buffer#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#buffer#getSwitchOrder() | |||
return g:fuf_buffer_switchOrder | |||
endfunction | |||
" | |||
function fuf#buffer#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#buffer#renewCache() | |||
endfunction | |||
" | |||
function fuf#buffer#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#buffer#onInit() | |||
call fuf#defineLaunchCommand('FufBuffer', s:MODE_NAME, '""', []) | |||
augroup fuf#buffer | |||
autocmd! | |||
autocmd BufEnter * call s:updateBufTimes() | |||
autocmd BufWritePost * call s:updateBufTimes() | |||
augroup END | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
let s:OPEN_TYPE_DELETE = -1 | |||
let s:bufTimes = {} | |||
" | |||
function s:updateBufTimes() | |||
let s:bufTimes[bufnr('%')] = localtime() | |||
endfunction | |||
" | |||
function s:makeItem(nr) | |||
let fname = (empty(bufname(a:nr)) | |||
\ ? '[No Name]' | |||
\ : fnamemodify(bufname(a:nr), ':p:~:.')) | |||
let time = (exists('s:bufTimes[a:nr]') ? s:bufTimes[a:nr] : 0) | |||
let item = fuf#makePathItem(fname, strftime(g:fuf_timeFormat, time), 0) | |||
let item.index = a:nr | |||
let item.bufNr = a:nr | |||
let item.time = time | |||
let item.abbrPrefix = s:getBufIndicator(a:nr) . ' ' | |||
return item | |||
endfunction | |||
" | |||
function s:getBufIndicator(bufNr) | |||
if !getbufvar(a:bufNr, '&modifiable') | |||
return '[-]' | |||
elseif getbufvar(a:bufNr, '&modified') | |||
return '[+]' | |||
elseif getbufvar(a:bufNr, '&readonly') | |||
return '[R]' | |||
else | |||
return ' ' | |||
endif | |||
endfunction | |||
" | |||
function s:compareTimeDescending(i1, i2) | |||
return a:i1.time == a:i2.time ? 0 : a:i1.time > a:i2.time ? -1 : +1 | |||
endfunction | |||
" | |||
function s:findItem(items, word) | |||
for item in a:items | |||
if item.word ==# a:word | |||
return item | |||
endif | |||
endfor | |||
return {} | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_buffer_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
let item = s:findItem(self.items, a:word) | |||
if empty(item) | |||
return [] | |||
endif | |||
return fuf#makePreviewLinesForFile(item.bufNr, a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
" not use bufnr(a:word) in order to handle unnamed buffer | |||
let item = s:findItem(self.items, a:word) | |||
if empty(item) | |||
" do nothing | |||
elseif a:mode ==# s:OPEN_TYPE_DELETE | |||
execute item.bufNr . 'bdelete' | |||
let self.reservedMode = self.getModeName() | |||
else | |||
call fuf#openBuffer(item.bufNr, a:mode, g:fuf_reuseWindow) | |||
endif | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
call fuf#defineKeyMappingInHandler(g:fuf_buffer_keyDelete, | |||
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')') | |||
let self.items = range(1, bufnr('$')) | |||
call filter(self.items, 'buflisted(v:val) && v:val != self.bufNrPrev && v:val != bufnr("%")') | |||
call map(self.items, 's:makeItem(v:val)') | |||
if g:fuf_buffer_mruOrder | |||
call sort(self.items, 's:compareTimeDescending') | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
endif | |||
let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items) | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,300 @@ | |||
"============================================================================= | |||
" Copyright (c) 2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#buffertag#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#buffertag#getSwitchOrder() | |||
return g:fuf_buffertag_switchOrder | |||
endfunction | |||
" | |||
function fuf#buffertag#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#buffertag#renewCache() | |||
let s:tagItemsCache = {} | |||
let s:tagDataCache = {} | |||
endfunction | |||
" | |||
function fuf#buffertag#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#buffertag#onInit() | |||
call fuf#defineLaunchCommand('FufBufferTag', s:MODE_NAME, '""', | |||
\ [['g:fuf_buffertag_forAll', 0]]) | |||
call fuf#defineLaunchCommand('FufBufferTagAll', s:MODE_NAME, '""', | |||
\ [['g:fuf_buffertag_forAll', 1]]) | |||
call fuf#defineLaunchCommand('FufBufferTagWithCursorWord', s:MODE_NAME, | |||
\ 'expand(''<cword>'')', [['g:fuf_buffertag_forAll', 0]]) | |||
call fuf#defineLaunchCommand('FufBufferTagAllWithCursorWord', s:MODE_NAME, | |||
\ 'expand(''<cword>'')', [['g:fuf_buffertag_forAll', 1]]) | |||
call fuf#defineLaunchCommand('FufBufferTagWithSelectedText', s:MODE_NAME, | |||
\ 'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 0]]) | |||
call fuf#defineLaunchCommand('FufBufferTagAllWithSelectedText', s:MODE_NAME, | |||
\ 'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 1]]) | |||
call l9#defineVariableDefault('g:fuf_buffertag_forAll', 0) " private option | |||
" the following settings originate from taglist.vim | |||
call l9#defineVariableDefault('g:fuf_buffertag__asm' , '--language-force=asm --asm-types=dlmt') | |||
call l9#defineVariableDefault('g:fuf_buffertag__aspperl' , '--language-force=asp --asp-types=fsv') | |||
call l9#defineVariableDefault('g:fuf_buffertag__aspvbs' , '--language-force=asp --asp-types=fsv') | |||
call l9#defineVariableDefault('g:fuf_buffertag__awk' , '--language-force=awk --awk-types=f') | |||
call l9#defineVariableDefault('g:fuf_buffertag__beta' , '--language-force=beta --beta-types=fsv') | |||
call l9#defineVariableDefault('g:fuf_buffertag__c' , '--language-force=c --c-types=dgsutvf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__cpp' , '--language-force=c++ --c++-types=nvdtcgsuf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__cs' , '--language-force=c# --c#-types=dtncEgsipm') | |||
call l9#defineVariableDefault('g:fuf_buffertag__cobol' , '--language-force=cobol --cobol-types=dfgpPs') | |||
call l9#defineVariableDefault('g:fuf_buffertag__eiffel' , '--language-force=eiffel --eiffel-types=cf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__erlang' , '--language-force=erlang --erlang-types=drmf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__expect' , '--language-force=tcl --tcl-types=cfp') | |||
call l9#defineVariableDefault('g:fuf_buffertag__fortran' , '--language-force=fortran --fortran-types=pbceiklmntvfs') | |||
call l9#defineVariableDefault('g:fuf_buffertag__html' , '--language-force=html --html-types=af') | |||
call l9#defineVariableDefault('g:fuf_buffertag__java' , '--language-force=java --java-types=pcifm') | |||
call l9#defineVariableDefault('g:fuf_buffertag__javascript', '--language-force=javascript --javascript-types=f') | |||
call l9#defineVariableDefault('g:fuf_buffertag__lisp' , '--language-force=lisp --lisp-types=f') | |||
call l9#defineVariableDefault('g:fuf_buffertag__lua' , '--language-force=lua --lua-types=f') | |||
call l9#defineVariableDefault('g:fuf_buffertag__make' , '--language-force=make --make-types=m') | |||
call l9#defineVariableDefault('g:fuf_buffertag__pascal' , '--language-force=pascal --pascal-types=fp') | |||
call l9#defineVariableDefault('g:fuf_buffertag__perl' , '--language-force=perl --perl-types=clps') | |||
call l9#defineVariableDefault('g:fuf_buffertag__php' , '--language-force=php --php-types=cdvf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__python' , '--language-force=python --python-types=cmf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__rexx' , '--language-force=rexx --rexx-types=s') | |||
call l9#defineVariableDefault('g:fuf_buffertag__ruby' , '--language-force=ruby --ruby-types=cfFm') | |||
call l9#defineVariableDefault('g:fuf_buffertag__scheme' , '--language-force=scheme --scheme-types=sf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__sh' , '--language-force=sh --sh-types=f') | |||
call l9#defineVariableDefault('g:fuf_buffertag__csh' , '--language-force=sh --sh-types=f') | |||
call l9#defineVariableDefault('g:fuf_buffertag__zsh' , '--language-force=sh --sh-types=f') | |||
call l9#defineVariableDefault('g:fuf_buffertag__slang' , '--language-force=slang --slang-types=nf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__sml' , '--language-force=sml --sml-types=ecsrtvf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__sql' , '--language-force=sql --sql-types=cFPrstTvfp') | |||
call l9#defineVariableDefault('g:fuf_buffertag__tcl' , '--language-force=tcl --tcl-types=cfmp') | |||
call l9#defineVariableDefault('g:fuf_buffertag__vera' , '--language-force=vera --vera-types=cdefgmpPtTvx') | |||
call l9#defineVariableDefault('g:fuf_buffertag__verilog' , '--language-force=verilog --verilog-types=mcPertwpvf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__vim' , '--language-force=vim --vim-types=avf') | |||
call l9#defineVariableDefault('g:fuf_buffertag__yacc' , '--language-force=yacc --yacc-types=l') | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:parseTagLine(line) | |||
" tag W:\Win32\SRC7\NCSIM\NCVW32\CUBEFACE.H /^#define CUBEFACE_H$/;" macro line:4 | |||
let fields = matchlist(a:line, '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline\:(\d+)') | |||
if empty(fields) | |||
return {} | |||
endif | |||
return { | |||
\ 'tag' : fields[1], | |||
\ 'fname' : fields[2], | |||
\ 'pattern': fields[3], | |||
\ 'kind' : fields[4], | |||
\ 'lnum' : str2nr(fields[5]), | |||
\ } | |||
endfunction | |||
" | |||
let s:TEMP_VARIABLES_GROUP = expand('<sfile>:p') | |||
" | |||
function s:getFileType(bufNr) | |||
let ft = getbufvar(a:bufNr, '&filetype') | |||
if !empty(ft) || bufloaded(a:bufNr) | |||
return ft | |||
endif | |||
let ft = getbufvar(a:bufNr, 'fuf_buffertag_filetype') | |||
if !empty(ft) | |||
return ft | |||
endif | |||
call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&eventignore', 'FileType') | |||
call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&filetype', &filetype) | |||
" from taglist.vim | |||
execute 'doautocmd filetypedetect BufRead ' . bufname(a:bufNr) | |||
let ft = &filetype | |||
call l9#tempvariables#end(s:TEMP_VARIABLES_GROUP) | |||
call setbufvar(a:bufNr, 'fuf_buffertag_filetype', ft) | |||
return ft | |||
endfunction | |||
" | |||
function s:makeCtagsCmd(bufNr) | |||
let ft = s:getFileType(a:bufNr) | |||
if !exists('g:fuf_buffertag__{ft}') | |||
return '' | |||
endif | |||
" | |||
let cmd = join([g:fuf_buffertag_ctagsPath, | |||
\ '-f - --sort=no --excmd=pattern --fields=nKs', | |||
\ g:fuf_buffertag__{ft}, | |||
\ shellescape(fnamemodify(bufname(a:bufNr), ':p'))]) | |||
return cmd | |||
endfunction | |||
" | |||
function s:getTagItems(bufNr) | |||
let cmd = s:makeCtagsCmd(a:bufNr) | |||
if empty(cmd) | |||
return [] | |||
elseif !exists('s:tagItemsCache[cmd]') || | |||
\ s:tagItemsCache[cmd].time < getftime(expand(bufname(a:bufNr))) | |||
let items = split(system(cmd), "\n") | |||
if v:shell_error | |||
call fuf#echoError([cmd] + items) | |||
throw "Command error" | |||
endif | |||
call map(items, 's:parseTagLine(v:val)') | |||
call filter(items, '!empty(v:val)') | |||
let s:tagItemsCache[cmd] = { | |||
\ 'time' : localtime(), | |||
\ 'items' : items, | |||
\ } | |||
endif | |||
return s:tagItemsCache[cmd].items | |||
endfunction | |||
" | |||
function s:makeItem(tag, itemMap) | |||
let menu = fnamemodify(a:itemMap[a:tag][0].fname, ':t') | |||
\ . ' [' . a:itemMap[a:tag][0].kind . ']' | |||
if len(a:itemMap[a:tag]) > 1 | |||
let menu .= ' (' . len(a:itemMap[a:tag]) . ')' | |||
endif | |||
let item = fuf#makeNonPathItem(a:tag, menu) | |||
return item | |||
endfunction | |||
" | |||
function s:getTagData(bufNrs) | |||
let key = join([0] + sort(copy(a:bufNrs)), "\n") | |||
let bufNames = map(copy(a:bufNrs), 'bufname(v:val)') | |||
if !exists('s:tagDataCache[key]') || | |||
\ fuf#countModifiedFiles(bufNames, s:tagDataCache[key].time) > 0 | |||
let itemMap = {} | |||
for item in l9#concat(map(copy(a:bufNrs), 's:getTagItems(v:val)')) | |||
if !exists('itemMap[item.tag]') | |||
let itemMap[item.tag] = [] | |||
endif | |||
call add(itemMap[item.tag], item) | |||
endfor | |||
let items = sort(keys(itemMap)) | |||
call map(items, 's:makeItem(v:val, itemMap)') | |||
call fuf#mapToSetSerialIndex(items, 1) | |||
call map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
let s:tagDataCache[key] = { | |||
\ 'time' : localtime(), | |||
\ 'itemMap': itemMap, | |||
\ 'items' : items, | |||
\ } | |||
endif | |||
return [s:tagDataCache[key].items, s:tagDataCache[key].itemMap] | |||
endfunction | |||
" | |||
function s:jumpToTag(item, mode) | |||
call fuf#openFile(a:item.fname, a:mode, g:fuf_reuseWindow) | |||
call cursor(a:item.lnum, 1) | |||
normal! zvzz | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_buffertag_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return 0 | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return [] | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
if !exists('self.itemMap[a:word][0]') | |||
call fuf#echoError('Definition not found:' . a:word) | |||
return | |||
elseif len(self.itemMap[a:word]) == 1 | |||
let i = 0 | |||
else | |||
let list = map(fuf#mapToSetSerialIndex(copy(self.itemMap[a:word]), 1), | |||
\ 'printf(" %2d: %s|%d| [%s] %s",v:val.index, fnamemodify(v:val.fname, ":~:."), v:val.lnum, v:val.kind, v:val.pattern)') | |||
let i = inputlist(['Select a definition of "' . a:word . '":'] + list) - 1 | |||
endif | |||
if 0 <= i && i < len(self.itemMap[a:word]) | |||
call s:jumpToTag(self.itemMap[a:word][i], a:mode) | |||
endif | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
if g:fuf_buffertag_forAll | |||
let bufNrs = filter(range(1, bufnr('$')), 'buflisted(v:val)') | |||
else | |||
let bufNrs = [self.bufNrPrev] | |||
endif | |||
let [self.items, self.itemMap] = s:getTagData(bufNrs) | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,137 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#callbackfile#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#callbackfile#getSwitchOrder() | |||
return -1 | |||
endfunction | |||
" | |||
function fuf#callbackfile#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#callbackfile#renewCache() | |||
let s:cache = {} | |||
endfunction | |||
" | |||
function fuf#callbackfile#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#callbackfile#onInit() | |||
endfunction | |||
" | |||
function fuf#callbackfile#launch(initialPattern, partialMatching, prompt, exclude, listener) | |||
let s:prompt = (empty(a:prompt) ? '>' : a:prompt) | |||
let s:exclude = a:exclude | |||
let s:listener = a:listener | |||
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:enumItems(dir) | |||
let key = getcwd() . g:fuf_ignoreCase . s:exclude . "\n" . a:dir | |||
if !exists('s:cache[key]') | |||
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, s:exclude) | |||
if isdirectory(a:dir) | |||
call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0)) | |||
endif | |||
call fuf#mapToSetSerialIndex(s:cache[key], 1) | |||
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key]) | |||
endif | |||
return s:cache[key] | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(s:prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return a:enteredPattern =~# '[^/\\]$' | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
let items = copy(s:enumItems(fuf#splitPath(a:patternPrimary).head)) | |||
return filter(items, 'bufnr("^" . v:val.word . "$") != self.bufNrPrev') | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call s:listener.onComplete(a:word, a:mode) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
if !a:opened && exists('s:listener.onAbort()') | |||
call s:listener.onAbort() | |||
endif | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,139 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#callbackitem#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#callbackitem#getSwitchOrder() | |||
return -1 | |||
endfunction | |||
" | |||
function fuf#callbackitem#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#callbackitem#renewCache() | |||
endfunction | |||
" | |||
function fuf#callbackitem#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#callbackitem#onInit() | |||
endfunction | |||
" | |||
function fuf#callbackitem#launch(initialPattern, partialMatching, prompt, listener, items, forPath) | |||
let s:prompt = (empty(a:prompt) ? '>' : a:prompt) | |||
let s:listener = a:listener | |||
let s:forPath = a:forPath | |||
let s:items = copy(a:items) | |||
if s:forPath | |||
call map(s:items, 'fuf#makePathItem(v:val, "", 1)') | |||
call fuf#mapToSetSerialIndex(s:items, 1) | |||
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items) | |||
else | |||
call map(s:items, 'fuf#makeNonPathItem(v:val, "")') | |||
call fuf#mapToSetSerialIndex(s:items, 1) | |||
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
endif | |||
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(s:prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
if s:forPath | |||
return g:fuf_previewHeight | |||
endif | |||
return 0 | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
let parser = (s:forPath | |||
\ ? 's:interpretPrimaryPatternForPath' | |||
\ : 's:interpretPrimaryPatternForNonPath') | |||
return fuf#makePatternSet(a:patternBase, parser, self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
if s:forPath | |||
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) | |||
endif | |||
return [] | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return s:items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call s:listener.onComplete(a:word, a:mode) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
if !a:opened && exists('s:listener.onAbort()') | |||
call s:listener.onAbort() | |||
endif | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,172 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#changelist#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#changelist#getSwitchOrder() | |||
return g:fuf_changelist_switchOrder | |||
endfunction | |||
" | |||
function fuf#changelist#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#changelist#renewCache() | |||
endfunction | |||
" | |||
function fuf#changelist#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#changelist#onInit() | |||
call fuf#defineLaunchCommand('FufChangeList', s:MODE_NAME, '""', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:getChangesLines() | |||
redir => result | |||
:silent changes | |||
redir END | |||
return split(result, "\n") | |||
endfunction | |||
" | |||
function s:parseChangesLine(line) | |||
" return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$') | |||
let elements = matchlist(a:line, '\v^(.)\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$') | |||
if empty(elements) | |||
return {} | |||
endif | |||
return { | |||
\ 'prefix': elements[1], | |||
\ 'count' : elements[2], | |||
\ 'lnum' : elements[3], | |||
\ 'text' : printf('|%d:%d|%s', elements[3], elements[4], elements[5]), | |||
\ } | |||
endfunction | |||
" | |||
function s:makeItem(line) | |||
let parsed = s:parseChangesLine(a:line) | |||
if empty(parsed) | |||
return {} | |||
endif | |||
let item = fuf#makeNonPathItem(parsed.text, '') | |||
let item.abbrPrefix = parsed.prefix | |||
let item.lnum = parsed.lnum | |||
return item | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_changelist_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
let items = filter(copy(self.items), 'v:val.word ==# a:word') | |||
if empty(items) | |||
return [] | |||
endif | |||
let lines = fuf#getFileLines(self.bufNrPrev) | |||
return fuf#makePreviewLinesAround( | |||
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#prejump(a:mode) | |||
let older = 0 | |||
for line in reverse(s:getChangesLines()) | |||
if stridx(line, '>') == 0 | |||
let older = 1 | |||
endif | |||
let parsed = s:parseChangesLine(line) | |||
if !empty(parsed) && parsed.text ==# a:word | |||
if parsed.count != 0 | |||
execute 'normal! ' . parsed.count . (older ? 'g;' : 'g,') . 'zvzz' | |||
endif | |||
break | |||
endif | |||
endfor | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
let self.items = s:getChangesLines() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
call map(self.items, 's:makeItem(v:val)') | |||
call filter(self.items, '!empty(v:val)') | |||
call reverse(self.items) | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: | |||
@@ -0,0 +1,199 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#coveragefile#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#coveragefile#getSwitchOrder() | |||
return g:fuf_coveragefile_switchOrder | |||
endfunction | |||
" | |||
function fuf#coveragefile#getEditableDataNames() | |||
return ['coverages'] | |||
endfunction | |||
" | |||
function fuf#coveragefile#renewCache() | |||
let s:cache = {} | |||
endfunction | |||
" | |||
function fuf#coveragefile#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#coveragefile#onInit() | |||
call fuf#defineLaunchCommand('FufCoverageFile', s:MODE_NAME, '""', []) | |||
call l9#defineVariableDefault('g:fuf_coveragefile_name', '') " private option | |||
command! -bang -narg=0 FufCoverageFileRegister call s:registerCoverage() | |||
command! -bang -narg=? FufCoverageFileChange call s:changeCoverage(<q-args>) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:enumItems() | |||
let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_coveragefile_exclude, | |||
\ g:fuf_coveragefile_globPatterns], "\n") | |||
if !exists('s:cache[key]') | |||
let s:cache[key] = l9#concat(map(copy(g:fuf_coveragefile_globPatterns), | |||
\ 'fuf#glob(v:val)')) | |||
call filter(s:cache[key], 'filereadable(v:val)') " filter out directories | |||
call map(s:cache[key], 'fuf#makePathItem(fnamemodify(v:val, ":~:."), "", 0)') | |||
if len(g:fuf_coveragefile_exclude) | |||
call filter(s:cache[key], 'v:val.word !~ g:fuf_coveragefile_exclude') | |||
endif | |||
call fuf#mapToSetSerialIndex(s:cache[key], 1) | |||
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key]) | |||
endif | |||
return s:cache[key] | |||
endfunction | |||
" | |||
function s:registerCoverage() | |||
let patterns = [] | |||
while 1 | |||
let pattern = l9#inputHl('Question', '[fuf] Glob pattern for coverage (<Esc> and end):', | |||
\ '', 'file') | |||
if pattern !~ '\S' | |||
break | |||
endif | |||
call add(patterns, pattern) | |||
endwhile | |||
if empty(patterns) | |||
call fuf#echoWarning('Canceled') | |||
return | |||
endif | |||
echo '[fuf] patterns: ' . string(patterns) | |||
let name = l9#inputHl('Question', '[fuf] Coverage name:') | |||
if name !~ '\S' | |||
call fuf#echoWarning('Canceled') | |||
return | |||
endif | |||
let coverages = fuf#loadDataFile(s:MODE_NAME, 'coverages') | |||
call insert(coverages, {'name': name, 'patterns': patterns}) | |||
call fuf#saveDataFile(s:MODE_NAME, 'coverages', coverages) | |||
endfunction | |||
" | |||
function s:createChangeCoverageListener() | |||
let listener = {} | |||
function listener.onComplete(name, method) | |||
call s:changeCoverage(a:name) | |||
endfunction | |||
return listener | |||
endfunction | |||
" | |||
function s:changeCoverage(name) | |||
let coverages = fuf#loadDataFile(s:MODE_NAME, 'coverages') | |||
if a:name !~ '\S' | |||
let names = map(copy(coverages), 'v:val.name') | |||
call fuf#callbackitem#launch('', 0, '>Coverage>', s:createChangeCoverageListener(), names, 0) | |||
return | |||
else | |||
let name = a:name | |||
endif | |||
call filter(coverages, 'v:val.name ==# name') | |||
if empty(coverages) | |||
call fuf#echoError('Coverage not found: ' . name) | |||
return | |||
endif | |||
call fuf#setOneTimeVariables( | |||
\ ['g:fuf_coveragefile_globPatterns', coverages[0].patterns], | |||
\ ['g:fuf_coveragefile_name' , a:name] | |||
\ ) | |||
FufCoverageFile | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
let nameString = (empty(g:fuf_coveragefile_name) ? '' | |||
\ : '[' . g:fuf_coveragefile_name . ']') | |||
return fuf#formatPrompt(g:fuf_coveragefile_prompt, self.partialMatching, | |||
\ nameString) | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$') | |||
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':~:.') | |||
let self.items = copy(s:enumItems()) | |||
call filter(self.items, 'v:val.word !=# bufNamePrev') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,132 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#dir#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#dir#getSwitchOrder() | |||
return g:fuf_dir_switchOrder | |||
endfunction | |||
" | |||
function fuf#dir#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#dir#renewCache() | |||
let s:cache = {} | |||
endfunction | |||
" | |||
function fuf#dir#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#dir#onInit() | |||
call fuf#defineLaunchCommand('FufDir' , s:MODE_NAME, '""', []) | |||
call fuf#defineLaunchCommand('FufDirWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', []) | |||
call fuf#defineLaunchCommand('FufDirWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:enumItems(dir) | |||
let key = getcwd() . g:fuf_ignoreCase . g:fuf_dir_exclude . "\n" . a:dir | |||
if !exists('s:cache[key]') | |||
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_dir_exclude) | |||
call filter(s:cache[key], 'v:val.word =~# ''[/\\]$''') | |||
if isdirectory(a:dir) | |||
call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0)) | |||
endif | |||
call fuf#mapToSetSerialIndex(s:cache[key], 1) | |||
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key]) | |||
endif | |||
return s:cache[key] | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_dir_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return a:enteredPattern =~# '[^/\\]$' | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return fuf#makePreviewLinesAround( | |||
\ fuf#glob(fnamemodify(a:word, ':p') . '*'), | |||
\ [], a:count, self.getPreviewHeight()) | |||
return | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return s:enumItems(fuf#splitPath(a:patternPrimary).head) | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
execute ':cd ' . fnameescape(a:word) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,139 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#file#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#file#getSwitchOrder() | |||
return g:fuf_file_switchOrder | |||
endfunction | |||
" | |||
function fuf#file#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#file#renewCache() | |||
let s:cache = {} | |||
endfunction | |||
" | |||
function fuf#file#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#file#onInit() | |||
call fuf#defineLaunchCommand('FufFile' , s:MODE_NAME, '""', []) | |||
call fuf#defineLaunchCommand('FufFileWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', []) | |||
call fuf#defineLaunchCommand('FufFileWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:enumItems(dir) | |||
let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_file_exclude, a:dir], "\n") | |||
if !exists('s:cache[key]') | |||
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_file_exclude) | |||
call fuf#mapToSetSerialIndex(s:cache[key], 1) | |||
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key]) | |||
endif | |||
return s:cache[key] | |||
endfunction | |||
" | |||
function s:enumNonCurrentItems(dir, bufNrPrev, cache) | |||
let key = a:dir . 'AVOIDING EMPTY KEY' | |||
if !exists('a:cache[key]') | |||
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$') | |||
let bufNamePrev = bufname(a:bufNrPrev) | |||
let a:cache[key] = | |||
\ filter(copy(s:enumItems(a:dir)), 'v:val.word !=# bufNamePrev') | |||
endif | |||
return a:cache[key] | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_file_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return a:enteredPattern =~# '[^/\\]$' | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return s:enumNonCurrentItems( | |||
\ fuf#splitPath(a:patternPrimary).head, self.bufNrPrev, self.cache) | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
let self.cache = {} | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,123 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#givencmd#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#givencmd#getSwitchOrder() | |||
return -1 | |||
endfunction | |||
" | |||
function fuf#givencmd#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#givencmd#renewCache() | |||
endfunction | |||
" | |||
function fuf#givencmd#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#givencmd#onInit() | |||
endfunction | |||
" | |||
function fuf#givencmd#launch(initialPattern, partialMatching, prompt, items) | |||
let s:prompt = (empty(a:prompt) ? '>' : a:prompt) | |||
let s:items = copy(a:items) | |||
call map(s:items, 'fuf#makeNonPathItem(v:val, "")') | |||
call fuf#mapToSetSerialIndex(s:items, 1) | |||
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(s:prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return 0 | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return [] | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return s:items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
if a:word[0] =~# '[:/?]' | |||
call histadd(a:word[0], a:word[1:]) | |||
endif | |||
call feedkeys(a:word . "\<CR>", 'n') | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,123 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#givendir#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#givendir#getSwitchOrder() | |||
return -1 | |||
endfunction | |||
" | |||
function fuf#givendir#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#givendir#renewCache() | |||
endfunction | |||
" | |||
function fuf#givendir#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#givendir#onInit() | |||
endfunction | |||
" | |||
function fuf#givendir#launch(initialPattern, partialMatching, prompt, items) | |||
let s:prompt = (empty(a:prompt) ? '>' : a:prompt) | |||
let s:items = map(copy(a:items), 'substitute(v:val, ''[/\\]\?$'', "", "")') | |||
let s:items = map(s:items, 'fuf#makePathItem(v:val, "", 0)') | |||
call fuf#mapToSetSerialIndex(s:items, 1) | |||
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items) | |||
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(s:prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return fuf#makePreviewLinesAround( | |||
\ fuf#glob(fnamemodify(a:word, ':p') . '*'), | |||
\ [], a:count, self.getPreviewHeight()) | |||
return | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return s:items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
execute ':cd ' . fnameescape(a:word) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,121 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#givenfile#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#givenfile#getSwitchOrder() | |||
return -1 | |||
endfunction | |||
" | |||
function fuf#givenfile#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#givenfile#renewCache() | |||
endfunction | |||
" | |||
function fuf#givenfile#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#givenfile#onInit() | |||
endfunction | |||
" | |||
function fuf#givenfile#launch(initialPattern, partialMatching, prompt, items) | |||
let s:prompt = (empty(a:prompt) ? '>' : a:prompt) | |||
let s:items = map(copy(a:items), 'fuf#makePathItem(v:val, "", 0)') | |||
call fuf#mapToSetSerialIndex(s:items, 1) | |||
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(s:prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return s:items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,198 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#help#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#help#getSwitchOrder() | |||
return g:fuf_help_switchOrder | |||
endfunction | |||
" | |||
function fuf#help#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#help#renewCache() | |||
let s:cache = {} | |||
endfunction | |||
" | |||
function fuf#help#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#help#onInit() | |||
call fuf#defineLaunchCommand('FufHelp' , s:MODE_NAME, '""', []) | |||
call fuf#defineLaunchCommand('FufHelpWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:getCurrentHelpTagFiles() | |||
let prefix = 'doc' . l9#getPathSeparator() | |||
let tagFiles = split(globpath(&runtimepath, prefix . 'tags' ), "\n") | |||
\ + split(globpath(&runtimepath, prefix . 'tags-??'), "\n") | |||
return sort(map(tagFiles, 'fnamemodify(v:val, ":p")')) | |||
endfunction | |||
" | |||
function s:parseHelpTagEntry(line, tagFile) | |||
let elements = split(a:line, "\t") | |||
if len(elements) != 3 || elements[0][0] ==# '!' | |||
return {} | |||
endif | |||
let suffix = matchstr(a:tagFile, '-\zs..$') | |||
if empty(suffix) | |||
let suffix = '@en' | |||
else | |||
let suffix = '@' . suffix | |||
endif | |||
let dir = fnamemodify(a:tagFile, ':h') . l9#getPathSeparator() | |||
return { | |||
\ 'word' : elements[0] . suffix, | |||
\ 'path' : dir . elements[1], | |||
\ 'pattern': elements[2][1:], | |||
\ } | |||
endfunction | |||
" | |||
function s:getHelpTagEntries(tagFile) | |||
let names = map(l9#readFile(a:tagFile), 's:parseHelpTagEntry(v:val, a:tagFile)') | |||
return filter(names, '!empty(v:val)') | |||
endfunction | |||
" | |||
function s:parseHelpTagFiles(tagFiles, key) | |||
let cacheName = 'cache-' . l9#hash224(a:key) | |||
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName) | |||
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0 | |||
return fuf#loadDataFile(s:MODE_NAME, cacheName) | |||
endif | |||
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getHelpTagEntries(v:val)'))) | |||
let items = map(items, 'extend(v:val, fuf#makeNonPathItem(v:val.word, ""))') | |||
call fuf#mapToSetSerialIndex(items, 1) | |||
let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
call fuf#saveDataFile(s:MODE_NAME, cacheName, items) | |||
return items | |||
endfunction | |||
" | |||
function s:enumHelpTags(tagFiles) | |||
if !len(a:tagFiles) | |||
return [] | |||
endif | |||
let key = join([g:fuf_ignoreCase] + a:tagFiles, "\n") | |||
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time) | |||
let s:cache[key] = { | |||
\ 'time' : localtime(), | |||
\ 'items' : s:parseHelpTagFiles(a:tagFiles, key) | |||
\ } | |||
endif | |||
return s:cache[key].items | |||
endfunction | |||
" | |||
function s:getMatchingIndex(lines, pattern) | |||
if empty(a:pattern) | |||
return -1 | |||
endif | |||
for i in range(len(a:lines)) | |||
if stridx(a:lines[i], a:pattern) >= 0 | |||
return i | |||
endif | |||
endfor | |||
return -1 | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_help_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
let items = filter(copy(s:enumHelpTags(self.tagFiles)), 'v:val.word ==# a:word') | |||
if empty(items) | |||
return [] | |||
endif | |||
let lines = fuf#getFileLines(items[0].path) | |||
let index = s:getMatchingIndex(lines, items[0].pattern) | |||
return [items[0].path . ':'] + fuf#makePreviewLinesAround( | |||
\ lines, (index < 0 ? [] : [index]), a:count, self.getPreviewHeight() - 1) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return s:enumHelpTags(self.tagFiles) | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#openHelp(a:word, a:mode) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
let self.tagFiles = s:getCurrentHelpTagFiles() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,182 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#jumplist#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#jumplist#getSwitchOrder() | |||
return g:fuf_jumplist_switchOrder | |||
endfunction | |||
" | |||
function fuf#jumplist#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#jumplist#renewCache() | |||
endfunction | |||
" | |||
function fuf#jumplist#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#jumplist#onInit() | |||
call fuf#defineLaunchCommand('FufJumpList', s:MODE_NAME, '""', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:getJumpsLines() | |||
redir => result | |||
:silent jumps | |||
redir END | |||
return split(result, "\n") | |||
endfunction | |||
" | |||
function s:parseJumpsLine(line, bufnrPrev) | |||
"return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$') | |||
let elements = matchlist(a:line, '\v^(.)\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$') | |||
if empty(elements) | |||
return {} | |||
endif | |||
let linePrevBuffer = join(getbufline(a:bufnrPrev, elements[3])) | |||
if stridx(linePrevBuffer, elements[5]) >= 0 | |||
let fname = bufname(a:bufnrPrev) | |||
let text = elements[5] | |||
else | |||
let fname = elements[5] | |||
let text = join(getbufline('^' . elements[5] . '$', elements[3])) | |||
endif | |||
return { | |||
\ 'prefix': elements[1], | |||
\ 'count' : elements[2], | |||
\ 'lnum' : elements[3], | |||
\ 'fname' : fname, | |||
\ 'text' : printf('%s|%d:%d|%s', fname, elements[3], elements[4], text), | |||
\ } | |||
endfunction | |||
" | |||
function s:makeItem(line, bufnrPrev) | |||
let parsed = s:parseJumpsLine(a:line, a:bufnrPrev) | |||
if empty(parsed) | |||
return {} | |||
endif | |||
let item = fuf#makeNonPathItem(parsed.text, '') | |||
let item.abbrPrefix = parsed.prefix | |||
let item.lnum = parsed.lnum | |||
let item.fname = parsed.fname | |||
return item | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_jumplist_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
let items = filter(copy(self.items), 'v:val.word ==# a:word') | |||
if empty(items) | |||
return [] | |||
endif | |||
let lines = fuf#getFileLines(items[0].fname) | |||
return fuf#makePreviewLinesAround( | |||
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#prejump(a:mode) | |||
let older = 0 | |||
for line in reverse(s:getJumpsLines()) | |||
if stridx(line, '>') == 0 | |||
let older = 1 | |||
endif | |||
let parsed = s:parseJumpsLine(line, self.bufNrPrev) | |||
if !empty(parsed) && parsed.text ==# a:word | |||
if parsed.count != 0 | |||
execute 'normal! ' . parsed.count . (older ? "\<C-o>" : "\<C-i>") . 'zvzz' | |||
endif | |||
break | |||
endif | |||
endfor | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
let self.items = s:getJumpsLines() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
call map(self.items, 's:makeItem(v:val, self.bufNrPrev)') | |||
call filter(self.items, '!empty(v:val)') | |||
call reverse(self.items) | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: | |||
@@ -0,0 +1,135 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#line#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#line#getSwitchOrder() | |||
return g:fuf_line_switchOrder | |||
endfunction | |||
" | |||
function fuf#line#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#line#renewCache() | |||
endfunction | |||
" | |||
function fuf#line#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#line#onInit() | |||
call fuf#defineLaunchCommand('FufLine', s:MODE_NAME, '""', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
let s:OPEN_TYPE_DELETE = -1 | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_line_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
let items = filter(copy(self.items), 'v:val.word ==# a:word') | |||
if empty(items) | |||
return [] | |||
endif | |||
let lines = fuf#getFileLines(self.bufNrPrev) | |||
return fuf#makePreviewLinesAround( | |||
\ lines, [items[0].index - 1], a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#prejump(a:mode) | |||
call filter(self.items, 'v:val.word ==# a:word') | |||
if empty(self.items) | |||
return | |||
execute 'cc ' . self.items[0].index | |||
endif | |||
call cursor(self.items[0].index, 0) | |||
normal! zvzz | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
let tab = repeat(' ', getbufvar(self.bufNrPrev, '&tabstop')) | |||
let self.items = getbufline(self.bufNrPrev, 1, '$') | |||
let lnumFormat = '%' . len(string(len(self.items) + 1)) . 'd|' | |||
for i in range(len(self.items)) | |||
let self.items[i] = printf(lnumFormat, i + 1) | |||
\ . substitute(self.items[i], "\t", tab, 'g') | |||
endfor | |||
call map(self.items, 'fuf#makeNonPathItem(v:val, "")') | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 0)') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,134 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#mrucmd#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#mrucmd#getSwitchOrder() | |||
return g:fuf_mrucmd_switchOrder | |||
endfunction | |||
" | |||
function fuf#mrucmd#getEditableDataNames() | |||
return ['items'] | |||
endfunction | |||
" | |||
function fuf#mrucmd#renewCache() | |||
endfunction | |||
" | |||
function fuf#mrucmd#requiresOnCommandPre() | |||
return 1 | |||
endfunction | |||
" | |||
function fuf#mrucmd#onInit() | |||
call fuf#defineLaunchCommand('FufMruCmd', s:MODE_NAME, '""', []) | |||
endfunction | |||
" | |||
function fuf#mrucmd#onCommandPre(cmd) | |||
if getcmdtype() =~# '^[:/?]' | |||
call s:updateInfo(a:cmd) | |||
endif | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:updateInfo(cmd) | |||
let items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
let items = fuf#updateMruList( | |||
\ items, { 'word' : a:cmd, 'time' : localtime() }, | |||
\ g:fuf_mrucmd_maxItem, g:fuf_mrucmd_exclude) | |||
call fuf#saveDataFile(s:MODE_NAME, 'items', items) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_mrucmd_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return 0 | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return [] | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call s:updateInfo(a:word) | |||
call histadd(a:word[0], a:word[1:]) | |||
call feedkeys(a:word . "\<CR>", 'n') | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))') | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,234 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#mrufile#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#mrufile#getSwitchOrder() | |||
return g:fuf_mrufile_switchOrder | |||
endfunction | |||
" | |||
function fuf#mrufile#getEditableDataNames() | |||
return ['items', 'itemdirs'] | |||
endfunction | |||
" | |||
function fuf#mrufile#renewCache() | |||
let s:cache = {} | |||
let s:aroundCache = {} | |||
endfunction | |||
" | |||
function fuf#mrufile#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#mrufile#onInit() | |||
call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""', []) | |||
call fuf#defineLaunchCommand('FufMruFileInCwd', s:MODE_NAME, | |||
\ '""', [['g:fuf_mrufile_underCwd', 1]]) | |||
call l9#defineVariableDefault('g:fuf_mrufile_underCwd', 0) " private option | |||
call l9#defineVariableDefault('g:fuf_mrufile_searchAroundLevel', -1) " private option | |||
augroup fuf#mrufile | |||
autocmd! | |||
autocmd BufEnter * call s:updateData() | |||
autocmd BufWritePost * call s:updateData() | |||
augroup END | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
let s:OPEN_TYPE_EXPAND = -1 | |||
" | |||
function s:updateData() | |||
if !empty(&buftype) || !filereadable(expand('%')) | |||
return | |||
endif | |||
let items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
let items = fuf#updateMruList( | |||
\ items, { 'word' : expand('%:p'), 'time' : localtime() }, | |||
\ g:fuf_mrufile_maxItem, g:fuf_mrufile_exclude) | |||
call fuf#saveDataFile(s:MODE_NAME, 'items', items) | |||
call s:removeItemFromCache(expand('%:p')) | |||
let itemDirs = fuf#loadDataFile(s:MODE_NAME, 'itemdirs') | |||
let itemDirs = fuf#updateMruList( | |||
\ itemDirs, { 'word' : expand('%:p:h') }, | |||
\ g:fuf_mrufile_maxItemDir, g:fuf_mrufile_exclude) | |||
call fuf#saveDataFile(s:MODE_NAME, 'itemdirs', itemDirs) | |||
endfunction | |||
" | |||
function s:removeItemFromCache(word) | |||
for items in values(s:cache) | |||
if exists('items[a:word]') | |||
unlet items[a:word] | |||
endif | |||
endfor | |||
endfunction | |||
" returns empty value if invalid item | |||
function s:formatItemUsingCache(item) | |||
if a:item.word !~ '\S' | |||
return {} | |||
endif | |||
if !exists('s:cache[a:item.word]') | |||
if filereadable(a:item.word) | |||
let s:cache[a:item.word] = fuf#makePathItem( | |||
\ fnamemodify(a:item.word, ':p:~'), strftime(g:fuf_timeFormat, a:item.time), 0) | |||
else | |||
let s:cache[a:item.word] = {} | |||
endif | |||
endif | |||
return s:cache[a:item.word] | |||
endfunction | |||
" | |||
function s:expandSearchDir(dir, level) | |||
let dirs = [a:dir] | |||
let dirPrev = a:dir | |||
for i in range(a:level) | |||
let dirPrev = l9#concatPaths([dirPrev, '*']) | |||
call add(dirs, dirPrev) | |||
endfor | |||
let dirPrev = a:dir | |||
for i in range(a:level) | |||
let dirPrevPrev = dirPrev | |||
let dirPrev = fnamemodify(dirPrev, ':h') | |||
if dirPrevPrev ==# dirPrev | |||
break | |||
endif | |||
call add(dirs, dirPrev) | |||
endfor | |||
return dirs | |||
endfunction | |||
" | |||
function s:listAroundFiles(dir) | |||
if !exists('s:aroundCache[a:dir]') | |||
let s:aroundCache[a:dir] = [a:dir] + | |||
\ fuf#glob(l9#concatPaths([a:dir, '*' ])) + | |||
\ fuf#glob(l9#concatPaths([a:dir, '.*'])) | |||
call filter(s:aroundCache[a:dir], 'filereadable(v:val)') | |||
call map(s:aroundCache[a:dir], 'fuf#makePathItem(fnamemodify(v:val, ":~"), "", 0)') | |||
if len(g:fuf_mrufile_exclude) | |||
call filter(s:aroundCache[a:dir], 'v:val.word !~ g:fuf_mrufile_exclude') | |||
endif | |||
endif | |||
return s:aroundCache[a:dir] | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
let cwdString = (g:fuf_mrufile_underCwd ? '[CWD]' : '') | |||
let levelString = (g:fuf_mrufile_searchAroundLevel < 0 ? '' | |||
\ : '[Around:' . g:fuf_mrufile_searchAroundLevel . ']') | |||
return fuf#formatPrompt(g:fuf_mrufile_prompt, self.partialMatching, cwdString . levelString) | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
if a:mode ==# s:OPEN_TYPE_EXPAND | |||
let nextLevel = (self.searchAroundLevel < 0 ? 0 : self.searchAroundLevel + 1) | |||
call fuf#setOneTimeVariables(['g:fuf_mrufile_searchAroundLevel', nextLevel]) | |||
let self.reservedMode = self.getModeName() | |||
return | |||
else | |||
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) | |||
endif | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
let self.searchAroundLevel = g:fuf_mrufile_searchAroundLevel | |||
call fuf#defineKeyMappingInHandler(g:fuf_mrufile_keyExpand, | |||
\ 'onCr(' . s:OPEN_TYPE_EXPAND . ')') | |||
if self.searchAroundLevel < 0 | |||
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items') | |||
call map(self.items, 's:formatItemUsingCache(v:val)') | |||
else | |||
let self.items = fuf#loadDataFile(s:MODE_NAME, 'itemdirs') | |||
call map(self.items, 's:expandSearchDir(v:val.word, g:fuf_mrufile_searchAroundLevel)') | |||
let self.items = l9#concat(self.items) | |||
let self.items = l9#unique(self.items) | |||
call map(self.items, 's:listAroundFiles(v:val)') | |||
let self.items = l9#concat(self.items) | |||
endif | |||
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$') | |||
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~') | |||
call filter(self.items, '!empty(v:val) && v:val.word !=# bufNamePrev') | |||
if g:fuf_mrufile_underCwd | |||
let cwd = fnamemodify(getcwd(), ':p:~') | |||
call filter(self.items, 'stridx(v:val.word, cwd) == 0') | |||
endif | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
call fuf#mapToSetAbbrWithSnippedWordAsPath(self.items) | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,154 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#quickfix#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#quickfix#getSwitchOrder() | |||
return g:fuf_quickfix_switchOrder | |||
endfunction | |||
" | |||
function fuf#quickfix#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#quickfix#renewCache() | |||
endfunction | |||
" | |||
function fuf#quickfix#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#quickfix#onInit() | |||
call fuf#defineLaunchCommand('FufQuickfix', s:MODE_NAME, '""', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:getJumpsLines() | |||
redir => result | |||
:silent jumps | |||
redir END | |||
return split(result, "\n") | |||
endfunction | |||
" | |||
function s:parseJumpsLine(line) | |||
return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$') | |||
endfunction | |||
" | |||
function s:makeItem(qfItem) | |||
if !a:qfItem.valid | |||
return {} | |||
endif | |||
let item = fuf#makeNonPathItem( | |||
\ printf('%s|%d:%d|%s', bufname(a:qfItem.bufnr), a:qfItem.lnum, | |||
\ a:qfItem.col, matchstr(a:qfItem.text, '\s*\zs.*\S')) | |||
\ , '') | |||
let item.bufnr = a:qfItem.bufnr | |||
let item.lnum = a:qfItem.lnum | |||
return item | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_quickfix_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
let items = filter(copy(self.items), 'v:val.word ==# a:word') | |||
if empty(items) | |||
return [] | |||
endif | |||
let lines = fuf#getFileLines(items[0].bufnr) | |||
return fuf#makePreviewLinesAround( | |||
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#prejump(a:mode) | |||
call filter(self.items, 'v:val.word ==# a:word') | |||
if !empty(self.items) | |||
execute 'cc ' . self.items[0].index | |||
endif | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
let self.items = getqflist() | |||
call map(self.items, 's:makeItem(v:val)') | |||
call fuf#mapToSetSerialIndex(self.items, 1) | |||
call filter(self.items, 'exists("v:val.word")') | |||
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: | |||
@@ -0,0 +1,178 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#tag#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#tag#getSwitchOrder() | |||
return g:fuf_tag_switchOrder | |||
endfunction | |||
" | |||
function fuf#tag#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#tag#renewCache() | |||
let s:cache = {} | |||
endfunction | |||
" | |||
function fuf#tag#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#tag#onInit() | |||
call fuf#defineLaunchCommand('FufTag' , s:MODE_NAME, '""', []) | |||
call fuf#defineLaunchCommand('FufTagWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:getTagNames(tagFile) | |||
let names = map(l9#readFile(a:tagFile), 'matchstr(v:val, ''^[^!\t][^\t]*'')') | |||
return filter(names, 'v:val =~# ''\S''') | |||
endfunction | |||
" | |||
function s:parseTagFiles(tagFiles, key) | |||
let cacheName = 'cache-' . l9#hash224(a:key) | |||
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName) | |||
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0 | |||
return fuf#loadDataFile(s:MODE_NAME, cacheName) | |||
endif | |||
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTagNames(v:val)'))) | |||
let items = map(items, 'fuf#makeNonPathItem(v:val, "")') | |||
call fuf#mapToSetSerialIndex(items, 1) | |||
let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') | |||
call fuf#saveDataFile(s:MODE_NAME, cacheName, items) | |||
return items | |||
endfunction | |||
" | |||
function s:enumTags(tagFiles) | |||
if !len(a:tagFiles) | |||
return [] | |||
endif | |||
let key = join([g:fuf_ignoreCase] + a:tagFiles, "\n") | |||
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time) | |||
let s:cache[key] = { | |||
\ 'time' : localtime(), | |||
\ 'items' : s:parseTagFiles(a:tagFiles, key) | |||
\ } | |||
endif | |||
return s:cache[key].items | |||
endfunction | |||
" | |||
function s:getMatchingIndex(lines, cmd) | |||
if a:cmd !~# '\D' | |||
return str2nr(a:cmd) | |||
endif | |||
let pattern = matchstr(a:cmd, '^\/\^\zs.*\ze\$\/$') | |||
if empty(pattern) | |||
return -1 | |||
endif | |||
for i in range(len(a:lines)) | |||
if a:lines[i] ==# pattern | |||
return i | |||
endif | |||
endfor | |||
return -1 | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_tag_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" 'cmd' is '/^hoge hoge$/' or line number | |||
function s:handler.makePreviewLines(word, count) | |||
let tags = taglist('^' . a:word . '$') | |||
if empty(tags) | |||
return [] | |||
endif | |||
let i = a:count % len(tags) | |||
let title = printf('(%d/%d) %s', i + 1, len(tags), tags[i].filename) | |||
let lines = fuf#getFileLines(tags[i].filename) | |||
let index = s:getMatchingIndex(lines, tags[i].cmd) | |||
return [title] + fuf#makePreviewLinesAround( | |||
\ lines, (index < 0 ? [] : [index]), 0, self.getPreviewHeight() - 1) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return s:enumTags(self.tagFiles) | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#openTag(a:word, a:mode) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
let self.tagFiles = fuf#getCurrentTagFiles() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
let &l:tags = join(self.tagFiles, ',') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
let &l:tags = '' | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,159 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, []) | |||
finish | |||
endif | |||
" }}}1 | |||
"============================================================================= | |||
" GLOBAL FUNCTIONS {{{1 | |||
" | |||
function fuf#taggedfile#createHandler(base) | |||
return a:base.concretize(copy(s:handler)) | |||
endfunction | |||
" | |||
function fuf#taggedfile#getSwitchOrder() | |||
return g:fuf_taggedfile_switchOrder | |||
endfunction | |||
" | |||
function fuf#taggedfile#getEditableDataNames() | |||
return [] | |||
endfunction | |||
" | |||
function fuf#taggedfile#renewCache() | |||
let s:cache = {} | |||
endfunction | |||
" | |||
function fuf#taggedfile#requiresOnCommandPre() | |||
return 0 | |||
endfunction | |||
" | |||
function fuf#taggedfile#onInit() | |||
call fuf#defineLaunchCommand('FufTaggedFile', s:MODE_NAME, '""', []) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS/VARIABLES {{{1 | |||
let s:MODE_NAME = expand('<sfile>:t:r') | |||
" | |||
function s:getTaggedFileList(tagfile) | |||
execute 'cd ' . fnamemodify(a:tagfile, ':h') | |||
let result = map(l9#readFile(a:tagfile), 'matchstr(v:val, ''^[^!\t][^\t]*\t\zs[^\t]\+'')') | |||
call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":p")') | |||
cd - | |||
call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":~:.")') | |||
return filter(result, 'v:val =~# ''[^/\\ ]$''') | |||
endfunction | |||
" | |||
function s:parseTagFiles(tagFiles, key) | |||
let cacheName = 'cache-' . l9#hash224(a:key) | |||
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName) | |||
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0 | |||
return fuf#loadDataFile(s:MODE_NAME, cacheName) | |||
endif | |||
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTaggedFileList(v:val)'))) | |||
call map(items, 'fuf#makePathItem(v:val, "", 0)') | |||
call fuf#mapToSetSerialIndex(items, 1) | |||
call fuf#mapToSetAbbrWithSnippedWordAsPath(items) | |||
call fuf#saveDataFile(s:MODE_NAME, cacheName, items) | |||
return items | |||
endfunction | |||
" | |||
function s:enumTaggedFiles(tagFiles) | |||
if !len(a:tagFiles) | |||
return [] | |||
endif | |||
let key = join([getcwd(), g:fuf_ignoreCase] + a:tagFiles, "\n") | |||
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time) | |||
let s:cache[key] = { | |||
\ 'time' : localtime(), | |||
\ 'items' : s:parseTagFiles(a:tagFiles, key) | |||
\ } | |||
endif | |||
return s:cache[key].items | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" s:handler {{{1 | |||
let s:handler = {} | |||
" | |||
function s:handler.getModeName() | |||
return s:MODE_NAME | |||
endfunction | |||
" | |||
function s:handler.getPrompt() | |||
return fuf#formatPrompt(g:fuf_taggedfile_prompt, self.partialMatching, '') | |||
endfunction | |||
" | |||
function s:handler.getPreviewHeight() | |||
return g:fuf_previewHeight | |||
endfunction | |||
" | |||
function s:handler.isOpenable(enteredPattern) | |||
return 1 | |||
endfunction | |||
" | |||
function s:handler.makePatternSet(patternBase) | |||
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', | |||
\ self.partialMatching) | |||
endfunction | |||
" | |||
function s:handler.makePreviewLines(word, count) | |||
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) | |||
endfunction | |||
" | |||
function s:handler.getCompleteItems(patternPrimary) | |||
return self.items | |||
endfunction | |||
" | |||
function s:handler.onOpen(word, mode) | |||
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPre() | |||
let self.tagFiles = fuf#getCurrentTagFiles() | |||
endfunction | |||
" | |||
function s:handler.onModeEnterPost() | |||
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$') | |||
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~:.') | |||
" NOTE: Don't do this in onModeEnterPre() | |||
" because that should return in a short time. | |||
let self.items = copy(s:enumTaggedFiles(self.tagFiles)) | |||
call filter(self.items, 'v:val.word !=# bufNamePrev') | |||
endfunction | |||
" | |||
function s:handler.onModeLeavePost(opened) | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,176 @@ | |||
:FufBookmarkDir fuf.txt /*:FufBookmarkDir* | |||
:FufBookmarkDirAdd fuf.txt /*:FufBookmarkDirAdd* | |||
:FufBookmarkFile fuf.txt /*:FufBookmarkFile* | |||
:FufBookmarkFileAdd fuf.txt /*:FufBookmarkFileAdd* | |||
:FufBookmarkFileAddAsSelectedText fuf.txt /*:FufBookmarkFileAddAsSelectedText* | |||
:FufBuffer fuf.txt /*:FufBuffer* | |||
:FufBufferTag fuf.txt /*:FufBufferTag* | |||
:FufBufferTagAll fuf.txt /*:FufBufferTagAll* | |||
:FufBufferTagAllWithCursorWord fuf.txt /*:FufBufferTagAllWithCursorWord* | |||
:FufBufferTagAllWithSelectedText fuf.txt /*:FufBufferTagAllWithSelectedText* | |||
:FufBufferTagWithCursorWord fuf.txt /*:FufBufferTagWithCursorWord* | |||
:FufBufferTagWithSelectedText fuf.txt /*:FufBufferTagWithSelectedText* | |||
:FufChangeList fuf.txt /*:FufChangeList* | |||
:FufCoverageFile fuf.txt /*:FufCoverageFile* | |||
:FufCoverageFileChange fuf.txt /*:FufCoverageFileChange* | |||
:FufCoverageFileRegister fuf.txt /*:FufCoverageFileRegister* | |||
:FufDir fuf.txt /*:FufDir* | |||
:FufDirWithCurrentBufferDir fuf.txt /*:FufDirWithCurrentBufferDir* | |||
:FufDirWithFullCwd fuf.txt /*:FufDirWithFullCwd* | |||
:FufEditDataFile fuf.txt /*:FufEditDataFile* | |||
:FufFile fuf.txt /*:FufFile* | |||
:FufFileWithCurrentBufferDir fuf.txt /*:FufFileWithCurrentBufferDir* | |||
:FufFileWithFullCwd fuf.txt /*:FufFileWithFullCwd* | |||
:FufHelp fuf.txt /*:FufHelp* | |||
:FufJumpList fuf.txt /*:FufJumpList* | |||
:FufLine fuf.txt /*:FufLine* | |||
:FufMruCmd fuf.txt /*:FufMruCmd* | |||
:FufMruFile fuf.txt /*:FufMruFile* | |||
:FufMruFileInCwd fuf.txt /*:FufMruFileInCwd* | |||
:FufQuickfix fuf.txt /*:FufQuickfix* | |||
:FufRenewCache fuf.txt /*:FufRenewCache* | |||
:FufTag fuf.txt /*:FufTag* | |||
:FufTagWithCursorWord fuf.txt /*:FufTagWithCursorWord* | |||
:FufTaggedFile fuf.txt /*:FufTaggedFile* | |||
abc fuf.txt /*abc* | |||
fuf fuf.txt /*fuf* | |||
fuf#setOneTimeVariables() fuf.txt /*fuf#setOneTimeVariables()* | |||
fuf-abbreviation fuf.txt /*fuf-abbreviation* | |||
fuf-about fuf.txt /*fuf-about* | |||
fuf-author fuf.txt /*fuf-author* | |||
fuf-bookmarkdir-mode fuf.txt /*fuf-bookmarkdir-mode* | |||
fuf-bookmarkfile-mode fuf.txt /*fuf-bookmarkfile-mode* | |||
fuf-buffer-mode fuf.txt /*fuf-buffer-mode* | |||
fuf-buffertag-mode fuf.txt /*fuf-buffertag-mode* | |||
fuf-cache fuf.txt /*fuf-cache* | |||
fuf-callbackfile-mode fuf.txt /*fuf-callbackfile-mode* | |||
fuf-callbackitem-mode fuf.txt /*fuf-callbackitem-mode* | |||
fuf-changelist-mode fuf.txt /*fuf-changelist-mode* | |||
fuf-changelog fuf.txt /*fuf-changelog* | |||
fuf-commands fuf.txt /*fuf-commands* | |||
fuf-contact fuf.txt /*fuf-contact* | |||
fuf-coveragefile-mode fuf.txt /*fuf-coveragefile-mode* | |||
fuf-data-file fuf.txt /*fuf-data-file* | |||
fuf-detailed-topics fuf.txt /*fuf-detailed-topics* | |||
fuf-dir-mode fuf.txt /*fuf-dir-mode* | |||
fuf-dot-sequence fuf.txt /*fuf-dot-sequence* | |||
fuf-file-mode fuf.txt /*fuf-file-mode* | |||
fuf-givencmd-mode fuf.txt /*fuf-givencmd-mode* | |||
fuf-givendir-mode fuf.txt /*fuf-givendir-mode* | |||
fuf-givenfile-mode fuf.txt /*fuf-givenfile-mode* | |||
fuf-help-mode fuf.txt /*fuf-help-mode* | |||
fuf-hiding-menu fuf.txt /*fuf-hiding-menu* | |||
fuf-how-to-add-mode fuf.txt /*fuf-how-to-add-mode* | |||
fuf-installation fuf.txt /*fuf-installation* | |||
fuf-introduction fuf.txt /*fuf-introduction* | |||
fuf-jumplist-mode fuf.txt /*fuf-jumplist-mode* | |||
fuf-line-mode fuf.txt /*fuf-line-mode* | |||
fuf-migemo fuf.txt /*fuf-migemo* | |||
fuf-modes fuf.txt /*fuf-modes* | |||
fuf-mrucmd-mode fuf.txt /*fuf-mrucmd-mode* | |||
fuf-mrufile-mode fuf.txt /*fuf-mrufile-mode* | |||
fuf-multiple-search fuf.txt /*fuf-multiple-search* | |||
fuf-options fuf.txt /*fuf-options* | |||
fuf-options-for-all-modes fuf.txt /*fuf-options-for-all-modes* | |||
fuf-options-for-bookmarkdir-mode fuf.txt /*fuf-options-for-bookmarkdir-mode* | |||
fuf-options-for-bookmarkfile-mode fuf.txt /*fuf-options-for-bookmarkfile-mode* | |||
fuf-options-for-buffer-mode fuf.txt /*fuf-options-for-buffer-mode* | |||
fuf-options-for-buffertag-mode fuf.txt /*fuf-options-for-buffertag-mode* | |||
fuf-options-for-changelist-mode fuf.txt /*fuf-options-for-changelist-mode* | |||
fuf-options-for-coveragefile-mode fuf.txt /*fuf-options-for-coveragefile-mode* | |||
fuf-options-for-dir-mode fuf.txt /*fuf-options-for-dir-mode* | |||
fuf-options-for-file-mode fuf.txt /*fuf-options-for-file-mode* | |||
fuf-options-for-help-mode fuf.txt /*fuf-options-for-help-mode* | |||
fuf-options-for-jumplist-mode fuf.txt /*fuf-options-for-jumplist-mode* | |||
fuf-options-for-line-mode fuf.txt /*fuf-options-for-line-mode* | |||
fuf-options-for-mrucmd-mode fuf.txt /*fuf-options-for-mrucmd-mode* | |||
fuf-options-for-mrufile-mode fuf.txt /*fuf-options-for-mrufile-mode* | |||
fuf-options-for-quickfix-mode fuf.txt /*fuf-options-for-quickfix-mode* | |||
fuf-options-for-tag-mode fuf.txt /*fuf-options-for-tag-mode* | |||
fuf-options-for-taggedfile-mode fuf.txt /*fuf-options-for-taggedfile-mode* | |||
fuf-quickfix-mode fuf.txt /*fuf-quickfix-mode* | |||
fuf-reusing-window fuf.txt /*fuf-reusing-window* | |||
fuf-search-patterns fuf.txt /*fuf-search-patterns* | |||
fuf-setting-one-time-option fuf.txt /*fuf-setting-one-time-option* | |||
fuf-sorting-of-completion-items fuf.txt /*fuf-sorting-of-completion-items* | |||
fuf-tag-mode fuf.txt /*fuf-tag-mode* | |||
fuf-taggedfile-mode fuf.txt /*fuf-taggedfile-mode* | |||
fuf-thanks fuf.txt /*fuf-thanks* | |||
fuf-usage fuf.txt /*fuf-usage* | |||
fuf-vimrc-example fuf.txt /*fuf-vimrc-example* | |||
fuf.txt fuf.txt /*fuf.txt* | |||
fuzzyfinder fuf.txt /*fuzzyfinder* | |||
g:fuf_abbrevMap fuf.txt /*g:fuf_abbrevMap* | |||
g:fuf_autoPreview fuf.txt /*g:fuf_autoPreview* | |||
g:fuf_bookmarkdir_keyDelete fuf.txt /*g:fuf_bookmarkdir_keyDelete* | |||
g:fuf_bookmarkdir_prompt fuf.txt /*g:fuf_bookmarkdir_prompt* | |||
g:fuf_bookmarkdir_switchOrder fuf.txt /*g:fuf_bookmarkdir_switchOrder* | |||
g:fuf_bookmarkfile_keyDelete fuf.txt /*g:fuf_bookmarkfile_keyDelete* | |||
g:fuf_bookmarkfile_prompt fuf.txt /*g:fuf_bookmarkfile_prompt* | |||
g:fuf_bookmarkfile_searchRange fuf.txt /*g:fuf_bookmarkfile_searchRange* | |||
g:fuf_bookmarkfile_switchOrder fuf.txt /*g:fuf_bookmarkfile_switchOrder* | |||
g:fuf_buffer_keyDelete fuf.txt /*g:fuf_buffer_keyDelete* | |||
g:fuf_buffer_mruOrder fuf.txt /*g:fuf_buffer_mruOrder* | |||
g:fuf_buffer_prompt fuf.txt /*g:fuf_buffer_prompt* | |||
g:fuf_buffer_switchOrder fuf.txt /*g:fuf_buffer_switchOrder* | |||
g:fuf_buffertag_ctagsPath fuf.txt /*g:fuf_buffertag_ctagsPath* | |||
g:fuf_buffertag_prompt fuf.txt /*g:fuf_buffertag_prompt* | |||
g:fuf_buffertag_switchOrder fuf.txt /*g:fuf_buffertag_switchOrder* | |||
g:fuf_changelist_prompt fuf.txt /*g:fuf_changelist_prompt* | |||
g:fuf_changelist_switchOrder fuf.txt /*g:fuf_changelist_switchOrder* | |||
g:fuf_coveragefile_exclude fuf.txt /*g:fuf_coveragefile_exclude* | |||
g:fuf_coveragefile_globPatterns fuf.txt /*g:fuf_coveragefile_globPatterns* | |||
g:fuf_coveragefile_prompt fuf.txt /*g:fuf_coveragefile_prompt* | |||
g:fuf_coveragefile_switchOrder fuf.txt /*g:fuf_coveragefile_switchOrder* | |||
g:fuf_dataDir fuf.txt /*g:fuf_dataDir* | |||
g:fuf_dir_exclude fuf.txt /*g:fuf_dir_exclude* | |||
g:fuf_dir_prompt fuf.txt /*g:fuf_dir_prompt* | |||
g:fuf_dir_switchOrder fuf.txt /*g:fuf_dir_switchOrder* | |||
g:fuf_enumeratingLimit fuf.txt /*g:fuf_enumeratingLimit* | |||
g:fuf_file_exclude fuf.txt /*g:fuf_file_exclude* | |||
g:fuf_file_prompt fuf.txt /*g:fuf_file_prompt* | |||
g:fuf_file_switchOrder fuf.txt /*g:fuf_file_switchOrder* | |||
g:fuf_fuzzyRefining fuf.txt /*g:fuf_fuzzyRefining* | |||
g:fuf_help_prompt fuf.txt /*g:fuf_help_prompt* | |||
g:fuf_help_switchOrder fuf.txt /*g:fuf_help_switchOrder* | |||
g:fuf_ignoreCase fuf.txt /*g:fuf_ignoreCase* | |||
g:fuf_jumplist_prompt fuf.txt /*g:fuf_jumplist_prompt* | |||
g:fuf_jumplist_switchOrder fuf.txt /*g:fuf_jumplist_switchOrder* | |||
g:fuf_keyNextMode fuf.txt /*g:fuf_keyNextMode* | |||
g:fuf_keyNextPattern fuf.txt /*g:fuf_keyNextPattern* | |||
g:fuf_keyOpen fuf.txt /*g:fuf_keyOpen* | |||
g:fuf_keyOpenSplit fuf.txt /*g:fuf_keyOpenSplit* | |||
g:fuf_keyOpenTabpage fuf.txt /*g:fuf_keyOpenTabpage* | |||
g:fuf_keyOpenVsplit fuf.txt /*g:fuf_keyOpenVsplit* | |||
g:fuf_keyPrevMode fuf.txt /*g:fuf_keyPrevMode* | |||
g:fuf_keyPrevPattern fuf.txt /*g:fuf_keyPrevPattern* | |||
g:fuf_keyPreview fuf.txt /*g:fuf_keyPreview* | |||
g:fuf_keySwitchMatching fuf.txt /*g:fuf_keySwitchMatching* | |||
g:fuf_learningLimit fuf.txt /*g:fuf_learningLimit* | |||
g:fuf_line_prompt fuf.txt /*g:fuf_line_prompt* | |||
g:fuf_line_switchOrder fuf.txt /*g:fuf_line_switchOrder* | |||
g:fuf_maxMenuWidth fuf.txt /*g:fuf_maxMenuWidth* | |||
g:fuf_modesDisable fuf.txt /*g:fuf_modesDisable* | |||
g:fuf_mrucmd_exclude fuf.txt /*g:fuf_mrucmd_exclude* | |||
g:fuf_mrucmd_maxItem fuf.txt /*g:fuf_mrucmd_maxItem* | |||
g:fuf_mrucmd_prompt fuf.txt /*g:fuf_mrucmd_prompt* | |||
g:fuf_mrucmd_switchOrder fuf.txt /*g:fuf_mrucmd_switchOrder* | |||
g:fuf_mrufile_exclude fuf.txt /*g:fuf_mrufile_exclude* | |||
g:fuf_mrufile_keyExpand fuf.txt /*g:fuf_mrufile_keyExpand* | |||
g:fuf_mrufile_maxItem fuf.txt /*g:fuf_mrufile_maxItem* | |||
g:fuf_mrufile_maxItemDir fuf.txt /*g:fuf_mrufile_maxItemDir* | |||
g:fuf_mrufile_prompt fuf.txt /*g:fuf_mrufile_prompt* | |||
g:fuf_mrufile_switchOrder fuf.txt /*g:fuf_mrufile_switchOrder* | |||
g:fuf_patternSeparator fuf.txt /*g:fuf_patternSeparator* | |||
g:fuf_previewHeight fuf.txt /*g:fuf_previewHeight* | |||
g:fuf_promptHighlight fuf.txt /*g:fuf_promptHighlight* | |||
g:fuf_quickfix_prompt fuf.txt /*g:fuf_quickfix_prompt* | |||
g:fuf_quickfix_switchOrder fuf.txt /*g:fuf_quickfix_switchOrder* | |||
g:fuf_reuseWindow fuf.txt /*g:fuf_reuseWindow* | |||
g:fuf_splitPathMatching fuf.txt /*g:fuf_splitPathMatching* | |||
g:fuf_tag_prompt fuf.txt /*g:fuf_tag_prompt* | |||
g:fuf_tag_switchOrder fuf.txt /*g:fuf_tag_switchOrder* | |||
g:fuf_taggedfile_prompt fuf.txt /*g:fuf_taggedfile_prompt* | |||
g:fuf_taggedfile_switchOrder fuf.txt /*g:fuf_taggedfile_switchOrder* | |||
g:fuf_timeFormat fuf.txt /*g:fuf_timeFormat* | |||
g:fuf_useMigemo fuf.txt /*g:fuf_useMigemo* |
@@ -0,0 +1,174 @@ | |||
!_TAG_FILE_ENCODING utf-8 // | |||
:FufBookmarkDir fuf.jax /*:FufBookmarkDir* | |||
:FufBookmarkDirAdd fuf.jax /*:FufBookmarkDirAdd* | |||
:FufBookmarkFile fuf.jax /*:FufBookmarkFile* | |||
:FufBookmarkFileAdd fuf.jax /*:FufBookmarkFileAdd* | |||
:FufBookmarkFileAddAsSelectedText fuf.jax /*:FufBookmarkFileAddAsSelectedText* | |||
:FufBuffer fuf.jax /*:FufBuffer* | |||
:FufBufferTag fuf.jax /*:FufBufferTag* | |||
:FufBufferTagAll fuf.jax /*:FufBufferTagAll* | |||
:FufBufferTagAllWithCursorWord fuf.jax /*:FufBufferTagAllWithCursorWord* | |||
:FufBufferTagAllWithSelectedText fuf.jax /*:FufBufferTagAllWithSelectedText* | |||
:FufBufferTagWithCursorWord fuf.jax /*:FufBufferTagWithCursorWord* | |||
:FufBufferTagWithSelectedText fuf.jax /*:FufBufferTagWithSelectedText* | |||
:FufChangeList fuf.jax /*:FufChangeList* | |||
:FufCoverageFileChange fuf.jax /*:FufCoverageFileChange* | |||
:FufCoverageFileRegister fuf.jax /*:FufCoverageFileRegister* | |||
:FufDir fuf.jax /*:FufDir* | |||
:FufDirWithCurrentBufferDir fuf.jax /*:FufDirWithCurrentBufferDir* | |||
:FufDirWithFullCwd fuf.jax /*:FufDirWithFullCwd* | |||
:FufEditDataFile fuf.jax /*:FufEditDataFile* | |||
:FufFile fuf.jax /*:FufFile* | |||
:FufFileWithCurrentBufferDir fuf.jax /*:FufFileWithCurrentBufferDir* | |||
:FufFileWithFullCwd fuf.jax /*:FufFileWithFullCwd* | |||
:FufHelp fuf.jax /*:FufHelp* | |||
:FufJumpList fuf.jax /*:FufJumpList* | |||
:FufLine fuf.jax /*:FufLine* | |||
:FufMruCmd fuf.jax /*:FufMruCmd* | |||
:FufMruFile fuf.jax /*:FufMruFile* | |||
:FufMruFileInCwd fuf.jax /*:FufMruFileInCwd* | |||
:FufQuickfix fuf.jax /*:FufQuickfix* | |||
:FufRenewCache fuf.jax /*:FufRenewCache* | |||
:FufTag fuf.jax /*:FufTag* | |||
:FufTagWithCursorWord fuf.jax /*:FufTagWithCursorWord* | |||
:FufTaggedFile fuf.jax /*:FufTaggedFile* | |||
abc fuf.jax /*abc* | |||
fuf fuf.jax /*fuf* | |||
fuf#setOneTimeVariables() fuf.jax /*fuf#setOneTimeVariables()* | |||
fuf-abbreviation fuf.jax /*fuf-abbreviation* | |||
fuf-about fuf.jax /*fuf-about* | |||
fuf-author fuf.jax /*fuf-author* | |||
fuf-bookmarkdir-mode fuf.jax /*fuf-bookmarkdir-mode* | |||
fuf-bookmarkfile-mode fuf.jax /*fuf-bookmarkfile-mode* | |||
fuf-buffer-mode fuf.jax /*fuf-buffer-mode* | |||
fuf-buffertag-mode fuf.jax /*fuf-buffertag-mode* | |||
fuf-cache fuf.jax /*fuf-cache* | |||
fuf-callbackfile-mode fuf.jax /*fuf-callbackfile-mode* | |||
fuf-callbackitem-mode fuf.jax /*fuf-callbackitem-mode* | |||
fuf-changelist-mode fuf.jax /*fuf-changelist-mode* | |||
fuf-commands fuf.jax /*fuf-commands* | |||
fuf-contact fuf.jax /*fuf-contact* | |||
fuf-coveragefile-mode fuf.jax /*fuf-coveragefile-mode* | |||
fuf-data-file fuf.jax /*fuf-data-file* | |||
fuf-detailed-topics fuf.jax /*fuf-detailed-topics* | |||
fuf-dir-mode fuf.jax /*fuf-dir-mode* | |||
fuf-dot-sequence fuf.jax /*fuf-dot-sequence* | |||
fuf-file-mode fuf.jax /*fuf-file-mode* | |||
fuf-givencmd-mode fuf.jax /*fuf-givencmd-mode* | |||
fuf-givendir-mode fuf.jax /*fuf-givendir-mode* | |||
fuf-givenfile-mode fuf.jax /*fuf-givenfile-mode* | |||
fuf-help-mode fuf.jax /*fuf-help-mode* | |||
fuf-hiding-menu fuf.jax /*fuf-hiding-menu* | |||
fuf-how-to-add-mode fuf.jax /*fuf-how-to-add-mode* | |||
fuf-installation fuf.jax /*fuf-installation* | |||
fuf-introduction fuf.jax /*fuf-introduction* | |||
fuf-jumplist-mode fuf.jax /*fuf-jumplist-mode* | |||
fuf-line-mode fuf.jax /*fuf-line-mode* | |||
fuf-migemo fuf.jax /*fuf-migemo* | |||
fuf-modes fuf.jax /*fuf-modes* | |||
fuf-mrucmd-mode fuf.jax /*fuf-mrucmd-mode* | |||
fuf-mrufile-mode fuf.jax /*fuf-mrufile-mode* | |||
fuf-multiple-search fuf.jax /*fuf-multiple-search* | |||
fuf-options fuf.jax /*fuf-options* | |||
fuf-options-for-all-modes fuf.jax /*fuf-options-for-all-modes* | |||
fuf-options-for-bookmarkdir-mode fuf.jax /*fuf-options-for-bookmarkdir-mode* | |||
fuf-options-for-bookmarkfile-mode fuf.jax /*fuf-options-for-bookmarkfile-mode* | |||
fuf-options-for-buffer-mode fuf.jax /*fuf-options-for-buffer-mode* | |||
fuf-options-for-buffertag-mode fuf.jax /*fuf-options-for-buffertag-mode* | |||
fuf-options-for-changelist-mode fuf.jax /*fuf-options-for-changelist-mode* | |||
fuf-options-for-coveragefile-mode fuf.jax /*fuf-options-for-coveragefile-mode* | |||
fuf-options-for-dir-mode fuf.jax /*fuf-options-for-dir-mode* | |||
fuf-options-for-file-mode fuf.jax /*fuf-options-for-file-mode* | |||
fuf-options-for-help-mode fuf.jax /*fuf-options-for-help-mode* | |||
fuf-options-for-jumplist-mode fuf.jax /*fuf-options-for-jumplist-mode* | |||
fuf-options-for-line-mode fuf.jax /*fuf-options-for-line-mode* | |||
fuf-options-for-mrucmd-mode fuf.jax /*fuf-options-for-mrucmd-mode* | |||
fuf-options-for-mrufile-mode fuf.jax /*fuf-options-for-mrufile-mode* | |||
fuf-options-for-quickfix-mode fuf.jax /*fuf-options-for-quickfix-mode* | |||
fuf-options-for-tag-mode fuf.jax /*fuf-options-for-tag-mode* | |||
fuf-options-for-taggedfile-mode fuf.jax /*fuf-options-for-taggedfile-mode* | |||
fuf-quickfix-mode fuf.jax /*fuf-quickfix-mode* | |||
fuf-reusing-window fuf.jax /*fuf-reusing-window* | |||
fuf-search-patterns fuf.jax /*fuf-search-patterns* | |||
fuf-setting-one-time-option fuf.jax /*fuf-setting-one-time-option* | |||
fuf-sorting-of-completion-items fuf.jax /*fuf-sorting-of-completion-items* | |||
fuf-tag-mode fuf.jax /*fuf-tag-mode* | |||
fuf-taggedfile-mode fuf.jax /*fuf-taggedfile-mode* | |||
fuf-usage fuf.jax /*fuf-usage* | |||
fuf-vimrc-example fuf.jax /*fuf-vimrc-example* | |||
fuf.jax fuf.jax /*fuf.jax* | |||
fuzzyfinder fuf.jax /*fuzzyfinder* | |||
g:fuf_abbrevMap fuf.jax /*g:fuf_abbrevMap* | |||
g:fuf_autoPreview fuf.jax /*g:fuf_autoPreview* | |||
g:fuf_bookmarkdir_keyDelete fuf.jax /*g:fuf_bookmarkdir_keyDelete* | |||
g:fuf_bookmarkdir_prompt fuf.jax /*g:fuf_bookmarkdir_prompt* | |||
g:fuf_bookmarkdir_switchOrder fuf.jax /*g:fuf_bookmarkdir_switchOrder* | |||
g:fuf_bookmarkfile_keyDelete fuf.jax /*g:fuf_bookmarkfile_keyDelete* | |||
g:fuf_bookmarkfile_prompt fuf.jax /*g:fuf_bookmarkfile_prompt* | |||
g:fuf_bookmarkfile_searchRange fuf.jax /*g:fuf_bookmarkfile_searchRange* | |||
g:fuf_bookmarkfile_switchOrder fuf.jax /*g:fuf_bookmarkfile_switchOrder* | |||
g:fuf_buffer_keyDelete fuf.jax /*g:fuf_buffer_keyDelete* | |||
g:fuf_buffer_mruOrder fuf.jax /*g:fuf_buffer_mruOrder* | |||
g:fuf_buffer_prompt fuf.jax /*g:fuf_buffer_prompt* | |||
g:fuf_buffer_switchOrder fuf.jax /*g:fuf_buffer_switchOrder* | |||
g:fuf_buffertag_ctagsPath fuf.jax /*g:fuf_buffertag_ctagsPath* | |||
g:fuf_buffertag_prompt fuf.jax /*g:fuf_buffertag_prompt* | |||
g:fuf_buffertag_switchOrder fuf.jax /*g:fuf_buffertag_switchOrder* | |||
g:fuf_changelist_prompt fuf.jax /*g:fuf_changelist_prompt* | |||
g:fuf_changelist_switchOrder fuf.jax /*g:fuf_changelist_switchOrder* | |||
g:fuf_coveragefile_exclude fuf.jax /*g:fuf_coveragefile_exclude* | |||
g:fuf_coveragefile_globPatterns fuf.jax /*g:fuf_coveragefile_globPatterns* | |||
g:fuf_coveragefile_prompt fuf.jax /*g:fuf_coveragefile_prompt* | |||
g:fuf_coveragefile_switchOrder fuf.jax /*g:fuf_coveragefile_switchOrder* | |||
g:fuf_dataDir fuf.jax /*g:fuf_dataDir* | |||
g:fuf_dir_exclude fuf.jax /*g:fuf_dir_exclude* | |||
g:fuf_dir_prompt fuf.jax /*g:fuf_dir_prompt* | |||
g:fuf_dir_switchOrder fuf.jax /*g:fuf_dir_switchOrder* | |||
g:fuf_enumeratingLimit fuf.jax /*g:fuf_enumeratingLimit* | |||
g:fuf_file_exclude fuf.jax /*g:fuf_file_exclude* | |||
g:fuf_file_prompt fuf.jax /*g:fuf_file_prompt* | |||
g:fuf_file_switchOrder fuf.jax /*g:fuf_file_switchOrder* | |||
g:fuf_fuzzyRefining fuf.jax /*g:fuf_fuzzyRefining* | |||
g:fuf_help_prompt fuf.jax /*g:fuf_help_prompt* | |||
g:fuf_help_switchOrder fuf.jax /*g:fuf_help_switchOrder* | |||
g:fuf_ignoreCase fuf.jax /*g:fuf_ignoreCase* | |||
g:fuf_jumplist_prompt fuf.jax /*g:fuf_jumplist_prompt* | |||
g:fuf_jumplist_switchOrder fuf.jax /*g:fuf_jumplist_switchOrder* | |||
g:fuf_keyNextMode fuf.jax /*g:fuf_keyNextMode* | |||
g:fuf_keyNextPattern fuf.jax /*g:fuf_keyNextPattern* | |||
g:fuf_keyOpen fuf.jax /*g:fuf_keyOpen* | |||
g:fuf_keyOpenSplit fuf.jax /*g:fuf_keyOpenSplit* | |||
g:fuf_keyOpenTabpage fuf.jax /*g:fuf_keyOpenTabpage* | |||
g:fuf_keyOpenVsplit fuf.jax /*g:fuf_keyOpenVsplit* | |||
g:fuf_keyPrevMode fuf.jax /*g:fuf_keyPrevMode* | |||
g:fuf_keyPrevPattern fuf.jax /*g:fuf_keyPrevPattern* | |||
g:fuf_keyPreview fuf.jax /*g:fuf_keyPreview* | |||
g:fuf_keySwitchMatching fuf.jax /*g:fuf_keySwitchMatching* | |||
g:fuf_learningLimit fuf.jax /*g:fuf_learningLimit* | |||
g:fuf_line_prompt fuf.jax /*g:fuf_line_prompt* | |||
g:fuf_line_switchOrder fuf.jax /*g:fuf_line_switchOrder* | |||
g:fuf_maxMenuWidth fuf.jax /*g:fuf_maxMenuWidth* | |||
g:fuf_modesDisable fuf.jax /*g:fuf_modesDisable* | |||
g:fuf_mrucmd_exclude fuf.jax /*g:fuf_mrucmd_exclude* | |||
g:fuf_mrucmd_maxItem fuf.jax /*g:fuf_mrucmd_maxItem* | |||
g:fuf_mrucmd_prompt fuf.jax /*g:fuf_mrucmd_prompt* | |||
g:fuf_mrucmd_switchOrder fuf.jax /*g:fuf_mrucmd_switchOrder* | |||
g:fuf_mrufile_exclude fuf.jax /*g:fuf_mrufile_exclude* | |||
g:fuf_mrufile_keyExpand fuf.jax /*g:fuf_mrufile_keyExpand* | |||
g:fuf_mrufile_maxItem fuf.jax /*g:fuf_mrufile_maxItem* | |||
g:fuf_mrufile_maxItemDir fuf.jax /*g:fuf_mrufile_maxItemDir* | |||
g:fuf_mrufile_prompt fuf.jax /*g:fuf_mrufile_prompt* | |||
g:fuf_mrufile_switchOrder fuf.jax /*g:fuf_mrufile_switchOrder* | |||
g:fuf_patternSeparator fuf.jax /*g:fuf_patternSeparator* | |||
g:fuf_previewHeight fuf.jax /*g:fuf_previewHeight* | |||
g:fuf_promptHighlight fuf.jax /*g:fuf_promptHighlight* | |||
g:fuf_quickfix_prompt fuf.jax /*g:fuf_quickfix_prompt* | |||
g:fuf_quickfix_switchOrder fuf.jax /*g:fuf_quickfix_switchOrder* | |||
g:fuf_reuseWindow fuf.jax /*g:fuf_reuseWindow* | |||
g:fuf_splitPathMatching fuf.jax /*g:fuf_splitPathMatching* | |||
g:fuf_tag_prompt fuf.jax /*g:fuf_tag_prompt* | |||
g:fuf_tag_switchOrder fuf.jax /*g:fuf_tag_switchOrder* | |||
g:fuf_taggedfile_prompt fuf.jax /*g:fuf_taggedfile_prompt* | |||
g:fuf_taggedfile_switchOrder fuf.jax /*g:fuf_taggedfile_switchOrder* | |||
g:fuf_timeFormat fuf.jax /*g:fuf_timeFormat* | |||
g:fuf_useMigemo fuf.jax /*g:fuf_useMigemo* |
@@ -0,0 +1,158 @@ | |||
"============================================================================= | |||
" Copyright (c) 2007-2010 Takeshi NISHIDA | |||
" | |||
" GetLatestVimScripts: 1984 1 :AutoInstall: FuzzyFinder | |||
"============================================================================= | |||
" LOAD GUARD {{{1 | |||
try | |||
if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 101, []) | |||
finish | |||
endif | |||
catch /E117/ | |||
echoerr '***** L9 library must be installed! *****' | |||
finish | |||
endtry | |||
" }}}1 | |||
"============================================================================= | |||
" LOCAL FUNCTIONS {{{1 | |||
" | |||
function s:initialize() | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_modesDisable' , [ 'mrufile', 'mrucmd', ]) | |||
call l9#defineVariableDefault('g:fuf_keyOpen' , '<CR>') | |||
call l9#defineVariableDefault('g:fuf_keyOpenSplit' , '<C-j>') | |||
call l9#defineVariableDefault('g:fuf_keyOpenVsplit' , '<C-k>') | |||
call l9#defineVariableDefault('g:fuf_keyOpenTabpage' , '<C-l>') | |||
call l9#defineVariableDefault('g:fuf_keyPreview' , '<C-@>') | |||
call l9#defineVariableDefault('g:fuf_keyNextMode' , '<C-t>') | |||
call l9#defineVariableDefault('g:fuf_keyPrevMode' , '<C-y>') | |||
call l9#defineVariableDefault('g:fuf_keyPrevPattern' , '<C-s>') | |||
call l9#defineVariableDefault('g:fuf_keyNextPattern' , '<C-_>') | |||
call l9#defineVariableDefault('g:fuf_keySwitchMatching', '<C-\><C-\>') | |||
call l9#defineVariableDefault('g:fuf_dataDir' , '~/.vim-fuf-data') | |||
call l9#defineVariableDefault('g:fuf_abbrevMap' , {}) | |||
call l9#defineVariableDefault('g:fuf_patternSeparator' , ';') | |||
call l9#defineVariableDefault('g:fuf_promptHighlight' , 'Question') | |||
call l9#defineVariableDefault('g:fuf_ignoreCase' , 1) | |||
call l9#defineVariableDefault('g:fuf_splitPathMatching', 1) | |||
call l9#defineVariableDefault('g:fuf_fuzzyRefining' , 0) | |||
call l9#defineVariableDefault('g:fuf_smartBs' , 1) | |||
call l9#defineVariableDefault('g:fuf_reuseWindow' , 1) | |||
call l9#defineVariableDefault('g:fuf_timeFormat' , '(%Y-%m-%d %H:%M:%S)') | |||
call l9#defineVariableDefault('g:fuf_learningLimit' , 100) | |||
call l9#defineVariableDefault('g:fuf_enumeratingLimit' , 50) | |||
call l9#defineVariableDefault('g:fuf_maxMenuWidth' , 78) | |||
call l9#defineVariableDefault('g:fuf_previewHeight' , 0) | |||
call l9#defineVariableDefault('g:fuf_autoPreview' , 0) | |||
call l9#defineVariableDefault('g:fuf_useMigemo' , 0) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_buffer_prompt' , '>Buffer[]>') | |||
call l9#defineVariableDefault('g:fuf_buffer_switchOrder', 10) | |||
call l9#defineVariableDefault('g:fuf_buffer_mruOrder' , 1) | |||
call l9#defineVariableDefault('g:fuf_buffer_keyDelete' , '<C-]>') | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_file_prompt' , '>File[]>') | |||
call l9#defineVariableDefault('g:fuf_file_switchOrder', 20) | |||
call l9#defineVariableDefault('g:fuf_file_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])') | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_coveragefile_prompt' , '>CoverageFile[]>') | |||
call l9#defineVariableDefault('g:fuf_coveragefile_switchOrder', 30) | |||
call l9#defineVariableDefault('g:fuf_coveragefile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])') | |||
call l9#defineVariableDefault('g:fuf_coveragefile_globPatterns', ['**/.*', '**/*']) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_dir_prompt' , '>Dir[]>') | |||
call l9#defineVariableDefault('g:fuf_dir_switchOrder', 40) | |||
call l9#defineVariableDefault('g:fuf_dir_exclude' , '\v(^|[/\\])\.(hg|git|bzr)($|[/\\])') | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_mrufile_prompt' , '>MRU-File[]>') | |||
call l9#defineVariableDefault('g:fuf_mrufile_switchOrder', 50) | |||
call l9#defineVariableDefault('g:fuf_mrufile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|^(\/\/|\\\\|\/mnt\/|\/media\/)') | |||
call l9#defineVariableDefault('g:fuf_mrufile_maxItem' , 200) | |||
call l9#defineVariableDefault('g:fuf_mrufile_maxItemDir' , 50) | |||
call l9#defineVariableDefault('g:fuf_mrufile_keyExpand' , '<C-]>') | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_mrucmd_prompt' , '>MRU-Cmd[]>') | |||
call l9#defineVariableDefault('g:fuf_mrucmd_switchOrder', 60) | |||
call l9#defineVariableDefault('g:fuf_mrucmd_exclude' , '^$') | |||
call l9#defineVariableDefault('g:fuf_mrucmd_maxItem' , 200) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_bookmarkfile_prompt' , '>Bookmark-File[]>') | |||
call l9#defineVariableDefault('g:fuf_bookmarkfile_switchOrder', 70) | |||
call l9#defineVariableDefault('g:fuf_bookmarkfile_searchRange', 400) | |||
call l9#defineVariableDefault('g:fuf_bookmarkfile_keyDelete' , '<C-]>') | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_bookmarkdir_prompt' , '>Bookmark-Dir[]>') | |||
call l9#defineVariableDefault('g:fuf_bookmarkdir_switchOrder', 80) | |||
call l9#defineVariableDefault('g:fuf_bookmarkdir_keyDelete' , '<C-]>') | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_tag_prompt' , '>Tag[]>') | |||
call l9#defineVariableDefault('g:fuf_tag_switchOrder', 90) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_buffertag_prompt' , '>Buffer-Tag[]>') | |||
call l9#defineVariableDefault('g:fuf_buffertag_switchOrder', 100) | |||
call l9#defineVariableDefault('g:fuf_buffertag_ctagsPath' , 'ctags') | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_taggedfile_prompt' , '>Tagged-File[]>') | |||
call l9#defineVariableDefault('g:fuf_taggedfile_switchOrder', 110) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_jumplist_prompt' , '>Jump-List[]>') | |||
call l9#defineVariableDefault('g:fuf_jumplist_switchOrder', 120) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_changelist_prompt' , '>Change-List[]>') | |||
call l9#defineVariableDefault('g:fuf_changelist_switchOrder', 130) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_quickfix_prompt' , '>Quickfix[]>') | |||
call l9#defineVariableDefault('g:fuf_quickfix_switchOrder', 140) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_line_prompt' , '>Line[]>') | |||
call l9#defineVariableDefault('g:fuf_line_switchOrder', 150) | |||
"--------------------------------------------------------------------------- | |||
call l9#defineVariableDefault('g:fuf_help_prompt' , '>Help[]>') | |||
call l9#defineVariableDefault('g:fuf_help_switchOrder', 160) | |||
"--------------------------------------------------------------------------- | |||
command! -bang -narg=0 FufEditDataFile call fuf#editDataFile() | |||
command! -bang -narg=0 FufRenewCache call s:renewCachesOfAllModes() | |||
"--------------------------------------------------------------------------- | |||
call fuf#addMode('buffer') | |||
call fuf#addMode('file') | |||
call fuf#addMode('coveragefile') | |||
call fuf#addMode('dir') | |||
call fuf#addMode('mrufile') | |||
call fuf#addMode('mrucmd') | |||
call fuf#addMode('bookmarkfile') | |||
call fuf#addMode('bookmarkdir') | |||
call fuf#addMode('tag') | |||
call fuf#addMode('buffertag') | |||
call fuf#addMode('taggedfile') | |||
call fuf#addMode('jumplist') | |||
call fuf#addMode('changelist') | |||
call fuf#addMode('quickfix') | |||
call fuf#addMode('line') | |||
call fuf#addMode('help') | |||
call fuf#addMode('givenfile') | |||
call fuf#addMode('givendir') | |||
call fuf#addMode('givencmd') | |||
call fuf#addMode('callbackfile') | |||
call fuf#addMode('callbackitem') | |||
"--------------------------------------------------------------------------- | |||
endfunction | |||
" | |||
function s:renewCachesOfAllModes() | |||
for m in fuf#getModeNames() | |||
call fuf#{m}#renewCache() | |||
endfor | |||
endfunction | |||
" }}}1 | |||
"============================================================================= | |||
" INITIALIZATION {{{1 | |||
call s:initialize() | |||
" }}}1 | |||
"============================================================================= | |||
" vim: set fdm=marker: |
@@ -0,0 +1,73 @@ | |||
" Vim syntax file | |||
" Language: build logs | |||
" Maintainer: Julian Ospald | |||
" Latest Revision: 30 May 2012 | |||
if exists("b:current_syntax") | |||
finish | |||
endif | |||
" flags | |||
syn match CFLAGS " -g" | |||
syn match CFLAGS " -[a-zA-Z][a-zA-Z0-9_\-\,\=\.\/]\+" | |||
syn match CPPFLAGS " -D[a-zA-Z0-9_\-\,\=\.\/\"]\+" | |||
syn match LINK " -l[a-zA-Z0-9_\-\,\=\.\/]\+" | |||
syn match LDFLAGS " -L[a-zA-Z0-9_\-\,\=\.\/]\+" | |||
syn match LDFLAGS " -Wl,[a-zA-Z0-9_\-\,\=\.\/]\+" | |||
syn match LDFLAGS " -shared" | |||
syn match LDFLAGS " -static" | |||
syn match LDFLAGS " -static[a-zA-Z0-9_\-\,\=\.\/]\+" | |||
syn match LDFLAGS " -rdynamic" | |||
syn match INCS " -I[a-zA-Z0-9_\-\,\=\.\/]\+" | |||
" files | |||
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.c" | |||
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.cc" | |||
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.cxx" | |||
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.cpp" | |||
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.h" | |||
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.hpp" | |||
syn match OBJECTS " [a-zA-Z0-9_\-\,\=\.\/]\+\.o" | |||
syn match LIBS " [a-zA-Z0-9_\,\=\.\/]\+\.a" | |||
syn match LIBS " [a-zA-Z0-9_\,\=\.\/]\+\.so" | |||
syn match LIBS " [a-zA-Z0-9_\,\=\.\/]\+\.so[\.0-9]\+" | |||
syn match TARGETS " -o [a-zA-Z0-9_\-\,\=\.\/]\+" | |||
" messages | |||
syn match cMLogMissing "[\./a-zA-Z0-9_]\+\.[a-zA-Z_]\+: No such .*$" | |||
syn match cMLogMissing "[\./a-zA-Z0-9_]\+\.[a-zA-Z_]\+: Datei oder Verzeichnis nicht gefunden" | |||
syn match cMLogMissing "undefined reference to .*$" | |||
syn match cMLogMissing "Keine Regel vorhanden.*$" | |||
syn match cMLogCurDir "Entering directory .*$" | |||
" syn match cMLogCurDir "cd [a-zA-Z0-9_\-\,\=\.\/]\+" | |||
syn match cMLogWarn "\<[wW]arn[iu]ng.*$" | |||
syn match cMLogErr "[Ee]rror.*$" | |||
syn match cMLogErr "No such .*$" | |||
" disrespected toolchain | |||
syn match toolchain "\V\C\<\(-\)\@<!ar\>" | |||
syn match toolchain "\V\C\<\(-\)\@<!ranlib\>" | |||
syn match toolchain "\V\C\<\(-\)\@<!cc\>" | |||
syn match toolchain "\V\C\<\(-\)\@<!gcc\>" | |||
syn match toolchain "\V\C\<\(-\)\@<!c\>\+++" | |||
syn match toolchain "\V\C\<\(-\)\@<!g\>\+++" | |||
hi cMLogWarn guifg=Red | |||
hi cMLogErr guifg=Red term=underline cterm=underline gui=underline | |||
hi cMLogCurDir guifg=Blue | |||
hi cMLogMissing guifg=Red | |||
hi toolchain guifg=Red | |||
hi CFLAGS guifg=Green | |||
hi CPPFLAGS guifg=DarkGreen | |||
hi LINK guifg=Yellow | |||
hi LDFLAGS guifg=Orange | |||
hi INCS guifg=DarkViolet | |||
hi TARGETS guifg=Brown | |||
hi LIBS guifg=Brown | |||
hi OBJECTS guifg=Black | |||
hi SOURCE guifg=Grey | |||
let b:current_syntax = "log" | |||
@@ -0,0 +1,461 @@ | |||
*paredit.txt* Paredit Last Change: 13 Dec 2016 | |||
Paredit Mode for Vim *paredit* *slimv-paredit* | |||
Version 0.9.13 | |||
The paredit.vim plugin performs structured editing of s-expressions used in | |||
the Lisp, Clojure, Scheme programming languages. It may come as part of Slimv | |||
but it is also distributed separately as a standalone plugin. | |||
|paredit-mode| Paredit mode | |||
|paredit-keys| Paredit keybindings | |||
|paredit-options| Paredit options | |||
=============================================================================== | |||
PAREDIT MODE *paredit-mode* | |||
Paredit mode is a special editing mode that keeps all matched characters | |||
(parentheses, square and curly braces, double quotes) balanced, i.e. all opening | |||
characters have a matching closing character. Most text entering and erasing | |||
commands try to maintain the balanced state, so no single matched character is | |||
added or deleted, they are entered or removed in pairs. | |||
The function takes care of strings and comments, so no parenthesis and square | |||
bracket balancing is performed inside a string or comment. | |||
Please note that [] and {} pairs are not balanced for Lisp filetypes, only | |||
for Clojure and Scheme. | |||
The idea is taken from the paredit mode of Emacs, but not all paredit.el | |||
editing functions are implemented or behave exactly the same way as they do | |||
in Emacs. | |||
When you enter a '(' then a matching ')' is automatically inserted. | |||
If needed, spaces before and/or after the '()' pair are added. | |||
When you press ')' in insert mode then there's no need to insert a closing | |||
parenthesis mark (it is already there), so the cursor is simply advanced past | |||
the next closing parenthesis (then the next outer closing parenthesis, etc.). | |||
The result of this is however that when entering text with paredit mode | |||
you can use the same keystrokes as without paredit mode and you get the same | |||
result. Of course you can choose to not enter the closing parenthesis (as | |||
required without paredit mode), because it is already there. | |||
When you are trying to delete a ')' alone then it is not possible, the cursor | |||
is simply moved inside the list, where all regular characters can be deleted. | |||
When the list is finally empty: '()', then the deletion of the opening '(' | |||
makes both parentheses erased at once, so the balanced state is maintained. | |||
All the above holds for [...] and "..." character pairs. | |||
When you are deleting multiple characters at once, e.g. deleting a whole line, | |||
or deleting till the end of the line, etc, then the deletion logic of a single | |||
character is iterated. This means that the whole line or the characters till | |||
the end of the line, etc are not necessarily deleted all. Depending on the | |||
number of open/close parentheses, square or curly braces, double quotes some | |||
of them might be kept in order to maintain the balanced state. | |||
For example if you press D in Normal mode to delete till the end of line | |||
between the a and b parameters of the following Clojure function definition: | |||
(defn myfunc [a b c] (+ a b c)) | |||
^--- press D here | |||
then the closing ] as well as the last closing ) will not be deleted, because | |||
in the list you have an ( and a [ to be matched, so the result will be: | |||
(defn myfunc [a]) | |||
If you are deleting multiple lines, then the above process is performed for | |||
all lines involved. If a line was not completely cleared, then it is joined | |||
with the next line and the process continues. | |||
Of course not all Vim commands are compatible with the paredit mode (e.g. | |||
you can yank and paste unbalanced code snippet, or comment out an asymmetrical | |||
part of the code), and there is also the possibility to edit the source code | |||
with paredit mode switched off or with another editor to make it unbalanced. | |||
When paredit mode detects that the underlying code is not balanced, then the | |||
paredit functionality is suspended until the top level form balance is fixed. | |||
As soon as all parens are matched, the paredit mode is automatically resumed. | |||
Paredit needs "syntax on" to identify the syntax elements of the underlying | |||
code, so if syntax is switched off, then paredit will not be suspended inside | |||
comments or strings. | |||
Slurpage and Barfage known from Emacs is also possible but in a different | |||
fashion: you don't move the symbols but move the opening or closing parenthesis | |||
over the symbol or a sub-list. This way you can move any symbol or sub-list | |||
into or out of the current list. It is not possible to move the parenthesis | |||
over its pair, so for example if you move the opening parenthesis to the right, | |||
then it will stop at the matched closing parenthesis. | |||
Paredit mode is set by default for .lisp, .cl, .clj, cljs, .scm and .rkt files, | |||
but it is possible to switch it off by putting the following statement in the | |||
.vimrc file: | |||
let g:paredit_mode = 0 | |||
You can enable paredit mode for other file types as well. Here is how to set | |||
it for Arc files in your .vimrc (assuming you have a filetype 'arc' defined): | |||
au FileType arc call PareditInitBuffer() | |||
Paredit is part of Slimv, but it is also distributed separately as a standalone | |||
plugin. If you indend to use the SWANK client and/or Slimv's indentation and | |||
syntax functions, then please install the Slimv plugin. Otherwise you may want | |||
to install the Paredit plugin thus omitting other unnecessary files. | |||
=============================================================================== | |||
PAREDIT KEYBINDINGS *paredit-keys* | |||
Here follows a list of paredit keybindings: | |||
Insert Mode: | |||
( Inserts '()' and moves the cursor inside. Also adds leading | |||
or trailing spaces when needed. | |||
Inserts '(' when inside comment or string. | |||
) Moves the cursor to the next closing parenthesis mark of | |||
the current list. When pressed again then moves to the next | |||
outer closing parenthesis, etc, until the closing of the | |||
top level form is reached. | |||
Inserts ')' when inside comment or string. | |||
If |g:paredit_electric_return| is on then it also re-gathers | |||
electric returns when appropriate. | |||
[ Inserts '[]' and moves the cursor inside. Also adds leading | |||
or trailing spaces when needed. | |||
Inserts '[' when inside comment or string. | |||
] Moves the cursor to the next closing square bracket of the | |||
current list. When pressed again then moves to the next | |||
outer closing square bracket, etc, until the closing of the | |||
top level form is reached. | |||
Inserts ']' when inside comment or string. | |||
If |g:paredit_electric_return| is on then it also re-gathers | |||
electric returns when appropriate. | |||
{ Inserts '{}' and moves the cursor inside. Also adds leading | |||
or trailing spaces when needed. | |||
Inserts '{' when inside comment or string. | |||
} Moves the cursor to the next closing curly brace of the | |||
current list. When pressed again then moves to the next | |||
outer closing curly brace, etc, until the closing of the | |||
top level form is reached. | |||
Inserts '}' when inside comment or string. | |||
If |g:paredit_electric_return| is on then it also re-gathers | |||
electric returns when appropriate. | |||
" When outside of string, inserts '""' and moves the cursor | |||
inside. When inside string then moves to the closing '"'. | |||
Inserts '"' when inside comment. Also insert '"' when inside | |||
string and preceded by a '\'. | |||
<BS> When about to delete a (, ), [, ], or " and there are other | |||
characters inside, then just skip it to the left. When | |||
about to delete the opening part of the matched character | |||
with nothing inside, then the whole empty list is removed. | |||
<Del> When about to delete a (, ), [, ], or " and there are other | |||
characters inside, then just skip it to the right. When | |||
about to delete the closing part of the matched character | |||
with nothing inside, then the whole empty list is removed. | |||
<Enter> If |g:paredit_electric_return| is on then insert an | |||
"electric return", i.e. create an empty line by inserting | |||
two newline characters. | |||
Normal Mode: | |||
( Finds opening '(' of the current list. Can be pressed | |||
repeatedly until the opening of the top level form reached. | |||
) Finds closing ')' of the current list. Can be pressed | |||
repeatedly until the closing of the top level form reached. | |||
[[ Go to the start of current/previous defun. | |||
]] Go to the start of next defun. | |||
<Leader>< If standing on a delimiter (parenthesis or square bracket) | |||
then moves it to the left by slurping or barfing the | |||
s-expression to the left, depending on the direction of the | |||
delimiter: | |||
Pressing '<' when standing on a ')' makes the s-expression | |||
to the left of the ')' going out of the current list. | |||
Pressing '<' when standing on a '(' makes the s-expression | |||
to the left of the '(' coming into the current list. | |||
For example pressing <Leader>< at position marked with |: | |||
(aaa bbb|) ---> (aaa|) bbb | |||
aaa |(bbb) ---> |(aaa bbb) | |||
<Leader>> If standing on a delimiter (parenthesis or square bracket) | |||
then moves it to the right by slurping or barfing the | |||
s-expression to the right, depending on the direction of the | |||
delimiter: | |||
Pressing '>' when standing on a '(' makes the s-expression | |||
to the right of the '(' going out of the current list. | |||
Pressing '>' when standing on a ')' makes the s-expression | |||
to the right of the ')' coming into the current list. | |||
For example pressing <Leader>< at position marked with |: | |||
(aaa|) bbb ---> (aaa bbb|) | |||
|(aaa bbb) ---> aaa |(bbb) | |||
<Leader>J Join two subsequent lists or strings. The first one must end | |||
before the cursor, the second one must start after the | |||
cursor position. | |||
For example pressing <Leader>J at position marked with |: | |||
(aaa)| (bbb) ---> (aaa |bbb) | |||
"aaa"| "bbb" ---> "aaa |bbb" | |||
<Leader>O Split ("Open") current list or string at the cursor position. | |||
Opposite of Join. Key O is selected because for the original | |||
Vim mapping J and O are also kind of opposites. | |||
For example pressing <Leader>O at position marked with |: | |||
(aaa |bbb) ---> (aaa) |(bbb) | |||
"aaa|bbb" ---> "aaa" |"bbb" | |||
<Leader>W Wrap the current symbol in a pair of parentheses. The cursor | |||
<Leader>w( is then positioned on the opening parenthesis, as wrapping | |||
is usually done because one wants to call a function with | |||
the symbol as parameter, so by pressing "a" one can enter | |||
the function name right after the newly inserted "(". | |||
For example pressing <Leader>W at position marked with |: | |||
(aaa b|bb ccc) ---> (aaa |(bbb) ccc) | |||
<Leader>w[ Wrap the current symbol in a pair of square brackets, | |||
similarly to <Leader>W. | |||
For example pressing <Leader>w[ at position marked with |: | |||
(aaa b|bb ccc) ---> (aaa |[bbb] ccc) | |||
<Leader>w{ Wrap the current symbol in a pair of curly braces, | |||
similarly to <Leader>W. | |||
For example pressing <Leader>w{ at position marked with |: | |||
(aaa b|bb ccc) ---> (aaa |{bbb} ccc) | |||
<Leader>w" Wrap the current symbol in a pair of double quotes, | |||
similarly to <Leader>W. | |||
For example pressing <Leader>w" at position marked with |: | |||
(aaa b|bb ccc) ---> (aaa "bbb|" ccc) | |||
<Leader>S Splice the current list into the containing list, i.e. | |||
remove the opening and closing parens. Opposite of wrap. | |||
For example pressing <Leader>S at position marked with |: | |||
(aaa (b|bb ccc) ddd) ---> (aaa |bbb ccc ddd) | |||
<Leader><Up> Splice the current list into the containing list by deleting | |||
everything backward from the cursor position up to the | |||
opening paren. | |||
For example pressing <Leader><Up> at position marked with |: | |||
(aaa (bbb |ccc) ddd) ---> (aaa |ccc ddd) | |||
<Leader><Down> Splice the current list into the containing list by deleting | |||
everything forward from the cursor position up to the | |||
closing paren. | |||
For example pressing <Leader><Down> at position marked with |: | |||
(aaa (bbb| ccc) ddd) ---> (aaa |bbb ddd) | |||
<Leader>I Raise the current symbol, i.e. replace the current list with | |||
the current symbol by deleting everything else (except the | |||
symbol) in the list, including the enclosing pair of parens. | |||
For example pressing <Leader>I at position marked with |: | |||
(aaa (b|bb ccc) ddd) ---> (aaa |bbb ddd) | |||
x or <Del> When about to delete a (, ), [, ], or " and there are other | |||
characters inside, then just skip it to the right. When | |||
about to delete the closing part of the matched character | |||
with nothing inside, then the whole empty list is removed. | |||
When preceded by a <count> value then delete this many | |||
characters. | |||
X When about to delete a (, ), [, ], or " and there are other | |||
characters inside, then just skip it to the left. When | |||
about to delete the opening part of the matched character | |||
with nothing inside, then the whole empty list is removed. | |||
D Keep deleting characters towards the end of line, | |||
maintaining the balanced state, i.e. keep the number of | |||
opening and closing parens the same. | |||
C Same as 'D' but go to insert mode at the end. | |||
s Same as 'x' but go to insert mode at the end. | |||
dd Delete whole line by keeping the balanced state, i.e. | |||
keep the number of opening and closing parens the same. | |||
When preceded by a <count> value then delete this many | |||
lines. | |||
cc Same as 'dd' but go to insert mode at the end. | |||
d{motion} Delete text till {motion}. Keeps text balanced, so if the | |||
surrounded text contains unpaired matched characters then | |||
they are not removed. | |||
c{motion} Delete text till {motion} and start insert mode. Keeps text | |||
balanced just like d{motion}. | |||
p Put the text after the cursor with all unbalanced matched | |||
characters removed. | |||
P Put the text before the cursor with all unbalanced matched | |||
characters removed. | |||
Visual Mode: | |||
( Finds opening '(' of the current list and selects the whole | |||
list. Can be pressed repeatedly until the top level form | |||
selected. | |||
) Finds closing ')' of the current list and selects the whole | |||
list. Can be pressed repeatedly until the top level form | |||
selected. | |||
d Delete the current visual selection. Keeps text balanced, | |||
x so the the selection contains unpaired matched characters | |||
<Del> then they are not removed. | |||
c Delete the current visual selection and start insert mode. | |||
Keeps text balanced just like the 'd' command. | |||
<Leader>W Wrap the current visual selection in a pair of parentheses. | |||
<Leader>w( The visual selection is kept. | |||
<Leader>w[ Wrap the current visual selection in a pair of square | |||
brackets. The visual selection is kept. | |||
<Leader>w{ Wrap the current visual selection in a pair of curly braces. | |||
The visual selection is kept. | |||
<Leader>w" Wrap the current visual selection in a pair of double | |||
quotes. The visual selection is kept. | |||
Please note that if variable |g:paredit_shortmaps| is nonzero then the | |||
following normal mode mappings don't get a <Leader> prefix, they are mapped | |||
to existing (but infrequently used) Vim functions and instead the original Vim | |||
functions are mapped with the <Leader> prefix: | |||
<, >, J, O, W, S | |||
Vim has many built-in mappings for manipulating s-expressions. Here follows a | |||
list of useful commands, these are not defined by paredit.vim, they are | |||
available even when paredit mode is switched off. | |||
% Find the matching pair of the parenthesis the cursor is | |||
standing on. | |||
d% Delete till the matching parenthesis. Normally it is used | |||
when the cursor is standing on a parenthesis (works with | |||
square or curly braces as well). If not standing on a | |||
parenthesis then deletes left till the first opening paren, | |||
so this command may also be used to delete an s-expression | |||
that is right before the cursor. | |||
daw Delete a word. Can be used to delete a list element, the | |||
cursor may be placed anywhere in the element. | |||
da( Delete the innermost s-expression. The cursor may be placed | |||
anywhere inside the s-expression. | |||
di( Same as da( but does not delete the enclosing parens. | |||
Davide Taviani made a cheetsheet for Paredit, which can be accessed here: | |||
https://github.com/StudyFlow/paredit.vim-cheatsheet | |||
=============================================================================== | |||
PAREDIT OPTIONS *paredit-options* | |||
|g:paredit_disable_clojure| If defined, paredit is disabled for clojure files. | |||
|g:paredit_disable_hy| If defined, paredit is disabled for hy files. | |||
|g:paredit_disable_lisp| If defined, paredit is disabled for lisp files. | |||
|g:paredit_disable_scheme| If defined, paredit is disabled for scheme files. | |||
|g:paredit_disable_shen| If defined, paredit is disabled for shen files. | |||
|g:paredit_electric_return| If nonzero, electric return feature is enabled. | |||
|g:paredit_smartjump| If nonzero, '(' and ')' also target square brackets | |||
and curly braces when editing Clojure or Scheme. | |||
|g:paredit_leader| Custom <Leader> setting for Paredit. | |||
|g:paredit_matchlines| Number of lines to look backward and forward | |||
when checking if the current form is balanced. | |||
|g:paredit_mode| If nonzero, paredit mode is switched on. | |||
|g:paredit_shortmaps| If nonzero, paredit is remapping some one-letter | |||
Vim commands that are not frequently used. | |||
*g:paredit_disable_clojure* | |||
*g:paredit_disable_lisp* | |||
*g:paredit_disable_scheme* | |||
*g:paredit_disable_shen* | |||
If defined then paredit is disabled for the given file type. Useful to use | |||
a different plugin for a specific file type, but keep using paredit for the | |||
others. | |||
*g:paredit_electric_return* | |||
If nonzero then "electric return" feature is enabled. This means that when an | |||
<Enter> is pressed before a closing paren in insert mode, paredit will actually | |||
insert two newlines creating an empty line. The extra newline is consumed at | |||
pressing the next closing paren. This feature allows linewise editing of the | |||
subform entered in the next (empty) line. | |||
In other words <Enter> "opens" parenthetical expressions while editing, ')' | |||
"closes" them. | |||
Please note that electric return is disabled for the REPL buffer if Slimv | |||
option |g:slimv_repl_simple_eval| is nonzero. In this case <Enter> is used | |||
to send the command line to the swank server for evaluation. | |||
Please find a video demonstration of the electric return feature here: | |||
http://img8.imageshack.us/img8/9479/openparen.gif | |||
*g:paredit_smartjump* | |||
If nonzero, this option changes the behavior of '(' and ')' in normal and visual | |||
modes when editing Clojure or Scheme. Rather than jumping to nearest open or close | |||
parenthesis, instead the cursor will jump to the nearest '(', '[', or '{' if | |||
you press '(', and it will jump to the nearest ')', ']', or '}' if you press | |||
')'. This option makes it much easier to navigate nested Clojure data | |||
structures. It does nothing if the filetype is not clojure or Scheme. | |||
*g:paredit_leader* | |||
This option allows a custom <Leader> setting for the Paredit keybindings. | |||
By default it has the same value as |mapleader|. If neither g:paredit_leader | |||
nor mapleader are defined then the default <Leader> is "," in Paredit. | |||
Example: | |||
let g:paredit_leader = '\' | |||
If this is set in the .vimrc then Wrap will be mapped to \W instead of ,W. | |||
There is a separate |g:slimv_leader| option for the general Slimv keybindings. | |||
*g:paredit_matchlines* | |||
Number of lines to look backward and forward when checking if the current | |||
top level form is balanced in paredit mode. Default is 100. | |||
*g:paredit_mode* | |||
If nonzero then paredit mode is switched on, i.e. the plugin tries to keep the | |||
balanced state of parens. This is the default behaviour. | |||
*g:paredit_shortmaps* | |||
If nonzero, paredit is remapping some one-letter normal mode Vim commands that | |||
are not frequently used. These are <, >, J, O, W, S. The original function of | |||
these maps then can be reached via <Leader> (which is the "," character | |||
by default in Paredit). | |||
Otherwise these paredit functions can be reached via <Leader> maintaining the | |||
original functions of these keys. | |||
=============================================================================== | |||
vim:tw=80:et:wrap:ft=help:norl: |
@@ -0,0 +1,58 @@ | |||
function! Send_to_Tmux(text) | |||
if !exists("b:tmux_sessionname") || !exists("b:tmux_windowname") | |||
if exists("g:tmux_sessionname") && exists("g:tmux_windowname") | |||
let b:tmux_sessionname = g:tmux_sessionname | |||
let b:tmux_windowname = g:tmux_windowname | |||
if exists("g:tmux_panenumber") | |||
let b:tmux_panenumber = g:tmux_panenumber | |||
end | |||
else | |||
call Tmux_Vars() | |||
end | |||
end | |||
let target = b:tmux_sessionname . ":" . b:tmux_windowname | |||
if exists("b:tmux_panenumber") | |||
let target .= "." . b:tmux_panenumber | |||
end | |||
call system("tmux set-buffer -t " . b:tmux_sessionname . " '" . substitute(a:text, "'", "'\\\\''", 'g') . "'" ) | |||
call system("tmux paste-buffer -t " . target) | |||
endfunction | |||
function! Tmux_Session_Names(A,L,P) | |||
return system("tmux list-sessions | sed -e 's/:.*$//'") | |||
endfunction | |||
function! Tmux_Window_Names(A,L,P) | |||
return system("tmux list-windows -t" . b:tmux_sessionname . ' | grep -e "^\w:" | sed -e "s/ \[[0-9x]*\]$//"') | |||
endfunction | |||
function! Tmux_Pane_Numbers(A,L,P) | |||
return system("tmux list-panes -t " . b:tmux_sessionname . ":" . b:tmux_windowname . " | sed -e 's/:.*$//'") | |||
endfunction | |||
function! Tmux_Vars() | |||
let b:tmux_sessionname = input("session name: ", "", "custom,Tmux_Session_Names") | |||
let b:tmux_windowname = substitute(input("window name: ", "", "custom,Tmux_Window_Names"), ":.*$" , '', 'g') | |||
if system("tmux list-panes -t " . b:tmux_sessionname . ":" . b:tmux_windowname . " | wc -l") > 1 | |||
let b:tmux_panenumber = input("pane number: ", "", "custom,Tmux_Pane_Numbers") | |||
end | |||
if !exists("g:tmux_sessionname") || !exists("g:tmux_windowname") | |||
let g:tmux_sessionname = b:tmux_sessionname | |||
let g:tmux_windowname = b:tmux_windowname | |||
if exists("b:tmux_panenumber") | |||
let g:tmux_panenumber = b:tmux_panenumber | |||
end | |||
end | |||
endfunction | |||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |||
vmap <C-c><C-c> "ry :call Send_to_Tmux(@r)<CR> | |||
nmap <C-c><C-c> vip<C-c><C-c> | |||
nmap <C-c>v :call Tmux_Vars()<CR> |
@@ -0,0 +1,248 @@ | |||
'short'/'long'-formats txtfmt.txt /*'short'\/'long'-formats* | |||
<C-\><C-\> txtfmt.txt /*<C-\\><C-\\>* | |||
[a txtfmt.txt /*[a* | |||
[ba txtfmt.txt /*[ba* | |||
[bc txtfmt.txt /*[bc* | |||
[bf txtfmt.txt /*[bf* | |||
[bk txtfmt.txt /*[bk* | |||
[c txtfmt.txt /*[c* | |||
[ea txtfmt.txt /*[ea* | |||
[ec txtfmt.txt /*[ec* | |||
[ef txtfmt.txt /*[ef* | |||
[ek txtfmt.txt /*[ek* | |||
[f txtfmt.txt /*[f* | |||
[k txtfmt.txt /*[k* | |||
[ta txtfmt.txt /*[ta* | |||
[tba txtfmt.txt /*[tba* | |||
[tbc txtfmt.txt /*[tbc* | |||
[tbf txtfmt.txt /*[tbf* | |||
[tbk txtfmt.txt /*[tbk* | |||
[tc txtfmt.txt /*[tc* | |||
[tea txtfmt.txt /*[tea* | |||
[tec txtfmt.txt /*[tec* | |||
[tef txtfmt.txt /*[tef* | |||
[tek txtfmt.txt /*[tek* | |||
[tf txtfmt.txt /*[tf* | |||
[tk txtfmt.txt /*[tk* | |||
\A txtfmt.txt /*\\A* | |||
\I txtfmt.txt /*\\I* | |||
\O txtfmt.txt /*\\O* | |||
\a txtfmt.txt /*\\a* | |||
\ga txtfmt.txt /*\\ga* | |||
\i txtfmt.txt /*\\i* | |||
\o txtfmt.txt /*\\o* | |||
\s txtfmt.txt /*\\s* | |||
\vA txtfmt.txt /*\\vA* | |||
\vI txtfmt.txt /*\\vI* | |||
\vO txtfmt.txt /*\\vO* | |||
\va txtfmt.txt /*\\va* | |||
\vi txtfmt.txt /*\\vi* | |||
\vo txtfmt.txt /*\\vo* | |||
\vs txtfmt.txt /*\\vs* | |||
]a txtfmt.txt /*]a* | |||
]ba txtfmt.txt /*]ba* | |||
]bc txtfmt.txt /*]bc* | |||
]bf txtfmt.txt /*]bf* | |||
]bk txtfmt.txt /*]bk* | |||
]c txtfmt.txt /*]c* | |||
]ea txtfmt.txt /*]ea* | |||
]ec txtfmt.txt /*]ec* | |||
]ef txtfmt.txt /*]ef* | |||
]ek txtfmt.txt /*]ek* | |||
]f txtfmt.txt /*]f* | |||
]k txtfmt.txt /*]k* | |||
]ta txtfmt.txt /*]ta* | |||
]tba txtfmt.txt /*]tba* | |||
]tbc txtfmt.txt /*]tbc* | |||
]tbf txtfmt.txt /*]tbf* | |||
]tbk txtfmt.txt /*]tbk* | |||
]tc txtfmt.txt /*]tc* | |||
]tea txtfmt.txt /*]tea* | |||
]tec txtfmt.txt /*]tec* | |||
]tef txtfmt.txt /*]tef* | |||
]tek txtfmt.txt /*]tek* | |||
]tf txtfmt.txt /*]tf* | |||
]tk txtfmt.txt /*]tk* | |||
indent_patch.txt txtfmt.txt /*indent_patch.txt* | |||
txtfmt txtfmt.txt /*txtfmt* | |||
txtfmt-'bcm' txtfmt.txt /*txtfmt-'bcm'* | |||
txtfmt-'bgcolormask' txtfmt.txt /*txtfmt-'bgcolormask'* | |||
txtfmt-'cncl' txtfmt.txt /*txtfmt-'cncl'* | |||
txtfmt-'cocu' txtfmt.txt /*txtfmt-'cocu'* | |||
txtfmt-'conceal' txtfmt.txt /*txtfmt-'conceal'* | |||
txtfmt-'concealcursor' txtfmt.txt /*txtfmt-'concealcursor'* | |||
txtfmt-'esc' txtfmt.txt /*txtfmt-'esc'* | |||
txtfmt-'escape' txtfmt.txt /*txtfmt-'escape'* | |||
txtfmt-'fcm' txtfmt.txt /*txtfmt-'fcm'* | |||
txtfmt-'fgcolormask' txtfmt.txt /*txtfmt-'fgcolormask'* | |||
txtfmt-'nested' txtfmt.txt /*txtfmt-'nested'* | |||
txtfmt-'nst' txtfmt.txt /*txtfmt-'nst'* | |||
txtfmt-'pack' txtfmt.txt /*txtfmt-'pack'* | |||
txtfmt-'pck' txtfmt.txt /*txtfmt-'pck'* | |||
txtfmt-'rng' txtfmt.txt /*txtfmt-'rng'* | |||
txtfmt-'sync' txtfmt.txt /*txtfmt-'sync'* | |||
txtfmt-'tokrange' txtfmt.txt /*txtfmt-'tokrange'* | |||
txtfmt-'tokrange'-expr txtfmt.txt /*txtfmt-'tokrange'-expr* | |||
txtfmt-'uc' txtfmt.txt /*txtfmt-'uc'* | |||
txtfmt-'undercurl' txtfmt.txt /*txtfmt-'undercurl'* | |||
txtfmt-:GetTokInfo txtfmt.txt /*txtfmt-:GetTokInfo* | |||
txtfmt-:MakeTestPage txtfmt.txt /*txtfmt-:MakeTestPage* | |||
txtfmt-:MoveStartTok txtfmt.txt /*txtfmt-:MoveStartTok* | |||
txtfmt-:Refresh txtfmt.txt /*txtfmt-:Refresh* | |||
txtfmt-:ShowTokenMap txtfmt.txt /*txtfmt-:ShowTokenMap* | |||
txtfmt-GetTokInfo() txtfmt.txt /*txtfmt-GetTokInfo()* | |||
txtfmt-GetTokStr() txtfmt.txt /*txtfmt-GetTokStr()* | |||
txtfmt-bck-till-any-beg-tok txtfmt.txt /*txtfmt-bck-till-any-beg-tok* | |||
txtfmt-bck-till-any-end-tok txtfmt.txt /*txtfmt-bck-till-any-end-tok* | |||
txtfmt-bck-till-any-tok txtfmt.txt /*txtfmt-bck-till-any-tok* | |||
txtfmt-bck-till-bgc-beg-tok txtfmt.txt /*txtfmt-bck-till-bgc-beg-tok* | |||
txtfmt-bck-till-bgc-end-tok txtfmt.txt /*txtfmt-bck-till-bgc-end-tok* | |||
txtfmt-bck-till-bgc-tok txtfmt.txt /*txtfmt-bck-till-bgc-tok* | |||
txtfmt-bck-till-clr-beg-tok txtfmt.txt /*txtfmt-bck-till-clr-beg-tok* | |||
txtfmt-bck-till-clr-end-tok txtfmt.txt /*txtfmt-bck-till-clr-end-tok* | |||
txtfmt-bck-till-clr-tok txtfmt.txt /*txtfmt-bck-till-clr-tok* | |||
txtfmt-bck-till-fmt-beg-tok txtfmt.txt /*txtfmt-bck-till-fmt-beg-tok* | |||
txtfmt-bck-till-fmt-end-tok txtfmt.txt /*txtfmt-bck-till-fmt-end-tok* | |||
txtfmt-bck-till-fmt-tok txtfmt.txt /*txtfmt-bck-till-fmt-tok* | |||
txtfmt-bck-to-any-beg-tok txtfmt.txt /*txtfmt-bck-to-any-beg-tok* | |||
txtfmt-bck-to-any-end-tok txtfmt.txt /*txtfmt-bck-to-any-end-tok* | |||
txtfmt-bck-to-any-tok txtfmt.txt /*txtfmt-bck-to-any-tok* | |||
txtfmt-bck-to-bgc-beg-tok txtfmt.txt /*txtfmt-bck-to-bgc-beg-tok* | |||
txtfmt-bck-to-bgc-end-tok txtfmt.txt /*txtfmt-bck-to-bgc-end-tok* | |||
txtfmt-bck-to-bgc-tok txtfmt.txt /*txtfmt-bck-to-bgc-tok* | |||
txtfmt-bck-to-clr-beg-tok txtfmt.txt /*txtfmt-bck-to-clr-beg-tok* | |||
txtfmt-bck-to-clr-end-tok txtfmt.txt /*txtfmt-bck-to-clr-end-tok* | |||
txtfmt-bck-to-clr-tok txtfmt.txt /*txtfmt-bck-to-clr-tok* | |||
txtfmt-bck-to-fmt-beg-tok txtfmt.txt /*txtfmt-bck-to-fmt-beg-tok* | |||
txtfmt-bck-to-fmt-end-tok txtfmt.txt /*txtfmt-bck-to-fmt-end-tok* | |||
txtfmt-bck-to-fmt-tok txtfmt.txt /*txtfmt-bck-to-fmt-tok* | |||
txtfmt-buflocal-user-map txtfmt.txt /*txtfmt-buflocal-user-map* | |||
txtfmt-choosing-token-range txtfmt.txt /*txtfmt-choosing-token-range* | |||
txtfmt-clr-spec txtfmt.txt /*txtfmt-clr-spec* | |||
txtfmt-color-config txtfmt.txt /*txtfmt-color-config* | |||
txtfmt-color-defaults txtfmt.txt /*txtfmt-color-defaults* | |||
txtfmt-colorschemes txtfmt.txt /*txtfmt-colorschemes* | |||
txtfmt-combining txtfmt.txt /*txtfmt-combining* | |||
txtfmt-conceal-backwards-compatibility txtfmt.txt /*txtfmt-conceal-backwards-compatibility* | |||
txtfmt-conceal-history txtfmt.txt /*txtfmt-conceal-history* | |||
txtfmt-conceal-notes txtfmt.txt /*txtfmt-conceal-notes* | |||
txtfmt-configuration txtfmt.txt /*txtfmt-configuration* | |||
txtfmt-contents txtfmt.txt /*txtfmt-contents* | |||
txtfmt-create-tok-str txtfmt.txt /*txtfmt-create-tok-str* | |||
txtfmt-cterm-default-background txtfmt.txt /*txtfmt-cterm-default-background* | |||
txtfmt-cterm-ignore-issue txtfmt.txt /*txtfmt-cterm-ignore-issue* | |||
txtfmt-cterm-ignore-workaround txtfmt.txt /*txtfmt-cterm-ignore-workaround* | |||
txtfmt-cterm-pitfalls txtfmt.txt /*txtfmt-cterm-pitfalls* | |||
txtfmt-cterm-term-issue txtfmt.txt /*txtfmt-cterm-term-issue* | |||
txtfmt-default-tokrange txtfmt.txt /*txtfmt-default-tokrange* | |||
txtfmt-dist-files txtfmt.txt /*txtfmt-dist-files* | |||
txtfmt-encoding txtfmt.txt /*txtfmt-encoding* | |||
txtfmt-filetype txtfmt.txt /*txtfmt-filetype* | |||
txtfmt-fmt-clr-spec-list txtfmt.txt /*txtfmt-fmt-clr-spec-list* | |||
txtfmt-fmt-spec txtfmt.txt /*txtfmt-fmt-spec* | |||
txtfmt-formats txtfmt.txt /*txtfmt-formats* | |||
txtfmt-fwd-till-any-beg-tok txtfmt.txt /*txtfmt-fwd-till-any-beg-tok* | |||
txtfmt-fwd-till-any-end-tok txtfmt.txt /*txtfmt-fwd-till-any-end-tok* | |||
txtfmt-fwd-till-any-tok txtfmt.txt /*txtfmt-fwd-till-any-tok* | |||
txtfmt-fwd-till-bgc-beg-tok txtfmt.txt /*txtfmt-fwd-till-bgc-beg-tok* | |||
txtfmt-fwd-till-bgc-end-tok txtfmt.txt /*txtfmt-fwd-till-bgc-end-tok* | |||
txtfmt-fwd-till-bgc-tok txtfmt.txt /*txtfmt-fwd-till-bgc-tok* | |||
txtfmt-fwd-till-clr-beg-tok txtfmt.txt /*txtfmt-fwd-till-clr-beg-tok* | |||
txtfmt-fwd-till-clr-end-tok txtfmt.txt /*txtfmt-fwd-till-clr-end-tok* | |||
txtfmt-fwd-till-clr-tok txtfmt.txt /*txtfmt-fwd-till-clr-tok* | |||
txtfmt-fwd-till-fmt-beg-tok txtfmt.txt /*txtfmt-fwd-till-fmt-beg-tok* | |||
txtfmt-fwd-till-fmt-end-tok txtfmt.txt /*txtfmt-fwd-till-fmt-end-tok* | |||
txtfmt-fwd-till-fmt-tok txtfmt.txt /*txtfmt-fwd-till-fmt-tok* | |||
txtfmt-fwd-to-any-beg-tok txtfmt.txt /*txtfmt-fwd-to-any-beg-tok* | |||
txtfmt-fwd-to-any-end-tok txtfmt.txt /*txtfmt-fwd-to-any-end-tok* | |||
txtfmt-fwd-to-any-tok txtfmt.txt /*txtfmt-fwd-to-any-tok* | |||
txtfmt-fwd-to-bgc-beg-tok txtfmt.txt /*txtfmt-fwd-to-bgc-beg-tok* | |||
txtfmt-fwd-to-bgc-end-tok txtfmt.txt /*txtfmt-fwd-to-bgc-end-tok* | |||
txtfmt-fwd-to-bgc-tok txtfmt.txt /*txtfmt-fwd-to-bgc-tok* | |||
txtfmt-fwd-to-clr-beg-tok txtfmt.txt /*txtfmt-fwd-to-clr-beg-tok* | |||
txtfmt-fwd-to-clr-end-tok txtfmt.txt /*txtfmt-fwd-to-clr-end-tok* | |||
txtfmt-fwd-to-clr-tok txtfmt.txt /*txtfmt-fwd-to-clr-tok* | |||
txtfmt-fwd-to-fmt-beg-tok txtfmt.txt /*txtfmt-fwd-to-fmt-beg-tok* | |||
txtfmt-fwd-to-fmt-end-tok txtfmt.txt /*txtfmt-fwd-to-fmt-end-tok* | |||
txtfmt-fwd-to-fmt-tok txtfmt.txt /*txtfmt-fwd-to-fmt-tok* | |||
txtfmt-get-tok-info txtfmt.txt /*txtfmt-get-tok-info* | |||
txtfmt-gnome-terminal-issue txtfmt.txt /*txtfmt-gnome-terminal-issue* | |||
txtfmt-gnome-terminal-issue-workaround txtfmt.txt /*txtfmt-gnome-terminal-issue-workaround* | |||
txtfmt-hl-color-names txtfmt.txt /*txtfmt-hl-color-names* | |||
txtfmt-ins-tok txtfmt.txt /*txtfmt-ins-tok* | |||
txtfmt-ins-tok-A txtfmt.txt /*txtfmt-ins-tok-A* | |||
txtfmt-ins-tok-CTRL-\_CTRL-\ txtfmt.txt /*txtfmt-ins-tok-CTRL-\\_CTRL-\\* | |||
txtfmt-ins-tok-I txtfmt.txt /*txtfmt-ins-tok-I* | |||
txtfmt-ins-tok-O txtfmt.txt /*txtfmt-ins-tok-O* | |||
txtfmt-ins-tok-a txtfmt.txt /*txtfmt-ins-tok-a* | |||
txtfmt-ins-tok-i txtfmt.txt /*txtfmt-ins-tok-i* | |||
txtfmt-ins-tok-map-list txtfmt.txt /*txtfmt-ins-tok-map-list* | |||
txtfmt-ins-tok-maps txtfmt.txt /*txtfmt-ins-tok-maps* | |||
txtfmt-ins-tok-o txtfmt.txt /*txtfmt-ins-tok-o* | |||
txtfmt-ins-tok-s txtfmt.txt /*txtfmt-ins-tok-s* | |||
txtfmt-ins-tok-vA txtfmt.txt /*txtfmt-ins-tok-vA* | |||
txtfmt-ins-tok-vI txtfmt.txt /*txtfmt-ins-tok-vI* | |||
txtfmt-ins-tok-vO txtfmt.txt /*txtfmt-ins-tok-vO* | |||
txtfmt-ins-tok-va txtfmt.txt /*txtfmt-ins-tok-va* | |||
txtfmt-ins-tok-vi txtfmt.txt /*txtfmt-ins-tok-vi* | |||
txtfmt-ins-tok-vo txtfmt.txt /*txtfmt-ins-tok-vo* | |||
txtfmt-ins-tok-vs txtfmt.txt /*txtfmt-ins-tok-vs* | |||
txtfmt-installation txtfmt.txt /*txtfmt-installation* | |||
txtfmt-jump-to-tok txtfmt.txt /*txtfmt-jump-to-tok* | |||
txtfmt-jump-to-tok-maps txtfmt.txt /*txtfmt-jump-to-tok-maps* | |||
txtfmt-loading txtfmt.txt /*txtfmt-loading* | |||
txtfmt-map-config txtfmt.txt /*txtfmt-map-config* | |||
txtfmt-map-conflict txtfmt.txt /*txtfmt-map-conflict* | |||
txtfmt-modeline txtfmt.txt /*txtfmt-modeline* | |||
txtfmt-modeline-fmt txtfmt.txt /*txtfmt-modeline-fmt* | |||
txtfmt-motivation txtfmt.txt /*txtfmt-motivation* | |||
txtfmt-move-tok-range txtfmt.txt /*txtfmt-move-tok-range* | |||
txtfmt-multibyte-syntax-bug txtfmt.txt /*txtfmt-multibyte-syntax-bug* | |||
txtfmt-nesting txtfmt.txt /*txtfmt-nesting* | |||
txtfmt-nesting-c-example txtfmt.txt /*txtfmt-nesting-c-example* | |||
txtfmt-nesting-notes-example txtfmt.txt /*txtfmt-nesting-notes-example* | |||
txtfmt-nesting-tvo-example txtfmt.txt /*txtfmt-nesting-tvo-example* | |||
txtfmt-opt-list txtfmt.txt /*txtfmt-opt-list* | |||
txtfmt-opt-names txtfmt.txt /*txtfmt-opt-names* | |||
txtfmt-opt-num-fmt txtfmt.txt /*txtfmt-opt-num-fmt* | |||
txtfmt-opt-refresh txtfmt.txt /*txtfmt-opt-refresh* | |||
txtfmt-opt-types txtfmt.txt /*txtfmt-opt-types* | |||
txtfmt-options txtfmt.txt /*txtfmt-options* | |||
txtfmt-overview txtfmt.txt /*txtfmt-overview* | |||
txtfmt-performance-considerations txtfmt.txt /*txtfmt-performance-considerations* | |||
txtfmt-private-use-area txtfmt.txt /*txtfmt-private-use-area* | |||
txtfmt-problematic-ranges txtfmt.txt /*txtfmt-problematic-ranges* | |||
txtfmt-query-tok-type txtfmt.txt /*txtfmt-query-tok-type* | |||
txtfmt-start-token txtfmt.txt /*txtfmt-start-token* | |||
txtfmt-starttok txtfmt.txt /*txtfmt-starttok* | |||
txtfmt-syn-rgn-count-table txtfmt.txt /*txtfmt-syn-rgn-count-table* | |||
txtfmt-test-cur-settings txtfmt.txt /*txtfmt-test-cur-settings* | |||
txtfmt-tok-descriptor txtfmt.txt /*txtfmt-tok-descriptor* | |||
txtfmt-upgrading-to-extended-long-formats txtfmt.txt /*txtfmt-upgrading-to-extended-long-formats* | |||
txtfmt-upgrading-tokrange txtfmt.txt /*txtfmt-upgrading-tokrange* | |||
txtfmt-user-interface txtfmt.txt /*txtfmt-user-interface* | |||
txtfmt-user-map-examples txtfmt.txt /*txtfmt-user-map-examples* | |||
txtfmt-user-map-expansion txtfmt.txt /*txtfmt-user-map-expansion* | |||
txtfmt-user-map-fmt txtfmt.txt /*txtfmt-user-map-fmt* | |||
txtfmt-user-maps txtfmt.txt /*txtfmt-user-maps* | |||
txtfmt-view-tok-map txtfmt.txt /*txtfmt-view-tok-map* | |||
txtfmt-viewing-old-files-without-conceal txtfmt.txt /*txtfmt-viewing-old-files-without-conceal* | |||
txtfmt.txt txtfmt.txt /*txtfmt.txt* | |||
txtfmtAllowxl txtfmt.txt /*txtfmtAllowxl* | |||
txtfmtBgcolormask txtfmt.txt /*txtfmtBgcolormask* | |||
txtfmtBgcolor{} txtfmt.txt /*txtfmtBgcolor{}* | |||
txtfmtColor{} txtfmt.txt /*txtfmtColor{}* | |||
txtfmtConceal txtfmt.txt /*txtfmtConceal* | |||
txtfmtConcealcursor txtfmt.txt /*txtfmtConcealcursor* | |||
txtfmtEscape txtfmt.txt /*txtfmtEscape* | |||
txtfmtFgcolormask txtfmt.txt /*txtfmtFgcolormask* | |||
txtfmtJumptoinactive txtfmt.txt /*txtfmtJumptoinactive* | |||
txtfmtMapwarn txtfmt.txt /*txtfmtMapwarn* | |||
txtfmtModelines txtfmt.txt /*txtfmtModelines* | |||
txtfmtNested txtfmt.txt /*txtfmtNested* | |||
txtfmtPack txtfmt.txt /*txtfmtPack* | |||
txtfmtSync txtfmt.txt /*txtfmtSync* | |||
txtfmtTokrange txtfmt.txt /*txtfmtTokrange* | |||
txtfmtUndercurl txtfmt.txt /*txtfmtUndercurl* | |||
txtfmtUsermaplimit txtfmt.txt /*txtfmtUsermaplimit* | |||
txtfmtUsermap{} txtfmt.txt /*txtfmtUsermap{}* |