創意。
我做了一些快速原型與此Vimscript中的片段:
let stat = {}
for ii in range(1, line('$'))
for word in split(getline(ii), '\(\k\@!.\)\+')
let stat[word] = get(stat, word, 0) + 1
endfor
endfor
echo sort(keys(filter(copy(stat), 'v:val == 1')))
運行上$ VIM/vim73 /自動加載/ vimball.vim(23.2 K銼與737線),我得到以下單個關鍵詞事件:
12, 1502, 2004, 2009, 2010, 299, 31, 4, 702, Allow, Apr, At, Author,
AutoInstall, Constants, Copyright, Date, DechoTabOn, ENTER, Error,
Functions, GetLatestVimScripts, Input, LICENSE, Listing, Load, Modelines,
No, Normal, Once, Output, Own, Ph, Risk, Statement, Usage, Use, VIM,
Version, Vim, Windoze, Your, about, accomplished, actions, allow, already,
appear, appears, applies, apportion, assume, attempts, automatically, base,
based, bash, both, bypass, c, ch, change, construct, continue, copyright,
cp, cr, create, creates, cygwin, decompress, decompression, defined, did,
dir, distribute, does, doesn, embedded, enc, endfor, even, events,
evidence, except, existing, express, extraction, fmr, fo, force, function,
getpos, give, given, grab, ie, implied, included, index, initialize, input,
inputrestore, inputsave, insure, invoked, its, just, keep, keepcpo, list,
listing, loop, made, messages, missing, mkvimball, named, neither, next,
noacd, nofile, noma, nor, normal, noruler, noshowcmd, ok, older, on,
option, options, over, patch, pick, picked, placed, present, previous,
prologue, prompt, read, readable, redraw, removed, same, see, setpos,
setting, settings, shell, showing, skip, specified, specify, spite, split,
standard, string, strlen, sure, suspect, switch, ta, tab#, take, that,
title, true, un, undefined, under, used, v31, various, warning, warranty,
was, when, where, will, wrote, your, zsh
嗯,看起來不是很對我有用(它也不會得到更好的意見時除外),但也許你可以藉此和改進它。
我覺得這樣會對眼睛造成壓力。你看過[ctags](http://ctags.sourceforge.net/ctags.html)還是使用linter? (例如,[pflakes](https://github.com/kevinw/pyflakes-vim)將突出顯示/下劃線代碼中不存在的變量)。 –
也許,你是第一個想出這樣一個想法的人。 :) – kev
我不認爲它會有壓力,因爲源代碼幾乎總是有大多數單詞重複不止一次,至少對於大型文件。 – morphles