2015-08-23 13 views
13

Gần đây tôi đã gặp phải plugin lạ này đối với Vim và không thể biết được việc sử dụng nó là gì.Plugin v9 vim cho là gì?

Nó gần như không được ghi chép và quý tộc thực sự nói về nó, nhưng nó có vẻ quan trọng đối với một số plugin khác.

Tất cả tôi thấy là ở đây:

http://www.vim.org/scripts/script.php?script_id=3252

https://github.com/eparreno/vim-l9

nhưng họ chỉ nói "Đây là một thư viện" và "See the sourcecode".

Bất cứ ai cũng biết nó là gì, nếu tôi nên có nó, cho mục đích gì, hoặc nếu tôi chỉ có thể xóa nó cho đến khi một số phụ thuộc không được đáp ứng trong một số plugin khác?

+5

Chà, bạn còn cần biết gì ngoài " nó là một thư viện "? L9 là một thư viện được sử dụng bởi các plugin khác vì vậy nó được quản lý giống như bất kỳ sự phụ thuộc nào khác: bạn * nên * thêm nó khi cần thiết và bạn * có thể * bỏ nó hoặc xóa nó khi nó không. Nếu bạn không phải là một plugin developper, những gì mà thư viện không hoặc không phải là không quan tâm nhưng, nếu bạn chỉ tò mò, đọc mã nguồn chua là đủ. – romainl

+5

@romaini "nó là một thư viện" nói nhiều như: "một số mã": hoàn toàn không có gì. Một sản phẩm phần mềm tốt nên có một số mô tả nó là gì và làm thế nào để sử dụng nó, nó shoud là một phần của gói phát hành. Là một ass thông minh bằng cách nói "chỉ cần đọc mã" là tốt nếu mã không dài dòng. – eddy147

Trả lời

14

Tôi đã nhận thấy các tham chiếu đến L9 ở một vài nơi, gần đây từ Vundle. Đúng, nó không được ghi chép ngay từ đầu. Nhưng có bình luận tốt trong tệp nguồn chính, autoload/l9.vim. Đó là một tập hợp các chức năng tiện ích đa năng. Dưới đây là phần lớn API của nó, tăng thêm xử lý Vim danh sách, số, chuỗi, đường, đường dẫn, tệp, bộ đệm, cửa sổ, tìm kiếm và hơn thế nữa:

" 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) 

" Removes duplicates (unstable) 
" This function doesn't change the list of argument. 
function l9#unique(items) 

" [ [0], [1,2], [3] ] -> [ 0, 1, 2, 3 ] 
" This function doesn't change the list of argument. 
function l9#concat(items) 

" [ [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) 

" filter() with the maximum number of items 
" This function doesn't change the list of argument. 
function l9#filterWithLimit(items, expr, limit) 

" 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) 

" Snips a:str and add a:mask if the length of a:str is more than a:len 
function l9#snipHead(str, len, mask) 

" Snips a:str and add a:mask if the length of a:str is more than a:len 
function l9#snipTail(str, len, mask) 

" Snips a:str and add a:mask if the length of a:str is more than a:len 
function l9#snipMid(str, len, mask) 

" wildcard -> regexp 
function l9#convertWildcardToRegexp(expr) 

" 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) 

" returns the path separator charactor. 
function l9#getPathSeparator() 

" [ 'a', 'b/', '/c' ] -> 'a/b/c' 
function l9#concatPaths(paths) 

" path: '/a/b/c/d', dir: '/a/b' => 'c/d' 
function l9#modifyPathRelativeToDir(path, dir) 

" Almost same as readfile(). 
function l9#readFile(...) 

" Almost same as writefile(). 
function l9#writeFile(...) 

" :wall/:wall! wrapper. Useful for writing readonly buffers. 
function l9#writeAll() 

" Loads given files with :edit command 
function l9#loadFilesToBuffers(files) 

" Deletes all buffers except given files with :bdelete command 
function l9#deleteAllBuffersExcept(files) 

" move current window to next tabpage. 
function l9#shiftWinNextTabpage() 

" move current window to previous tabpage. 
function l9#shiftWinPrevTabpage() 

" move to a window containing specified buffer. 
" returns 0 if the buffer is not found. 
function l9#moveToBufferWindowInCurrentTabpage(bufNr) 

" returns 0 if the buffer is not found. 
function s:moveToOtherTabpageOpeningBuffer(bufNr) 

" move to a window containing specified buffer. 
" returns 0 if the buffer is not found. 
function l9#moveToBufferWindowInOtherTabpage(bufNr) 

" echo/echomsg with highlighting. 
function l9#echoHl(hl, msg, prefix, addingHistory) 

" input() with highlighting. 
" This function can take list as {completion} argument. 
function l9#inputHl(hl, ...) 

" only called by l9#inputHl() for completion. 
function l9#completeForInputHl(lead, line, pos) 

" returns last selected text in Visual mode. 
function l9#getSelectedText() 

" loads given text as Vim script with :source command 
function l9#loadScript(text) 

" 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) 

" Execute :vimgrep for buffers using l9#grepFiles() 
" See also: :L9GrepBuffer :L9GrepBufferAll 
function l9#grepBuffers(pattern, bufNrs) 

" 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) 

" Notify a message using an external program. 
" Currently supports Balloonly, Screen, and Tmux. 
function l9#notifyExternally(msg)