mirror of
https://github.com/gryf/.vim.git
synced 2025-12-17 11:30:29 +01:00
Moja prawie współczesna konfiguracja. Dużo rzeczy :)
This commit is contained in:
677
.vimrc
677
.vimrc
@@ -1,370 +1,351 @@
|
||||
" gvim settings:
|
||||
"
|
||||
"set guifontset=-misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859-2
|
||||
"set guifont=-misc-fixed-medium-r-normal-*-*-120-*-*-c-*-iso8859-2
|
||||
"set mouse=a
|
||||
"set guifontset="Monospace 13"
|
||||
"set guifont="Monospace 13"
|
||||
"colorscheme pablo
|
||||
"Basic setup for all files {{{
|
||||
set nocompatible "VIM over VI
|
||||
|
||||
filetype plugin indent on "turn plugins/indent on
|
||||
syntax on "Turn syntax highlighting on
|
||||
|
||||
" vim setting:
|
||||
"
|
||||
set bg=dark
|
||||
"
|
||||
" VIM configuration file
|
||||
" Author: Piotr Debicki (pdebicki@poczta.onet.pl)
|
||||
""""""""
|
||||
"
|
||||
" Always set autoindenting on
|
||||
"
|
||||
set autoindent
|
||||
"
|
||||
" Automatically save modifications to files when
|
||||
" using critical commands
|
||||
"
|
||||
set autowrite
|
||||
"
|
||||
" Allow backspacing over everything in insert mode
|
||||
"
|
||||
set backspace=2
|
||||
"
|
||||
" Don't make a backup before overwriting
|
||||
"
|
||||
set nobackup
|
||||
"
|
||||
" Reset cinwords - this suxx with smartindent
|
||||
"
|
||||
set cinwords=
|
||||
"
|
||||
" Use Vim settings, rather then Vi settings
|
||||
"
|
||||
set nocompatible
|
||||
"
|
||||
" Ask for confirmation rather then refuse certain commands
|
||||
"
|
||||
set confirm
|
||||
"
|
||||
" Type of <EOL> in written files
|
||||
"
|
||||
set fileformats=unix,dos
|
||||
"
|
||||
" Automatic formatting settings
|
||||
"
|
||||
set formatoptions=croq
|
||||
"
|
||||
" Keep hidden windows
|
||||
"
|
||||
set hidden
|
||||
"
|
||||
" Keep 50 lines of command line history
|
||||
"
|
||||
set history=50
|
||||
"
|
||||
" Don't highlight search patterns
|
||||
"
|
||||
set nohlsearch
|
||||
"
|
||||
" Ignore case in search patterns
|
||||
"
|
||||
set ignorecase
|
||||
"
|
||||
" Always show statusbar
|
||||
"
|
||||
set laststatus=2
|
||||
"
|
||||
" Don't update screen while executing macros
|
||||
"
|
||||
set lazyredraw
|
||||
"
|
||||
" Strings to use in 'list' mode
|
||||
"
|
||||
set listchars=tab:>-,trail:-,eol:$
|
||||
"
|
||||
" Show the cursor position all the time
|
||||
"
|
||||
set ruler
|
||||
"
|
||||
" Content of the ruler string
|
||||
"
|
||||
set rulerformat=%l,%c%V%=#%n\ %3p%%
|
||||
"
|
||||
" Minimal number of lines to scroll when the cursor gets off the screen
|
||||
"
|
||||
" set scrolljump=1
|
||||
"
|
||||
" Minimal number of screen lines to keep above and below the cursor
|
||||
"
|
||||
set scrolloff=3
|
||||
"
|
||||
" Define the behavior of the selection
|
||||
"
|
||||
set selection=exclusive
|
||||
"
|
||||
" Name of the shell to use for ! and :! commands
|
||||
"
|
||||
" set shell=[3mbin[0mbash
|
||||
"
|
||||
" Number of spaces to use for each step of (auto)indent
|
||||
"
|
||||
set shiftwidth=4
|
||||
"
|
||||
" Abbreviate some messages
|
||||
"
|
||||
set shortmess=atToOI
|
||||
"
|
||||
" String to put at the start of lines that have been wrapped
|
||||
"
|
||||
set showbreak=>
|
||||
"
|
||||
" Show (partial) command in status line
|
||||
"
|
||||
set showcmd
|
||||
"
|
||||
" When a bracket is inserted, briefly jump to the matching one
|
||||
"
|
||||
set showmatch
|
||||
"
|
||||
" Do smart autoindenting when starting a new line
|
||||
"
|
||||
set smartindent
|
||||
"
|
||||
" Create new window below current one
|
||||
"
|
||||
set splitbelow
|
||||
"
|
||||
" Use swap file
|
||||
"
|
||||
set swapfile
|
||||
"
|
||||
" Turn beeping off
|
||||
"
|
||||
set t_vb=
|
||||
"
|
||||
" Set tab stop to 4
|
||||
"
|
||||
set tabstop=4
|
||||
"
|
||||
" Turn off scrolling -> faster
|
||||
"
|
||||
" set ttyscroll=0
|
||||
"
|
||||
" After typing this many chars the swap file will be written to disk
|
||||
"
|
||||
set updatecount=50
|
||||
"
|
||||
" Configure .viminfo
|
||||
"
|
||||
set viminfo='20,\"50
|
||||
"
|
||||
" Cursor keys wrap to previous/next line
|
||||
"
|
||||
set whichwrap+=<,>,[,]
|
||||
"
|
||||
" Character to start wildcard expansion in the command-line
|
||||
"
|
||||
set wildchar=<TAB>
|
||||
"
|
||||
" Put command-line completion in an enhanced mode
|
||||
"
|
||||
set wildmenu
|
||||
"
|
||||
" Turn line wrapping off (a ja chc<68> wrap)
|
||||
"
|
||||
" set nowrap
|
||||
"
|
||||
" Number of characters from the right window border where wrapping starts
|
||||
"
|
||||
set wrapmargin=1
|
||||
"
|
||||
" Turn syntax highlighting on
|
||||
"
|
||||
syntax on
|
||||
set backspace=indent,eol,start "Allow backspacing over everything in insert mode
|
||||
set background=dark "Hint Vim that I use dark colorscheme
|
||||
|
||||
"
|
||||
" wgrywaj r<>wnie<69> widoki dla plik<69>w php
|
||||
"
|
||||
set confirm "Ask for confirmation rather then refuse certain commands
|
||||
set cursorline "Turn on current line highlight
|
||||
set expandtab "I want spaces instead of tabs
|
||||
set fileencodings=ucs-bom,utf-8,latin2,default,latin1,default
|
||||
set fileformats=unix,dos "Type of <EOL> in written files
|
||||
set formatoptions=croqw "Automatic formatting settings
|
||||
set hidden "Keep hidden windows
|
||||
set history=1000 "Keep 1000 lines of command line history
|
||||
set ignorecase "Ignore case in search patterns
|
||||
set laststatus=2 "Always show statusbar
|
||||
set lazyredraw "Don't update screen while executing macros
|
||||
|
||||
au BufWinLeave *.php mkview
|
||||
au BufWinEnter *.php silent loadview
|
||||
"set listchars=tab:▸⎯,eol:◦ "Strings to use in 'list' mode. list is off by default.
|
||||
"set listchars=tab:▸⎯,eol:· "Strings to use in 'list' mode. list is off by default.
|
||||
"set listchars=tab:⇄·,eol:↵ "Strings to use in 'list' mode. list is off by default.
|
||||
"set listchars=tab:▸⎯,eol:↲,trail:· "Strings to use in 'list' mode. list is off by default.
|
||||
set listchars=tab:▸⎯,trail:· "Strings to use in 'list' mode. list is off by default.
|
||||
set number "show line numbers
|
||||
"set ruler "Show the cursor position all the time
|
||||
set rulerformat=%l,%c%V%=#%n\ %3p%% "Content of the ruler string
|
||||
"set statusline=%<%F\ %h%m%r%=%-14.(%l,%c%V%=#%n\ %3p%%)\ %P
|
||||
"set statusline=%<%F\ %h%m%r%=%-14.(%l,%c%V%)\ #%n\ %3p%%
|
||||
set scrolloff=5 "Minimal number of screen lines to keep above and below the cursor
|
||||
set selection=exclusive "Define the behavior of the selection
|
||||
|
||||
"
|
||||
" ============================
|
||||
" Abbreviations
|
||||
" ============================
|
||||
"
|
||||
" Some C abbreviations
|
||||
"
|
||||
iab Zmain int main(int argc, char *argv[])
|
||||
iab Zinc #include
|
||||
iab Zdef #define
|
||||
"
|
||||
" Some other abbreviations
|
||||
"
|
||||
iab Zdate <C-R>=strftime("%y%m%d")<CR>
|
||||
iab Ztime <C-R>=strftime("%H:%M:%S")<CR>
|
||||
iab Zmymail pdebicki@poczta.onet.pl
|
||||
iab Zmyphone 0 502 935 242
|
||||
iab Zfilename <C-R>=expand("%:t:r")<CR>
|
||||
iab Zfilepath <C-R>=expand("%:p")<CR>
|
||||
"
|
||||
" ============================
|
||||
" Customization
|
||||
" ============================
|
||||
"
|
||||
" Function keys
|
||||
"
|
||||
nmap <F1> 3K
|
||||
nmap <F5> :cnext<CR>
|
||||
nmap <F6> :cprevious<CR>
|
||||
nmap <F7> :clist<CR>
|
||||
nmap <F9> :make<CR>
|
||||
nmap <F10> :!!<CR>
|
||||
nmap <F11> :call SwitchTabstop()<CR>
|
||||
nmap <F12> :call SwitchSyntax()<CR>
|
||||
nmap <F2> :call SwitchIndent()<CR>
|
||||
imap <F1> <ESC>3Ki
|
||||
imap <F5> <ESC>:cnext<CR>
|
||||
imap <F6> <ESC>:cprevious<CR>
|
||||
imap <F7> <ESC>:clist<CR>
|
||||
imap <F9> <ESC>:make<CR>
|
||||
imap <F10> <ESC>:!!<CR>
|
||||
imap <F11> <ESC>:call SwitchTabstop()<CR>i
|
||||
imap <F12> <ESC>:call SwitchSyntax()<CR>i
|
||||
imap <F2> <ESC>:call SwitchIndent()<CR>i
|
||||
"
|
||||
" Show next buffer
|
||||
"
|
||||
nmap <TAB> :bnext<CR>
|
||||
"
|
||||
" Execute shell commands easier
|
||||
"
|
||||
nmap ! :!
|
||||
"
|
||||
" Align line
|
||||
"
|
||||
nmap ,ac :center<CR>
|
||||
nmap ,al :left<CR>
|
||||
nmap ,ar :right<CR>
|
||||
"
|
||||
" Print the ASCII value of the character under the cursor
|
||||
"
|
||||
nmap ,as :ascii<CR>
|
||||
"
|
||||
" Change type of <EOL> - unix/dos
|
||||
"
|
||||
nmap ,eol :call ChangeFileFormat()<CR>
|
||||
"
|
||||
" Insert C/C++ source footer
|
||||
"
|
||||
nmap ,fo :%r $HOME/src/TEMPLATE/FOOTER<CR>
|
||||
"
|
||||
" Insert C/C++ source header
|
||||
"
|
||||
nmap ,he :0r $HOME/src/TEMPLATE/HEADER<CR>
|
||||
"
|
||||
" Turn highlight search on/off
|
||||
"
|
||||
nmap ,hs :call ToggleOption('hlsearch')<CR>
|
||||
"
|
||||
" Turn line numbers on/off
|
||||
"
|
||||
nmap ,nu :call ToggleOption('number')<CR>
|
||||
"
|
||||
" Remove all empty lines
|
||||
"
|
||||
nmap ,re :g/^$/d<CR>
|
||||
"
|
||||
" Edit .vimrc
|
||||
"
|
||||
nmap ,rc :n $HOME/.vimrc<CR>
|
||||
"
|
||||
" Turn line wrapping on/off
|
||||
"
|
||||
nmap ,wr :call ToggleOption('wrap')<CR>
|
||||
"
|
||||
" Show white spaces on/off
|
||||
"
|
||||
nmap ,ws :call ToggleOption('list')<CR>
|
||||
"
|
||||
" Make selection lowercase
|
||||
"
|
||||
vmap ,l u
|
||||
"
|
||||
" Rot13 encode selection
|
||||
"
|
||||
vmap ,r g?
|
||||
"
|
||||
" Make selection switch case
|
||||
"
|
||||
vmap ,s ~
|
||||
"
|
||||
" Make selection uppercase
|
||||
"
|
||||
vmap ,u U
|
||||
"
|
||||
" tym, oto, skr<6B>tem komentuj/unkomentuj ca<63>e linie, bloki, etc.
|
||||
" niezb<7A>dny plugin enhcommentify w ~/.vim/plugin
|
||||
"
|
||||
nmap <C-a> :call EnhancedCommentify('', 'guess')<CR>j
|
||||
vmap <C-a> :call EnhancedCommentify('', 'guess')<CR>j
|
||||
set sessionoptions-=blank "Don't store empty windows
|
||||
set sessionoptions-=globals "Don't store global vars
|
||||
set sessionoptions-=localoptions "Don't store local options and mappings
|
||||
set sessionoptions-=options "Don't store options and mappings
|
||||
set shiftwidth=4 "Number of spaces to use for each step of (auto)indent
|
||||
set shortmess=atToOI "Abbreviate some messages
|
||||
set showbreak=> "String to put at the start of lines that have been wrapped
|
||||
set showcmd "Show (partial) command in status line
|
||||
set showmatch "When a bracket is inserted, briefly jump to the matching one
|
||||
"set smartindent "Do smart autoindenting when starting a new line
|
||||
filetype indent on "Indenting per filetype rather then smartindent.
|
||||
set smarttab "Do the smart tab/backspace behaviour
|
||||
set softtabstop=4
|
||||
|
||||
"
|
||||
" ============================
|
||||
" Functions
|
||||
" ============================
|
||||
"spell options
|
||||
set spelllang=pl,en
|
||||
set spellfile=/home/gryf/.vim/pol.utf8.add
|
||||
|
||||
function ToggleOption (option)
|
||||
execute 'set ' . a:option . '!'
|
||||
execute 'echo "' . a:option . ':" strpart("OFFON",3*&' . a:option . ',3)'
|
||||
set splitbelow "Create new window below current one
|
||||
set swapfile "Use swap file
|
||||
set t_vb= "Turn beeping off
|
||||
set tabstop=4 "Set tab stop to 4
|
||||
set updatecount=50 "After typing this many chars the swap file will be written to disk
|
||||
set viewoptions-=options "Don't store options in view stored in ~/.vim/view dir
|
||||
set viminfo='20,\"50 "Configure .viminfo
|
||||
set whichwrap+=<,>,[,] "Cursor keys wrap to previous/next line
|
||||
set wildchar=<TAB> "Character to start wildcard expansion in the command-line
|
||||
set wildmenu "Put command-line completion in an enhanced mode
|
||||
set wrapmargin=1 "Number of characters from the right window border where wrapping starts
|
||||
|
||||
" TOhtml options
|
||||
:let html_number_lines = 1
|
||||
:let html_use_css = 1
|
||||
:let html_ignore_folding = 1
|
||||
:let html_use_encoding = "utf-8"
|
||||
"}}}
|
||||
"PYTHON: specific vim behaviour for Python files {{{
|
||||
"
|
||||
"remove all trailing withitespace for python before write
|
||||
autocmd BufWritePre *.py :call <SID>StripTrailingWhitespaces()
|
||||
"autocmd BufWritePre *.py :!message.py '%'
|
||||
"Load views for py files
|
||||
autocmd BufWinLeave *.py mkview
|
||||
autocmd BufWinEnter *.py silent loadview
|
||||
|
||||
"Set python custom editor behaviour. Note, smartindent is not recommended for
|
||||
"python files!
|
||||
autocmd FileType python set tabstop=4|set softtabstop=4|set shiftwidth=4
|
||||
autocmd FileType python set expandtab|set smarttab|set noautoindent
|
||||
autocmd FileType python set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with
|
||||
autocmd FileType python set foldmethod=indent|set foldlevel=100|set list|set textwidth=78|set cinkeys-=0#
|
||||
autocmd FileType python set indentkeys-=0#|inoremap # X<BS>#
|
||||
autocmd FileType python set ofu=syntaxcomplete#Complete
|
||||
|
||||
"autocmd FileType python setlocal omnifunc=pysmell#Complete
|
||||
let python_highlight_all=1
|
||||
" }}}
|
||||
" OTHER FILES: {{{
|
||||
"autocmd FileType python :!echo '%'
|
||||
autocmd FileType sql set nolist|set nosmartindent|set autoindent|set foldmethod=manual
|
||||
autocmd FileType vim set nolist|set nosmartindent|set autoindent|set foldmethod=manual
|
||||
autocmd FileType snippet set nolist|set tabstop=4|set autoindent|set foldmethod=manual|set noexpandtab|set shiftwidth=4
|
||||
autocmd FileType snippets set noexpandtab, nolist
|
||||
augroup mkd
|
||||
autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:>
|
||||
augroup END
|
||||
autocmd FileType rst set spf=/home/gryf/.vim/pol.utf8.add|set textwidth=80
|
||||
|
||||
"}}}
|
||||
"LaTeX: option for LaTeX files {{{
|
||||
autocmd FileType tex compiler rubber|map <F5> :make<cr>
|
||||
"}}}
|
||||
"TERMINAL: options for terminal emulators {{{
|
||||
if $TERM == 'rxvt-unicode' || $TERM == 'xterm'
|
||||
set t_Co=256 "Enable 256 colors support
|
||||
set term=rxvt-unicode256 "Set terminal type
|
||||
"repair urxvt ctrl+pgup/down behaviour
|
||||
map [5^ <C-PageUp>
|
||||
map [6^ <C-PageDown>
|
||||
endif
|
||||
if $TERM == 'linux'
|
||||
"For term like linux terminal keep interface simple
|
||||
set nolist
|
||||
set nocursorline
|
||||
set nonumber
|
||||
endif
|
||||
"}}}
|
||||
"PLUGINS: {{{
|
||||
"getscriptPlugin
|
||||
"let g:GetLatestVimScripts_allowautoinstall=1 "allow autoinstall scripts
|
||||
|
||||
"TagList{{{2
|
||||
let Tlist_Use_Right_Window = 1
|
||||
"show menu in gvim. usefull to pop it up from kbd
|
||||
let Tlist_Show_Menu = 1
|
||||
let Tlist_Auto_Open = 0
|
||||
let Tlist_Display_Prototype = 1
|
||||
"open fold for current buff, and close all others...
|
||||
let Tlist_File_Fold_Auto_Close = 1
|
||||
".. or just display current file
|
||||
"let Tlist_Show_One_File = 1
|
||||
let Tlist_Sort_Type = "name"
|
||||
let Tlist_Exit_OnlyWindow = 1
|
||||
let Tlist_WinWidth = 40
|
||||
"}}}
|
||||
|
||||
"NERDTree
|
||||
let NERDTreeWinSize = 40
|
||||
|
||||
"VimWIKI
|
||||
let g:vimwiki_list = [{'html_header': '~/vimwiki/vimwiki_head.tpl',
|
||||
\ 'html_footer': '~/vimwiki/vimwiki_foot.tpl'}]
|
||||
|
||||
"ShowMarks
|
||||
let g:showmarks_ignore_type = "hqprm"
|
||||
let g:showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
"jsbeautify
|
||||
nnoremap <silent> <leader>ff :call g:Jsbeautify()<cr>:retab!<cr>
|
||||
|
||||
" pydiction
|
||||
let g:pydiction_location = '/home/gryf/.vim/after/ftplugin/pytdiction/complete-dict'
|
||||
"}}}
|
||||
"KEYS: User definied keyboard shortcuts {{{
|
||||
|
||||
"set <C-F1>=^[[11^
|
||||
"set <S-F1> = ^[[23~
|
||||
"nmap <TAB> :bnext<CR>
|
||||
"nmap <S-F1> :split<CR>
|
||||
"nmap <C-F1> :vsplit<CR>
|
||||
|
||||
"Cycle through buffers.
|
||||
map <C-p> :bp<CR>
|
||||
map <C-n> :bn<CR>
|
||||
"map <C-PageUp> :bp<CR>
|
||||
"map <C-PageDown> :bn<CR>
|
||||
|
||||
"Cycle through tabs.
|
||||
if $TERM == 'rxvt-unicode'
|
||||
map <C-PageDown> :tabn<CR>
|
||||
map <C-PageUp> :tabp<CR>
|
||||
endif
|
||||
|
||||
map <F5> :PyLint<cr>
|
||||
map <F6> :call PyLintBuf()<cr>
|
||||
|
||||
"map ctags plugin to show popup menu in gvim
|
||||
"map <F6> :popup Tags<CR>
|
||||
|
||||
"QuickFix jumps
|
||||
map <F9> :cp<CR>
|
||||
map <F10> :cn<CR>
|
||||
map <F11> :lprevious<CR>
|
||||
map <F12> :lnext<CR>
|
||||
map <S-F9> :QFix<CR>
|
||||
map <S-F11> :LWin<CR>
|
||||
map <S-F12> :call ToggleQFonValidate()<CR>
|
||||
|
||||
"remove trailing whitespaces
|
||||
map <C-e> :%s/\s\+$//<CR>
|
||||
|
||||
"redefine tab key for vimwiki
|
||||
map <Leader>wn <Plug>VimwikiNextWord
|
||||
map <Leader>wp <Plug>VimwikiPrevWord
|
||||
map ]b :call OpenInFirefox()<cr>
|
||||
|
||||
"make displaying tags easy
|
||||
nmap <Leader>t :Tlist<CR>
|
||||
"aswell minibufexplorer
|
||||
"map <Leader>b :TMiniBufExplorer<CR><CR>
|
||||
"eclim Buffer shortcut
|
||||
map <Leader>b :Buffers<CR>
|
||||
|
||||
" copy current buffer filename (full path)
|
||||
nmap ,cn :silent call <SID>CopyFileName(1)<CR>
|
||||
" copy current buffer filename (filename only)
|
||||
nmap ,cs :silent call <SID>CopyFileName(0)<CR>
|
||||
|
||||
"FuzzyFinder plugin. Keys for file fuf
|
||||
map <C-F> :FufFile **/<CR>
|
||||
" }}}
|
||||
" FUNCTIONS: usefull functions for all of th files {{{
|
||||
"Sessions
|
||||
"autocmd VimEnter * call LoadSession()
|
||||
"autocmd VimLeave * call SaveSession()
|
||||
"
|
||||
"function! SaveSession()
|
||||
" execute 'mksession!'
|
||||
"endfunction
|
||||
"
|
||||
"function! LoadSession()
|
||||
" if argc() == 0
|
||||
" execute 'source Session.vim'
|
||||
" endif
|
||||
"endfunction
|
||||
|
||||
"function <SID>PyLint()
|
||||
" :make
|
||||
" let l:mbe = 0
|
||||
" if bufwinnr(bufnr('-MiniBufExplorer-')) != -1
|
||||
" let l:mbe = 1
|
||||
" :CMiniBufExplorer
|
||||
" endif
|
||||
" :cwindow
|
||||
" if l:mbe == 1
|
||||
" :MiniBufExplorer
|
||||
" endif
|
||||
"endfunction
|
||||
|
||||
function! <SID>StripTrailingWhitespaces()
|
||||
" Preparation: save last search, and cursor position.
|
||||
let _s=@/
|
||||
let l = line(".")
|
||||
let c = col(".")
|
||||
" Do the business:
|
||||
%s/\s\+$//e
|
||||
" Clean up: restore previous search history, and cursor position
|
||||
let @/=_s
|
||||
call cursor(l, c)
|
||||
endfunction
|
||||
|
||||
function ChangeFileFormat()
|
||||
if &fileformat == "unix"
|
||||
set fileformat=dos
|
||||
echo "<EOL> type: DOS"
|
||||
function <SID>CopyFileName(full)
|
||||
if a:full
|
||||
let l:full_fn = expand("%:p")
|
||||
else
|
||||
set fileformat=unix
|
||||
echo "<EOL> type: UNIX"
|
||||
let l:full_fn = expand("%")
|
||||
endif
|
||||
|
||||
" Convert slashes to backslashes for Windows.
|
||||
if has('win32')
|
||||
let @*=substitute(l:full_fn, "/", "\\", "g")
|
||||
else
|
||||
let @*=l:full_fn
|
||||
endif
|
||||
echo l:full_fn + " copied to clipboard"
|
||||
endfunction
|
||||
|
||||
command -bang -nargs=? QFix call QFixToggle(<bang>0)
|
||||
function! QFixToggle(forced)
|
||||
if exists("g:qfix_win") && a:forced == 0
|
||||
cclose
|
||||
unlet g:qfix_win
|
||||
else
|
||||
copen 10
|
||||
let g:qfix_win = bufnr("$")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function SwitchTabstop()
|
||||
if &tabstop == 4
|
||||
set tabstop=8
|
||||
echo "Tabstop = 8"
|
||||
command -bang -nargs=? LWin call LocationWindowToggle(<bang>0)
|
||||
function! LocationWindowToggle(forced)
|
||||
if exists("g:loc_win") && a:forced == 0
|
||||
lclose
|
||||
unlet g:loc_win
|
||||
else
|
||||
set tabstop=4
|
||||
echo "Tabstop = 4"
|
||||
lopen 10
|
||||
let g:loc_win = bufnr("$")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function SwitchSyntax()
|
||||
if has("syntax_items")
|
||||
syntax off
|
||||
echo "Syntax highlighting OFF"
|
||||
else
|
||||
syntax on
|
||||
echo "Syntax highlighting ON"
|
||||
" OpenInFirefox
|
||||
" try to open url in Firefox
|
||||
function! OpenInFirefox()
|
||||
let l:line = getline(".")
|
||||
let l:cursor_position = getpos(".")[2]
|
||||
let l:url = ""
|
||||
let l:pattern = '\c\%(http[s]\?\|ftp\|file\)\:\/\/[^$ ]\+'
|
||||
|
||||
for i in split(l:line)
|
||||
if match(i, l:pattern) == 0
|
||||
"check position in line against cursor_position
|
||||
for x in range(match(l:line, i), match(l:line, i) + len(i))
|
||||
if l:cursor_position == x
|
||||
let l:url = i
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
|
||||
if len(l:url) > 0
|
||||
call system("firefox " . l:url)
|
||||
echohl Statement
|
||||
echo "Opened '" . l:url ."' in firefox."
|
||||
else
|
||||
echohl WarningMsg
|
||||
echo "Not an URL under cursor."
|
||||
endif
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
function SwitchIndent()
|
||||
if &autoindent
|
||||
set noautoindent
|
||||
set nosmartindent
|
||||
set formatoptions=
|
||||
echo "Indent OFF"
|
||||
else
|
||||
set autoindent
|
||||
set smartindent
|
||||
set formatoptions=croq
|
||||
echo "Indent ON"
|
||||
"}}}
|
||||
" GUI: here goes all the gvim customizations {{{
|
||||
if has('gui_running')
|
||||
"set guifont=Consolas\ 12 "I like this font, but it looks like crap on linux
|
||||
"set listchars=tab:▸⎼,eol:↲ "Strings to use in 'list' mode. this is different from console fixed-misc font.
|
||||
set guifont=Fixed\ 14 "I like this font better.
|
||||
set mouse=a "Enable mouse support
|
||||
set guioptions-=T "No toolbar
|
||||
"add menuitem OpenInFirefox
|
||||
nmenu 666 PopUp.&Open\ in\ browser :call OpenInFirefox()<cr>
|
||||
"Turn off annoying beep
|
||||
au GUIEnter * set vb t_vb=
|
||||
endif
|
||||
"}}}
|
||||
" HIGHLIGHT: colorscheme and highlight, which should be applyed on after {{{
|
||||
" some vim initialization
|
||||
if $TERM == 'linux'
|
||||
colorscheme pablo
|
||||
else
|
||||
colorscheme wombat256grf
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" vim:ts=4:sw=4:wrap:
|
||||
" - EOF -
|
||||
|
||||
|
||||
|
||||
"highlight code beyond 79 column (must be after colorscheme)
|
||||
highlight OverLength ctermbg=black
|
||||
match OverLength /\%81v.*/
|
||||
"}}}
|
||||
" vim:ts=4:sw=4:wrap:fdm=marker:
|
||||
|
||||
37
GetLatest/GetLatestVimScripts.dat
Normal file
37
GetLatest/GetLatestVimScripts.dat
Normal file
@@ -0,0 +1,37 @@
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
### plugins
|
||||
102 9375 DirDiff.vim
|
||||
1658 11834 NERD_tree.vim
|
||||
2754 12764 :AutoInstall: delimitMate.vim
|
||||
1984 11852 fuzzyfinder.vim
|
||||
642 8136 :AutoInstall: getscript.vim
|
||||
311 7645 grep.vim
|
||||
2727 11120 jsbeautify.vim
|
||||
2666 12423 Mark
|
||||
2262 8944 occur.vim
|
||||
2421 9423 pysmell.vim
|
||||
152 3342 showmarks.vim
|
||||
2540 11006 snipMate.vim
|
||||
273 7701 taglist.vim
|
||||
2607 10388 tasklist.vim
|
||||
90 12743 vcscommand.vim
|
||||
2226 12476 vimwiki.vim
|
||||
1334 6377 vst.vim
|
||||
### colors
|
||||
1975 7471 lettuce.vim
|
||||
2536 12154 lucius.vim
|
||||
1165 3741 tolerable.vim
|
||||
2465 11352 wombat256.vim
|
||||
# ftplugin
|
||||
2441 12763 pyflakes.vim
|
||||
30 9196 python_fn.vim
|
||||
1542 10872 pythoncomplete.vim
|
||||
### indent
|
||||
1936 7708 javascript.vim
|
||||
# there is also python.vim, which is close to PEP8, but author of
|
||||
# changes doesn't put it on vim.org scripts. it can be (still) found on
|
||||
# http://monkey.org/~caz/python.vim
|
||||
### syntax
|
||||
790 12805 python.vim
|
||||
|
||||
18
GetLatest/GetLatestVimScripts.dist
Normal file
18
GetLatest/GetLatestVimScripts.dist
Normal file
@@ -0,0 +1,18 @@
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
294 1 Align.vim
|
||||
302 2 AnsiEsc.vim
|
||||
122 3 astronaut.vim
|
||||
104 4 blockhl.vim
|
||||
120 5 decho.vim
|
||||
40 6 DrawIt.tar.gz
|
||||
451 7 EasyAccents.vim
|
||||
195 8 engspchk.vim
|
||||
642 9 GetLatestVimScripts.vim
|
||||
489 10 Manpageview.vim
|
||||
551 11 Mines.vim
|
||||
514 12 mrswin.vim
|
||||
670 13 visincr.vim
|
||||
628 14 SeeTab.vim
|
||||
508 15 ZoomWin.vim
|
||||
877 16 gvcolor.vim
|
||||
35
after/plugin/snipMate.vim
Normal file
35
after/plugin/snipMate.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
" These are the mappings for snipMate.vim. Putting it here ensures that it
|
||||
" will be mapped after other plugins such as supertab.vim.
|
||||
if !exists('loaded_snips') || exists('s:did_snips_mappings')
|
||||
finish
|
||||
endif
|
||||
let s:did_snips_mappings = 1
|
||||
|
||||
ino <silent> <tab> <c-r>=TriggerSnippet()<cr>
|
||||
snor <silent> <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
|
||||
ino <silent> <s-tab> <c-r>=BackwardsSnippet()<cr>
|
||||
snor <silent> <s-tab> <esc>i<right><c-r>=BackwardsSnippet()<cr>
|
||||
ino <silent> <c-r><tab> <c-r>=ShowAvailableSnips()<cr>
|
||||
|
||||
" The default mappings for these are annoying & sometimes break snipMate.
|
||||
" You can change them back if you want, I've put them here for convenience.
|
||||
snor <bs> b<bs>
|
||||
snor <right> <esc>a
|
||||
snor <left> <esc>bi
|
||||
snor ' b<bs>'
|
||||
snor ` b<bs>`
|
||||
snor % b<bs>%
|
||||
snor U b<bs>U
|
||||
snor ^ b<bs>^
|
||||
snor \ b<bs>\
|
||||
snor <c-x> b<bs><c-x>
|
||||
|
||||
" By default load snippets in snippets_dir
|
||||
if empty(snippets_dir)
|
||||
finish
|
||||
endif
|
||||
|
||||
call GetSnippets(snippets_dir, '_') " Get global snippets
|
||||
|
||||
au FileType * if &ft != 'help' | call GetSnippets(snippets_dir, &ft) | endif
|
||||
" vim:noet:sw=4:ts=4:ft=vim
|
||||
1155
autoload/fuf.vim
Normal file
1155
autoload/fuf.vim
Normal file
File diff suppressed because it is too large
Load Diff
211
autoload/fuf/bookmark.vim
Normal file
211
autoload/fuf/bookmark.vim
Normal file
@@ -0,0 +1,211 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_bookmark') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_bookmark = 1
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" GLOBAL FUNCTIONS {{{1
|
||||
|
||||
"
|
||||
function fuf#bookmark#createHandler(base)
|
||||
return a:base.concretize(copy(s:handler))
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#bookmark#getSwitchOrder()
|
||||
return g:fuf_bookmark_switchOrder
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#bookmark#renewCache()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#bookmark#requiresOnCommandPre()
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#bookmark#onInit()
|
||||
call fuf#defineLaunchCommand('FufBookmark', s:MODE_NAME, '""')
|
||||
command! -bang -narg=? FufAddBookmark call s:bookmarkHere(<q-args>)
|
||||
command! -bang -narg=0 -range FufAddBookmarkAsSelectedText call s:bookmarkHere(s:getSelectedText())
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" LOCAL FUNCTIONS/VARIABLES {{{1
|
||||
|
||||
let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
let s:OPEN_TYPE_DELETE = -1
|
||||
|
||||
"
|
||||
function s: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
|
||||
|
||||
" 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_bookmark_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#echoWithHl('Can''t bookmark this buffer.', 'WarningMsg')
|
||||
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 = fuf#inputHl('Bookmark as:', item.word, 'Question')
|
||||
if item.word !~ '\S'
|
||||
call fuf#echoWithHl('Canceled', 'WarningMsg')
|
||||
return
|
||||
endif
|
||||
let info = fuf#loadInfoFile(s:MODE_NAME)
|
||||
call insert(info.data, item)
|
||||
call fuf#saveInfoFile(s:MODE_NAME, info)
|
||||
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_bookmark_prompt, self.partialMatching)
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPreviewHeight()
|
||||
return g:fuf_previewHeight
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
return 0
|
||||
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(self.info.data, 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
|
||||
call filter(self.info.data, 'v:val.word !=# a:word')
|
||||
call fuf#saveInfoFile(s:MODE_NAME, self.info)
|
||||
call fuf#launch(s:MODE_NAME, self.lastPattern, self.partialMatching)
|
||||
return
|
||||
else
|
||||
let item = s:findItem(self.info.data, 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_bookmark_keyDelete,
|
||||
\ 'onCr(' . s:OPEN_TYPE_DELETE . ', 0)')
|
||||
let self.items = copy(self.info.data)
|
||||
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:
|
||||
176
autoload/fuf/buffer.vim
Normal file
176
autoload/fuf/buffer.vim
Normal file
@@ -0,0 +1,176 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_buffer') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_buffer = 1
|
||||
|
||||
" }}}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#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: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), ':~:.'))
|
||||
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.targetsPath()
|
||||
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)
|
||||
call fuf#openBuffer(item.bufNr, a:mode, g:fuf_reuseWindow)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeEnterPre()
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeEnterPost()
|
||||
let self.items = map(filter(range(1, bufnr('$')),
|
||||
\ 'buflisted(v:val) && v:val != self.bufNrPrev'),
|
||||
\ 's:makeItem(v:val)')
|
||||
if g:fuf_buffer_mruOrder
|
||||
call fuf#mapToSetSerialIndex(sort(self.items, 's:compareTimeDescending'), 1)
|
||||
endif
|
||||
let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeLeavePost(opened)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" vim: set fdm=marker:
|
||||
133
autoload/fuf/callbackfile.vim
Normal file
133
autoload/fuf/callbackfile.vim
Normal file
@@ -0,0 +1,133 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_callbackfile') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_callbackfile = 1
|
||||
|
||||
" }}}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#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() . 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.targetsPath()
|
||||
return 1
|
||||
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
|
||||
call s:listener.onAbort()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" vim: set fdm=marker:
|
||||
135
autoload/fuf/callbackitem.vim
Normal file
135
autoload/fuf/callbackitem.vim
Normal file
@@ -0,0 +1,135 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_callbackitem') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_callbackitem = 1
|
||||
|
||||
" }}}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#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.targetsPath()
|
||||
return s:forPath
|
||||
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
|
||||
call s:listener.onAbort()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" vim: set fdm=marker:
|
||||
168
autoload/fuf/changelist.vim
Normal file
168
autoload/fuf/changelist.vim
Normal file
@@ -0,0 +1,168 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_changelist') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_changelist = 1
|
||||
|
||||
" }}}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#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.targetsPath()
|
||||
return 0
|
||||
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:
|
||||
|
||||
128
autoload/fuf/dir.vim
Normal file
128
autoload/fuf/dir.vim
Normal file
@@ -0,0 +1,128 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_dir') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_dir = 1
|
||||
|
||||
" }}}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#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_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.targetsPath()
|
||||
return 1
|
||||
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(
|
||||
\ split(glob(fnamemodify(a:word, ':p') . '*'), "\n"),
|
||||
\ [], 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:
|
||||
137
autoload/fuf/file.vim
Normal file
137
autoload/fuf/file.vim
Normal file
@@ -0,0 +1,137 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_file') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_file = 1
|
||||
|
||||
" }}}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#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 = getcwd() . g:fuf_file_exclude . "\n" . a:dir
|
||||
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, bufNr, cache)
|
||||
let key = a:dir . 'AVOIDING EMPTY KEY'
|
||||
if !exists('a:cache[key]')
|
||||
" NOTE: filtering should be done with
|
||||
" 'bufnr("^" . v:val.word . "$") != a:bufNr'.
|
||||
" But it takes a lot of time!
|
||||
let bufName = bufname(a:bufNr)
|
||||
let a:cache[key] =
|
||||
\ filter(copy(s:enumItems(a:dir)), 'v:val.word != bufName')
|
||||
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.targetsPath()
|
||||
return 1
|
||||
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:
|
||||
119
autoload/fuf/givencmd.vim
Normal file
119
autoload/fuf/givencmd.vim
Normal file
@@ -0,0 +1,119 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_givencmd') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_givencmd = 1
|
||||
|
||||
" }}}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#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.targetsPath()
|
||||
return 0
|
||||
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:
|
||||
119
autoload/fuf/givendir.vim
Normal file
119
autoload/fuf/givendir.vim
Normal file
@@ -0,0 +1,119 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_givendir') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_givendir = 1
|
||||
|
||||
" }}}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#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.targetsPath()
|
||||
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(
|
||||
\ split(glob(fnamemodify(a:word, ':p') . '*'), "\n"),
|
||||
\ [], 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:
|
||||
117
autoload/fuf/givenfile.vim
Normal file
117
autoload/fuf/givenfile.vim
Normal file
@@ -0,0 +1,117 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_givenfile') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_givenfile = 1
|
||||
|
||||
" }}}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#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.targetsPath()
|
||||
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:
|
||||
202
autoload/fuf/help.vim
Normal file
202
autoload/fuf/help.vim
Normal file
@@ -0,0 +1,202 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_help') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_help = 1
|
||||
|
||||
" }}}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#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' . fuf#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') . fuf#getPathSeparator()
|
||||
return {
|
||||
\ 'word' : elements[0] . suffix,
|
||||
\ 'path' : dir . elements[1],
|
||||
\ 'pattern': elements[2][1:],
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:getHelpTagEntries(tagFile)
|
||||
let names = map(readfile(a:tagFile), 's:parseHelpTagEntry(v:val, a:tagFile)')
|
||||
return filter(names, '!empty(v:val)')
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:parseHelpTagFiles(tagFiles)
|
||||
if !empty(g:fuf_help_cache_dir)
|
||||
if !isdirectory(expand(g:fuf_help_cache_dir))
|
||||
call mkdir(expand(g:fuf_help_cache_dir), 'p')
|
||||
endif
|
||||
" NOTE: fnamemodify('a/b', ':p') returns 'a/b/' if the directory exists.
|
||||
let cacheFile = fnamemodify(g:fuf_help_cache_dir, ':p')
|
||||
\ . fuf#hash224(join(a:tagFiles, "\n"))
|
||||
if filereadable(cacheFile) && fuf#countModifiedFiles(a:tagFiles, getftime(cacheFile)) == 0
|
||||
return map(readfile(cacheFile), 'eval(v:val)')
|
||||
endif
|
||||
endif
|
||||
let items = fuf#unique(fuf#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)')
|
||||
if !empty(g:fuf_help_cache_dir)
|
||||
call writefile(map(copy(items), 'string(v:val)'), cacheFile)
|
||||
endif
|
||||
return items
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:enumHelpTags(tagFiles)
|
||||
if !len(a:tagFiles)
|
||||
return []
|
||||
endif
|
||||
let key = join(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)
|
||||
\ }
|
||||
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.targetsPath()
|
||||
return 0
|
||||
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:
|
||||
178
autoload/fuf/jumplist.vim
Normal file
178
autoload/fuf/jumplist.vim
Normal file
@@ -0,0 +1,178 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_jumplist') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_jumplist = 1
|
||||
|
||||
" }}}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#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.targetsPath()
|
||||
return 0
|
||||
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:
|
||||
|
||||
131
autoload/fuf/line.vim
Normal file
131
autoload/fuf/line.vim
Normal file
@@ -0,0 +1,131 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_line') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_line = 1
|
||||
|
||||
" }}}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#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.targetsPath()
|
||||
return 0
|
||||
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:
|
||||
130
autoload/fuf/mrucmd.vim
Normal file
130
autoload/fuf/mrucmd.vim
Normal file
@@ -0,0 +1,130 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_mrucmd') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_mrucmd = 1
|
||||
|
||||
" }}}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#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 info = fuf#loadInfoFile(s:MODE_NAME)
|
||||
let info.data = fuf#updateMruList(
|
||||
\ info.data, { 'word' : a:cmd, 'time' : localtime() },
|
||||
\ g:fuf_mrucmd_maxItem, g:fuf_mrucmd_exclude)
|
||||
call fuf#saveInfoFile(s:MODE_NAME, info)
|
||||
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.targetsPath()
|
||||
return 0
|
||||
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 = copy(self.info.data)
|
||||
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:
|
||||
156
autoload/fuf/mrufile.vim
Normal file
156
autoload/fuf/mrufile.vim
Normal file
@@ -0,0 +1,156 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_mrufile') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_mrufile = 1
|
||||
|
||||
" }}}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#renewCache()
|
||||
let s:cache = {}
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#mrufile#requiresOnCommandPre()
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
"
|
||||
function fuf#mrufile#onInit()
|
||||
call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""')
|
||||
augroup fuf#mrufile
|
||||
autocmd!
|
||||
autocmd BufEnter * call s:updateInfo()
|
||||
autocmd BufWritePost * call s:updateInfo()
|
||||
augroup END
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" LOCAL FUNCTIONS/VARIABLES {{{1
|
||||
|
||||
let s:MODE_NAME = expand('<sfile>:t:r')
|
||||
|
||||
"
|
||||
function s:updateInfo()
|
||||
if !empty(&buftype) || !filereadable(expand('%'))
|
||||
return
|
||||
endif
|
||||
let info = fuf#loadInfoFile(s:MODE_NAME)
|
||||
let info.data = fuf#updateMruList(
|
||||
\ info.data, { 'word' : expand('%:p'), 'time' : localtime() },
|
||||
\ g:fuf_mrufile_maxItem, g:fuf_mrufile_exclude)
|
||||
call fuf#saveInfoFile(s:MODE_NAME, info)
|
||||
call s:removeItemFromCache(expand('%:p'))
|
||||
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, ':~'), strftime(g:fuf_timeFormat, a:item.time), 0)
|
||||
else
|
||||
let s:cache[a:item.word] = {}
|
||||
endif
|
||||
endif
|
||||
return s:cache[a:item.word]
|
||||
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_mrufile_prompt, self.partialMatching)
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.getPreviewHeight()
|
||||
return g:fuf_previewHeight
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.targetsPath()
|
||||
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()
|
||||
let self.items = copy(self.info.data)
|
||||
let self.items = map(self.items, 's:formatItemUsingCache(v:val)')
|
||||
let self.items = filter(self.items, '!empty(v:val) && bufnr("^" . v:val.word . "$") != self.bufNrPrev')
|
||||
let self.items = fuf#mapToSetSerialIndex(self.items, 1)
|
||||
let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeLeavePost(opened)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" vim: set fdm=marker:
|
||||
150
autoload/fuf/quickfix.vim
Normal file
150
autoload/fuf/quickfix.vim
Normal file
@@ -0,0 +1,150 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_quickfix') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_quickfix = 1
|
||||
|
||||
" }}}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#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.targetsPath()
|
||||
return 0
|
||||
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:
|
||||
|
||||
182
autoload/fuf/tag.vim
Normal file
182
autoload/fuf/tag.vim
Normal file
@@ -0,0 +1,182 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_tag') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_tag = 1
|
||||
|
||||
" }}}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#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(readfile(a:tagFile), 'matchstr(v:val, ''^[^!\t][^\t]*'')')
|
||||
return filter(names, 'v:val =~# ''\S''')
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:parseTagFiles(tagFiles)
|
||||
if !empty(g:fuf_tag_cache_dir)
|
||||
if !isdirectory(expand(g:fuf_tag_cache_dir))
|
||||
call mkdir(expand(g:fuf_tag_cache_dir), 'p')
|
||||
endif
|
||||
" NOTE: fnamemodify('a/b', ':p') returns 'a/b/' if the directory exists.
|
||||
let cacheFile = fnamemodify(g:fuf_tag_cache_dir, ':p')
|
||||
\ . fuf#hash224(join(a:tagFiles, "\n"))
|
||||
if filereadable(cacheFile) && fuf#countModifiedFiles(a:tagFiles, getftime(cacheFile)) == 0
|
||||
return map(readfile(cacheFile), 'eval(v:val)')
|
||||
endif
|
||||
endif
|
||||
let items = fuf#unique(fuf#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)')
|
||||
if !empty(g:fuf_tag_cache_dir)
|
||||
call writefile(map(copy(items), 'string(v:val)'), cacheFile)
|
||||
endif
|
||||
return items
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:enumTags(tagFiles)
|
||||
if !len(a:tagFiles)
|
||||
return []
|
||||
endif
|
||||
let key = join(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)
|
||||
\ }
|
||||
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.targetsPath()
|
||||
return 0
|
||||
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:
|
||||
162
autoload/fuf/taggedfile.vim
Normal file
162
autoload/fuf/taggedfile.vim
Normal file
@@ -0,0 +1,162 @@
|
||||
"=============================================================================
|
||||
" Copyright (c) 2007-2009 Takeshi NISHIDA
|
||||
"
|
||||
"=============================================================================
|
||||
" LOAD GUARD {{{1
|
||||
|
||||
if exists('g:loaded_autoload_fuf_taggedfile') || v:version < 702
|
||||
finish
|
||||
endif
|
||||
let g:loaded_autoload_fuf_taggedfile = 1
|
||||
|
||||
" }}}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#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(readfile(a:tagfile), 'matchstr(v:val, ''^[^!\t][^\t]*\t\zs[^\t]\+'')')
|
||||
call map(readfile(a:tagfile), 'fnamemodify(v:val, ":p")')
|
||||
cd -
|
||||
call map(readfile(a:tagfile), 'fnamemodify(v:val, ":~:.")')
|
||||
return filter(result, 'v:val =~# ''[^/\\ ]$''')
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:parseTagFiles(tagFiles)
|
||||
if !empty(g:fuf_taggedfile_cache_dir)
|
||||
if !isdirectory(expand(g:fuf_taggedfile_cache_dir))
|
||||
call mkdir(expand(g:fuf_taggedfile_cache_dir), 'p')
|
||||
endif
|
||||
" NOTE: fnamemodify('a/b', ':p') returns 'a/b/' if the directory exists.
|
||||
let cacheFile = fnamemodify(g:fuf_taggedfile_cache_dir, ':p')
|
||||
\ . fuf#hash224(join(a:tagFiles, "\n"))
|
||||
if filereadable(cacheFile) && fuf#countModifiedFiles(a:tagFiles, getftime(cacheFile)) == 0
|
||||
return map(readfile(cacheFile), 'eval(v:val)')
|
||||
endif
|
||||
endif
|
||||
let items = fuf#unique(fuf#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)
|
||||
if !empty(g:fuf_taggedfile_cache_dir)
|
||||
call writefile(map(copy(items), 'string(v:val)'), cacheFile)
|
||||
endif
|
||||
return items
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:enumTaggedFiles(tagFiles)
|
||||
if !len(a:tagFiles)
|
||||
return []
|
||||
endif
|
||||
let key = join([getcwd()] + 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)
|
||||
\ }
|
||||
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.targetsPath()
|
||||
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: Don't do this in onModeEnterPre()
|
||||
" because that should return in a short time.
|
||||
let self.items =
|
||||
\ filter(copy(s:enumTaggedFiles(self.tagFiles)),
|
||||
\ 'bufnr("^" . v:val.word . "$") != self.bufNrPrev')
|
||||
endfunction
|
||||
|
||||
"
|
||||
function s:handler.onModeLeavePost(opened)
|
||||
endfunction
|
||||
|
||||
" }}}1
|
||||
"=============================================================================
|
||||
" vim: set fdm=marker:
|
||||
591
autoload/getscript.vim
Normal file
591
autoload/getscript.vim
Normal file
@@ -0,0 +1,591 @@
|
||||
" ---------------------------------------------------------------------
|
||||
" getscript.vim
|
||||
" Author: Charles E. Campbell, Jr.
|
||||
" Date: Jan 08, 2008
|
||||
" Version: 29
|
||||
" Installing: :help glvs-install
|
||||
" Usage: :help glvs
|
||||
"
|
||||
" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim
|
||||
"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
|
||||
" ---------------------------------------------------------------------
|
||||
" Initialization: {{{1
|
||||
" if you're sourcing this file, surely you can't be
|
||||
" expecting vim to be in its vi-compatible mode!
|
||||
if &cp
|
||||
echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)"
|
||||
finish
|
||||
endif
|
||||
let s:keepcpo = &cpo
|
||||
set cpo&vim
|
||||
"DechoTabOn
|
||||
|
||||
if exists("g:loaded_getscript")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_getscript= "v29"
|
||||
|
||||
" ---------------------------
|
||||
" Global Variables: {{{1
|
||||
" ---------------------------
|
||||
" Cygwin Detection ------- {{{2
|
||||
if !exists("g:getscript_cygwin")
|
||||
if has("win32") || has("win95") || has("win64") || has("win16")
|
||||
if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
|
||||
let g:getscript_cygwin= 1
|
||||
else
|
||||
let g:getscript_cygwin= 0
|
||||
endif
|
||||
else
|
||||
let g:getscript_cygwin= 0
|
||||
endif
|
||||
endif
|
||||
" shell quoting character {{{2
|
||||
if exists("g:netrw_shq") && !exists("g:getscript_shq")
|
||||
let g:getscript_shq= g:netrw_shq
|
||||
elseif !exists("g:getscript_shq")
|
||||
if exists("&shq") && &shq != ""
|
||||
let g:getscript_shq= &shq
|
||||
elseif exists("&sxq") && &sxq != ""
|
||||
let g:getscript_shq= &sxq
|
||||
elseif has("win32") || has("win95") || has("win64") || has("win16")
|
||||
if g:getscript_cygwin
|
||||
let g:getscript_shq= "'"
|
||||
else
|
||||
let g:getscript_shq= '"'
|
||||
endif
|
||||
else
|
||||
let g:getscript_shq= "'"
|
||||
endif
|
||||
" call Decho("g:getscript_shq<".g:getscript_shq.">")
|
||||
endif
|
||||
|
||||
" wget vs curl {{{2
|
||||
if !exists("g:GetLatestVimScripts_wget")
|
||||
if executable("wget")
|
||||
let g:GetLatestVimScripts_wget= "wget"
|
||||
elseif executable("curl")
|
||||
let g:GetLatestVimScripts_wget= "curl"
|
||||
else
|
||||
let g:GetLatestVimScripts_wget = 'echo "GetLatestVimScripts needs wget or curl"'
|
||||
let g:GetLatestVimScripts_options = ""
|
||||
endif
|
||||
endif
|
||||
|
||||
" options that wget and curl require:
|
||||
if !exists("g:GetLatestVimScripts_options")
|
||||
if g:GetLatestVimScripts_wget == "wget"
|
||||
let g:GetLatestVimScripts_options= "-q -O"
|
||||
elseif g:GetLatestVimScripts_wget == "curl"
|
||||
let g:GetLatestVimScripts_options= "-s -O"
|
||||
else
|
||||
let g:GetLatestVimScripts_options= ""
|
||||
endif
|
||||
endif
|
||||
|
||||
" by default, allow autoinstall lines to work
|
||||
if !exists("g:GetLatestVimScripts_allowautoinstall")
|
||||
let g:GetLatestVimScripts_allowautoinstall= 1
|
||||
endif
|
||||
|
||||
"" For debugging:
|
||||
"let g:GetLatestVimScripts_wget = "echo"
|
||||
"let g:GetLatestVimScripts_options = "options"
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Check If AutoInstall Capable: {{{1
|
||||
let s:autoinstall= ""
|
||||
if g:GetLatestVimScripts_allowautoinstall
|
||||
|
||||
if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash"
|
||||
" windows (but not cygwin/bash)
|
||||
let s:dotvim= "vimfiles"
|
||||
if !exists("g:GetLatestVimScripts_mv")
|
||||
let g:GetLatestVimScripts_mv= "ren"
|
||||
endif
|
||||
|
||||
else
|
||||
" unix
|
||||
let s:dotvim= ".vim"
|
||||
if !exists("g:GetLatestVimScripts_mv")
|
||||
let g:GetLatestVimScripts_mv= "mv"
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim)
|
||||
let s:autoinstall= $HOME."/".s:dotvim
|
||||
endif
|
||||
" call Decho("s:autoinstall<".s:autoinstall.">")
|
||||
"else "Decho
|
||||
" call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled")
|
||||
endif
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Public Interface: {{{1
|
||||
com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts()
|
||||
com! -nargs=0 GetScript call getscript#GetLatestVimScripts()
|
||||
silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts()
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" GetOneScript: (Get Latest Vim Script) this function operates {{{1
|
||||
" on the current line, interpreting two numbers and text as
|
||||
" ScriptID, SourceID, and Filename.
|
||||
" It downloads any scripts that have newer versions from vim.sf.net.
|
||||
fun! s:GetOneScript(...)
|
||||
" call Dfunc("GetOneScript()")
|
||||
|
||||
" set options to allow progress to be shown on screen
|
||||
let rega= @a
|
||||
let t_ti= &t_ti
|
||||
let t_te= &t_te
|
||||
let rs = &rs
|
||||
set t_ti= t_te= nors
|
||||
|
||||
" put current line on top-of-screen and interpret it into
|
||||
" a script identifer : used to obtain webpage
|
||||
" source identifier : used to identify current version
|
||||
" and an associated comment: used to report on what's being considered
|
||||
if a:0 >= 3
|
||||
let scriptid = a:1
|
||||
let srcid = a:2
|
||||
let fname = a:3
|
||||
let cmmnt = ""
|
||||
" call Decho("scriptid<".scriptid.">")
|
||||
" call Decho("srcid <".srcid.">")
|
||||
" call Decho("fname <".fname.">")
|
||||
else
|
||||
let curline = getline(".")
|
||||
if curline =~ '^\s*#'
|
||||
let @a= rega
|
||||
" call Dret("GetOneScript : skipping a pure comment line")
|
||||
return
|
||||
endif
|
||||
let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)\(\s*#.*\)\=$'
|
||||
try
|
||||
let scriptid = substitute(curline,parsepat,'\1','e')
|
||||
catch /^Vim\%((\a\+)\)\=:E486/
|
||||
let scriptid= 0
|
||||
endtry
|
||||
try
|
||||
let srcid = substitute(curline,parsepat,'\2','e')
|
||||
catch /^Vim\%((\a\+)\)\=:E486/
|
||||
let srcid= 0
|
||||
endtry
|
||||
try
|
||||
let fname= substitute(curline,parsepat,'\3','e')
|
||||
catch /^Vim\%((\a\+)\)\=:E486/
|
||||
let fname= ""
|
||||
endtry
|
||||
try
|
||||
let cmmnt= substitute(curline,parsepat,'\4','e')
|
||||
catch /^Vim\%((\a\+)\)\=:E486/
|
||||
let cmmnt= ""
|
||||
endtry
|
||||
" call Decho("curline <".curline.">")
|
||||
" call Decho("parsepat<".parsepat.">")
|
||||
" call Decho("scriptid<".scriptid.">")
|
||||
" call Decho("srcid <".srcid.">")
|
||||
" call Decho("fname <".fname.">")
|
||||
endif
|
||||
|
||||
if scriptid == 0 || srcid == 0
|
||||
" When looking for :AutoInstall: lines, skip scripts that have 0 0 scriptname
|
||||
let @a= rega
|
||||
" call Dret("GetOneScript : skipping a scriptid==srcid==0 line")
|
||||
return
|
||||
endif
|
||||
|
||||
let doautoinstall= 0
|
||||
if fname =~ ":AutoInstall:"
|
||||
" call Decho("case AutoInstall: fname<".fname.">")
|
||||
let aicmmnt= substitute(fname,'\s\+:AutoInstall:\s\+',' ','')
|
||||
" call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall)
|
||||
if s:autoinstall != ""
|
||||
let doautoinstall = g:GetLatestVimScripts_allowautoinstall
|
||||
endif
|
||||
else
|
||||
let aicmmnt= fname
|
||||
endif
|
||||
" call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall)
|
||||
|
||||
exe "norm z\<CR>"
|
||||
redraw!
|
||||
" call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid)
|
||||
echomsg 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid
|
||||
|
||||
" grab a copy of the plugin's vim.sf.net webpage
|
||||
let scriptaddr = 'http://vim.sf.net/script.php?script_id='.scriptid
|
||||
let tmpfile = tempname()
|
||||
let v:errmsg = ""
|
||||
|
||||
" make up to three tries at downloading the description
|
||||
let itry= 1
|
||||
while itry <= 3
|
||||
" call Decho("try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr)
|
||||
if has("win32") || has("win16") || has("win95")
|
||||
" call Decho("new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq.' '.g:getscript_shq.scriptaddr.g:getscript_shq."|q!")
|
||||
new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq.' '.g:getscript_shq.scriptaddr.g:getscript_shq|q!
|
||||
else
|
||||
" call Decho("exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq." ".g:getscript_shq.scriptaddr.g:getscript_shq)
|
||||
exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq." ".g:getscript_shq.scriptaddr.g:getscript_shq
|
||||
endif
|
||||
if itry == 1
|
||||
exe "silent vsplit ".tmpfile
|
||||
else
|
||||
silent! e %
|
||||
endif
|
||||
|
||||
" find the latest source-id in the plugin's webpage
|
||||
silent! 1
|
||||
let findpkg= search('Click on the package to download','W')
|
||||
if findpkg > 0
|
||||
break
|
||||
endif
|
||||
let itry= itry + 1
|
||||
endwhile
|
||||
" call Decho(" --- end downloading tries while loop --- itry=".itry)
|
||||
|
||||
" testing: did finding "Click on the package..." fail?
|
||||
if findpkg == 0 || itry >= 4
|
||||
silent q!
|
||||
call delete(tmpfile)
|
||||
" restore options
|
||||
let &t_ti = t_ti
|
||||
let &t_te = t_te
|
||||
let &rs = rs
|
||||
let s:downerrors = s:downerrors + 1
|
||||
" call Decho("***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">")
|
||||
echomsg "***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">"
|
||||
" call Dret("GetOneScript : srch for /Click on the package/ failed")
|
||||
let @a= rega
|
||||
return
|
||||
endif
|
||||
" call Decho('found "Click on the package to download"')
|
||||
|
||||
let findsrcid= search('src_id=','W')
|
||||
if findsrcid == 0
|
||||
silent q!
|
||||
call delete(tmpfile)
|
||||
" restore options
|
||||
let &t_ti = t_ti
|
||||
let &t_te = t_te
|
||||
let &rs = rs
|
||||
let s:downerrors = s:downerrors + 1
|
||||
" call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">")
|
||||
echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">"
|
||||
let @a= rega
|
||||
" call Dret("GetOneScript : srch for /src_id/ failed")
|
||||
return
|
||||
endif
|
||||
" call Decho('found "src_id=" in description page')
|
||||
|
||||
let srcidpat = '^\s*<td class.*src_id=\(\d\+\)">\([^<]\+\)<.*$'
|
||||
let latestsrcid= substitute(getline("."),srcidpat,'\1','')
|
||||
let sname = substitute(getline("."),srcidpat,'\2','') " script name actually downloaded
|
||||
" call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> sname<".sname.">")
|
||||
silent q!
|
||||
call delete(tmpfile)
|
||||
|
||||
" convert the strings-of-numbers into numbers
|
||||
let srcid = srcid + 0
|
||||
let latestsrcid = latestsrcid + 0
|
||||
" call Decho("srcid=".srcid." latestsrcid=".latestsrcid." sname<".sname.">")
|
||||
|
||||
" has the plugin's most-recent srcid increased, which indicates
|
||||
" that it has been updated
|
||||
if latestsrcid > srcid
|
||||
" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."]: need to update <".sname.">")
|
||||
|
||||
let s:downloads= s:downloads + 1
|
||||
if sname == bufname("%")
|
||||
" GetLatestVimScript has to be careful about downloading itself
|
||||
let sname= "NEW_".sname
|
||||
endif
|
||||
|
||||
" the plugin has been updated since we last obtained it, so download a new copy
|
||||
" call Decho("...downloading new <".sname.">")
|
||||
echomsg "...downloading new <".sname.">"
|
||||
if has("win32") || has("win16") || has("win95")
|
||||
" call Decho("new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq."|q")
|
||||
new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq|q
|
||||
else
|
||||
" call Decho("silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq)
|
||||
exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq
|
||||
endif
|
||||
|
||||
" AutoInstall: only if doautoinstall has been requested by the plugin itself
|
||||
if doautoinstall
|
||||
" call Decho("attempting to do autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname))
|
||||
if filereadable(sname)
|
||||
" call Decho("silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.s:autoinstall.g:getscript_shq)
|
||||
exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.s:autoinstall.g:getscript_shq
|
||||
let curdir = escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #")
|
||||
let installdir= curdir."/Installed"
|
||||
if !isdirectory(installdir)
|
||||
call mkdir(installdir)
|
||||
endif
|
||||
" call Decho("exe cd ".s:autoinstall)
|
||||
exe "cd ".escape(s:autoinstall,' ')
|
||||
|
||||
" decompress
|
||||
if sname =~ '\.bz2$'
|
||||
" call Decho("decompress: attempt to bunzip2 ".sname)
|
||||
exe "silent !bunzip2 ".g:getscript_shq.sname.g:getscript_shq
|
||||
let sname= substitute(sname,'\.bz2$','','')
|
||||
" call Decho("decompress: new sname<".sname."> after bunzip2")
|
||||
elseif sname =~ '\.gz$'
|
||||
" call Decho("decompress: attempt to gunzip ".sname)
|
||||
exe "silent !gunzip ".g:getscript_shq.sname.g:getscript_shq
|
||||
let sname= substitute(sname,'\.gz$','','')
|
||||
" call Decho("decompress: new sname<".sname."> after gunzip")
|
||||
endif
|
||||
|
||||
" distribute archive(.zip, .tar, .vba) contents
|
||||
if sname =~ '\.zip$'
|
||||
" call Decho("dearchive: attempt to unzip ".sname)
|
||||
exe "silent !unzip -o ".g:getscript_shq.sname.g:getscript_shq
|
||||
elseif sname =~ '\.tar$'
|
||||
" call Decho("dearchive: attempt to untar ".sname)
|
||||
exe "silent !tar -xvf ".g:getscript_shq.sname.g:getscript_shq
|
||||
elseif sname =~ '\.vba$'
|
||||
" call Decho("dearchive: attempt to handle a vimball: ".sname)
|
||||
silent 1split
|
||||
exe "silent e ".escape(sname,' ')
|
||||
silent so %
|
||||
silent q
|
||||
endif
|
||||
|
||||
if sname =~ '.vim$'
|
||||
" call Decho("dearchive: attempt to simply move ".sname." to plugin")
|
||||
exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." plugin"
|
||||
else
|
||||
" call Decho("dearchive: move <".sname."> to installdir<".installdir.">")
|
||||
exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".installdir
|
||||
endif
|
||||
|
||||
" helptags step
|
||||
let docdir= substitute(&rtp,',.*','','e')."/doc"
|
||||
" call Decho("helptags: docdir<".docdir.">")
|
||||
exe "helptags ".docdir
|
||||
exe "cd ".curdir
|
||||
endif
|
||||
if fname !~ ':AutoInstall:'
|
||||
let modline=scriptid." ".latestsrcid." :AutoInstall: ".fname.cmmnt
|
||||
else
|
||||
let modline=scriptid." ".latestsrcid." ".fname.cmmnt
|
||||
endif
|
||||
else
|
||||
let modline=scriptid." ".latestsrcid." ".fname.cmmnt
|
||||
endif
|
||||
|
||||
" update the data in the <GetLatestVimScripts.dat> file
|
||||
call setline(line("."),modline)
|
||||
" call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">")
|
||||
" else " Decho
|
||||
" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."], no need to update")
|
||||
endif
|
||||
|
||||
" restore options
|
||||
let &t_ti = t_ti
|
||||
let &t_te = t_te
|
||||
let &rs = rs
|
||||
let @a = rega
|
||||
|
||||
" call Dret("GetOneScript")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" GetLatestVimScripts: this function gets the latest versions of {{{1
|
||||
" scripts based on the list in
|
||||
" (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat
|
||||
fun! getscript#GetLatestVimScripts()
|
||||
" call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">")
|
||||
|
||||
" insure that wget is executable
|
||||
if executable(g:GetLatestVimScripts_wget) != 1
|
||||
echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system"
|
||||
" call Dret("GetLatestVimScripts : wget not executable/availble")
|
||||
return
|
||||
endif
|
||||
|
||||
" Find the .../GetLatest subdirectory under the runtimepath
|
||||
for datadir in split(&rtp,',') + ['']
|
||||
if isdirectory(datadir."/GetLatest")
|
||||
" call Decho("found directory<".datadir.">")
|
||||
let datadir= datadir . "/GetLatest"
|
||||
break
|
||||
endif
|
||||
if filereadable(datadir."GetLatestVimScripts.dat")
|
||||
" call Decho("found ".datadir."/GetLatestVimScripts.dat")
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Sanity checks: readability and writability
|
||||
if datadir == ""
|
||||
echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install'
|
||||
" call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory")
|
||||
return
|
||||
endif
|
||||
|
||||
if filewritable(datadir) != 2
|
||||
echoerr "(getLatestVimScripts) Your ".datadir." isn't writable"
|
||||
" call Dret("GetLatestVimScripts : non-writable directory<".datadir.">")
|
||||
return
|
||||
endif
|
||||
let datafile= datadir."/GetLatestVimScripts.dat"
|
||||
if !filereadable(datafile)
|
||||
echoerr "Your data file<".datafile."> isn't readable"
|
||||
" call Dret("GetLatestVimScripts : non-readable datafile<".datafile.">")
|
||||
return
|
||||
endif
|
||||
if !filewritable(datafile)
|
||||
echoerr "Your data file<".datafile."> isn't writable"
|
||||
" call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">")
|
||||
return
|
||||
endif
|
||||
" call Decho("datadir <".datadir.">")
|
||||
" call Decho("datafile <".datafile.">")
|
||||
|
||||
" don't let any events interfere (like winmanager's, taglist's, etc)
|
||||
let eikeep= &ei
|
||||
set ei=all
|
||||
|
||||
" record current directory, change to datadir, open split window with
|
||||
" datafile
|
||||
let origdir= getcwd()
|
||||
exe "cd ".escape(substitute(datadir,'\','/','ge'),"|[]*'\" #")
|
||||
split
|
||||
exe "e ".escape(substitute(datafile,'\','/','ge'),"|[]*'\" #")
|
||||
res 1000
|
||||
let s:downloads = 0
|
||||
let s:downerrors= 0
|
||||
|
||||
" Check on dependencies mentioned in plugins
|
||||
" call Decho(" ")
|
||||
" call Decho("searching plugins for GetLatestVimScripts dependencies")
|
||||
let lastline = line("$")
|
||||
" call Decho("lastline#".lastline)
|
||||
let plugins = split(globpath(&rtp,"plugin/*.vim"),'\n')
|
||||
let foundscript = 0
|
||||
let firstdir= ""
|
||||
|
||||
for plugin in plugins
|
||||
|
||||
" don't process plugins in system directories
|
||||
if firstdir == ""
|
||||
let firstdir= substitute(plugin,'[/\\][^/\\]\+$','','')
|
||||
" call Decho("setting firstdir<".firstdir.">")
|
||||
else
|
||||
let curdir= substitute(plugin,'[/\\][^/\\]\+$','','')
|
||||
" call Decho("curdir<".curdir.">")
|
||||
if curdir != firstdir
|
||||
" call Decho("skipping subsequent plugins: curdir<".curdir."> != firstdir<".firstdir.">")
|
||||
break
|
||||
endif
|
||||
endif
|
||||
|
||||
" read plugin in
|
||||
$
|
||||
" call Decho(" ")
|
||||
" call Decho(".dependency checking<".plugin."> line$=".line("$"))
|
||||
exe "silent r ".escape(plugin,"[]#*$%'\" ?`!&();<>\\")
|
||||
|
||||
while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0
|
||||
let newscript= substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e')
|
||||
let llp1 = lastline+1
|
||||
" call Decho("..newscript<".newscript.">")
|
||||
|
||||
" don't process ""GetLatestVimScripts lines -- those that have been doubly-commented out
|
||||
if newscript !~ '^"'
|
||||
" found a "GetLatestVimScripts: # #" line in the script; check if its already in the datafile
|
||||
let curline = line(".")
|
||||
let noai_script = substitute(newscript,'\s*:AutoInstall:\s*','','e')
|
||||
exe llp1
|
||||
let srchline = search('\<'.noai_script.'\>','bW')
|
||||
" call Decho("..noai_script<".noai_script."> srch=".srchline."curline#".line(".")." lastline#".lastline)
|
||||
|
||||
if srchline == 0
|
||||
" found a new script to permanently include in the datafile
|
||||
let keep_rega = @a
|
||||
let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','')
|
||||
exe lastline."put a"
|
||||
echomsg "Appending <".@a."> to ".datafile." for ".newscript
|
||||
" call Decho("..APPEND (".noai_script.")<".@a."> to GetLatestVimScripts.dat")
|
||||
let @a = keep_rega
|
||||
let lastline = llp1
|
||||
let curline = curline + 1
|
||||
let foundscript = foundscript + 1
|
||||
" else " Decho
|
||||
" call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")")
|
||||
endif
|
||||
|
||||
let curline = curline + 1
|
||||
exe curline
|
||||
endif
|
||||
endwhile
|
||||
|
||||
let llp1= lastline + 1
|
||||
" call Decho(".deleting lines: ".llp1.",$d")
|
||||
exe "silent! ".llp1.",$d"
|
||||
endfor
|
||||
" call Decho("--- end dependency checking loop --- foundscript=".foundscript)
|
||||
" call Decho(" ")
|
||||
|
||||
if foundscript == 0
|
||||
setlocal nomod
|
||||
endif
|
||||
|
||||
" Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat
|
||||
" call Decho("begin: checking out-of-date scripts using datafile<".datafile.">")
|
||||
setlocal lz
|
||||
1
|
||||
" /^-----/,$g/^\s*\d/call Decho(getline("."))
|
||||
1
|
||||
/^-----/,$g/^\s*\d/call s:GetOneScript()
|
||||
" call Decho("--- end out-of-date checking --- ")
|
||||
|
||||
" Final report (an echomsg)
|
||||
try
|
||||
silent! ?^-------?
|
||||
catch /^Vim\%((\a\+)\)\=:E114/
|
||||
" call Dret("GetLatestVimScripts : nothing done!")
|
||||
return
|
||||
endtry
|
||||
exe "norm! kz\<CR>"
|
||||
redraw!
|
||||
let s:msg = ""
|
||||
if s:downloads == 1
|
||||
let s:msg = "Downloaded one updated script to <".datadir.">"
|
||||
elseif s:downloads == 2
|
||||
let s:msg= "Downloaded two updated scripts to <".datadir.">"
|
||||
elseif s:downloads > 1
|
||||
let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">"
|
||||
else
|
||||
let s:msg= "Everything was already current"
|
||||
endif
|
||||
if s:downerrors > 0
|
||||
let s:msg= s:msg." (".s:downerrors." downloading errors)"
|
||||
endif
|
||||
echomsg s:msg
|
||||
" save the file
|
||||
if &mod
|
||||
silent! w!
|
||||
endif
|
||||
q
|
||||
|
||||
" restore events and current directory
|
||||
exe "cd ".escape(substitute(origdir,'\','/','ge'),"|[]*'\" #")
|
||||
let &ei= eikeep
|
||||
setlocal nolz
|
||||
" call Dret("GetLatestVimScripts : did ".s:downloads." downloads")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Restore Options: {{{1
|
||||
let &cpo= s:keepcpo
|
||||
unlet s:keepcpo
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Modelines: {{{1
|
||||
" vim: ts=8 sts=2 fdm=marker nowrap
|
||||
471
autoload/mark.vim
Normal file
471
autoload/mark.vim
Normal file
@@ -0,0 +1,471 @@
|
||||
" Script Name: mark.vim
|
||||
" Description: Highlight several words in different colors simultaneously.
|
||||
"
|
||||
" Copyright: (C) 2005-2008 by Yuheng Xie
|
||||
" (C) 2008-2010 by Ingo Karkat
|
||||
" The VIM LICENSE applies to this script; see ':help copyright'.
|
||||
"
|
||||
" Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||
"
|
||||
" Dependencies:
|
||||
" - SearchSpecial.vim autoload script (optional, for improved search messages).
|
||||
"
|
||||
" Version: 2.3.3
|
||||
" Changes:
|
||||
" 19-Feb-2010, Andy Wokula
|
||||
" - BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results
|
||||
" in endless loop. Thanks to Andy Wokula for the patch.
|
||||
"
|
||||
" 17-Nov-2009, Ingo Karkat + Andy Wokula
|
||||
" - BUG: Creation of literal pattern via '\V' in {Visual}<Leader>m mapping
|
||||
" collided with individual escaping done in <Leader>m mapping so that an
|
||||
" escaped '\*' would be interpreted as a multi item when both modes are used
|
||||
" for marking. Replaced \V with s:EscapeText() to be consistent. Replaced the
|
||||
" (overly) generic mark#GetVisualSelectionEscaped() with
|
||||
" mark#GetVisualSelectionAsRegexp() and
|
||||
" mark#GetVisualSelectionAsLiteralPattern(). Thanks to Andy Wokula for the
|
||||
" patch.
|
||||
"
|
||||
" 06-Jul-2009, Ingo Karkat
|
||||
" - Re-wrote s:AnyMark() in functional programming style.
|
||||
" - Now resetting 'smartcase' before the search, this setting should not be
|
||||
" considered for *-command-alike searches and cannot be supported because all
|
||||
" mark patterns are concatenated into one large regexp, anyway.
|
||||
"
|
||||
" 04-Jul-2009, Ingo Karkat
|
||||
" - Re-wrote s:Search() to handle v:count:
|
||||
" - Obsoleted s:current_mark_position; mark#CurrentMark() now returns both the
|
||||
" mark text and start position.
|
||||
" - s:Search() now checks for a jump to the current mark during a backward
|
||||
" search; this eliminates a lot of logic at its calling sites.
|
||||
" - Reverted negative logic at calling sites; using empty() instead of != "".
|
||||
" - Now passing a:isBackward instead of optional flags into s:Search() and
|
||||
" around its callers.
|
||||
" - ':normal! zv' moved from callers into s:Search().
|
||||
" - Removed delegation to SearchSpecial#ErrorMessage(), because the fallback
|
||||
" implementation is perfectly fine and the SearchSpecial routine changed its
|
||||
" output format into something unsuitable anyway.
|
||||
" - Using descriptive text instead of "@" (and appropriate highlighting) when
|
||||
" querying for the pattern to mark.
|
||||
"
|
||||
" 02-Jul-2009, Ingo Karkat
|
||||
" - Split off functions into autoload script.
|
||||
|
||||
"- functions ------------------------------------------------------------------
|
||||
function! s:EscapeText( text )
|
||||
return substitute( escape(a:text, '\' . '^$.*[~'), "\n", '\\n', 'ge' )
|
||||
endfunction
|
||||
" Mark the current word, like the built-in star command.
|
||||
" If the cursor is on an existing mark, remove it.
|
||||
function! mark#MarkCurrentWord()
|
||||
let l:regexp = mark#CurrentMark()[0]
|
||||
if empty(l:regexp)
|
||||
let l:cword = expand("<cword>")
|
||||
|
||||
" The star command only creates a \<whole word\> search pattern if the
|
||||
" <cword> actually only consists of keyword characters.
|
||||
if l:cword =~# '^\k\+$'
|
||||
let l:regexp = '\<' . s:EscapeText(l:cword) . '\>'
|
||||
elseif l:cword != ''
|
||||
let l:regexp = s:EscapeText(l:cword)
|
||||
endif
|
||||
endif
|
||||
|
||||
if ! empty(l:regexp)
|
||||
call mark#DoMark(l:regexp)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:GetVisualSelection()
|
||||
let save_a = @a
|
||||
silent normal! gv"ay
|
||||
let res = @a
|
||||
let @a = save_a
|
||||
return res
|
||||
endfunction
|
||||
function! mark#GetVisualSelectionAsLiteralPattern()
|
||||
return s:EscapeText(s:GetVisualSelection())
|
||||
endfunction
|
||||
function! mark#GetVisualSelectionAsRegexp()
|
||||
return substitute(s:GetVisualSelection(), '\n', '', 'g')
|
||||
endfunction
|
||||
|
||||
" Manually input a regular expression.
|
||||
function! mark#MarkRegex( regexpPreset )
|
||||
call inputsave()
|
||||
echohl Question
|
||||
let l:regexp = input('Input pattern to mark: ', a:regexpPreset)
|
||||
echohl None
|
||||
call inputrestore()
|
||||
if ! empty(l:regexp)
|
||||
call mark#DoMark(l:regexp)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:Cycle( ... )
|
||||
let l:currentCycle = g:mwCycle
|
||||
let l:newCycle = (a:0 ? a:1 : g:mwCycle) + 1
|
||||
let g:mwCycle = (l:newCycle < g:mwCycleMax ? l:newCycle : 0)
|
||||
return l:currentCycle
|
||||
endfunction
|
||||
|
||||
" Set / clear matches in the current window.
|
||||
function! s:MarkMatch( indices, expr )
|
||||
for l:index in a:indices
|
||||
if w:mwMatch[l:index] > 0
|
||||
silent! call matchdelete(w:mwMatch[l:index])
|
||||
let w:mwMatch[l:index] = 0
|
||||
endif
|
||||
endfor
|
||||
|
||||
if ! empty(a:expr)
|
||||
" Make the match according to the 'ignorecase' setting, like the star command.
|
||||
" (But honor an explicit case-sensitive regexp via the /\C/ atom.)
|
||||
let l:expr = ((&ignorecase && a:expr !~# '\\\@<!\\C') ? '\c' . a:expr : a:expr)
|
||||
|
||||
" Info: matchadd() does not consider the 'magic' (it's always on),
|
||||
" 'ignorecase' and 'smartcase' settings.
|
||||
let w:mwMatch[a:indices[0]] = matchadd('MarkWord' . (a:indices[0] + 1), l:expr, -10)
|
||||
endif
|
||||
endfunction
|
||||
" Set / clear matches in all windows.
|
||||
function! s:MarkScope( indices, expr )
|
||||
let l:currentWinNr = winnr()
|
||||
|
||||
" By entering a window, its height is potentially increased from 0 to 1 (the
|
||||
" minimum for the current window). To avoid any modification, save the window
|
||||
" sizes and restore them after visiting all windows.
|
||||
let l:originalWindowLayout = winrestcmd()
|
||||
|
||||
noautocmd windo call s:MarkMatch(a:indices, a:expr)
|
||||
execute l:currentWinNr . 'wincmd w'
|
||||
silent! execute l:originalWindowLayout
|
||||
endfunction
|
||||
" Update matches in all windows.
|
||||
function! mark#UpdateScope()
|
||||
let l:currentWinNr = winnr()
|
||||
|
||||
" By entering a window, its height is potentially increased from 0 to 1 (the
|
||||
" minimum for the current window). To avoid any modification, save the window
|
||||
" sizes and restore them after visiting all windows.
|
||||
let l:originalWindowLayout = winrestcmd()
|
||||
|
||||
noautocmd windo call mark#UpdateMark()
|
||||
execute l:currentWinNr . 'wincmd w'
|
||||
silent! execute l:originalWindowLayout
|
||||
endfunction
|
||||
" Mark or unmark a regular expression.
|
||||
function! mark#DoMark(...) " DoMark(regexp)
|
||||
let regexp = (a:0 ? a:1 : '')
|
||||
|
||||
" clear all marks if regexp is null
|
||||
if empty(regexp)
|
||||
let i = 0
|
||||
let indices = []
|
||||
while i < g:mwCycleMax
|
||||
if !empty(g:mwWord[i])
|
||||
let g:mwWord[i] = ''
|
||||
call add(indices, i)
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
let g:mwLastSearched = ""
|
||||
call s:MarkScope(l:indices, '')
|
||||
return
|
||||
endif
|
||||
|
||||
" clear the mark if it has been marked
|
||||
let i = 0
|
||||
while i < g:mwCycleMax
|
||||
if regexp == g:mwWord[i]
|
||||
if g:mwLastSearched == g:mwWord[i]
|
||||
let g:mwLastSearched = ''
|
||||
endif
|
||||
let g:mwWord[i] = ''
|
||||
call s:MarkScope([i], '')
|
||||
return
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
|
||||
" add to history
|
||||
if stridx(g:mwHistAdd, "/") >= 0
|
||||
call histadd("/", regexp)
|
||||
endif
|
||||
if stridx(g:mwHistAdd, "@") >= 0
|
||||
call histadd("@", regexp)
|
||||
endif
|
||||
|
||||
" choose an unused mark group
|
||||
let i = 0
|
||||
while i < g:mwCycleMax
|
||||
if empty(g:mwWord[i])
|
||||
let g:mwWord[i] = regexp
|
||||
call s:Cycle(i)
|
||||
call s:MarkScope([i], regexp)
|
||||
return
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
|
||||
" choose a mark group by cycle
|
||||
let i = s:Cycle()
|
||||
if g:mwLastSearched == g:mwWord[i]
|
||||
let g:mwLastSearched = ''
|
||||
endif
|
||||
let g:mwWord[i] = regexp
|
||||
call s:MarkScope([i], regexp)
|
||||
endfunction
|
||||
" Initialize mark colors in a (new) window.
|
||||
function! mark#UpdateMark()
|
||||
if ! exists('w:mwMatch')
|
||||
let w:mwMatch = repeat([0], g:mwCycleMax)
|
||||
endif
|
||||
|
||||
let i = 0
|
||||
while i < g:mwCycleMax
|
||||
if empty(g:mwWord[i])
|
||||
call s:MarkMatch([i], '')
|
||||
else
|
||||
call s:MarkMatch([i], g:mwWord[i])
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" Return [mark text, mark start position] of the mark under the cursor (or
|
||||
" ['', []] if there is no mark); multi-lines marks not supported.
|
||||
function! mark#CurrentMark()
|
||||
let line = getline(".")
|
||||
let i = 0
|
||||
while i < g:mwCycleMax
|
||||
if !empty(g:mwWord[i])
|
||||
" Note: col() is 1-based, all other indexes zero-based!
|
||||
let start = 0
|
||||
while start >= 0 && start < strlen(line) && start < col(".")
|
||||
let b = match(line, g:mwWord[i], start)
|
||||
let e = matchend(line, g:mwWord[i], start)
|
||||
if b < col(".") && col(".") <= e
|
||||
return [g:mwWord[i], [line("."), (b + 1)]]
|
||||
endif
|
||||
if b == e
|
||||
break
|
||||
endif
|
||||
let start = e
|
||||
endwhile
|
||||
endif
|
||||
let i += 1
|
||||
endwhile
|
||||
return ['', []]
|
||||
endfunction
|
||||
|
||||
" Search current mark.
|
||||
function! mark#SearchCurrentMark( isBackward )
|
||||
let [l:markText, l:markPosition] = mark#CurrentMark()
|
||||
if empty(l:markText)
|
||||
if empty(g:mwLastSearched)
|
||||
call mark#SearchAnyMark(a:isBackward)
|
||||
let g:mwLastSearched = mark#CurrentMark()[0]
|
||||
else
|
||||
call s:Search(g:mwLastSearched, a:isBackward, [], 'same-mark')
|
||||
endif
|
||||
else
|
||||
call s:Search(l:markText, a:isBackward, l:markPosition, (l:markText ==# g:mwLastSearched ? 'same-mark' : 'new-mark'))
|
||||
let g:mwLastSearched = l:markText
|
||||
endif
|
||||
endfunction
|
||||
|
||||
silent! call SearchSpecial#DoesNotExist() " Execute a function to force autoload.
|
||||
if exists('*SearchSpecial#WrapMessage')
|
||||
function! s:WrapMessage( searchType, searchPattern, isBackward )
|
||||
redraw
|
||||
call SearchSpecial#WrapMessage(a:searchType, a:searchPattern, a:isBackward)
|
||||
endfunction
|
||||
function! s:EchoSearchPattern( searchType, searchPattern, isBackward )
|
||||
call SearchSpecial#EchoSearchPattern(a:searchType, a:searchPattern, a:isBackward)
|
||||
endfunction
|
||||
else
|
||||
function! s:Trim( message )
|
||||
" Limit length to avoid "Hit ENTER" prompt.
|
||||
return strpart(a:message, 0, (&columns / 2)) . (len(a:message) > (&columns / 2) ? "..." : "")
|
||||
endfunction
|
||||
function! s:WrapMessage( searchType, searchPattern, isBackward )
|
||||
redraw
|
||||
let v:warningmsg = printf('%s search hit %s, continuing at %s', a:searchType, (a:isBackward ? 'TOP' : 'BOTTOM'), (a:isBackward ? 'BOTTOM' : 'TOP'))
|
||||
echohl WarningMsg
|
||||
echo s:Trim(v:warningmsg)
|
||||
echohl None
|
||||
endfunction
|
||||
function! s:EchoSearchPattern( searchType, searchPattern, isBackward )
|
||||
let l:message = (a:isBackward ? '?' : '/') . a:searchPattern
|
||||
echohl SearchSpecialSearchType
|
||||
echo a:searchType
|
||||
echohl None
|
||||
echon s:Trim(l:message)
|
||||
endfunction
|
||||
endif
|
||||
function! s:ErrorMessage( searchType, searchPattern, isBackward )
|
||||
if &wrapscan
|
||||
let v:errmsg = a:searchType . ' not found: ' . a:searchPattern
|
||||
else
|
||||
let v:errmsg = printf('%s search hit %s without match for: %s', a:searchType, (a:isBackward ? 'TOP' : 'BOTTOM'), a:searchPattern)
|
||||
endif
|
||||
echohl ErrorMsg
|
||||
echomsg v:errmsg
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
" Wrapper around search() with additonal search and error messages and "wrapscan" warning.
|
||||
function! s:Search( pattern, isBackward, currentMarkPosition, searchType )
|
||||
let l:save_view = winsaveview()
|
||||
|
||||
" searchpos() obeys the 'smartcase' setting; however, this setting doesn't
|
||||
" make sense for the mark search, because all patterns for the marks are
|
||||
" concatenated as branches in one large regexp, and because patterns that
|
||||
" result from the *-command-alike mappings should not obey 'smartcase' (like
|
||||
" the * command itself), anyway. If the :Mark command wants to support
|
||||
" 'smartcase', it'd have to emulate that into the regular expression.
|
||||
let l:save_smartcase = &smartcase
|
||||
set nosmartcase
|
||||
|
||||
let l:count = v:count1
|
||||
let [l:startLine, l:startCol] = [line('.'), col('.')]
|
||||
let l:isWrapped = 0
|
||||
let l:isMatch = 0
|
||||
let l:line = 0
|
||||
while l:count > 0
|
||||
" Search for next match, 'wrapscan' applies.
|
||||
let [l:line, l:col] = searchpos( a:pattern, (a:isBackward ? 'b' : '') )
|
||||
|
||||
"****D echomsg '****' a:isBackward string([l:line, l:col]) string(a:currentMarkPosition) l:count
|
||||
if a:isBackward && l:line > 0 && [l:line, l:col] == a:currentMarkPosition && l:count == v:count1
|
||||
" On a search in backward direction, the first match is the start of the
|
||||
" current mark (if the cursor was positioned on the current mark text, and
|
||||
" not at the start of the mark text).
|
||||
" In contrast to the normal search, this is not considered the first
|
||||
" match. The mark text is one entity; if the cursor is positioned anywhere
|
||||
" inside the mark text, the mark text is considered the current mark. The
|
||||
" built-in '*' and '#' commands behave in the same way; the entire <cword>
|
||||
" text is considered the current match, and jumps move outside that text.
|
||||
" In normal search, the cursor can be positioned anywhere (via offsets)
|
||||
" around the search, and only that single cursor position is considered
|
||||
" the current match.
|
||||
" Thus, the search is retried without a decrease of l:count, but only if
|
||||
" this was the first match; repeat visits during wrapping around count as
|
||||
" a regular match. The search also must not be retried when this is the
|
||||
" first match, but we've been here before (i.e. l:isMatch is set): This
|
||||
" means that there is only the current mark in the buffer, and we must
|
||||
" break out of the loop and indicate that no other mark was found.
|
||||
if l:isMatch
|
||||
let l:line = 0
|
||||
break
|
||||
endif
|
||||
|
||||
" The l:isMatch flag is set so if the final mark cannot be reached, the
|
||||
" original cursor position is restored. This flag also allows us to detect
|
||||
" whether we've been here before, which is checked above.
|
||||
let l:isMatch = 1
|
||||
elseif l:line > 0
|
||||
let l:isMatch = 1
|
||||
let l:count -= 1
|
||||
|
||||
" Note: No need to check 'wrapscan'; the wrapping can only occur if
|
||||
" 'wrapscan' is actually on.
|
||||
if ! a:isBackward && (l:startLine > l:line || l:startLine == l:line && l:startCol >= l:col)
|
||||
let l:isWrapped = 1
|
||||
elseif a:isBackward && (l:startLine < l:line || l:startLine == l:line && l:startCol <= l:col)
|
||||
let l:isWrapped = 1
|
||||
endif
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
let &smartcase = l:save_smartcase
|
||||
|
||||
" We're not stuck when the search wrapped around and landed on the current
|
||||
" mark; that's why we exclude a possible wrap-around via v:count1 == 1.
|
||||
let l:isStuckAtCurrentMark = ([l:line, l:col] == a:currentMarkPosition && v:count1 == 1)
|
||||
if l:line > 0 && ! l:isStuckAtCurrentMark
|
||||
normal! zv
|
||||
|
||||
if l:isWrapped
|
||||
call s:WrapMessage(a:searchType, a:pattern, a:isBackward)
|
||||
else
|
||||
call s:EchoSearchPattern(a:searchType, a:pattern, a:isBackward)
|
||||
endif
|
||||
return 1
|
||||
else
|
||||
if l:isMatch
|
||||
" The view has been changed by moving through matches until the end /
|
||||
" start of file, when 'nowrapscan' forced a stop of searching before the
|
||||
" l:count'th match was found.
|
||||
" Restore the view to the state before the search.
|
||||
call winrestview(l:save_view)
|
||||
endif
|
||||
call s:ErrorMessage(a:searchType, a:pattern, a:isBackward)
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Combine all marks into one regexp.
|
||||
function! s:AnyMark()
|
||||
return join(filter(copy(g:mwWord), '! empty(v:val)'), '\|')
|
||||
endfunction
|
||||
|
||||
" Search any mark.
|
||||
function! mark#SearchAnyMark( isBackward )
|
||||
let l:markPosition = mark#CurrentMark()[1]
|
||||
let l:markText = s:AnyMark()
|
||||
call s:Search(l:markText, a:isBackward, l:markPosition, 'any-mark')
|
||||
let g:mwLastSearched = ""
|
||||
endfunction
|
||||
|
||||
" Search last searched mark.
|
||||
function! mark#SearchNext( isBackward )
|
||||
let l:markText = mark#CurrentMark()[0]
|
||||
if empty(l:markText)
|
||||
return 0
|
||||
else
|
||||
if empty(g:mwLastSearched)
|
||||
call mark#SearchAnyMark(a:isBackward)
|
||||
else
|
||||
call mark#SearchCurrentMark(a:isBackward)
|
||||
endif
|
||||
return 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"- initializations ------------------------------------------------------------
|
||||
augroup Mark
|
||||
autocmd!
|
||||
autocmd VimEnter * if ! exists('w:mwMatch') | call mark#UpdateMark() | endif
|
||||
autocmd WinEnter * if ! exists('w:mwMatch') | call mark#UpdateMark() | endif
|
||||
autocmd TabEnter * call mark#UpdateScope()
|
||||
augroup END
|
||||
|
||||
" Define global variables and initialize current scope.
|
||||
function! s:InitMarkVariables()
|
||||
if !exists("g:mwHistAdd")
|
||||
let g:mwHistAdd = "/@"
|
||||
endif
|
||||
if !exists("g:mwCycleMax")
|
||||
let i = 1
|
||||
while hlexists("MarkWord" . i)
|
||||
let i = i + 1
|
||||
endwhile
|
||||
let g:mwCycleMax = i - 1
|
||||
endif
|
||||
if !exists("g:mwCycle")
|
||||
let g:mwCycle = 0
|
||||
endif
|
||||
if !exists("g:mwWord")
|
||||
let g:mwWord = repeat([''], g:mwCycleMax)
|
||||
endif
|
||||
if !exists("g:mwLastSearched")
|
||||
let g:mwLastSearched = ""
|
||||
endif
|
||||
endfunction
|
||||
call s:InitMarkVariables()
|
||||
call mark#UpdateScope()
|
||||
|
||||
" vim: ts=2 sw=2
|
||||
433
autoload/snipMate.vim
Normal file
433
autoload/snipMate.vim
Normal file
@@ -0,0 +1,433 @@
|
||||
fun! Filename(...)
|
||||
let filename = expand('%:t:r')
|
||||
if filename == '' | return a:0 == 2 ? a:2 : '' | endif
|
||||
return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
|
||||
endf
|
||||
|
||||
fun s:RemoveSnippet()
|
||||
unl! g:snipPos s:curPos s:snipLen s:endCol s:endLine s:prevLen
|
||||
\ s:lastBuf s:oldWord
|
||||
if exists('s:update')
|
||||
unl s:startCol s:origWordLen s:update
|
||||
if exists('s:oldVars') | unl s:oldVars s:oldEndCol | endif
|
||||
endif
|
||||
aug! snipMateAutocmds
|
||||
endf
|
||||
|
||||
fun snipMate#expandSnip(snip, col)
|
||||
let lnum = line('.') | let col = a:col
|
||||
|
||||
let snippet = s:ProcessSnippet(a:snip)
|
||||
" Avoid error if eval evaluates to nothing
|
||||
if snippet == '' | return '' | endif
|
||||
|
||||
" Expand snippet onto current position with the tab stops removed
|
||||
let snipLines = split(substitute(snippet, '$\d\+\|${\d\+.\{-}}', '', 'g'), "\n", 1)
|
||||
|
||||
let line = getline(lnum)
|
||||
let afterCursor = strpart(line, col - 1)
|
||||
" Keep text after the cursor
|
||||
if afterCursor != "\t" && afterCursor != ' '
|
||||
let line = strpart(line, 0, col - 1)
|
||||
let snipLines[-1] .= afterCursor
|
||||
else
|
||||
let afterCursor = ''
|
||||
" For some reason the cursor needs to move one right after this
|
||||
if line != '' && col == 1 && &ve != 'all' && &ve != 'onemore'
|
||||
let col += 1
|
||||
endif
|
||||
endif
|
||||
|
||||
call setline(lnum, line.snipLines[0])
|
||||
|
||||
" Autoindent snippet according to previous indentation
|
||||
let indent = matchend(line, '^.\{-}\ze\(\S\|$\)') + 1
|
||||
call append(lnum, map(snipLines[1:], "'".strpart(line, 0, indent - 1)."'.v:val"))
|
||||
|
||||
" Open any folds snippet expands into
|
||||
if &fen | sil! exe lnum.','.(lnum + len(snipLines) - 1).'foldopen' | endif
|
||||
|
||||
let [g:snipPos, s:snipLen] = s:BuildTabStops(snippet, lnum, col - indent, indent)
|
||||
|
||||
if s:snipLen
|
||||
aug snipMateAutocmds
|
||||
au CursorMovedI * call s:UpdateChangedSnip(0)
|
||||
au InsertEnter * call s:UpdateChangedSnip(1)
|
||||
aug END
|
||||
let s:lastBuf = bufnr(0) " Only expand snippet while in current buffer
|
||||
let s:curPos = 0
|
||||
let s:endCol = g:snipPos[s:curPos][1]
|
||||
let s:endLine = g:snipPos[s:curPos][0]
|
||||
|
||||
call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
|
||||
let s:prevLen = [line('$'), col('$')]
|
||||
if g:snipPos[s:curPos][2] != -1 | return s:SelectWord() | endif
|
||||
else
|
||||
unl g:snipPos s:snipLen
|
||||
" Place cursor at end of snippet if no tab stop is given
|
||||
let newlines = len(snipLines) - 1
|
||||
call cursor(lnum + newlines, indent + len(snipLines[-1]) - len(afterCursor)
|
||||
\ + (newlines ? 0: col - 1))
|
||||
endif
|
||||
return ''
|
||||
endf
|
||||
|
||||
" Prepare snippet to be processed by s:BuildTabStops
|
||||
fun s:ProcessSnippet(snip)
|
||||
let snippet = a:snip
|
||||
" Evaluate eval (`...`) expressions.
|
||||
" Using a loop here instead of a regex fixes a bug with nested "\=".
|
||||
if stridx(snippet, '`') != -1
|
||||
while match(snippet, '`.\{-}`') != -1
|
||||
let snippet = substitute(snippet, '`.\{-}`',
|
||||
\ substitute(eval(matchstr(snippet, '`\zs.\{-}\ze`')),
|
||||
\ "\n\\%$", '', ''), '')
|
||||
endw
|
||||
let snippet = substitute(snippet, "\r", "\n", 'g')
|
||||
endif
|
||||
|
||||
" Place all text after a colon in a tab stop after the tab stop
|
||||
" (e.g. "${#:foo}" becomes "${:foo}foo").
|
||||
" This helps tell the position of the tab stops later.
|
||||
let snippet = substitute(snippet, '${\d\+:\(.\{-}\)}', '&\1', 'g')
|
||||
|
||||
" Update the a:snip so that all the $# become the text after
|
||||
" the colon in their associated ${#}.
|
||||
" (e.g. "${1:foo}" turns all "$1"'s into "foo")
|
||||
let i = 1
|
||||
while stridx(snippet, '${'.i) != -1
|
||||
let s = matchstr(snippet, '${'.i.':\zs.\{-}\ze}')
|
||||
if s != ''
|
||||
let snippet = substitute(snippet, '$'.i, s.'&', 'g')
|
||||
endif
|
||||
let i += 1
|
||||
endw
|
||||
|
||||
if &et " Expand tabs to spaces if 'expandtab' is set.
|
||||
return substitute(snippet, '\t', repeat(' ', &sts ? &sts : &sw), 'g')
|
||||
endif
|
||||
return snippet
|
||||
endf
|
||||
|
||||
" Counts occurences of haystack in needle
|
||||
fun s:Count(haystack, needle)
|
||||
let counter = 0
|
||||
let index = stridx(a:haystack, a:needle)
|
||||
while index != -1
|
||||
let index = stridx(a:haystack, a:needle, index+1)
|
||||
let counter += 1
|
||||
endw
|
||||
return counter
|
||||
endf
|
||||
|
||||
" Builds a list of a list of each tab stop in the snippet containing:
|
||||
" 1.) The tab stop's line number.
|
||||
" 2.) The tab stop's column number
|
||||
" (by getting the length of the string between the last "\n" and the
|
||||
" tab stop).
|
||||
" 3.) The length of the text after the colon for the current tab stop
|
||||
" (e.g. "${1:foo}" would return 3). If there is no text, -1 is returned.
|
||||
" 4.) If the "${#:}" construct is given, another list containing all
|
||||
" the matches of "$#", to be replaced with the placeholder. This list is
|
||||
" composed the same way as the parent; the first item is the line number,
|
||||
" and the second is the column.
|
||||
fun s:BuildTabStops(snip, lnum, col, indent)
|
||||
let snipPos = []
|
||||
let i = 1
|
||||
let withoutVars = substitute(a:snip, '$\d\+', '', 'g')
|
||||
while stridx(a:snip, '${'.i) != -1
|
||||
let beforeTabStop = matchstr(withoutVars, '^.*\ze${'.i.'\D')
|
||||
let withoutOthers = substitute(withoutVars, '${\('.i.'\D\)\@!\d\+.\{-}}', '', 'g')
|
||||
|
||||
let j = i - 1
|
||||
call add(snipPos, [0, 0, -1])
|
||||
let snipPos[j][0] = a:lnum + s:Count(beforeTabStop, "\n")
|
||||
let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze${'.i.'\D'))
|
||||
if snipPos[j][0] == a:lnum | let snipPos[j][1] += a:col | endif
|
||||
|
||||
" Get all $# matches in another list, if ${#:name} is given
|
||||
if stridx(withoutVars, '${'.i.':') != -1
|
||||
let snipPos[j][2] = len(matchstr(withoutVars, '${'.i.':\zs.\{-}\ze}'))
|
||||
let dots = repeat('.', snipPos[j][2])
|
||||
call add(snipPos[j], [])
|
||||
let withoutOthers = substitute(a:snip, '${\d\+.\{-}}\|$'.i.'\@!\d\+', '', 'g')
|
||||
while match(withoutOthers, '$'.i.'\(\D\|$\)') != -1
|
||||
let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.'$'.i.'\(\D\|$\)')
|
||||
call add(snipPos[j][3], [0, 0])
|
||||
let snipPos[j][3][-1][0] = a:lnum + s:Count(beforeMark, "\n")
|
||||
let snipPos[j][3][-1][1] = a:indent + (snipPos[j][3][-1][0] > a:lnum
|
||||
\ ? len(matchstr(beforeMark, '.*\n\zs.*'))
|
||||
\ : a:col + len(beforeMark))
|
||||
let withoutOthers = substitute(withoutOthers, '$'.i.'\ze\(\D\|$\)', '', '')
|
||||
endw
|
||||
endif
|
||||
let i += 1
|
||||
endw
|
||||
return [snipPos, i - 1]
|
||||
endf
|
||||
|
||||
fun snipMate#jumpTabStop(backwards)
|
||||
let leftPlaceholder = exists('s:origWordLen')
|
||||
\ && s:origWordLen != g:snipPos[s:curPos][2]
|
||||
if leftPlaceholder && exists('s:oldEndCol')
|
||||
let startPlaceholder = s:oldEndCol + 1
|
||||
endif
|
||||
|
||||
if exists('s:update')
|
||||
call s:UpdatePlaceholderTabStops()
|
||||
else
|
||||
call s:UpdateTabStops()
|
||||
endif
|
||||
|
||||
" Don't reselect placeholder if it has been modified
|
||||
if leftPlaceholder && g:snipPos[s:curPos][2] != -1
|
||||
if exists('startPlaceholder')
|
||||
let g:snipPos[s:curPos][1] = startPlaceholder
|
||||
else
|
||||
let g:snipPos[s:curPos][1] = col('.')
|
||||
let g:snipPos[s:curPos][2] = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
let s:curPos += a:backwards ? -1 : 1
|
||||
" Loop over the snippet when going backwards from the beginning
|
||||
if s:curPos < 0 | let s:curPos = s:snipLen - 1 | endif
|
||||
|
||||
if s:curPos == s:snipLen
|
||||
let sMode = s:endCol == g:snipPos[s:curPos-1][1]+g:snipPos[s:curPos-1][2]
|
||||
call s:RemoveSnippet()
|
||||
return sMode ? "\<tab>" : TriggerSnippet()
|
||||
endif
|
||||
|
||||
call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
|
||||
|
||||
let s:endLine = g:snipPos[s:curPos][0]
|
||||
let s:endCol = g:snipPos[s:curPos][1]
|
||||
let s:prevLen = [line('$'), col('$')]
|
||||
|
||||
return g:snipPos[s:curPos][2] == -1 ? '' : s:SelectWord()
|
||||
endf
|
||||
|
||||
fun s:UpdatePlaceholderTabStops()
|
||||
let changeLen = s:origWordLen - g:snipPos[s:curPos][2]
|
||||
unl s:startCol s:origWordLen s:update
|
||||
if !exists('s:oldVars') | return | endif
|
||||
" Update tab stops in snippet if text has been added via "$#"
|
||||
" (e.g., in "${1:foo}bar$1${2}").
|
||||
if changeLen != 0
|
||||
let curLine = line('.')
|
||||
|
||||
for pos in g:snipPos
|
||||
if pos == g:snipPos[s:curPos] | continue | endif
|
||||
let changed = pos[0] == curLine && pos[1] > s:oldEndCol
|
||||
let changedVars = 0
|
||||
let endPlaceholder = pos[2] - 1 + pos[1]
|
||||
" Subtract changeLen from each tab stop that was after any of
|
||||
" the current tab stop's placeholders.
|
||||
for [lnum, col] in s:oldVars
|
||||
if lnum > pos[0] | break | endif
|
||||
if pos[0] == lnum
|
||||
if pos[1] > col || (pos[2] == -1 && pos[1] == col)
|
||||
let changed += 1
|
||||
elseif col < endPlaceholder
|
||||
let changedVars += 1
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
let pos[1] -= changeLen * changed
|
||||
let pos[2] -= changeLen * changedVars " Parse variables within placeholders
|
||||
" e.g., "${1:foo} ${2:$1bar}"
|
||||
|
||||
if pos[2] == -1 | continue | endif
|
||||
" Do the same to any placeholders in the other tab stops.
|
||||
for nPos in pos[3]
|
||||
let changed = nPos[0] == curLine && nPos[1] > s:oldEndCol
|
||||
for [lnum, col] in s:oldVars
|
||||
if lnum > nPos[0] | break | endif
|
||||
if nPos[0] == lnum && nPos[1] > col
|
||||
let changed += 1
|
||||
endif
|
||||
endfor
|
||||
let nPos[1] -= changeLen * changed
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
unl s:endCol s:oldVars s:oldEndCol
|
||||
endf
|
||||
|
||||
fun s:UpdateTabStops()
|
||||
let changeLine = s:endLine - g:snipPos[s:curPos][0]
|
||||
let changeCol = s:endCol - g:snipPos[s:curPos][1]
|
||||
if exists('s:origWordLen')
|
||||
let changeCol -= s:origWordLen
|
||||
unl s:origWordLen
|
||||
endif
|
||||
let lnum = g:snipPos[s:curPos][0]
|
||||
let col = g:snipPos[s:curPos][1]
|
||||
" Update the line number of all proceeding tab stops if <cr> has
|
||||
" been inserted.
|
||||
if changeLine != 0
|
||||
let changeLine -= 1
|
||||
for pos in g:snipPos
|
||||
if pos[0] >= lnum
|
||||
if pos[0] == lnum | let pos[1] += changeCol | endif
|
||||
let pos[0] += changeLine
|
||||
endif
|
||||
if pos[2] == -1 | continue | endif
|
||||
for nPos in pos[3]
|
||||
if nPos[0] >= lnum
|
||||
if nPos[0] == lnum | let nPos[1] += changeCol | endif
|
||||
let nPos[0] += changeLine
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
elseif changeCol != 0
|
||||
" Update the column of all proceeding tab stops if text has
|
||||
" been inserted/deleted in the current line.
|
||||
for pos in g:snipPos
|
||||
if pos[1] >= col && pos[0] == lnum
|
||||
let pos[1] += changeCol
|
||||
endif
|
||||
if pos[2] == -1 | continue | endif
|
||||
for nPos in pos[3]
|
||||
if nPos[0] > lnum | break | endif
|
||||
if nPos[0] == lnum && nPos[1] >= col
|
||||
let nPos[1] += changeCol
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
endf
|
||||
|
||||
fun s:SelectWord()
|
||||
let s:origWordLen = g:snipPos[s:curPos][2]
|
||||
let s:oldWord = strpart(getline('.'), g:snipPos[s:curPos][1] - 1,
|
||||
\ s:origWordLen)
|
||||
let s:prevLen[1] -= s:origWordLen
|
||||
if !empty(g:snipPos[s:curPos][3])
|
||||
let s:update = 1
|
||||
let s:endCol = -1
|
||||
let s:startCol = g:snipPos[s:curPos][1] - 1
|
||||
endif
|
||||
if !s:origWordLen | return '' | endif
|
||||
let l = col('.') != 1 ? 'l' : ''
|
||||
if &sel == 'exclusive'
|
||||
return "\<esc>".l.'v'.s:origWordLen."l\<c-g>"
|
||||
endif
|
||||
return s:origWordLen == 1 ? "\<esc>".l.'gh'
|
||||
\ : "\<esc>".l.'v'.(s:origWordLen - 1)."l\<c-g>"
|
||||
endf
|
||||
|
||||
" This updates the snippet as you type when text needs to be inserted
|
||||
" into multiple places (e.g. in "${1:default text}foo$1bar$1",
|
||||
" "default text" would be highlighted, and if the user types something,
|
||||
" UpdateChangedSnip() would be called so that the text after "foo" & "bar"
|
||||
" are updated accordingly)
|
||||
"
|
||||
" It also automatically quits the snippet if the cursor is moved out of it
|
||||
" while in insert mode.
|
||||
fun s:UpdateChangedSnip(entering)
|
||||
if exists('g:snipPos') && bufnr(0) != s:lastBuf
|
||||
call s:RemoveSnippet()
|
||||
elseif exists('s:update') " If modifying a placeholder
|
||||
if !exists('s:oldVars') && s:curPos + 1 < s:snipLen
|
||||
" Save the old snippet & word length before it's updated
|
||||
" s:startCol must be saved too, in case text is added
|
||||
" before the snippet (e.g. in "foo$1${2}bar${1:foo}").
|
||||
let s:oldEndCol = s:startCol
|
||||
let s:oldVars = deepcopy(g:snipPos[s:curPos][3])
|
||||
endif
|
||||
let col = col('.') - 1
|
||||
|
||||
if s:endCol != -1
|
||||
let changeLen = col('$') - s:prevLen[1]
|
||||
let s:endCol += changeLen
|
||||
else " When being updated the first time, after leaving select mode
|
||||
if a:entering | return | endif
|
||||
let s:endCol = col - 1
|
||||
endif
|
||||
|
||||
" If the cursor moves outside the snippet, quit it
|
||||
if line('.') != g:snipPos[s:curPos][0] || col < s:startCol ||
|
||||
\ col - 1 > s:endCol
|
||||
unl! s:startCol s:origWordLen s:oldVars s:update
|
||||
return s:RemoveSnippet()
|
||||
endif
|
||||
|
||||
call s:UpdateVars()
|
||||
let s:prevLen[1] = col('$')
|
||||
elseif exists('g:snipPos')
|
||||
if !a:entering && g:snipPos[s:curPos][2] != -1
|
||||
let g:snipPos[s:curPos][2] = -2
|
||||
endif
|
||||
|
||||
let col = col('.')
|
||||
let lnum = line('.')
|
||||
let changeLine = line('$') - s:prevLen[0]
|
||||
|
||||
if lnum == s:endLine
|
||||
let s:endCol += col('$') - s:prevLen[1]
|
||||
let s:prevLen = [line('$'), col('$')]
|
||||
endif
|
||||
if changeLine != 0
|
||||
let s:endLine += changeLine
|
||||
let s:endCol = col
|
||||
endif
|
||||
|
||||
" Delete snippet if cursor moves out of it in insert mode
|
||||
if (lnum == s:endLine && (col > s:endCol || col < g:snipPos[s:curPos][1]))
|
||||
\ || lnum > s:endLine || lnum < g:snipPos[s:curPos][0]
|
||||
call s:RemoveSnippet()
|
||||
endif
|
||||
endif
|
||||
endf
|
||||
|
||||
" This updates the variables in a snippet when a placeholder has been edited.
|
||||
" (e.g., each "$1" in "${1:foo} $1bar $1bar")
|
||||
fun s:UpdateVars()
|
||||
let newWordLen = s:endCol - s:startCol + 1
|
||||
let newWord = strpart(getline('.'), s:startCol, newWordLen)
|
||||
if newWord == s:oldWord || empty(g:snipPos[s:curPos][3])
|
||||
return
|
||||
endif
|
||||
|
||||
let changeLen = g:snipPos[s:curPos][2] - newWordLen
|
||||
let curLine = line('.')
|
||||
let startCol = col('.')
|
||||
let oldStartSnip = s:startCol
|
||||
let updateTabStops = changeLen != 0
|
||||
let i = 0
|
||||
|
||||
for [lnum, col] in g:snipPos[s:curPos][3]
|
||||
if updateTabStops
|
||||
let start = s:startCol
|
||||
if lnum == curLine && col <= start
|
||||
let s:startCol -= changeLen
|
||||
let s:endCol -= changeLen
|
||||
endif
|
||||
for nPos in g:snipPos[s:curPos][3][(i):]
|
||||
" This list is in ascending order, so quit if we've gone too far.
|
||||
if nPos[0] > lnum | break | endif
|
||||
if nPos[0] == lnum && nPos[1] > col
|
||||
let nPos[1] -= changeLen
|
||||
endif
|
||||
endfor
|
||||
if lnum == curLine && col > start
|
||||
let col -= changeLen
|
||||
let g:snipPos[s:curPos][3][i][1] = col
|
||||
endif
|
||||
let i += 1
|
||||
endif
|
||||
|
||||
" "Very nomagic" is used here to allow special characters.
|
||||
call setline(lnum, substitute(getline(lnum), '\%'.col.'c\V'.
|
||||
\ escape(s:oldWord, '\'), escape(newWord, '\&'), ''))
|
||||
endfor
|
||||
if oldStartSnip != s:startCol
|
||||
call cursor(0, startCol + s:startCol - oldStartSnip)
|
||||
endif
|
||||
|
||||
let s:oldWord = newWord
|
||||
let g:snipPos[s:curPos][2] = newWordLen
|
||||
endf
|
||||
" vim:noet:sw=4:ts=4:ft=vim
|
||||
699
autoload/vimwiki.vim
Normal file
699
autoload/vimwiki.vim
Normal file
@@ -0,0 +1,699 @@
|
||||
" Vimwiki autoload plugin file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
if exists("g:loaded_vimwiki_auto") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki_auto = 1
|
||||
|
||||
if has("win32")
|
||||
let s:os_sep = '\'
|
||||
else
|
||||
let s:os_sep = '/'
|
||||
endif
|
||||
|
||||
let s:badsymbols = '['.g:vimwiki_badsyms.g:vimwiki_stripsym.'<>|?*:"]'
|
||||
|
||||
" MISC helper functions {{{
|
||||
|
||||
" This function is double defined.
|
||||
" TODO: refactor common functions into new module.
|
||||
function! s:chomp_slash(str) "{{{
|
||||
return substitute(a:str, '[/\\]\+$', '', '')
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_windows()
|
||||
return has("win32") || has("win64") || has("win95") || has("win16")
|
||||
endfunction
|
||||
|
||||
function! vimwiki#mkdir(path) "{{{
|
||||
let path = expand(a:path)
|
||||
if !isdirectory(path) && exists("*mkdir")
|
||||
let path = s:chomp_slash(path)
|
||||
if s:is_windows() && !empty(g:vimwiki_w32_dir_enc)
|
||||
let path = iconv(path, &enc, g:vimwiki_w32_dir_enc)
|
||||
endif
|
||||
call mkdir(path, "p")
|
||||
endif
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! vimwiki#safe_link(string) "{{{
|
||||
return substitute(a:string, s:badsymbols, g:vimwiki_stripsym, 'g')
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! vimwiki#unsafe_link(string) "{{{
|
||||
return substitute(a:string, g:vimwiki_stripsym, s:badsymbols, 'g')
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! vimwiki#subdir(path, filename)"{{{
|
||||
let path = expand(a:path)
|
||||
let filename = expand(a:filename)
|
||||
let idx = 0
|
||||
while path[idx] == filename[idx]
|
||||
let idx = idx + 1
|
||||
endwhile
|
||||
|
||||
let p = split(strpart(filename, idx), '[/\\]')
|
||||
let res = join(p[:-2], s:os_sep)
|
||||
if len(res) > 0
|
||||
let res = res.s:os_sep
|
||||
endif
|
||||
return res
|
||||
endfunction"}}}
|
||||
|
||||
function! vimwiki#current_subdir()"{{{
|
||||
return vimwiki#subdir(VimwikiGet('path'), expand('%:p'))
|
||||
endfunction"}}}
|
||||
|
||||
function! vimwiki#open_link(cmd, link, ...) "{{{
|
||||
if s:is_link_to_non_wiki_file(a:link)
|
||||
call s:edit_file(a:cmd, a:link)
|
||||
else
|
||||
if a:0
|
||||
let vimwiki_prev_link = [a:1, []]
|
||||
elseif &ft == 'vimwiki'
|
||||
let vimwiki_prev_link = [expand('%:p'), getpos('.')]
|
||||
endif
|
||||
|
||||
call s:edit_file(a:cmd, VimwikiGet('path').a:link.VimwikiGet('ext'))
|
||||
|
||||
if exists('vimwiki_prev_link')
|
||||
let b:vimwiki_prev_link = vimwiki_prev_link
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:filename(link) "{{{
|
||||
let result = vimwiki#safe_link(a:link)
|
||||
if a:link =~ '|'
|
||||
let result = vimwiki#safe_link(split(a:link, '|')[0])
|
||||
elseif a:link =~ ']['
|
||||
let result = vimwiki#safe_link(split(a:link, '][')[0])
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:is_wiki_word(str) "{{{
|
||||
if a:str =~ g:vimwiki_word1 && a:str !~ '[[:space:]\\/]'
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:edit_file(command, filename) "{{{
|
||||
let fname = escape(a:filename, '% ')
|
||||
call vimwiki#mkdir(fnamemodify(a:filename, ":p:h"))
|
||||
execute a:command.' '.fname
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:search_word(wikiRx, cmd) "{{{
|
||||
let match_line = search(a:wikiRx, 's'.a:cmd)
|
||||
if match_line == 0
|
||||
echomsg "vimwiki: Wiki link not found."
|
||||
endif
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:get_word_at_cursor(wikiRX) "{{{
|
||||
let col = col('.') - 1
|
||||
let line = getline('.')
|
||||
let ebeg = -1
|
||||
let cont = match(line, a:wikiRX, 0)
|
||||
while (ebeg >= 0 || (0 <= cont) && (cont <= col))
|
||||
let contn = matchend(line, a:wikiRX, cont)
|
||||
if (cont <= col) && (col < contn)
|
||||
let ebeg = match(line, a:wikiRX, cont)
|
||||
let elen = contn - ebeg
|
||||
break
|
||||
else
|
||||
let cont = match(line, a:wikiRX, contn)
|
||||
endif
|
||||
endwh
|
||||
if ebeg >= 0
|
||||
return strpart(line, ebeg, elen)
|
||||
else
|
||||
return ""
|
||||
endif
|
||||
endf "}}}
|
||||
|
||||
function! s:strip_word(word) "{{{
|
||||
let result = a:word
|
||||
if strpart(a:word, 0, 2) == "[["
|
||||
" get rid of [[ and ]]
|
||||
let w = strpart(a:word, 2, strlen(a:word)-4)
|
||||
|
||||
if w =~ '|'
|
||||
" we want "link" from [[link|link desc]]
|
||||
let w = split(w, "|")[0]
|
||||
elseif w =~ ']['
|
||||
" we want "link" from [[link][link desc]]
|
||||
let w = split(w, "][")[0]
|
||||
endif
|
||||
|
||||
let result = vimwiki#safe_link(w)
|
||||
endif
|
||||
return result
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:is_link_to_non_wiki_file(word) "{{{
|
||||
" Check if word is link to a non-wiki file.
|
||||
" The easiest way is to check if it has extension like .txt or .html
|
||||
if a:word =~ '\.\w\{1,4}$'
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:print_wiki_list() "{{{
|
||||
let idx = 0
|
||||
while idx < len(g:vimwiki_list)
|
||||
if idx == g:vimwiki_current_idx
|
||||
let sep = ' * '
|
||||
echohl PmenuSel
|
||||
else
|
||||
let sep = ' '
|
||||
echohl None
|
||||
endif
|
||||
echo (idx + 1).sep.VimwikiGet('path', idx)
|
||||
let idx += 1
|
||||
endwhile
|
||||
echohl None
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! vimwiki#select(wnum)"{{{
|
||||
if a:wnum < 1 || a:wnum > len(g:vimwiki_list)
|
||||
return
|
||||
endif
|
||||
if &ft == 'vimwiki'
|
||||
let b:vimwiki_idx = g:vimwiki_current_idx
|
||||
endif
|
||||
let g:vimwiki_current_idx = a:wnum - 1
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:update_wiki_link(fname, old, new) " {{{
|
||||
echo "Updating links in ".a:fname
|
||||
let has_updates = 0
|
||||
let dest = []
|
||||
for line in readfile(a:fname)
|
||||
if !has_updates && match(line, a:old) != -1
|
||||
let has_updates = 1
|
||||
endif
|
||||
call add(dest, substitute(line, a:old, escape(a:new, "&"), "g"))
|
||||
endfor
|
||||
" add exception handling...
|
||||
if has_updates
|
||||
call rename(a:fname, a:fname.'#vimwiki_upd#')
|
||||
call writefile(dest, a:fname)
|
||||
call delete(a:fname.'#vimwiki_upd#')
|
||||
endif
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:update_wiki_links_dir(dir, old_fname, new_fname) " {{{
|
||||
let old_fname = substitute(a:old_fname, '[/\\]', '[/\\\\]', 'g')
|
||||
let new_fname = a:new_fname
|
||||
|
||||
if !s:is_wiki_word(new_fname)
|
||||
let new_fname = '[['.new_fname.']]'
|
||||
endif
|
||||
if !s:is_wiki_word(old_fname)
|
||||
let old_fname = '\[\['.vimwiki#unsafe_link(old_fname).
|
||||
\ '\%(|.*\)\?\%(\]\[.*\)\?\]\]'
|
||||
else
|
||||
let old_fname = '\<'.old_fname.'\>'
|
||||
endif
|
||||
let files = split(glob(VimwikiGet('path').a:dir.'*'.VimwikiGet('ext')), '\n')
|
||||
for fname in files
|
||||
call s:update_wiki_link(fname, old_fname, new_fname)
|
||||
endfor
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:tail_name(fname) "{{{
|
||||
let result = substitute(a:fname, ":", "__colon__", "g")
|
||||
let result = fnamemodify(result, ":t:r")
|
||||
let result = substitute(result, "__colon__", ":", "g")
|
||||
return result
|
||||
endfunction "}}}
|
||||
|
||||
function! s:update_wiki_links(old_fname, new_fname) " {{{
|
||||
let old_fname = s:tail_name(a:old_fname)
|
||||
let new_fname = s:tail_name(a:new_fname)
|
||||
|
||||
let subdirs = split(a:old_fname, '[/\\]')[: -2]
|
||||
|
||||
" TODO: Use Dictionary here...
|
||||
let dirs_keys = ['']
|
||||
let dirs_vals = ['']
|
||||
if len(subdirs) > 0
|
||||
let dirs_keys = ['']
|
||||
let dirs_vals = [join(subdirs, '/').'/']
|
||||
let idx = 0
|
||||
while idx < len(subdirs) - 1
|
||||
call add(dirs_keys, join(subdirs[: idx], '/').'/')
|
||||
call add(dirs_vals, join(subdirs[idx+1 :], '/').'/')
|
||||
let idx = idx + 1
|
||||
endwhile
|
||||
call add(dirs_keys,join(subdirs, '/').'/')
|
||||
call add(dirs_vals, '')
|
||||
endif
|
||||
|
||||
let idx = 0
|
||||
while idx < len(dirs_keys)
|
||||
let dir = dirs_keys[idx]
|
||||
let new_dir = dirs_vals[idx]
|
||||
call s:update_wiki_links_dir(dir,
|
||||
\ new_dir.old_fname, new_dir.new_fname)
|
||||
let idx = idx + 1
|
||||
endwhile
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:get_wiki_buffers() "{{{
|
||||
let blist = []
|
||||
let bcount = 1
|
||||
while bcount<=bufnr("$")
|
||||
if bufexists(bcount)
|
||||
let bname = fnamemodify(bufname(bcount), ":p")
|
||||
if bname =~ VimwikiGet('ext')."$"
|
||||
let bitem = [bname, getbufvar(bname, "vimwiki_prev_link")]
|
||||
call add(blist, bitem)
|
||||
endif
|
||||
endif
|
||||
let bcount = bcount + 1
|
||||
endwhile
|
||||
return blist
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! s:open_wiki_buffer(item) "{{{
|
||||
call s:edit_file('e', a:item[0])
|
||||
if !empty(a:item[1])
|
||||
call setbufvar(a:item[0], "vimwiki_prev_link", a:item[1])
|
||||
endif
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
" }}}
|
||||
|
||||
" SYNTAX highlight {{{
|
||||
function! vimwiki#WikiHighlightWords() "{{{
|
||||
" search all wiki files in 'path' and its subdirs.
|
||||
let subdir = vimwiki#current_subdir()
|
||||
let wikies = glob(VimwikiGet('path').subdir.'**/*'.VimwikiGet('ext'))
|
||||
|
||||
" remove .wiki extensions
|
||||
let wikies = substitute(wikies, '\'.VimwikiGet('ext'), "", "g")
|
||||
let g:vimwiki_wikiwords = split(wikies, '\n')
|
||||
|
||||
" remove backup files (.wiki~)
|
||||
call filter(g:vimwiki_wikiwords, 'v:val !~ ''.*\~$''')
|
||||
|
||||
" remove paths
|
||||
let rem_path = escape(expand(VimwikiGet('path')).subdir, '\')
|
||||
call map(g:vimwiki_wikiwords, 'substitute(v:val, rem_path, "", "g")')
|
||||
|
||||
" Links with subdirs should be highlighted for linux and windows separators
|
||||
" Change \ or / to [/\\]
|
||||
let os_p = '[/\\]'
|
||||
let os_p2 = escape(os_p, '\')
|
||||
call map(g:vimwiki_wikiwords, 'substitute(v:val, os_p, os_p2, "g")')
|
||||
|
||||
for word in g:vimwiki_wikiwords
|
||||
if g:vimwiki_camel_case &&
|
||||
\ word =~ g:vimwiki_word1 && !s:is_link_to_non_wiki_file(word)
|
||||
execute 'syntax match VimwikiWord /\%(^\|[^!]\)\@<=\<'.word.'\>/'
|
||||
endif
|
||||
execute 'syntax match VimwikiWord /\[\[\<'.
|
||||
\ vimwiki#unsafe_link(word).
|
||||
\ '\>\%(|\+.*\)*\]\]/'
|
||||
execute 'syntax match VimwikiWord /\[\[\<'.
|
||||
\ vimwiki#unsafe_link(word).
|
||||
\ '\>\]\[.\+\]\]/'
|
||||
endfor
|
||||
execute 'syntax match VimwikiWord /\[\[.\+\.\%(jpg\|png\|gif\)\%(|\+.*\)*\]\]/'
|
||||
execute 'syntax match VimwikiWord /\[\[.\+\.\%(jpg\|png\|gif\)\]\[.\+\]\]/'
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! vimwiki#hl_exists(hl)"{{{
|
||||
if !hlexists(a:hl)
|
||||
return 0
|
||||
endif
|
||||
redir => hlstatus
|
||||
exe "silent hi" a:hl
|
||||
redir END
|
||||
return (hlstatus !~ "cleared")
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! vimwiki#nested_syntax(filetype, start, end, textSnipHl) abort "{{{
|
||||
" From http://vim.wikia.com/wiki/VimTip857
|
||||
let ft=toupper(a:filetype)
|
||||
let group='textGroup'.ft
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax=b:current_syntax
|
||||
" Remove current syntax definition, as some syntax files (e.g. cpp.vim)
|
||||
" do nothing if b:current_syntax is defined.
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
" Some syntax files set up iskeyword which might scratch vimwiki a bit.
|
||||
" Let us save and restore it later.
|
||||
" let b:skip_set_iskeyword = 1
|
||||
let is_keyword = &iskeyword
|
||||
|
||||
execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim'
|
||||
try
|
||||
execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim'
|
||||
catch
|
||||
endtry
|
||||
|
||||
let &iskeyword = is_keyword
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax=s:current_syntax
|
||||
else
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
execute 'syntax region textSnip'.ft.'
|
||||
\ matchgroup='.a:textSnipHl.'
|
||||
\ start="'.a:start.'" end="'.a:end.'"
|
||||
\ contains=@'.group
|
||||
endfunction "}}}
|
||||
|
||||
"}}}
|
||||
|
||||
" WIKI functions {{{
|
||||
function! vimwiki#WikiNextWord() "{{{
|
||||
call s:search_word(g:vimwiki_rxWikiWord.'\|'.g:vimwiki_rxWeblink, '')
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! vimwiki#WikiPrevWord() "{{{
|
||||
call s:search_word(g:vimwiki_rxWikiWord.'\|'.g:vimwiki_rxWeblink, 'b')
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! vimwiki#WikiFollowWord(split) "{{{
|
||||
if a:split == "split"
|
||||
let cmd = ":split "
|
||||
elseif a:split == "vsplit"
|
||||
let cmd = ":vsplit "
|
||||
else
|
||||
let cmd = ":e "
|
||||
endif
|
||||
|
||||
let link = s:strip_word(s:get_word_at_cursor(g:vimwiki_rxWikiWord))
|
||||
if link == ""
|
||||
let weblink = s:strip_word(s:get_word_at_cursor(g:vimwiki_rxWeblink))
|
||||
if weblink != ""
|
||||
call VimwikiWeblinkHandler(weblink)
|
||||
else
|
||||
execute "normal! \n"
|
||||
endif
|
||||
return
|
||||
endif
|
||||
|
||||
let subdir = vimwiki#current_subdir()
|
||||
call vimwiki#open_link(cmd, subdir.link)
|
||||
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! vimwiki#WikiGoBackWord() "{{{
|
||||
if exists("b:vimwiki_prev_link")
|
||||
" go back to saved WikiWord
|
||||
let prev_word = b:vimwiki_prev_link
|
||||
execute ":e ".substitute(prev_word[0], '\s', '\\\0', 'g')
|
||||
call setpos('.', prev_word[1])
|
||||
endif
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! vimwiki#WikiGoHome(index) "{{{
|
||||
call vimwiki#select(a:index)
|
||||
call vimwiki#mkdir(VimwikiGet('path'))
|
||||
|
||||
try
|
||||
execute ':e '.fnameescape(
|
||||
\ VimwikiGet('path').VimwikiGet('index').VimwikiGet('ext'))
|
||||
catch /E37/ " catch 'No write since last change' error
|
||||
" this is really unsecure!!!
|
||||
execute ':'.VimwikiGet('gohome').' '.
|
||||
\ VimwikiGet('path').
|
||||
\ VimwikiGet('index').
|
||||
\ VimwikiGet('ext')
|
||||
catch /E325/ " catch 'ATTENTION' error (:h E325)
|
||||
endtry
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! vimwiki#WikiDeleteWord() "{{{
|
||||
"" file system funcs
|
||||
"" Delete WikiWord you are in from filesystem
|
||||
let val = input('Delete ['.expand('%').'] (y/n)? ', "")
|
||||
if val != 'y'
|
||||
return
|
||||
endif
|
||||
let fname = expand('%:p')
|
||||
try
|
||||
call delete(fname)
|
||||
catch /.*/
|
||||
echomsg 'vimwiki: Cannot delete "'.expand('%:t:r').'"!'
|
||||
return
|
||||
endtry
|
||||
execute "bdelete! ".escape(fname, " ")
|
||||
|
||||
" reread buffer => deleted WikiWord should appear as non-existent
|
||||
if expand('%:p') != ""
|
||||
execute "e"
|
||||
endif
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! vimwiki#WikiRenameWord() "{{{
|
||||
"" Rename WikiWord, update all links to renamed WikiWord
|
||||
let subdir = vimwiki#current_subdir()
|
||||
let old_fname = subdir.expand('%:t')
|
||||
|
||||
" there is no file (new one maybe)
|
||||
if glob(expand('%:p')) == ''
|
||||
echomsg 'vimwiki: Cannot rename "'.expand('%:p').
|
||||
\'". It does not exist! (New file? Save it before renaming.)'
|
||||
return
|
||||
endif
|
||||
|
||||
let val = input('Rename "'.expand('%:t:r').'" (y/n)? ', "")
|
||||
if val!='y'
|
||||
return
|
||||
endif
|
||||
|
||||
let new_link = input('Enter new name: ', "")
|
||||
|
||||
if new_link =~ '[/\\]'
|
||||
" It is actually doable but I do not have free time to do it.
|
||||
echomsg 'vimwiki: Cannot rename to a filename with path!'
|
||||
return
|
||||
endif
|
||||
|
||||
let new_link = subdir.new_link
|
||||
|
||||
" check new_fname - it should be 'good', not empty
|
||||
if substitute(new_link, '\s', '', 'g') == ''
|
||||
echomsg 'vimwiki: Cannot rename to an empty filename!'
|
||||
return
|
||||
endif
|
||||
if s:is_link_to_non_wiki_file(new_link)
|
||||
echomsg 'vimwiki: Cannot rename to a filename with extension (ie .txt .html)!'
|
||||
return
|
||||
endif
|
||||
|
||||
let new_link = s:strip_word(new_link)
|
||||
let new_fname = VimwikiGet('path').s:filename(new_link).VimwikiGet('ext')
|
||||
|
||||
" do not rename if word with such name exists
|
||||
let fname = glob(new_fname)
|
||||
if fname != ''
|
||||
echomsg 'vimwiki: Cannot rename to "'.new_fname.
|
||||
\ '". File with that name exist!'
|
||||
return
|
||||
endif
|
||||
" rename WikiWord file
|
||||
try
|
||||
echomsg "Renaming ".VimwikiGet('path').old_fname." to ".new_fname
|
||||
let res = rename(expand('%:p'), expand(new_fname))
|
||||
if res != 0
|
||||
throw "Cannot rename!"
|
||||
end
|
||||
catch /.*/
|
||||
echomsg 'vimwiki: Cannot rename "'.expand('%:t:r').'" to "'.new_fname.'"'
|
||||
return
|
||||
endtry
|
||||
|
||||
let &buftype="nofile"
|
||||
|
||||
let cur_buffer = [expand('%:p'),
|
||||
\getbufvar(expand('%:p'), "vimwiki_prev_link")]
|
||||
|
||||
let blist = s:get_wiki_buffers()
|
||||
|
||||
" save wiki buffers
|
||||
for bitem in blist
|
||||
execute ':b '.escape(bitem[0], ' ')
|
||||
execute ':update'
|
||||
endfor
|
||||
|
||||
execute ':b '.escape(cur_buffer[0], ' ')
|
||||
|
||||
" remove wiki buffers
|
||||
for bitem in blist
|
||||
execute 'bwipeout '.escape(bitem[0], ' ')
|
||||
endfor
|
||||
|
||||
let setting_more = &more
|
||||
setlocal nomore
|
||||
|
||||
" update links
|
||||
call s:update_wiki_links(old_fname, new_link)
|
||||
|
||||
" restore wiki buffers
|
||||
for bitem in blist
|
||||
if bitem[0] != cur_buffer[0]
|
||||
call s:open_wiki_buffer(bitem)
|
||||
endif
|
||||
endfor
|
||||
|
||||
call s:open_wiki_buffer([new_fname,
|
||||
\ cur_buffer[1]])
|
||||
" execute 'bwipeout '.escape(cur_buffer[0], ' ')
|
||||
|
||||
echomsg old_fname." is renamed to ".new_fname
|
||||
|
||||
let &more = setting_more
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
function! vimwiki#WikiUISelect()"{{{
|
||||
call s:print_wiki_list()
|
||||
let idx = input("Select Wiki (specify number): ")
|
||||
if idx == ""
|
||||
return
|
||||
endif
|
||||
call vimwiki#WikiGoHome(idx)
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
" }}}
|
||||
|
||||
" TEXT OBJECTS functions {{{
|
||||
|
||||
function! vimwiki#TO_header(inner, visual) "{{{
|
||||
if !search('^\(=\+\)[^=]\+\1\s*$', 'bcW')
|
||||
return
|
||||
endif
|
||||
|
||||
let sel_start = line("'<")
|
||||
let sel_end = line("'>")
|
||||
let block_start = line(".")
|
||||
let advance = 0
|
||||
|
||||
let level = vimwiki#count_first_sym(getline('.'))
|
||||
|
||||
let is_header_selected = sel_start == block_start
|
||||
\ && sel_start != sel_end
|
||||
|
||||
if a:visual && is_header_selected
|
||||
if level > 1
|
||||
let level -= 1
|
||||
call search('^\(=\{'.level.'\}\)[^=]\+\1\s*$', 'bcW')
|
||||
else
|
||||
let advance = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
normal! V
|
||||
|
||||
if a:visual && is_header_selected
|
||||
call cursor(sel_end + advance, 0)
|
||||
endif
|
||||
|
||||
if search('^\(=\{1,'.level.'}\)[^=]\+\1\s*$', 'W')
|
||||
call cursor(line('.') - 1, 0)
|
||||
else
|
||||
call cursor(line('$'), 0)
|
||||
endif
|
||||
|
||||
if a:inner && getline(line('.')) =~ '^\s*$'
|
||||
let lnum = prevnonblank(line('.') - 1)
|
||||
call cursor(lnum, 0)
|
||||
endif
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! vimwiki#count_first_sym(line) "{{{
|
||||
let first_sym = matchstr(a:line, '\S')
|
||||
return len(matchstr(a:line, first_sym.'\+'))
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki#AddHeaderLevel() "{{{
|
||||
let lnum = line('.')
|
||||
let line = getline(lnum)
|
||||
|
||||
if line =~ '^\s*$'
|
||||
return
|
||||
endif
|
||||
|
||||
if line =~ '^\s*\(=\+\).\+\1\s*$'
|
||||
let level = vimwiki#count_first_sym(line)
|
||||
if level < 6
|
||||
let line = substitute(line, '\(=\+\).\+\1', '=&=', '')
|
||||
call setline(lnum, line)
|
||||
endif
|
||||
else
|
||||
let line = substitute(line, '^\s*', '&= ', '')
|
||||
let line = substitute(line, '\s*$', ' =&', '')
|
||||
call setline(lnum, line)
|
||||
endif
|
||||
endfunction
|
||||
"}}}
|
||||
|
||||
function! vimwiki#RemoveHeaderLevel() "{{{
|
||||
let lnum = line('.')
|
||||
let line = getline(lnum)
|
||||
|
||||
if line =~ '^\s*$'
|
||||
return
|
||||
endif
|
||||
|
||||
if line =~ '^\s*\(=\+\).\+\1\s*$'
|
||||
let level = vimwiki#count_first_sym(line)
|
||||
let old = repeat('=', level)
|
||||
let new = repeat('=', level - 1)
|
||||
|
||||
let chomp = line =~ '=\s'
|
||||
|
||||
let line = substitute(line, old, new, 'g')
|
||||
|
||||
if level == 1 && chomp
|
||||
let line = substitute(line, '^\s', '', 'g')
|
||||
let line = substitute(line, '\s$', '', 'g')
|
||||
endif
|
||||
call setline(lnum, line)
|
||||
endif
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
" }}}
|
||||
216
autoload/vimwiki_diary.vim
Normal file
216
autoload/vimwiki_diary.vim
Normal file
@@ -0,0 +1,216 @@
|
||||
" Vimwiki autoload plugin file
|
||||
" Desc: Handle diary notes
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" Load only once {{{
|
||||
if exists("g:loaded_vimwiki_diary_auto") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki_diary_auto = 1
|
||||
"}}}
|
||||
|
||||
function! s:prefix_zero(num) "{{{
|
||||
if a:num < 10
|
||||
return '0'.a:num
|
||||
endif
|
||||
return a:num
|
||||
endfunction "}}}
|
||||
|
||||
function! s:desc(d1, d2) "{{{
|
||||
return a:d1 == a:d2 ? 0 : a:d1 < a:d2 ? 1 : -1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_date_link(fmt) "{{{
|
||||
return strftime(a:fmt)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:link_exists(lines, link) "{{{
|
||||
let link_exists = 0
|
||||
for line in a:lines
|
||||
if line =~ escape(a:link, '[]\')
|
||||
let link_exists = 1
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return link_exists
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_path() "{{{
|
||||
return VimwikiGet('path').VimwikiGet('diary_rel_path')
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_index() "{{{
|
||||
return s:diary_path().VimwikiGet('diary_index').VimwikiGet('ext')
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_diary_range(lines, header) "{{{
|
||||
let rx = '\[\[\d\{4}-\d\d-\d\d\]\]'
|
||||
let idx = 0
|
||||
let ln_start = -1
|
||||
let ln_end = -1
|
||||
for line in a:lines
|
||||
if ln_start != -1
|
||||
if line =~ '^\s*\(=\)\+.*\1\s*$' || (line !~ rx && line !~ '^\s*$')
|
||||
break
|
||||
endif
|
||||
endif
|
||||
if line =~ '^\s*\(=\)\+\s*'.a:header.'\s*\1\s*$'
|
||||
let ln_start = idx + 1
|
||||
endif
|
||||
let idx += 1
|
||||
endfor
|
||||
|
||||
let ln_end = idx - 1
|
||||
return [ln_start, ln_end]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:diary_date_link() "{{{
|
||||
return s:get_date_link(VimwikiGet('diary_link_fmt'))
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_file_contents(file_name) "{{{
|
||||
let lines = []
|
||||
let bufnr = bufnr(expand(a:file_name))
|
||||
if bufnr != -1
|
||||
let lines = getbufline(bufnr, 1, '$')
|
||||
else
|
||||
try
|
||||
let lines = readfile(expand(a:file_name))
|
||||
catch
|
||||
endtry
|
||||
endif
|
||||
return [lines, bufnr]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_links() "{{{
|
||||
let rx = '\d\{4}-\d\d-\d\d'
|
||||
let s_links = glob(VimwikiGet('path').VimwikiGet('diary_rel_path').'*.wiki')
|
||||
|
||||
"let s_links = substitute(s_links, '\'.VimwikiGet('ext'), "", "g")
|
||||
let s_links = substitute(s_links, '\.wiki', "", "g")
|
||||
let links = split(s_links, '\n')
|
||||
|
||||
" remove backup files (.wiki~)
|
||||
call filter(links, 'v:val !~ ''.*\~$''')
|
||||
|
||||
" remove paths
|
||||
call map(links, 'fnamemodify(v:val, ":t")')
|
||||
|
||||
call filter(links, 'v:val =~ "'.escape(rx, '\').'"')
|
||||
call map(links, '"[[".v:val."]]"')
|
||||
return links
|
||||
endfunction "}}}
|
||||
|
||||
function! s:format_links(links) "{{{
|
||||
let lines = []
|
||||
let line = '| '
|
||||
let idx = 0
|
||||
let trigger = 0
|
||||
while idx < len(a:links)
|
||||
if idx/VimwikiGet('diary_link_count') > trigger
|
||||
let trigger = idx/VimwikiGet('diary_link_count')
|
||||
call add(lines, substitute(line, '\s\+$', '', ''))
|
||||
let line = '| '
|
||||
endif
|
||||
let line .= a:links[idx].' | '
|
||||
let idx += 1
|
||||
endwhile
|
||||
call add(lines, substitute(line, '\s\+$', '', ''))
|
||||
call extend(lines, [''])
|
||||
|
||||
return lines
|
||||
endfunction "}}}
|
||||
|
||||
function! s:add_link(page, header, link) "{{{
|
||||
let [lines, bufnr] = s:get_file_contents(a:page)
|
||||
|
||||
let [ln_start, ln_end] = s:get_diary_range(lines, a:header)
|
||||
|
||||
let link = '[['.a:link.']]'
|
||||
|
||||
let link_exists = s:link_exists(lines[ln_start : ln_end], link)
|
||||
|
||||
if !link_exists
|
||||
|
||||
if ln_start == -1
|
||||
call insert(lines, '= '.a:header.' =')
|
||||
let ln_start = 1
|
||||
endif
|
||||
|
||||
" removing 'old' links
|
||||
let idx = ln_end - ln_start
|
||||
while idx > 0
|
||||
call remove(lines, ln_start)
|
||||
let idx -= 1
|
||||
endwhile
|
||||
|
||||
" get all diary links from filesystem
|
||||
let links = s:get_links()
|
||||
|
||||
" add current link
|
||||
if index(links, link) == -1
|
||||
call add(links, link)
|
||||
endif
|
||||
|
||||
let links = sort(links, 's:desc')
|
||||
call extend(lines, s:format_links(links), ln_start)
|
||||
|
||||
if bufnr != -1
|
||||
exe 'buffer '.bufnr
|
||||
if !&readonly
|
||||
1,$delete _
|
||||
call append(1, lines)
|
||||
1,1delete _
|
||||
endif
|
||||
else
|
||||
call writefile(lines, expand(a:page))
|
||||
endif
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:make_date_link(...) "{{{
|
||||
if a:0
|
||||
let link = a:1
|
||||
else
|
||||
let link = s:diary_date_link()
|
||||
endif
|
||||
let header = VimwikiGet('diary_header')
|
||||
call s:add_link(s:diary_index(), header, link)
|
||||
return VimwikiGet('diary_rel_path').link
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki_diary#make_note(index, ...) "{{{
|
||||
call vimwiki#select(a:index)
|
||||
call vimwiki#mkdir(VimwikiGet('path').VimwikiGet('diary_rel_path'))
|
||||
if a:0
|
||||
let link = s:make_date_link(a:1)
|
||||
else
|
||||
let link = s:make_date_link()
|
||||
endif
|
||||
call vimwiki#open_link(':e ', link, s:diary_index())
|
||||
endfunction "}}}
|
||||
|
||||
" Calendar.vim callback.
|
||||
function! vimwiki_diary#calendar_action(day, month, year, week, dir) "{{{
|
||||
let day = s:prefix_zero(a:day)
|
||||
let month = s:prefix_zero(a:month)
|
||||
|
||||
let link = a:year.'-'.month.'-'.day
|
||||
if winnr('#') == 0
|
||||
if a:dir == 'V'
|
||||
vsplit
|
||||
else
|
||||
split
|
||||
endif
|
||||
else
|
||||
wincmd p
|
||||
if !&hidden && &modified
|
||||
new
|
||||
endif
|
||||
endif
|
||||
|
||||
" Create diary note for a selected date in default wiki.
|
||||
call vimwiki_diary#make_note(1, link)
|
||||
endfunction
|
||||
|
||||
1123
autoload/vimwiki_html.vim
Normal file
1123
autoload/vimwiki_html.vim
Normal file
File diff suppressed because it is too large
Load Diff
361
autoload/vimwiki_lst.vim
Normal file
361
autoload/vimwiki_lst.vim
Normal file
@@ -0,0 +1,361 @@
|
||||
" Vimwiki autoload plugin file
|
||||
" Todo lists related stuff here.
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
if exists("g:loaded_vimwiki_list_auto") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki_lst_auto = 1
|
||||
|
||||
" Script variables {{{
|
||||
let s:rx_li_box = '\[.\?\]'
|
||||
" }}}
|
||||
|
||||
" Script functions {{{
|
||||
|
||||
" Get checkbox regexp
|
||||
function! s:rx_li_symbol(rate) "{{{
|
||||
let result = ''
|
||||
if a:rate == 100
|
||||
let result = g:vimwiki_listsyms[4]
|
||||
elseif a:rate == 0
|
||||
let result = g:vimwiki_listsyms[0]
|
||||
elseif a:rate >= 67
|
||||
let result = g:vimwiki_listsyms[3]
|
||||
elseif a:rate >= 34
|
||||
let result = g:vimwiki_listsyms[2]
|
||||
else
|
||||
let result = g:vimwiki_listsyms[1]
|
||||
endif
|
||||
|
||||
return '\['.result.'\]'
|
||||
endfunction "}}}
|
||||
|
||||
" Get regexp of the list item.
|
||||
function! s:rx_list_item() "{{{
|
||||
return '\('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)'
|
||||
endfunction "}}}
|
||||
|
||||
" Get regexp of the list item with checkbox.
|
||||
function! s:rx_cb_list_item() "{{{
|
||||
" return s:rx_list_item().'\s*\zs\[.\?\]'
|
||||
return s:rx_list_item().'\s*\zs\[.\?\]'
|
||||
endfunction "}}}
|
||||
|
||||
" Get level of the list item.
|
||||
function! s:get_level(lnum) "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
let level = vimwiki#count_first_sym(getline(a:lnum))
|
||||
else
|
||||
let level = indent(a:lnum)
|
||||
endif
|
||||
return level
|
||||
endfunction "}}}
|
||||
|
||||
" Get previous list item.
|
||||
" Returns: line number or 0.
|
||||
function! s:prev_list_item(lnum) "{{{
|
||||
let c_lnum = a:lnum - 1
|
||||
while c_lnum >= 1
|
||||
let line = getline(c_lnum)
|
||||
if line =~ s:rx_list_item()
|
||||
return c_lnum
|
||||
endif
|
||||
if line =~ '^\s*$'
|
||||
return 0
|
||||
endif
|
||||
let c_lnum -= 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
" Get next list item in the list.
|
||||
" Returns: line number or 0.
|
||||
function! s:next_list_item(lnum) "{{{
|
||||
let c_lnum = a:lnum + 1
|
||||
while c_lnum <= line('$')
|
||||
let line = getline(c_lnum)
|
||||
if line =~ s:rx_list_item()
|
||||
return c_lnum
|
||||
endif
|
||||
if line =~ '^\s*$'
|
||||
return 0
|
||||
endif
|
||||
let c_lnum += 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
" Find next list item in the buffer.
|
||||
" Returns: line number or 0.
|
||||
function! s:find_next_list_item(lnum) "{{{
|
||||
let c_lnum = a:lnum + 1
|
||||
while c_lnum <= line('$')
|
||||
let line = getline(c_lnum)
|
||||
if line =~ s:rx_list_item()
|
||||
return c_lnum
|
||||
endif
|
||||
let c_lnum += 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
" Set state of the list item on line number "lnum" to [ ] or [x]
|
||||
function! s:set_state(lnum, rate) "{{{
|
||||
let line = getline(a:lnum)
|
||||
let state = s:rx_li_symbol(a:rate)
|
||||
let line = substitute(line, s:rx_li_box, state, '')
|
||||
call setline(a:lnum, line)
|
||||
endfunction "}}}
|
||||
|
||||
" Get state of the list item on line number "lnum"
|
||||
function! s:get_state(lnum) "{{{
|
||||
let state = 0
|
||||
let line = getline(a:lnum)
|
||||
let opt = matchstr(line, s:rx_cb_list_item())
|
||||
if opt =~ s:rx_li_symbol(100)
|
||||
let state = 100
|
||||
elseif opt =~ s:rx_li_symbol(0)
|
||||
let state = 0
|
||||
elseif opt =~ s:rx_li_symbol(25)
|
||||
let state = 25
|
||||
elseif opt =~ s:rx_li_symbol(50)
|
||||
let state = 50
|
||||
elseif opt =~ s:rx_li_symbol(75)
|
||||
let state = 75
|
||||
endif
|
||||
return state
|
||||
endfunction "}}}
|
||||
|
||||
" Returns 1 if there is checkbox on a list item, 0 otherwise.
|
||||
function! s:is_cb_list_item(lnum) "{{{
|
||||
return getline(a:lnum) =~ s:rx_cb_list_item()
|
||||
endfunction "}}}
|
||||
|
||||
" Returns start line number of list item, 0 if it is not a list.
|
||||
function! s:is_list_item(lnum) "{{{
|
||||
let c_lnum = a:lnum
|
||||
while c_lnum >= 1
|
||||
let line = getline(c_lnum)
|
||||
if line =~ s:rx_list_item()
|
||||
return c_lnum
|
||||
endif
|
||||
if line =~ '^\s*$'
|
||||
return 0
|
||||
endif
|
||||
if indent(c_lnum) > indent(a:lnum)
|
||||
return 0
|
||||
endif
|
||||
let c_lnum -= 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
" Returns char column of checkbox. Used in parent/child checks.
|
||||
function! s:get_li_pos(lnum) "{{{
|
||||
return stridx(getline(a:lnum), '[')
|
||||
endfunction "}}}
|
||||
|
||||
" Returns list of line numbers of parent and all its child items.
|
||||
function! s:get_child_items(lnum) "{{{
|
||||
let result = []
|
||||
let lnum = a:lnum
|
||||
let p_pos = s:get_level(lnum)
|
||||
|
||||
" add parent
|
||||
call add(result, lnum)
|
||||
|
||||
let lnum = s:next_list_item(lnum)
|
||||
while lnum != 0 && s:is_list_item(lnum) && s:get_level(lnum) > p_pos
|
||||
call add(result, lnum)
|
||||
let lnum = s:next_list_item(lnum)
|
||||
endwhile
|
||||
|
||||
return result
|
||||
endfunction "}}}
|
||||
|
||||
" Returns list of line numbers of all items of the same level.
|
||||
function! s:get_sibling_items(lnum) "{{{
|
||||
let result = []
|
||||
let lnum = a:lnum
|
||||
let ind = s:get_level(lnum)
|
||||
|
||||
while s:get_level(lnum) >= ind &&
|
||||
\ lnum != 0
|
||||
|
||||
if s:get_level(lnum) == ind && s:is_cb_list_item(lnum)
|
||||
call add(result, lnum)
|
||||
endif
|
||||
let lnum = s:next_list_item(lnum)
|
||||
endwhile
|
||||
|
||||
let lnum = s:prev_list_item(a:lnum)
|
||||
while s:get_level(lnum) >= ind &&
|
||||
\ lnum != 0
|
||||
|
||||
if s:get_level(lnum) == ind && s:is_cb_list_item(lnum)
|
||||
call add(result, lnum)
|
||||
endif
|
||||
let lnum = s:prev_list_item(lnum)
|
||||
endwhile
|
||||
|
||||
return result
|
||||
endfunction "}}}
|
||||
|
||||
" Returns line number of the parent of lnum item
|
||||
function! s:get_parent_item(lnum) "{{{
|
||||
let lnum = a:lnum
|
||||
let ind = s:get_level(lnum)
|
||||
|
||||
let lnum = s:prev_list_item(lnum)
|
||||
while lnum != 0 && s:is_list_item(lnum) && s:get_level(lnum) >= ind
|
||||
let lnum = s:prev_list_item(lnum)
|
||||
endwhile
|
||||
|
||||
if s:is_cb_list_item(lnum)
|
||||
return lnum
|
||||
else
|
||||
return a:lnum
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" Creates checkbox in a list item.
|
||||
function! s:create_cb_list_item(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
let m = matchstr(line, s:rx_list_item())
|
||||
if m != ''
|
||||
let li_content = substitute(strpart(line, len(m)), '^\s*', '', '')
|
||||
let line = m.'[ ] '.li_content
|
||||
call setline(a:lnum, line)
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
" Tells if all of the sibling list items are checked or not.
|
||||
function! s:all_siblings_checked(lnum) "{{{
|
||||
let result = 0
|
||||
let cnt = 0
|
||||
let siblings = s:get_sibling_items(a:lnum)
|
||||
for lnum in siblings
|
||||
let cnt += s:get_state(lnum)/100.0
|
||||
endfor
|
||||
let result = (cnt*100.0)/len(siblings)
|
||||
return result
|
||||
endfunction "}}}
|
||||
|
||||
" Creates checkbox on a list item if there is no one.
|
||||
function! s:TLI_create_checkbox(lnum) "{{{
|
||||
if a:lnum && !s:is_cb_list_item(a:lnum)
|
||||
if g:vimwiki_auto_checkbox
|
||||
call s:create_cb_list_item(a:lnum)
|
||||
endif
|
||||
return 1
|
||||
endif
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
" Switch state of the child list items.
|
||||
function! s:TLI_switch_child_state(lnum) "{{{
|
||||
let current_state = s:get_state(a:lnum)
|
||||
if current_state == 100
|
||||
let new_state = 0
|
||||
else
|
||||
let new_state = 100
|
||||
endif
|
||||
for lnum in s:get_child_items(a:lnum)
|
||||
call s:set_state(lnum, new_state)
|
||||
endfor
|
||||
endfunction "}}}
|
||||
|
||||
" Switch state of the parent list items.
|
||||
function! s:TLI_switch_parent_state(lnum) "{{{
|
||||
let c_lnum = a:lnum
|
||||
while s:is_cb_list_item(c_lnum)
|
||||
let parent_lnum = s:get_parent_item(c_lnum)
|
||||
if parent_lnum == c_lnum
|
||||
break
|
||||
endif
|
||||
call s:set_state(parent_lnum, s:all_siblings_checked(c_lnum))
|
||||
|
||||
let c_lnum = parent_lnum
|
||||
endwhile
|
||||
endfunction "}}}
|
||||
|
||||
function! s:TLI_toggle(lnum) "{{{
|
||||
if !s:TLI_create_checkbox(a:lnum)
|
||||
call s:TLI_switch_child_state(a:lnum)
|
||||
endif
|
||||
call s:TLI_switch_parent_state(a:lnum)
|
||||
endfunction "}}}
|
||||
|
||||
" Script functions }}}
|
||||
|
||||
" Toggle list item between [ ] and [X]
|
||||
function! vimwiki_lst#ToggleListItem(line1, line2) "{{{
|
||||
let line1 = a:line1
|
||||
let line2 = a:line2
|
||||
|
||||
if line1 != line2 && !s:is_list_item(line1)
|
||||
let line1 = s:find_next_list_item(line1)
|
||||
endif
|
||||
|
||||
let c_lnum = line1
|
||||
while c_lnum != 0 && c_lnum <= line2
|
||||
let li_lnum = s:is_list_item(c_lnum)
|
||||
|
||||
if li_lnum
|
||||
let li_level = s:get_level(li_lnum)
|
||||
if c_lnum == line1
|
||||
let start_li_level = li_level
|
||||
endif
|
||||
|
||||
if li_level <= start_li_level
|
||||
call s:TLI_toggle(li_lnum)
|
||||
let start_li_level = li_level
|
||||
endif
|
||||
endif
|
||||
|
||||
let c_lnum = s:find_next_list_item(c_lnum)
|
||||
endwhile
|
||||
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki_lst#insertCR() "{{{
|
||||
" This function is heavily relies on proper 'set comments' option.
|
||||
let cr = "\<CR>"
|
||||
if getline('.') =~ s:rx_cb_list_item()
|
||||
let cr .= '[ ] '
|
||||
endif
|
||||
return cr
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki_lst#insertOo(cmd) "{{{
|
||||
" cmd should be 'o' or 'O'
|
||||
|
||||
let beg_lnum = foldclosed('.')
|
||||
let end_lnum = foldclosedend('.')
|
||||
if end_lnum != -1 && a:cmd ==# 'o'
|
||||
let lnum = end_lnum
|
||||
let line = getline(beg_lnum)
|
||||
else
|
||||
let line = getline('.')
|
||||
let lnum = line('.')
|
||||
endif
|
||||
|
||||
let res = ''
|
||||
if line =~ s:rx_cb_list_item()
|
||||
let res = matchstr(line, s:rx_list_item()).'[ ] '
|
||||
elseif line =~ s:rx_list_item()
|
||||
let res = matchstr(line, s:rx_list_item())
|
||||
elseif &autoindent || &smartindent
|
||||
let res = matchstr(line, '^\s*')
|
||||
endif
|
||||
if a:cmd ==# 'o'
|
||||
call append(lnum, res)
|
||||
call cursor(lnum + 1, col('$'))
|
||||
else
|
||||
call append(lnum - 1, res)
|
||||
call cursor(lnum, col('$'))
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
335
autoload/vimwiki_tbl.vim
Normal file
335
autoload/vimwiki_tbl.vim
Normal file
@@ -0,0 +1,335 @@
|
||||
" Vimwiki autoload plugin file
|
||||
" Desc: Tables
|
||||
" | Easily | manageable | text | tables | ! |
|
||||
" |--------+------------+-------+--------+---------|
|
||||
" | Have | fun! | Drink | tea | Period. |
|
||||
"
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
" Load only once {{{
|
||||
if exists("g:loaded_vimwiki_tbl_auto") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_vimwiki_tbl_auto = 1
|
||||
"}}}
|
||||
|
||||
let s:textwidth = &tw
|
||||
|
||||
" Misc functions {{{
|
||||
function! s:wide_len(str) "{{{
|
||||
return strlen(substitute(a:str, '.', 'x', 'g'))
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_table(line) "{{{
|
||||
return a:line =~ '^\s*\%(|[^|]\+\)\+|\s*$' || s:is_separator(a:line)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_separator(line) "{{{
|
||||
return a:line =~ '^\s*|\s*-\+'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:is_last_column(lnum, cnum) "{{{
|
||||
return strpart(getline(a:lnum), a:cnum - 1) =~ '^[^|]*|\s*$'
|
||||
endfunction "}}}
|
||||
|
||||
function! s:count_separators(lnum) "{{{
|
||||
let lnum = a:lnum + 1
|
||||
while lnum < line('$')
|
||||
if !s:is_separator(getline(lnum))
|
||||
break
|
||||
endif
|
||||
let lnum += 1
|
||||
endwhile
|
||||
|
||||
return (lnum-a:lnum)
|
||||
endfunction "}}}
|
||||
|
||||
function! s:create_empty_row(cols) "{{{
|
||||
let first_cell = "| |"
|
||||
let cell = " |"
|
||||
let row = first_cell
|
||||
|
||||
for c in range(a:cols - 1)
|
||||
let row .= cell
|
||||
endfor
|
||||
|
||||
return row
|
||||
endfunction "}}}
|
||||
|
||||
function! s:create_row_sep(cols) "{{{
|
||||
let first_cell = "|---+"
|
||||
let cell = "---+"
|
||||
let last_cell = "---|"
|
||||
|
||||
if a:cols < 2
|
||||
return "|---|"
|
||||
endif
|
||||
|
||||
let row = first_cell
|
||||
|
||||
for c in range(a:cols - 2)
|
||||
let row .= cell
|
||||
endfor
|
||||
|
||||
let row .= last_cell
|
||||
|
||||
return row
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_values(line) "{{{
|
||||
let cells = []
|
||||
let cnt = 0
|
||||
let idx = 0
|
||||
while idx != -1 && idx < strlen(a:line) - 1
|
||||
let cell = matchstr(a:line, '|\zs[^|]\+\ze|', idx)
|
||||
let cell = substitute(cell, '^\s*\(.\{-}\)\s*$', '\1', 'g')
|
||||
call add(cells, [cnt, cell])
|
||||
let cnt += 1
|
||||
let idx = matchend(a:line, '|\zs[^|]\+\ze|', idx)
|
||||
endwhile
|
||||
return cells
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_rows(lnum) "{{{
|
||||
if !s:is_table(getline(a:lnum))
|
||||
return
|
||||
endif
|
||||
|
||||
let upper_rows = []
|
||||
let lower_rows = []
|
||||
|
||||
let lnum = a:lnum - 1
|
||||
while lnum > 1
|
||||
let line = getline(lnum)
|
||||
if s:is_table(line)
|
||||
call add(upper_rows, [lnum, line])
|
||||
else
|
||||
break
|
||||
endif
|
||||
let lnum -= 1
|
||||
endwhile
|
||||
call reverse(upper_rows)
|
||||
|
||||
let lnum = a:lnum
|
||||
while lnum <= line('$')
|
||||
let line = getline(lnum)
|
||||
if s:is_table(line)
|
||||
call add(lower_rows, [lnum, line])
|
||||
else
|
||||
break
|
||||
endif
|
||||
let lnum += 1
|
||||
endwhile
|
||||
|
||||
return upper_rows + lower_rows
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_cell_max_lens(lnum) "{{{
|
||||
let max_lens = {}
|
||||
for [lnum, row] in s:get_rows(a:lnum)
|
||||
if s:is_separator(row)
|
||||
continue
|
||||
endif
|
||||
for [idx, cell] in s:get_values(row)
|
||||
if has_key(max_lens, idx)
|
||||
let max_lens[idx] = max([s:wide_len(cell), max_lens[idx]])
|
||||
else
|
||||
let max_lens[idx] = s:wide_len(cell)
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
return max_lens
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_aligned_rows(lnum, max_lens) "{{{
|
||||
let rows = []
|
||||
for [lnum, row] in s:get_rows(a:lnum)
|
||||
if s:is_separator(row)
|
||||
let new_row = s:fmt_sep(a:max_lens)
|
||||
else
|
||||
let new_row = s:fmt_row(row, a:max_lens)
|
||||
endif
|
||||
call add(rows, [lnum, new_row])
|
||||
endfor
|
||||
return rows
|
||||
endfunction "}}}
|
||||
" }}}
|
||||
|
||||
" Format functions {{{
|
||||
function! s:fmt_cell(cell, max_len) "{{{
|
||||
let cell = ' '.a:cell.' '
|
||||
|
||||
let diff = a:max_len - s:wide_len(a:cell)
|
||||
if diff == 0 && empty(a:cell)
|
||||
let diff = 1
|
||||
endif
|
||||
|
||||
let cell .= repeat(' ', diff)
|
||||
return cell
|
||||
endfunction "}}}
|
||||
|
||||
function! s:fmt_row(line, max_lens) "{{{
|
||||
let new_line = '|'
|
||||
let values = s:get_values(a:line)
|
||||
for [idx, cell] in values
|
||||
let new_line .= s:fmt_cell(cell, a:max_lens[idx]).'|'
|
||||
endfor
|
||||
|
||||
let idx = len(values)
|
||||
while idx < len(a:max_lens)
|
||||
let new_line .= s:fmt_cell('', a:max_lens[idx]).'|'
|
||||
let idx += 1
|
||||
endwhile
|
||||
return new_line
|
||||
endfunction "}}}
|
||||
|
||||
function! s:fmt_cell_sep(max_len) "{{{
|
||||
if a:max_len == 0
|
||||
return repeat('-', 3)
|
||||
else
|
||||
return repeat('-', a:max_len+2)
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:fmt_sep(max_lens) "{{{
|
||||
let sep = '|'
|
||||
for idx in range(len(a:max_lens))
|
||||
let sep .= s:fmt_cell_sep(a:max_lens[idx]).'+'
|
||||
endfor
|
||||
let sep = substitute(sep, '+$', '|', '')
|
||||
return sep
|
||||
endfunction "}}}
|
||||
"}}}
|
||||
|
||||
" Keyboard functions "{{{
|
||||
function! s:kbd_create_new_row(cols, goto_first) "{{{
|
||||
let cmd = "\<ESC>o".s:create_empty_row(a:cols)
|
||||
let cmd .= "\<ESC>:call vimwiki_tbl#format(line('.'))\<CR>"
|
||||
if a:goto_first
|
||||
let cmd .= "0f|T|a"
|
||||
else
|
||||
let cmd .= "0".(col('.')-1)."lT|a"
|
||||
endif
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_next_row() "{{{
|
||||
let cmd = "\<ESC>jt|T|a"
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
function! s:kbd_goto_next_col(last) "{{{
|
||||
if col('.') == 1
|
||||
let cmd = "\<ESC>la"
|
||||
else
|
||||
if a:last
|
||||
let seps = s:count_separators(line('.'))
|
||||
let cmd = "\<ESC>".seps."j0f|F|la"
|
||||
else
|
||||
let cmd = "\<ESC>f|la"
|
||||
endif
|
||||
endif
|
||||
return cmd
|
||||
endfunction "}}}
|
||||
|
||||
"}}}
|
||||
|
||||
" Global functions {{{
|
||||
function! vimwiki_tbl#kbd_cr() "{{{
|
||||
let lnum = line('.')
|
||||
if !s:is_table(getline(lnum))
|
||||
return "\<CR>"
|
||||
endif
|
||||
|
||||
if s:is_separator(getline(lnum+1)) || !s:is_table(getline(lnum+1))
|
||||
let cols = len(s:get_values(getline(lnum)))
|
||||
return s:kbd_create_new_row(cols, 0)
|
||||
else
|
||||
return s:kbd_goto_next_row()
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki_tbl#kbd_tab() "{{{
|
||||
let lnum = line('.')
|
||||
if !s:is_table(getline(lnum))
|
||||
return "\<Tab>"
|
||||
endif
|
||||
|
||||
let last = s:is_last_column(lnum, col('.'))
|
||||
if last && !s:is_table(getline(lnum+1))
|
||||
let cols = len(s:get_values(getline(lnum)))
|
||||
return s:kbd_create_new_row(cols, 1)
|
||||
endif
|
||||
return s:kbd_goto_next_col(last)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki_tbl#format(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
|
||||
let max_lens = s:get_cell_max_lens(a:lnum)
|
||||
|
||||
for [lnum, row] in s:get_aligned_rows(a:lnum, max_lens)
|
||||
call setline(lnum, row)
|
||||
endfor
|
||||
|
||||
let &tw = s:textwidth
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki_tbl#create(...) "{{{
|
||||
if a:0 > 1
|
||||
let cols = a:1
|
||||
let rows = a:2
|
||||
elseif a:0 == 1
|
||||
let cols = a:1
|
||||
let rows = 2
|
||||
elseif a:0 == 0
|
||||
let cols = 5
|
||||
let rows = 2
|
||||
endif
|
||||
|
||||
if cols < 1
|
||||
let cols = 5
|
||||
endif
|
||||
|
||||
if rows < 1
|
||||
let rows = 2
|
||||
endif
|
||||
|
||||
let lines = []
|
||||
let row = s:create_empty_row(cols)
|
||||
|
||||
call add(lines, row)
|
||||
if rows > 1
|
||||
call add(lines, s:create_row_sep(cols))
|
||||
endif
|
||||
|
||||
for r in range(rows - 1)
|
||||
call add(lines, row)
|
||||
endfor
|
||||
|
||||
call append(line('.'), lines)
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki_tbl#align_or_cmd(cmd) "{{{
|
||||
if s:is_table(getline('.'))
|
||||
call vimwiki_tbl#format(line('.'))
|
||||
else
|
||||
exe 'normal! '.a:cmd
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! vimwiki_tbl#reset_tw(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
if !s:is_table(line)
|
||||
return
|
||||
endif
|
||||
|
||||
let s:textwidth = &tw
|
||||
let &tw = 0
|
||||
endfunction "}}}
|
||||
|
||||
"}}}
|
||||
99
autoload/vst/default.css
Normal file
99
autoload/vst/default.css
Normal file
@@ -0,0 +1,99 @@
|
||||
body { color: #000; background-color: #fff; margin: 0px 10%; min-width: 720px; font-family: Verdana, sans-serif;
|
||||
counter-reset: chapter section subsection subsubsection paragraph lchapter lsection lsubsection lsubsubsection lparagraph}
|
||||
div.footnote { border-left: 1px solid #000; margin-left: 0em; clear: both }
|
||||
div.ftext { position: relative; margin-left: 50px }
|
||||
div.fnumber { float: left; width: 40px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
|
||||
div.fnumber a { margin: 0px; padding: 0px }
|
||||
div.ctext { position: relative; margin-left: 100px }
|
||||
div.cnumber { float: left; width: 90px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
|
||||
div.cnumber a { margin: 0px; padding: 0px }
|
||||
div.tip { border: 2px solid #0d0; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.warning, div.caution, div.danger, div.error { border: 2px solid #f00; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.note, div.hint, div.important { border: 2px solid #000; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.figure { display: block; padding: 1em; width: 400px; clear: both}
|
||||
div.topic { margin: 2em }
|
||||
div.vstsidebar, div.sidebar { border: 2px solid #aaa; color: #000; background-color: #ffffee; float: right; width: 40%; margin-left: 1em; margin-right: -1em; padding: 1em }
|
||||
span.strike { text-decoration: line-through }
|
||||
span.big { font-size: large }
|
||||
span.small { font-size: small }
|
||||
span.title { font-style: italic }
|
||||
span.notetitle { font-size: large; font-weight: 900; font-family: Verdana, sans-serif }
|
||||
p.toc { font-size: large; font-weight: 900 }
|
||||
p.notesubtitle { font-weight: 900; font-family: Verdana, sans-serif }
|
||||
p.attribution { font-style: italic; margin-left: 8em; text-indent: -1.4em }
|
||||
.vstright { float: right; margin: 1em }
|
||||
.vstleft { float: left; margin: 1em }
|
||||
.vstcenter { margin: 1em auto }
|
||||
blockquote.pull { font-size: large }
|
||||
p.rubric { font-size: large; margin-left: 2em }
|
||||
dd.normal { margin-bottom: 0.5em }
|
||||
dt.option { float: left; margin: 0em 0em 5px 2em; padding: 0px; font-family: monospace }
|
||||
dd.option { padding: 0px; margin: 0em 0em 5px 10em; text-indent: 0.5em }
|
||||
dd.option > p { margin: 0px }
|
||||
dd.normal > p { margin: 0px }
|
||||
table { border-collapse: collapse; margin: 0.5em 0em }
|
||||
thead, tfoot { text-align: center; font-weight: bold }
|
||||
td { border: 1px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td blockquote p{ margin: 0px; padding: 0px}
|
||||
td blockquote { margin: 0px; padding: 0px}
|
||||
table.vstbless td { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td > p { margin: 0px }
|
||||
table.field { border: 0px solid #000; margin-left: 2em; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fkey { font-weight: 900 }
|
||||
td.fval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fkey { font-weight: 900; border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fdkey { text-align: center; font-weight: 900 }
|
||||
td.fdval { text-align: center; font-style: italic }
|
||||
td.fakey { text-align: center; font-weight: 900 }
|
||||
td.faval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
hr { width: 80%; margin: 1.5em auto }
|
||||
h1 { text-align: center; clear: both }
|
||||
h2, h3, h4, h5, h6 { text-align: left; margin-top: 1em; clear: both }
|
||||
h2 { counter-reset: section subsection subsubsection paragraph }
|
||||
h3 { counter-reset: subsection subsubsection paragraph }
|
||||
h4 { counter-reset: subsubsection paragraph }
|
||||
h5 { counter-reset: paragraph }
|
||||
h1 a { color: #000; background-color: transparent }
|
||||
h2 a { color: #000; background-color: transparent }
|
||||
h3 a { color: #000; background-color: transparent }
|
||||
h4 a { color: #000; background-color: transparent }
|
||||
h5 a { color: #000; background-color: transparent }
|
||||
h6 a { color: #000; background-color: transparent }
|
||||
p.subh1 { text-align: center; font-size: 120%; font-variant: small-caps }
|
||||
p.subh2, p.subh3, p.subh4, p.subh5, p.subh6 { text-align: left; font-size: 120%; font-variant: small-caps }
|
||||
h2:before { content: counter(chapter)" "; counter-increment: chapter }
|
||||
h3:before { content: counter(chapter)"."counter(section)" "; counter-increment: section }
|
||||
h4:before { content: counter(chapter)"."counter(section)"."counter(subsection)" "; counter-increment: subsection }
|
||||
h5:before { content: counter(chapter)"."counter(section)"."counter(subsection)"."counter(subsubsection)" "; counter-increment: subsubsection }
|
||||
h6:before { content: counter(chapter)"."counter(section)"."counter(subsection)"."counter(subsubsection)"."counter(paragraph)" "; counter-increment: paragraph}
|
||||
li.h1 { margin-left: 0em }
|
||||
li.h2 { margin-left: 1em; counter-reset: lsection lsubsection lsubsubsection lparagraph }
|
||||
li.h3 { margin-left: 2em; counter-reset: lsubsection lsubsubsection lparagraph }
|
||||
li.h4 { margin-left: 3em; counter-reset: lsubsubsection lparagraph }
|
||||
li.h5 { margin-left: 4em; counter-reset: lparagraph }
|
||||
li.h2:before { content: counter(lchapter)" "; counter-increment: lchapter }
|
||||
li.h3:before { content: counter(lchapter)"."counter(lsection)" "; counter-increment: lsection }
|
||||
li.h4:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)" "; counter-increment: lsubsection }
|
||||
li.h5:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)"."counter(lsubsubsection)" "; counter-increment: lsubsubsection }
|
||||
li.h6:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)"."counter(lsubsubsection)"."counter(lparagraph)" "; counter-increment: lparagraph}
|
||||
li.h6 { margin-left: 5em }
|
||||
ol, ul { margin-bottom: 0.5em; margin-top: 0.5em }
|
||||
ol.loweralpha { list-style-type: lower-alpha }
|
||||
ol.upperalpha { list-style-type: upper-alpha }
|
||||
ol.lowerroman { list-style-type: lower-roman }
|
||||
ol.upperroman { list-style-type: upper-roman }
|
||||
ol.decimal { list-style-type: decimal }
|
||||
ul.square { list-style-type: square }
|
||||
ul.circle { list-style-type: circle }
|
||||
ul.disc { list-style-type: disc }
|
||||
li > p { margin: 0em }
|
||||
img { border: 1px solid #000; padding: 0em; display: block; margin: 1em auto }
|
||||
img.inline { border: 1px solid #000; padding: 0em; margin: 0em; display: inline }
|
||||
pre { color: #000; background-color: #eee; margin-left: 2em; clear: both; overflow: auto }
|
||||
div.unknown { font-family: monospace; color: #000; background-color: #fff; margin: 1em; padding: 1em; clear: both; border: 3px solid red}
|
||||
pre.quoted { color: #000; background-color: #eee; margin-left: 0em; clear: both; overflow: auto }
|
||||
pre.rawlatex { color: #000; background-color: #ddd; border: 1px solid #000; padding: 0.1em; clear: both; overflow: auto }
|
||||
pre.address { font-family: Verdana, sans-serif; display: inline; margin: 0px; color: #000; background-color: #fff; overflow: auto }
|
||||
span.target { text-decoration: underline }
|
||||
div.vstfooter hr { width: 100%; margin: 0px }
|
||||
div.vstfooter p { margin: 0px }
|
||||
110
autoload/vst/lightblue.css
Normal file
110
autoload/vst/lightblue.css
Normal file
@@ -0,0 +1,110 @@
|
||||
/* Vim reStructured Text CSS */
|
||||
|
||||
body { background-color: #fff; margin: 0px 10%; width: 45em; font-family: Georgia, serif;}
|
||||
div.footnote { border-left: 1px solid silver; margin-left: 0em; clear: both }
|
||||
div.ftext { position: relative; margin-left: 50px }
|
||||
div.fnumber { float: left; width: 40px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
|
||||
div.fnumber a { margin: 0px; padding: 0px }
|
||||
div.ctext { position: relative; margin-left: 100px }
|
||||
div.cnumber { float: left; width: 90px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
|
||||
div.cnumber a { margin: 0px; padding: 0px }
|
||||
div.tip { border: 2px solid #0d0; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.warning, div.caution, div.danger, div.error { border: 2px solid #f00; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.note, div.hint, div.important { border: 2px solid silver; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.figure { display: block; padding: 1em; width: 400px; clear: both}
|
||||
div.topic { margin: 2em }
|
||||
div.vstsidebar, div.sidebar { border: 2px solid #aaa; background-color: #ffffee; float: right; width: 40%; margin-left: 1em; margin-right: -1em; padding: 1em }
|
||||
span.strike { text-decoration: line-through }
|
||||
span.big { font-size: large }
|
||||
span.small { font-size: small }
|
||||
span.title { font-style: italic }
|
||||
span.toc { font-size: large; font-weight: 900 }
|
||||
span.notetitle { font-size: large; font-weight: 900; font-family: Arial, sans-serif }
|
||||
p.notesubtitle { font-weight: 900; font-family: Arial, sans-serif }
|
||||
p.attribution { font-style: italic; margin-left: 8em; text-indent: -1.4em }
|
||||
.vstright { float: right; margin: 1em }
|
||||
.vstleft { float: left; margin: 1em }
|
||||
.vstcenter { margin: 1em; margin-left: auto; margin-right: auto }
|
||||
blockquote.pull { font-size: large }
|
||||
p.rubric { font-size: large; margin-left: 2em }
|
||||
dd.normal { margin-bottom: 0.5em }
|
||||
dt.option { float: left; margin: 0em 0em 5px 2em; padding: 0px; font-family: monospace }
|
||||
dd.option { margin: 0px; padding: 0px; margin: 0em 0em 5px 10em; text-indent: 0.5em }
|
||||
dd.option > p { margin: 0px }
|
||||
dd.normal > p { margin: 0px }
|
||||
table { border-collapse: collapse; border-top: 1px solid navy; border-bottom: 1px solid navy; margin: 0.5em; margin-left: 0em; margin-right: 0em }
|
||||
thead, tfoot { text-align: center; font-weight: bold }
|
||||
thead { font-family: Arial, sans-serif; border-bottom: 1px solid silver; }
|
||||
td { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td blockquote p{ margin: 0px; padding: 0px}
|
||||
td blockquote { margin: 0px; padding: 0px}
|
||||
table.vstbless { border: 0px solid #000; }
|
||||
table.vstbless thead { border: 0px solid #000; }
|
||||
table.vstbless td { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td > p { margin: 0px }
|
||||
table.field { border: 0px solid #000; margin-left: 2em; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fkey { font-weight: 900 }
|
||||
td.fval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fkey { font-weight: 900; border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fdkey { text-align: center; font-weight: 900 }
|
||||
td.fdval { text-align: center; font-style: italic }
|
||||
td.fakey { text-align: center; font-weight: 900 }
|
||||
td.faval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
hr { width: 80%; margin: 1.5em auto; border: 1px solid silver }
|
||||
h1 { border-bottom: 2px solid silver; text-align: center; clear: both }
|
||||
h2, h3, h4, h5, h6 { text-align: left; margin-top: 1em; clear: both; padding-top: 0.5em;}
|
||||
h2, h3 { border-bottom: 1px solid silver; }
|
||||
h1 a { color: dodgerblue4 }
|
||||
h2 a { color: dodgerblue4 }
|
||||
h3 a { color: dodgerblue4 }
|
||||
h4 a { color: dodgerblue4 }
|
||||
h5 a { color: dodgerblue4 }
|
||||
h6 a { color: dodgerblue4 }
|
||||
p.subh1 { text-align: center; font-size: 120%; font-variant: small-caps }
|
||||
p.subh2, p.subh3, p.subh4, p.subh5, p.subh6 { text-align: left; font-size: 120%; font-variant: small-caps }
|
||||
li.h1 { margin-left: 0em }
|
||||
li.h2 { margin-left: 1em;}
|
||||
li.h3 { margin-left: 2em;}
|
||||
li.h4 { margin-left: 3em;}
|
||||
li.h5 { margin-left: 4em;}
|
||||
li.h6 { margin-left: 5em }
|
||||
ol, ul { margin-bottom: 0.5em; margin-top: 0.5em }
|
||||
ol.loweralpha { list-style-type: lower-alpha }
|
||||
ol.upperalpha { list-style-type: upper-alpha }
|
||||
ol.lowerroman { list-style-type: lower-roman }
|
||||
ol.upperroman { list-style-type: upper-roman }
|
||||
ol.decimal { list-style-type: decimal }
|
||||
ul.square { list-style-type: square }
|
||||
ul.circle { list-style-type: circle }
|
||||
ul.disc { list-style-type: disc }
|
||||
li > p { margin: 0em }
|
||||
img { border: 1px solid #000; padding: 0em; display: block; margin: 1em; margin-left: auto; margin-right: auto }
|
||||
img.inline { border: 1px solid #000; padding: 0em; margin: 0em; display: inline }
|
||||
pre { background-color: #f9f9f9; margin-left: 2em; clear: both; overflow: auto }
|
||||
div.unknown { font-family: monospace; background-color: #fff; margin: 1em; padding: 1em; clear: both; border: 3px solid red}
|
||||
pre.quoted { background-color: #eee; margin-left: 0em; clear: both; overflow: auto }
|
||||
pre.rawlatex { background-color: #ddd; border: 1px solid #000; padding: 0.1em; clear: both; overflow: auto }
|
||||
pre.address { font-family: Georgia, serif; display: inline; margin: 0px; background-color: #fff; overflow: auto }
|
||||
span.target { text-decoration: underline }
|
||||
div.vstfooter hr { width: 100%; margin: 0px; margin-top: 0em }
|
||||
div.vstfooter p { margin: 0px }
|
||||
|
||||
/* Debug borders */
|
||||
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
|
||||
/*
|
||||
border: 1px solid red;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
a { color: dodgerblue4; }
|
||||
a:visited { color: fuchsia; }
|
||||
tt { color: dodgerblue4; }
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: dodgerblue4;
|
||||
font-family: Arial, sans-serif;
|
||||
margin-top: 1.2em;
|
||||
margin-bottom: 0.5em;
|
||||
line-height: 1.3;
|
||||
}
|
||||
18
autoload/vst/myhtmlvst.vim
Normal file
18
autoload/vst/myhtmlvst.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
" Author: Mikolaj Machowski
|
||||
" Example of macro for g:vst_html_post file
|
||||
call cursor(1,1)
|
||||
while search('^\s*{read\w\{-}:.\{-}}\s*$', 'W')
|
||||
let data = matchlist(getline('.'), '^\s*{read\(\w\{-}\):\(.\{-}\)}\s*$')
|
||||
silent s/.*//ge
|
||||
if data[1] == ''
|
||||
let output = readfile(data[2])
|
||||
else
|
||||
if data[1] == 'bang'
|
||||
let data[1] = ''
|
||||
endif
|
||||
let output = split(system(data[1].' '.data[2]), "\n")
|
||||
endif
|
||||
call map(output, "' '.v:val")
|
||||
let jout = "<pre>\n".join(output, "\n")."\n</pre>"
|
||||
put =jout
|
||||
endwhile
|
||||
BIN
autoload/vst/s5ui/blank.gif
Normal file
BIN
autoload/vst/s5ui/blank.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 49 B |
23
autoload/vst/s5ui/framing.css
Normal file
23
autoload/vst/s5ui/framing.css
Normal file
@@ -0,0 +1,23 @@
|
||||
/* The following styles size, place, and layer the slide components.
|
||||
Edit these if you want to change the overall slide layout.
|
||||
The commented lines can be uncommented (and modified, if necessary)
|
||||
to help you with the rearrangement process. */
|
||||
|
||||
/* target = 1024x768 */
|
||||
|
||||
div#header, div#footer, .slide {width: 100%; top: 0; left: 0;}
|
||||
div#header {top: 0; height: 3em; z-index: 1;}
|
||||
div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;}
|
||||
.slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;}
|
||||
div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;}
|
||||
div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
|
||||
margin: 0;}
|
||||
#currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;}
|
||||
html>body #currentSlide {position: fixed;}
|
||||
|
||||
/*
|
||||
div#header {background: #FCC;}
|
||||
div#footer {background: #CCF;}
|
||||
div#controls {background: #BBD;}
|
||||
div#currentSlide {background: #FFC;}
|
||||
*/
|
||||
42
autoload/vst/s5ui/iepngfix.htc
Normal file
42
autoload/vst/s5ui/iepngfix.htc
Normal file
@@ -0,0 +1,42 @@
|
||||
<public:component>
|
||||
<public:attach event="onpropertychange" onevent="doFix()" />
|
||||
|
||||
<script>
|
||||
|
||||
// IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
|
||||
// Free usage permitted as long as this notice remains intact.
|
||||
|
||||
// This must be a path to a blank image. That's all the configuration you need here.
|
||||
var blankImg = 'v11rc1/default/blank.gif';
|
||||
|
||||
var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
|
||||
|
||||
function filt(s, m) {
|
||||
if (filters[f]) {
|
||||
filters[f].enabled = s ? true : false;
|
||||
if (s) with (filters[f]) { src = s; sizingMethod = m }
|
||||
} else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
|
||||
}
|
||||
|
||||
function doFix() {
|
||||
if ((parseFloat(navigator.userAgent.match(/MSIE (\S+)/)[1]) < 5.5) ||
|
||||
(event && !/(background|src)/.test(event.propertyName))) return;
|
||||
|
||||
if (tagName == 'IMG') {
|
||||
if ((/\.png$/i).test(src)) {
|
||||
filt(src, 'image'); // was 'scale'
|
||||
src = blankImg;
|
||||
} else if (src.indexOf(blankImg) < 0) filt();
|
||||
} else if (style.backgroundImage) {
|
||||
if (style.backgroundImage.match(/^url[("']+(.*\.png)[)"']+$/i)) {
|
||||
var s = RegExp.$1;
|
||||
style.backgroundImage = '';
|
||||
filt(s, 'crop');
|
||||
} else filt();
|
||||
}
|
||||
}
|
||||
|
||||
doFix();
|
||||
|
||||
</script>
|
||||
</public:component>
|
||||
7
autoload/vst/s5ui/opera.css
Normal file
7
autoload/vst/s5ui/opera.css
Normal file
@@ -0,0 +1,7 @@
|
||||
/* DO NOT CHANGE THESE unless you really want to break Opera Show */
|
||||
.slide {
|
||||
visibility: visible !important;
|
||||
position: static !important;
|
||||
page-break-before: always;
|
||||
}
|
||||
#slide0 {page-break-before: avoid;}
|
||||
15
autoload/vst/s5ui/outline.css
Normal file
15
autoload/vst/s5ui/outline.css
Normal file
@@ -0,0 +1,15 @@
|
||||
/* don't change this unless you want the layout stuff to show up in the outline view! */
|
||||
|
||||
.layout div, #footer *, #controlForm * {display: none;}
|
||||
#footer, #controls, #controlForm, #navLinks, #toggle {
|
||||
display: block; visibility: visible; margin: 0; padding: 0;}
|
||||
#toggle {float: right; padding: 0.5em;}
|
||||
html>body #toggle {position: fixed; top: 0; right: 0;}
|
||||
|
||||
/* making the outline look pretty-ish */
|
||||
|
||||
#slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;}
|
||||
#slide0 h1 {padding-top: 1.5em;}
|
||||
.slide h1 {margin: 1.5em 0 0; padding-top: 0.25em;
|
||||
border-top: 1px solid #888; border-bottom: 1px solid #AAA;}
|
||||
#toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;}
|
||||
86
autoload/vst/s5ui/pretty.css
Normal file
86
autoload/vst/s5ui/pretty.css
Normal file
@@ -0,0 +1,86 @@
|
||||
/* Following are the presentation styles -- edit away! */
|
||||
|
||||
body {background: #FFF url(bodybg.gif) -16px 0 no-repeat; color: #000; font-size: 2em;}
|
||||
:link, :visited {text-decoration: none; color: #00C;}
|
||||
#controls :active {color: #88A !important;}
|
||||
#controls :focus {outline: 1px dotted #227;}
|
||||
h1, h2, h3, h4 {font-size: 100%; margin: 0; padding: 0; font-weight: inherit;}
|
||||
ul, pre {margin: 0; line-height: 1em;}
|
||||
html, body {margin: 0; padding: 0;}
|
||||
|
||||
blockquote, q {font-style: italic;}
|
||||
blockquote {padding: 0 2em 0.5em; margin: 0 1.5em 0.5em; text-align: center; font-size: 1em;}
|
||||
blockquote p {margin: 0;}
|
||||
blockquote i {font-style: normal;}
|
||||
blockquote b {display: block; margin-top: 0.5em; font-weight: normal; font-size: smaller; font-style: normal;}
|
||||
blockquote b i {font-style: italic;}
|
||||
|
||||
kbd {font-weight: bold; font-size: 1em;}
|
||||
sup {font-size: smaller; line-height: 1px;}
|
||||
|
||||
.slide code {padding: 2px 0.25em; font-weight: bold; color: #533;}
|
||||
.slide code.bad, code del {color: red;}
|
||||
.slide code.old {color: silver;}
|
||||
.slide pre {padding: 0; margin: 0.25em 0 0.5em 0.5em; color: #533; font-size: 90%;}
|
||||
.slide pre code {display: block;}
|
||||
.slide ul {margin-left: 5%; margin-right: 7%; list-style: disc;}
|
||||
.slide li {margin-top: 0.75em; margin-right: 0;}
|
||||
.slide ul ul {line-height: 1;}
|
||||
.slide ul ul li {margin: .2em; font-size: 85%; list-style: square;}
|
||||
.slide img.leader {display: block; margin: 0 auto;}
|
||||
|
||||
div#header, div#footer {background: #005; color: #AAB;
|
||||
font-family: Verdana, Helvetica, sans-serif;}
|
||||
div#header {background: #005 url(bodybg.gif) -16px 0 no-repeat;
|
||||
line-height: 1px;}
|
||||
div#footer {font-size: 0.5em; font-weight: bold; padding: 1em 0;}
|
||||
#footer h1, #footer h2 {display: block; padding: 0 1em;}
|
||||
#footer h2 {font-style: italic;}
|
||||
|
||||
div.long {font-size: 0.75em;}
|
||||
.slide h1 {position: absolute; top: 0.7em; left: 87px; z-index: 1;
|
||||
margin: 0; padding: 0.3em 0 0 50px; white-space: nowrap;
|
||||
font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize;
|
||||
color: #DDE; background: #005;}
|
||||
.slide h3 {font-size: 130%;}
|
||||
h1 abbr {font-variant: small-caps;}
|
||||
|
||||
div#controls {position: absolute; left: 50%; bottom: 0;
|
||||
width: 50%;
|
||||
text-align: right; font: bold 0.9em Verdana, Helvetica, sans-serif;}
|
||||
html>body div#controls {position: fixed; padding: 0 0 1em 0;
|
||||
top: auto;}
|
||||
div#controls form {position: absolute; bottom: 0; right: 0; width: 100%;
|
||||
margin: 0; padding: 0;}
|
||||
#controls #navLinks a {padding: 0; margin: 0 0.5em;
|
||||
background: #005; border: none; color: #779;
|
||||
cursor: pointer;}
|
||||
#controls #navList {height: 1em;}
|
||||
#controls #navList #jumplist {position: absolute; bottom: 0; right: 0; background: #DDD; color: #227;}
|
||||
|
||||
#currentSlide {text-align: center; font-size: 0.5em; color: #449;}
|
||||
|
||||
#slide0 {padding-top: 3.5em; font-size: 90%;}
|
||||
#slide0 h1 {position: static; margin: 1em 0 0; padding: 0;
|
||||
font: bold 2em Helvetica, sans-serif; white-space: normal;
|
||||
color: #000; background: transparent;}
|
||||
#slide0 h2 {font: bold italic 1em Helvetica, sans-serif; margin: 0.25em;}
|
||||
#slide0 h3 {margin-top: 1.5em; font-size: 1.5em;}
|
||||
#slide0 h4 {margin-top: 0; font-size: 1em;}
|
||||
|
||||
ul.urls {list-style: none; display: inline; margin: 0;}
|
||||
.urls li {display: inline; margin: 0;}
|
||||
.note {display: none;}
|
||||
.external {border-bottom: 1px dotted gray;}
|
||||
html>body .external {border-bottom: none;}
|
||||
.external:after {content: " \274F"; font-size: smaller; color: #77B;}
|
||||
|
||||
.incremental, .incremental *, .incremental *:after {color: #DDE; visibility: visible;}
|
||||
img.incremental {visibility: hidden;}
|
||||
.slide .current {color: #B02;}
|
||||
|
||||
|
||||
/* diagnostics
|
||||
|
||||
li:after {content: " [" attr(class) "]"; color: #F88;}
|
||||
*/
|
||||
1
autoload/vst/s5ui/print.css
Normal file
1
autoload/vst/s5ui/print.css
Normal file
@@ -0,0 +1 @@
|
||||
/* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */
|
||||
9
autoload/vst/s5ui/s5-core.css
Normal file
9
autoload/vst/s5ui/s5-core.css
Normal file
@@ -0,0 +1,9 @@
|
||||
/* Do not edit or override these styles! The system will likely break if you do. */
|
||||
|
||||
div#header, div#footer, div#controls, .slide {position: absolute;}
|
||||
html>body div#header, html>body div#footer,
|
||||
html>body div#controls, html>body .slide {position: fixed;}
|
||||
.handout {display: none;}
|
||||
.layout {display: block;}
|
||||
.slide, .hideme, .incremental {visibility: hidden;}
|
||||
#slide0 {visibility: visible;}
|
||||
3
autoload/vst/s5ui/slides.css
Normal file
3
autoload/vst/s5ui/slides.css
Normal file
@@ -0,0 +1,3 @@
|
||||
@import url(s5-core.css); /* required to make the slide show run at all */
|
||||
@import url(framing.css); /* sets basic placement and size of slide components */
|
||||
@import url(pretty.css); /* stuff that makes the slides look better than blah */
|
||||
552
autoload/vst/s5ui/slides.js
Normal file
552
autoload/vst/s5ui/slides.js
Normal file
@@ -0,0 +1,552 @@
|
||||
// S5 v1.1 slides.js -- released into the Public Domain
|
||||
//
|
||||
// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for information
|
||||
// about all the wonderful and talented contributors to this code!
|
||||
|
||||
var undef;
|
||||
var slideCSS = '';
|
||||
var snum = 0;
|
||||
var smax = 1;
|
||||
var incpos = 0;
|
||||
var number = undef;
|
||||
var s5mode = true;
|
||||
var defaultView = 'slideshow';
|
||||
var controlVis = 'visible';
|
||||
|
||||
var isIE = navigator.appName == 'Microsoft Internet Explorer' ? 1 : 0;
|
||||
var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;
|
||||
var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;
|
||||
|
||||
function hasClass(object, className) {
|
||||
if (!object.className) return false;
|
||||
return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);
|
||||
}
|
||||
|
||||
function hasValue(object, value) {
|
||||
if (!object) return false;
|
||||
return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);
|
||||
}
|
||||
|
||||
function removeClass(object,className) {
|
||||
if (!object) return;
|
||||
object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);
|
||||
}
|
||||
|
||||
function addClass(object,className) {
|
||||
if (!object || hasClass(object, className)) return;
|
||||
if (object.className) {
|
||||
object.className += ' '+className;
|
||||
} else {
|
||||
object.className = className;
|
||||
}
|
||||
}
|
||||
|
||||
function GetElementsWithClassName(elementName,className) {
|
||||
var allElements = document.getElementsByTagName(elementName);
|
||||
var elemColl = new Array();
|
||||
for (var i = 0; i< allElements.length; i++) {
|
||||
if (hasClass(allElements[i], className)) {
|
||||
elemColl[elemColl.length] = allElements[i];
|
||||
}
|
||||
}
|
||||
return elemColl;
|
||||
}
|
||||
|
||||
function isParentOrSelf(element, id) {
|
||||
if (element == null || element.nodeName=='BODY') return false;
|
||||
else if (element.id == id) return true;
|
||||
else return isParentOrSelf(element.parentNode, id);
|
||||
}
|
||||
|
||||
function nodeValue(node) {
|
||||
var result = "";
|
||||
if (node.nodeType == 1) {
|
||||
var children = node.childNodes;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
result += nodeValue(children[i]);
|
||||
}
|
||||
}
|
||||
else if (node.nodeType == 3) {
|
||||
result = node.nodeValue;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
function slideLabel() {
|
||||
var slideColl = GetElementsWithClassName('*','slide');
|
||||
var list = document.getElementById('jumplist');
|
||||
smax = slideColl.length;
|
||||
for (var n = 0; n < smax; n++) {
|
||||
var obj = slideColl[n];
|
||||
|
||||
var did = 'slide' + n.toString();
|
||||
obj.setAttribute('id',did);
|
||||
if (isOp) continue;
|
||||
|
||||
var otext = '';
|
||||
var menu = obj.firstChild;
|
||||
if (!menu) continue; // to cope with empty slides
|
||||
while (menu && menu.nodeType == 3) {
|
||||
menu = menu.nextSibling;
|
||||
}
|
||||
if (!menu) continue; // to cope with slides with only text nodes
|
||||
|
||||
var menunodes = menu.childNodes;
|
||||
for (var o = 0; o < menunodes.length; o++) {
|
||||
otext += nodeValue(menunodes[o]);
|
||||
}
|
||||
list.options[list.length] = new Option(n + ' : ' + otext, n);
|
||||
}
|
||||
}
|
||||
|
||||
function currentSlide() {
|
||||
var cs;
|
||||
if (document.getElementById) {
|
||||
cs = document.getElementById('currentSlide');
|
||||
} else {
|
||||
cs = document.currentSlide;
|
||||
}
|
||||
cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' +
|
||||
'<span id="csSep">\/<\/span> ' +
|
||||
'<span id="csTotal">' + (smax-1) + '<\/span>';
|
||||
if (snum == 0) {
|
||||
cs.style.visibility = 'hidden';
|
||||
} else {
|
||||
cs.style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
|
||||
function go(step) {
|
||||
if (document.getElementById('slideProj').disabled || step == 0) return;
|
||||
var jl = document.getElementById('jumplist');
|
||||
var cid = 'slide' + snum;
|
||||
var ce = document.getElementById(cid);
|
||||
if (incrementals[snum].length > 0) {
|
||||
for (var i = 0; i < incrementals[snum].length; i++) {
|
||||
removeClass(incrementals[snum][i], 'current');
|
||||
removeClass(incrementals[snum][i], 'incremental');
|
||||
}
|
||||
}
|
||||
if (step != 'j') {
|
||||
snum += step;
|
||||
lmax = smax - 1;
|
||||
if (snum > lmax) snum = lmax;
|
||||
if (snum < 0) snum = 0;
|
||||
} else
|
||||
snum = parseInt(jl.value);
|
||||
var nid = 'slide' + snum;
|
||||
var ne = document.getElementById(nid);
|
||||
if (!ne) {
|
||||
ne = document.getElementById('slide0');
|
||||
snum = 0;
|
||||
}
|
||||
if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}
|
||||
if (incrementals[snum].length > 0 && incpos == 0) {
|
||||
for (var i = 0; i < incrementals[snum].length; i++) {
|
||||
if (hasClass(incrementals[snum][i], 'current'))
|
||||
incpos = i + 1;
|
||||
else
|
||||
addClass(incrementals[snum][i], 'incremental');
|
||||
}
|
||||
}
|
||||
if (incrementals[snum].length > 0 && incpos > 0)
|
||||
addClass(incrementals[snum][incpos - 1], 'current');
|
||||
ce.style.visibility = 'hidden';
|
||||
ne.style.visibility = 'visible';
|
||||
jl.selectedIndex = snum;
|
||||
currentSlide();
|
||||
number = 0;
|
||||
}
|
||||
|
||||
function goTo(target) {
|
||||
if (target >= smax || target == snum) return;
|
||||
go(target - snum);
|
||||
}
|
||||
|
||||
function subgo(step) {
|
||||
if (step > 0) {
|
||||
removeClass(incrementals[snum][incpos - 1],'current');
|
||||
removeClass(incrementals[snum][incpos], 'incremental');
|
||||
addClass(incrementals[snum][incpos],'current');
|
||||
incpos++;
|
||||
} else {
|
||||
incpos--;
|
||||
removeClass(incrementals[snum][incpos],'current');
|
||||
addClass(incrementals[snum][incpos], 'incremental');
|
||||
addClass(incrementals[snum][incpos - 1],'current');
|
||||
}
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
var slideColl = GetElementsWithClassName('*','slide');
|
||||
var slides = document.getElementById('slideProj');
|
||||
var outline = document.getElementById('outlineStyle');
|
||||
if (!slides.disabled) {
|
||||
slides.disabled = true;
|
||||
outline.disabled = false;
|
||||
s5mode = false;
|
||||
fontSize('1em');
|
||||
for (var n = 0; n < smax; n++) {
|
||||
var slide = slideColl[n];
|
||||
slide.style.visibility = 'visible';
|
||||
}
|
||||
} else {
|
||||
slides.disabled = false;
|
||||
outline.disabled = true;
|
||||
s5mode = true;
|
||||
fontScale();
|
||||
for (var n = 0; n < smax; n++) {
|
||||
var slide = slideColl[n];
|
||||
slide.style.visibility = 'hidden';
|
||||
}
|
||||
slideColl[snum].style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
|
||||
function showHide(action) {
|
||||
var obj = GetElementsWithClassName('*','hideme')[0];
|
||||
switch (action) {
|
||||
case 's': obj.style.visibility = 'visible'; break;
|
||||
case 'h': obj.style.visibility = 'hidden'; break;
|
||||
case 'k':
|
||||
if (obj.style.visibility != 'visible') {
|
||||
obj.style.visibility = 'visible';
|
||||
} else {
|
||||
obj.style.visibility = 'hidden';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)
|
||||
function keys(key) {
|
||||
if (!key) {
|
||||
key = event;
|
||||
key.which = key.keyCode;
|
||||
}
|
||||
if (key.which == 84) {
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
if (s5mode) {
|
||||
switch (key.which) {
|
||||
case 10: // return
|
||||
case 13: // enter
|
||||
if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
|
||||
if (key.target && isParentOrSelf(key.target, 'controls')) return;
|
||||
if(number != undef) {
|
||||
goTo(number);
|
||||
break;
|
||||
}
|
||||
case 32: // spacebar
|
||||
case 34: // page down
|
||||
case 39: // rightkey
|
||||
case 40: // downkey
|
||||
if(number != undef) {
|
||||
go(number);
|
||||
} else if (!incrementals[snum] || incpos >= incrementals[snum].length) {
|
||||
go(1);
|
||||
} else {
|
||||
subgo(1);
|
||||
}
|
||||
break;
|
||||
case 33: // page up
|
||||
case 37: // leftkey
|
||||
case 38: // upkey
|
||||
if(number != undef) {
|
||||
go(-1 * number);
|
||||
} else if (!incrementals[snum] || incpos <= 0) {
|
||||
go(-1);
|
||||
} else {
|
||||
subgo(-1);
|
||||
}
|
||||
break;
|
||||
case 36: // home
|
||||
goTo(0);
|
||||
break;
|
||||
case 35: // end
|
||||
goTo(smax-1);
|
||||
break;
|
||||
case 67: // c
|
||||
showHide('k');
|
||||
break;
|
||||
}
|
||||
if (key.which < 48 || key.which > 57) {
|
||||
number = undef;
|
||||
} else {
|
||||
if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;
|
||||
if (key.target && isParentOrSelf(key.target, 'controls')) return;
|
||||
number = (((number != undef) ? number : 0) * 10) + (key.which - 48);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function clicker(e) {
|
||||
number = undef;
|
||||
var target;
|
||||
if (window.event) {
|
||||
target = window.event.srcElement;
|
||||
e = window.event;
|
||||
} else target = e.target;
|
||||
if (target.href != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target, 'object')) return true;
|
||||
if (!e.which || e.which == 1) {
|
||||
if (!incrementals[snum] || incpos >= incrementals[snum].length) {
|
||||
go(1);
|
||||
} else {
|
||||
subgo(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function findSlide(hash) {
|
||||
var target = null;
|
||||
var slides = GetElementsWithClassName('*','slide');
|
||||
for (var i = 0; i < slides.length; i++) {
|
||||
var targetSlide = slides[i];
|
||||
if ( (targetSlide.name && targetSlide.name == hash)
|
||||
|| (targetSlide.id && targetSlide.id == hash) ) {
|
||||
target = targetSlide;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while(target != null && target.nodeName != 'BODY') {
|
||||
if (hasClass(target, 'slide')) {
|
||||
return parseInt(target.id.slice(5));
|
||||
}
|
||||
target = target.parentNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function slideJump() {
|
||||
if (window.location.hash == null) return;
|
||||
var sregex = /^#slide(\d+)$/;
|
||||
var matches = sregex.exec(window.location.hash);
|
||||
var dest = null;
|
||||
if (matches != null) {
|
||||
dest = parseInt(matches[1]);
|
||||
} else {
|
||||
dest = findSlide(window.location.hash.slice(1));
|
||||
}
|
||||
if (dest != null)
|
||||
go(dest - snum);
|
||||
}
|
||||
|
||||
function fixLinks() {
|
||||
var thisUri = window.location.href;
|
||||
thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length);
|
||||
var aelements = document.getElementsByTagName('A');
|
||||
for (var i = 0; i < aelements.length; i++) {
|
||||
var a = aelements[i].href;
|
||||
var slideID = a.match('\#slide[0-9]{1,2}');
|
||||
if ((slideID) && (slideID[0].slice(0,1) == '#')) {
|
||||
var dest = findSlide(slideID[0].slice(1));
|
||||
if (dest != null) {
|
||||
if (aelements[i].addEventListener) {
|
||||
aelements[i].addEventListener("click", new Function("e",
|
||||
"if (document.getElementById('slideProj').disabled) return;" +
|
||||
"go("+dest+" - snum); " +
|
||||
"if (e.preventDefault) e.preventDefault();"), true);
|
||||
} else if (aelements[i].attachEvent) {
|
||||
aelements[i].attachEvent("onclick", new Function("",
|
||||
"if (document.getElementById('slideProj').disabled) return;" +
|
||||
"go("+dest+" - snum); " +
|
||||
"event.returnValue = false;"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function externalLinks() {
|
||||
if (!document.getElementsByTagName) return;
|
||||
var anchors = document.getElementsByTagName('a');
|
||||
for (var i=0; i<anchors.length; i++) {
|
||||
var anchor = anchors[i];
|
||||
if (anchor.href && hasValue(anchor.rel, 'external')) {
|
||||
anchor.target = '_blank';
|
||||
addClass(anchor,'external');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createControls() {
|
||||
var controlsDiv = document.getElementById("controls");
|
||||
if (!controlsDiv) return;
|
||||
var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"';
|
||||
var hideDiv, hideList = '';
|
||||
if (controlVis == 'hidden') {
|
||||
hideDiv = hider;
|
||||
} else {
|
||||
hideList = hider;
|
||||
}
|
||||
controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' +
|
||||
'<div id="navLinks">' +
|
||||
'<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>' +
|
||||
'<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>' +
|
||||
'<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>' +
|
||||
'<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' +
|
||||
'<\/div><\/form>';
|
||||
if (controlVis == 'hidden') {
|
||||
var hidden = document.getElementById('navLinks');
|
||||
} else {
|
||||
var hidden = document.getElementById('jumplist');
|
||||
}
|
||||
addClass(hidden,'hideme');
|
||||
}
|
||||
|
||||
function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers
|
||||
if (!s5mode) return false;
|
||||
var vScale = 22; // both yield 32 (after rounding) at 1024x768
|
||||
var hScale = 32; // perhaps should auto-calculate based on theme's declared value?
|
||||
if (window.innerHeight) {
|
||||
var vSize = window.innerHeight;
|
||||
var hSize = window.innerWidth;
|
||||
} else if (document.documentElement.clientHeight) {
|
||||
var vSize = document.documentElement.clientHeight;
|
||||
var hSize = document.documentElement.clientWidth;
|
||||
} else if (document.body.clientHeight) {
|
||||
var vSize = document.body.clientHeight;
|
||||
var hSize = document.body.clientWidth;
|
||||
} else {
|
||||
var vSize = 700; // assuming 1024x768, minus chrome and such
|
||||
var hSize = 1024; // these do not account for kiosk mode or Opera Show
|
||||
}
|
||||
var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale));
|
||||
fontSize(newSize + 'px');
|
||||
if (isGe) { // hack to counter incremental reflow bugs
|
||||
var obj = document.getElementsByTagName('body')[0];
|
||||
obj.style.display = 'none';
|
||||
obj.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
function fontSize(value) {
|
||||
if (!(s5ss = document.getElementById('s5ss'))) {
|
||||
if (!isIE) {
|
||||
document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style'));
|
||||
s5ss.setAttribute('media','screen, projection');
|
||||
s5ss.setAttribute('id','s5ss');
|
||||
} else {
|
||||
document.createStyleSheet();
|
||||
document.s5ss = document.styleSheets[document.styleSheets.length - 1];
|
||||
}
|
||||
}
|
||||
if (!isIE) {
|
||||
while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild);
|
||||
s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}'));
|
||||
} else {
|
||||
document.s5ss.addRule('body','font-size: ' + value + ' !important;');
|
||||
}
|
||||
}
|
||||
|
||||
function notOperaFix() {
|
||||
slideCSS = document.getElementById('slideProj').href;
|
||||
var slides = document.getElementById('slideProj');
|
||||
var outline = document.getElementById('outlineStyle');
|
||||
slides.setAttribute('media','screen');
|
||||
outline.disabled = true;
|
||||
if (isGe) {
|
||||
slides.setAttribute('href','null'); // Gecko fix
|
||||
slides.setAttribute('href',slideCSS); // Gecko fix
|
||||
}
|
||||
if (isIE && document.styleSheets && document.styleSheets[0]) {
|
||||
document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)');
|
||||
document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)');
|
||||
document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)');
|
||||
}
|
||||
}
|
||||
|
||||
function getIncrementals(obj) {
|
||||
var incrementals = new Array();
|
||||
if (!obj)
|
||||
return incrementals;
|
||||
var children = obj.childNodes;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
if (hasClass(child, 'incremental')) {
|
||||
if (child.nodeName == 'OL' || child.nodeName == 'UL') {
|
||||
removeClass(child, 'incremental');
|
||||
for (var j = 0; j < child.childNodes.length; j++) {
|
||||
if (child.childNodes[j].nodeType == 1) {
|
||||
addClass(child.childNodes[j], 'incremental');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
incrementals[incrementals.length] = child;
|
||||
removeClass(child,'incremental');
|
||||
}
|
||||
}
|
||||
if (hasClass(child, 'show-first')) {
|
||||
if (child.nodeName == 'OL' || child.nodeName == 'UL') {
|
||||
removeClass(child, 'show-first');
|
||||
if (child.childNodes[isGe].nodeType == 1) {
|
||||
removeClass(child.childNodes[isGe], 'incremental');
|
||||
}
|
||||
} else {
|
||||
incrementals[incrementals.length] = child;
|
||||
}
|
||||
}
|
||||
incrementals = incrementals.concat(getIncrementals(child));
|
||||
}
|
||||
return incrementals;
|
||||
}
|
||||
|
||||
function createIncrementals() {
|
||||
var incrementals = new Array();
|
||||
for (var i = 0; i < smax; i++) {
|
||||
incrementals[i] = getIncrementals(document.getElementById('slide'+i));
|
||||
}
|
||||
return incrementals;
|
||||
}
|
||||
|
||||
function defaultCheck() {
|
||||
var allMetas = document.getElementsByTagName('meta');
|
||||
for (var i = 0; i< allMetas.length; i++) {
|
||||
if (allMetas[i].name == 'defaultView') {
|
||||
defaultView = allMetas[i].content;
|
||||
}
|
||||
if (allMetas[i].name == 'controlVis') {
|
||||
controlVis = allMetas[i].content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Key trap fix, new function body for trap()
|
||||
function trap(e) {
|
||||
if (!e) {
|
||||
e = event;
|
||||
e.which = e.keyCode;
|
||||
}
|
||||
try {
|
||||
modifierKey = e.ctrlKey || e.altKey || e.metaKey;
|
||||
}
|
||||
catch(e) {
|
||||
modifierKey = false;
|
||||
}
|
||||
return modifierKey || e.which == 0;
|
||||
}
|
||||
|
||||
function startup() {
|
||||
defaultCheck();
|
||||
if (!isOp) createControls();
|
||||
slideLabel();
|
||||
fixLinks();
|
||||
externalLinks();
|
||||
fontScale();
|
||||
if (!isOp) {
|
||||
notOperaFix();
|
||||
incrementals = createIncrementals();
|
||||
slideJump();
|
||||
if (defaultView == 'outline') {
|
||||
toggle();
|
||||
}
|
||||
document.onkeyup = keys;
|
||||
document.onkeypress = trap;
|
||||
document.onclick = clicker;
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = startup;
|
||||
window.onresize = function(){setTimeout('fontScale()', 50);}
|
||||
6151
autoload/vst/vst.vim
Normal file
6151
autoload/vst/vst.vim
Normal file
File diff suppressed because it is too large
Load Diff
215
colors/lettuce.vim
Normal file
215
colors/lettuce.vim
Normal file
@@ -0,0 +1,215 @@
|
||||
" Vim color file
|
||||
" Version: 1.2 2007.08.08
|
||||
" Author: Valyaeff Valentin <hhyperr AT gmail DOT com>
|
||||
" License: GPL
|
||||
"
|
||||
" Copyright 2007 Valyaeff Valentin
|
||||
"
|
||||
" This program is free software: you can redistribute it and/or modify
|
||||
" it under the terms of the GNU General Public License as published by
|
||||
" the Free Software Foundation, either version 3 of the License, or
|
||||
" (at your option) any later version.
|
||||
"
|
||||
" This program is distributed in the hope that it will be useful,
|
||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
" GNU General Public License for more details.
|
||||
"
|
||||
" You should have received a copy of the GNU General Public License
|
||||
" along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set background=dark
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
let g:colors_name="lettuce"
|
||||
|
||||
|
||||
augroup Syntax_extensions
|
||||
au!
|
||||
au Syntax c,cpp,ruby,javascript syn match Operator "[*/%&|!=><^~,.;:?+-]\+" display contains=TOP
|
||||
au Syntax c,cpp syn region cParen matchgroup=Operator transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell
|
||||
au Syntax c,cpp syn region cCppParen matchgroup=Operator transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||
au Syntax c,cpp syn region cBracket matchgroup=Operator transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell
|
||||
au Syntax c,cpp syn region cCppBracket matchgroup=Operator transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
|
||||
au Syntax c,cpp syn region cBlock matchgroup=OperatorCurlyBrackets start="{" end="}" transparent fold
|
||||
au Syntax ruby syn match rubyBlockParameter "\%(\%(\<do\>\|{\)\s*\)\@<=|\s*[( ,a-zA-Z0-9_*)]\+\ze\s*|"hs=s+1 display
|
||||
au Syntax ruby syn region rubyCurlyBlock matchgroup=Operator start="{" end="}" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo fold
|
||||
au Syntax ruby syn region rubyParentheses matchgroup=Operator start="(" end=")" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo
|
||||
au Syntax ruby syn region rubySquareBrackets matchgroup=Operator start="\[" end="\]" contains=ALLBUT,@rubyExtendedStringSpecial,rubyTodo
|
||||
au Syntax javascript syn region javascriptCurlyBrackets matchgroup=Operator start="{" end="}" transparent fold
|
||||
au Syntax javascript syn region javascriptParentheses matchgroup=Operator start="(" end=")" transparent
|
||||
au Syntax javascript syn region javascriptSquareBrackets matchgroup=Operator start="\[" end="\]" transparent
|
||||
augroup END
|
||||
|
||||
|
||||
if !has("gui_running")
|
||||
|
||||
hi rubyGlobalVariable cterm=none ctermfg=64
|
||||
hi rubyPredefinedIdentifier cterm=bold ctermfg=64
|
||||
hi def link rubyStringDelimiter String
|
||||
|
||||
hi Normal cterm=none ctermbg=232 ctermfg=189
|
||||
hi StatusLine cterm=none ctermbg=236 ctermfg=231
|
||||
hi StatusLineNC cterm=none ctermbg=236 ctermfg=103
|
||||
hi User1 cterm=bold ctermbg=236 ctermfg=223
|
||||
hi User2 cterm=none ctermbg=236 ctermfg=240
|
||||
hi VertSplit cterm=none ctermbg=236 ctermfg=103
|
||||
hi TabLine cterm=none ctermbg=236 ctermfg=145
|
||||
hi TabLineFill cterm=none ctermbg=236
|
||||
hi TabLineSel cterm=none ctermbg=240 ctermfg=253
|
||||
hi LineNr cterm=none ctermfg=238
|
||||
hi NonText cterm=bold ctermbg=233 ctermfg=241
|
||||
hi Folded cterm=none ctermbg=234 ctermfg=136
|
||||
hi FoldColumn cterm=none ctermbg=236 ctermfg=103
|
||||
hi SignColumn cterm=none ctermbg=236 ctermfg=103
|
||||
hi CursorColumn cterm=none ctermbg=234
|
||||
hi CursorLine cterm=none ctermbg=234
|
||||
hi IncSearch cterm=bold ctermbg=63 ctermfg=232
|
||||
hi Search cterm=none ctermbg=36 ctermfg=232
|
||||
hi Visual cterm=none ctermbg=24
|
||||
hi WildMenu cterm=bold ctermbg=35 ctermfg=232
|
||||
hi ModeMsg cterm=bold ctermfg=110
|
||||
hi MoreMsg cterm=bold ctermfg=121
|
||||
hi Question cterm=bold ctermfg=121
|
||||
hi ErrorMsg cterm=none ctermbg=88 ctermfg=255
|
||||
hi WarningMsg cterm=none ctermbg=58 ctermfg=255
|
||||
hi SpecialKey cterm=none ctermfg=77
|
||||
hi Title cterm=bold ctermfg=147
|
||||
hi Directory ctermfg=105
|
||||
hi DiffAdd cterm=none ctermbg=18
|
||||
hi DiffChange cterm=none ctermbg=58
|
||||
hi DiffDelete cterm=none ctermbg=52 ctermfg=58
|
||||
hi DiffText cterm=none ctermbg=53
|
||||
hi Pmenu cterm=none ctermbg=17 ctermfg=121
|
||||
hi PmenuSel cterm=none ctermbg=24 ctermfg=121
|
||||
hi PmenuSbar cterm=none ctermbg=19
|
||||
hi PmenuThumb cterm=none ctermbg=37
|
||||
hi MatchParen cterm=bold ctermbg=24
|
||||
hi SpellBad cterm=none ctermbg=88
|
||||
hi SpellCap cterm=none ctermbg=18
|
||||
hi SpellLocal cterm=none ctermbg=30
|
||||
hi SpellRare cterm=none ctermbg=90
|
||||
|
||||
hi Comment cterm=none ctermfg=138
|
||||
hi Constant cterm=none ctermfg=215
|
||||
hi String cterm=none ctermbg=235 ctermfg=215
|
||||
hi Character cterm=none ctermbg=235 ctermfg=215
|
||||
hi Number cterm=none ctermfg=34
|
||||
hi Float cterm=none ctermfg=41
|
||||
hi Identifier cterm=none ctermfg=186
|
||||
hi Function cterm=none ctermfg=210
|
||||
hi Statement cterm=bold ctermfg=63
|
||||
hi Exception cterm=bold ctermfg=99
|
||||
hi Operator cterm=none ctermfg=75
|
||||
hi Label cterm=none ctermfg=63
|
||||
hi PreProc cterm=bold ctermfg=36
|
||||
hi Type cterm=bold ctermfg=71
|
||||
hi Special cterm=none ctermbg=235 ctermfg=87
|
||||
hi Underlined cterm=underline ctermfg=227
|
||||
hi Ignore cterm=bold ctermfg=235
|
||||
hi Error cterm=bold ctermbg=52 ctermfg=231
|
||||
hi Todo cterm=bold ctermbg=143 ctermfg=16
|
||||
|
||||
hi OperatorCurlyBrackets cterm=bold ctermfg=75
|
||||
|
||||
" highlight modes
|
||||
autocmd InsertEnter * hi StatusLine ctermbg=52
|
||||
autocmd InsertEnter * hi User1 ctermbg=52
|
||||
autocmd InsertEnter * hi User2 ctermbg=52
|
||||
autocmd InsertLeave * hi User2 ctermbg=236
|
||||
autocmd InsertLeave * hi User1 ctermbg=236
|
||||
autocmd InsertLeave * hi StatusLine ctermbg=236
|
||||
autocmd CmdwinEnter * hi StatusLine ctermbg=22
|
||||
autocmd CmdwinEnter * hi User1 ctermbg=22
|
||||
autocmd CmdwinEnter * hi User2 ctermbg=22
|
||||
autocmd CmdwinLeave * hi User2 ctermbg=236
|
||||
autocmd CmdwinLeave * hi User1 ctermbg=236
|
||||
autocmd CmdwinLeave * hi StatusLine ctermbg=236
|
||||
|
||||
else
|
||||
|
||||
hi rubyGlobalVariable gui=none guifg=#5f8700
|
||||
hi rubyPredefinedIdentifier gui=bold guifg=#5f8700
|
||||
hi def link rubyStringDelimiter String
|
||||
|
||||
hi Normal gui=none guibg=#080808 guifg=#dfdfff
|
||||
hi StatusLine gui=none guibg=#303030 guifg=#ffffff
|
||||
hi StatusLineNC gui=none guibg=#303030 guifg=#8787af
|
||||
hi User1 gui=bold guibg=#303030 guifg=#ffdfaf
|
||||
hi User2 gui=none guibg=#303030 guifg=#585858
|
||||
hi VertSplit gui=none guibg=#303030 guifg=#8787af
|
||||
hi TabLine gui=none guibg=#303030 guifg=#afafaf
|
||||
hi TabLineFill gui=none guibg=#303030
|
||||
hi TabLineSel gui=none guibg=#585858 guifg=#dadada
|
||||
hi LineNr gui=none guifg=#444444
|
||||
hi NonText gui=bold guibg=#121212 guifg=#606060
|
||||
hi Folded gui=none guibg=#1c1c1c guifg=#af8700
|
||||
hi FoldColumn gui=none guibg=#303030 guifg=#8787af
|
||||
hi SignColumn gui=none guibg=#303030 guifg=#8787af
|
||||
hi CursorColumn gui=none guibg=#1c1c1c
|
||||
hi CursorLine gui=none guibg=#1c1c1c
|
||||
hi IncSearch gui=bold guibg=#5f5fff guifg=#080808
|
||||
hi Search gui=none guibg=#00af87 guifg=#080808
|
||||
hi Visual gui=none guibg=#005f87
|
||||
hi WildMenu gui=bold guibg=#00af5f guifg=#080808
|
||||
hi ModeMsg gui=bold guifg=#87afdf
|
||||
hi MoreMsg gui=bold guifg=#87ffaf
|
||||
hi Question gui=bold guifg=#87ffaf
|
||||
hi ErrorMsg gui=none guibg=#870000 guifg=#eeeeee
|
||||
hi WarningMsg gui=none guibg=#5f5f00 guifg=#eeeeee
|
||||
hi SpecialKey gui=none guifg=#5fdf5f
|
||||
hi Title gui=bold guifg=#afafff
|
||||
hi Directory guifg=#8787ff
|
||||
hi DiffAdd gui=none guibg=#000087
|
||||
hi DiffChange gui=none guibg=#5f5f00
|
||||
hi DiffDelete gui=none guibg=#5f0000 guifg=#5f5f00
|
||||
hi DiffText gui=none guibg=#5f005f
|
||||
hi Pmenu gui=none guibg=#00005f guifg=#87ffaf
|
||||
hi PmenuSel gui=none guibg=#005f87 guifg=#87ffaf
|
||||
hi PmenuSbar gui=none guibg=#0000af
|
||||
hi PmenuThumb gui=none guibg=#00afaf
|
||||
hi MatchParen gui=bold guibg=#005f87
|
||||
hi SpellBad gui=none guibg=#870000
|
||||
hi SpellCap gui=none guibg=#000087
|
||||
hi SpellLocal gui=none guibg=#008787
|
||||
hi SpellRare gui=none guibg=#870087
|
||||
|
||||
hi Comment gui=none guifg=#af8787
|
||||
hi Constant gui=none guifg=#ffaf5f
|
||||
hi String gui=none guibg=#262626 guifg=#ffaf5f
|
||||
hi Character gui=none guibg=#262626 guifg=#ffaf5f
|
||||
hi Number gui=none guifg=#00af00
|
||||
hi Float gui=none guifg=#00df5f
|
||||
hi Identifier gui=none guifg=#dfdf87
|
||||
hi Function gui=none guifg=#ff8787
|
||||
hi Statement gui=bold guifg=#5f5fff
|
||||
hi Exception gui=bold guifg=#875fff
|
||||
hi Operator gui=none guifg=#5fafff
|
||||
hi Label gui=none guifg=#5f5fff
|
||||
hi PreProc gui=bold guifg=#00af87
|
||||
hi Type gui=bold guifg=#5faf5f
|
||||
hi Special gui=none guibg=#262626 guifg=#5fffff
|
||||
hi Underlined gui=underline guifg=#ffff5f
|
||||
hi Ignore gui=bold guifg=#262626
|
||||
hi Error gui=bold guibg=#5f0000 guifg=#ffffff
|
||||
hi Todo gui=bold guibg=#afaf5f guifg=#000000
|
||||
|
||||
hi OperatorCurlyBrackets gui=bold guifg=#5fafff
|
||||
|
||||
" highlight modes
|
||||
autocmd InsertEnter * hi StatusLine guibg=#5f0000
|
||||
autocmd InsertEnter * hi User1 guibg=#5f0000
|
||||
autocmd InsertEnter * hi User2 guibg=#5f0000
|
||||
autocmd InsertLeave * hi User2 guibg=#303030
|
||||
autocmd InsertLeave * hi User1 guibg=#303030
|
||||
autocmd InsertLeave * hi StatusLine guibg=#303030
|
||||
autocmd CmdwinEnter * hi StatusLine guibg=#005f00
|
||||
autocmd CmdwinEnter * hi User1 guibg=#005f00
|
||||
autocmd CmdwinEnter * hi User2 guibg=#005f00
|
||||
autocmd CmdwinLeave * hi User2 guibg=#303030
|
||||
autocmd CmdwinLeave * hi User1 guibg=#303030
|
||||
autocmd CmdwinLeave * hi StatusLine guibg=#303030
|
||||
|
||||
end
|
||||
346
colors/lucius.vim
Normal file
346
colors/lucius.vim
Normal file
@@ -0,0 +1,346 @@
|
||||
" Vim color file
|
||||
" Maintainer: Jonathan Filip <jfilip1024@gmail.com>
|
||||
" Last Modified: Wed Oct 21, 2009 11:39AM
|
||||
" Version: 3.1
|
||||
"
|
||||
" GUI / 256 color terminal
|
||||
"
|
||||
" I started out trying to combine my favorite parts of other schemes and ended
|
||||
" up with this (oceandeep, moria, peaksea, wombat, zenburn).
|
||||
"
|
||||
" This file also tries to have descriptive comments for each higlighting group
|
||||
" so it is easy to understand what each part does.
|
||||
|
||||
|
||||
set background=dark
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
let colors_name="lucius"
|
||||
|
||||
" Some other colors to save
|
||||
" blue: 3eb8e5
|
||||
" green: 92d400
|
||||
" c green: d5f876, cae682
|
||||
" new blue: 002D62
|
||||
" new gray: CCCCCC
|
||||
|
||||
|
||||
" Base color
|
||||
" ----------
|
||||
hi Normal guifg=#e0e0e0 guibg=#202020
|
||||
hi Normal ctermfg=253 ctermbg=235
|
||||
|
||||
|
||||
" Comment Group
|
||||
" -------------
|
||||
" any comment
|
||||
hi Comment guifg=#606060 gui=none
|
||||
hi Comment ctermfg=240 cterm=none
|
||||
|
||||
|
||||
" Constant Group
|
||||
" --------------
|
||||
" any constant
|
||||
hi Constant guifg=#8cd0d3 gui=none
|
||||
hi Constant ctermfg=116 cterm=none
|
||||
" strings
|
||||
hi String guifg=#80c0d9 gui=none
|
||||
hi String ctermfg=110 cterm=none
|
||||
" character constant
|
||||
hi Character guifg=#80c0d9 gui=none
|
||||
hi Character ctermfg=110 cterm=none
|
||||
" numbers decimal/hex
|
||||
hi Number guifg=#8cd0d3 gui=none
|
||||
hi Number ctermfg=116 cterm=none
|
||||
" true, false
|
||||
hi Boolean guifg=#8cd0d3 gui=none
|
||||
hi Boolean ctermfg=116 cterm=none
|
||||
" float
|
||||
hi Float guifg=#8cd0d3 gui=none
|
||||
hi Float ctermfg=116 cterm=none
|
||||
|
||||
|
||||
" Identifier Group
|
||||
" ----------------
|
||||
" any variable name
|
||||
hi Identifier guifg=#efaf7f gui=none
|
||||
hi Identifier ctermfg=216 cterm=none
|
||||
" function, method, class
|
||||
hi Function guifg=#efaf7f gui=none
|
||||
hi Function ctermfg=216 cterm=none
|
||||
|
||||
|
||||
" Statement Group
|
||||
" ---------------
|
||||
" any statement
|
||||
hi Statement guifg=#b3d38c gui=none
|
||||
hi Statement ctermfg=150 cterm=none
|
||||
" if, then, else
|
||||
hi Conditional guifg=#b3d38c gui=none
|
||||
hi Conditional ctermfg=150 cterm=none
|
||||
" try, catch, throw, raise
|
||||
hi Exception guifg=#b3d38c gui=none
|
||||
hi Exception ctermfg=150 cterm=none
|
||||
" for, while, do
|
||||
hi Repeat guifg=#b3d38c gui=none
|
||||
hi Repeat ctermfg=150 cterm=none
|
||||
" case, default
|
||||
hi Label guifg=#b3d38c gui=none
|
||||
hi Label ctermfg=150 cterm=none
|
||||
" sizeof, +, *
|
||||
hi Operator guifg=#b3d38c gui=none
|
||||
hi Operator ctermfg=150 cterm=none
|
||||
" any other keyword
|
||||
hi Keyword guifg=#b3d38c gui=none
|
||||
hi Keyword ctermfg=150 cterm=none
|
||||
|
||||
|
||||
" Preprocessor Group
|
||||
" ------------------
|
||||
" generic preprocessor
|
||||
hi PreProc guifg=#f0dfaf gui=none
|
||||
hi PreProc ctermfg=223 cterm=none
|
||||
" #include
|
||||
hi Include guifg=#f0dfaf gui=none
|
||||
hi Include ctermfg=223 cterm=none
|
||||
" #define
|
||||
hi Define guifg=#f0dfaf gui=none
|
||||
hi Define ctermfg=223 cterm=none
|
||||
" same as define
|
||||
hi Macro guifg=#f0dfaf gui=none
|
||||
hi Macro ctermfg=223 cterm=none
|
||||
" #if, #else, #endif
|
||||
hi PreCondit guifg=#f0dfaf gui=none
|
||||
hi PreCondit ctermfg=223 cterm=none
|
||||
|
||||
|
||||
" Type Group
|
||||
" ----------
|
||||
" int, long, char
|
||||
hi Type guifg=#93d6a9 gui=none
|
||||
hi Type ctermfg=115 cterm=none
|
||||
" static, register, volative
|
||||
hi StorageClass guifg=#93d6a9 gui=none
|
||||
hi StorageClass ctermfg=115 cterm=none
|
||||
" struct, union, enum
|
||||
hi Structure guifg=#93d6a9 gui=none
|
||||
hi Structure ctermfg=115 cterm=none
|
||||
" typedef
|
||||
hi Typedef guifg=#93d6a9 gui=none
|
||||
hi Typedef ctermfg=115 cterm=none
|
||||
|
||||
|
||||
" Special Group
|
||||
" -------------
|
||||
" any special symbol
|
||||
hi Special guifg=#cca3b3 gui=none
|
||||
hi Special ctermfg=181 cterm=none
|
||||
" special character in a constant
|
||||
hi SpecialChar guifg=#cca3b3 gui=none
|
||||
hi SpecialChar ctermfg=181 cterm=none
|
||||
" things you can CTRL-]
|
||||
hi Tag guifg=#cca3b3 gui=none
|
||||
hi Tag ctermfg=181 cterm=none
|
||||
" character that needs attention
|
||||
hi Delimiter guifg=#cca3b3 gui=none
|
||||
hi Delimiter ctermfg=181 cterm=none
|
||||
" special things inside a comment
|
||||
hi SpecialComment guifg=#cca3b3 gui=none
|
||||
hi SpecialComment ctermfg=181 cterm=none
|
||||
" debugging statements
|
||||
hi Debug guifg=#cca3b3 guibg=NONE gui=none
|
||||
hi Debug ctermfg=181 ctermbg=NONE cterm=none
|
||||
|
||||
|
||||
" Underlined Group
|
||||
" ----------------
|
||||
" text that stands out, html links
|
||||
hi Underlined guifg=fg gui=underline
|
||||
hi Underlined ctermfg=fg cterm=underline
|
||||
|
||||
|
||||
" Ignore Group
|
||||
" ------------
|
||||
" left blank, hidden
|
||||
hi Ignore guifg=bg
|
||||
hi Ignore ctermfg=bg
|
||||
|
||||
|
||||
" Error Group
|
||||
" -----------
|
||||
" any erroneous construct
|
||||
hi Error guifg=#e37170 guibg=#432323 gui=none
|
||||
hi Error ctermfg=167 ctermbg=52 cterm=none
|
||||
|
||||
|
||||
" Todo Group
|
||||
" ----------
|
||||
" todo, fixme, note, xxx
|
||||
hi Todo guifg=#efef8f guibg=NONE gui=underline
|
||||
hi Todo ctermfg=228 ctermbg=NONE cterm=underline
|
||||
|
||||
|
||||
" Spelling
|
||||
" --------
|
||||
" word not recognized
|
||||
hi SpellBad guisp=#ee0000 gui=undercurl
|
||||
hi SpellBad ctermbg=9 cterm=undercurl
|
||||
" word not capitalized
|
||||
hi SpellCap guisp=#eeee00 gui=undercurl
|
||||
hi SpellCap ctermbg=12 cterm=undercurl
|
||||
" rare word
|
||||
hi SpellRare guisp=#ffa500 gui=undercurl
|
||||
hi SpellRare ctermbg=13 cterm=undercurl
|
||||
" wrong spelling for selected region
|
||||
hi SpellLocal guisp=#ffa500 gui=undercurl
|
||||
hi SpellLocal ctermbg=14 cterm=undercurl
|
||||
|
||||
|
||||
" Cursor
|
||||
" ------
|
||||
" character under the cursor
|
||||
hi Cursor guifg=bg guibg=#a3e3ed
|
||||
hi Cursor ctermfg=bg ctermbg=153
|
||||
" like cursor, but used when in IME mode
|
||||
hi CursorIM guifg=bg guibg=#96cdcd
|
||||
hi CursorIM ctermfg=bg ctermbg=116
|
||||
" cursor column
|
||||
hi CursorColumn guifg=NONE guibg=#202438 gui=none
|
||||
hi CursorColumn ctermfg=NONE ctermbg=236 cterm=none
|
||||
" cursor line/row
|
||||
hi CursorLine gui=NONE guibg=#202438 gui=none
|
||||
hi CursorLine cterm=NONE ctermbg=236 cterm=none
|
||||
|
||||
|
||||
" Misc
|
||||
" ----
|
||||
" directory names and other special names in listings
|
||||
hi Directory guifg=#c0e0b0 gui=none
|
||||
hi Directory ctermfg=151 cterm=none
|
||||
" error messages on the command line
|
||||
hi ErrorMsg guifg=#ee0000 guibg=NONE gui=none
|
||||
hi ErrorMsg ctermfg=196 ctermbg=NONE cterm=none
|
||||
" column separating vertically split windows
|
||||
hi VertSplit guifg=#777777 guibg=#363946 gui=none
|
||||
hi VertSplit ctermfg=242 ctermbg=237 cterm=none
|
||||
" columns where signs are displayed (used in IDEs)
|
||||
hi SignColumn guifg=#9fafaf guibg=#181818 gui=none
|
||||
hi SignColumn ctermfg=145 ctermbg=233 cterm=none
|
||||
" line numbers
|
||||
hi LineNr guifg=#818698 guibg=#363946
|
||||
hi LineNr ctermfg=102 ctermbg=237
|
||||
" match parenthesis, brackets
|
||||
hi MatchParen guifg=#00ff00 guibg=NONE gui=bold
|
||||
hi MatchParen ctermfg=46 ctermbg=NONE cterm=bold
|
||||
" the 'more' prompt when output takes more than one line
|
||||
hi MoreMsg guifg=#2e8b57 gui=none
|
||||
hi MoreMsg ctermfg=29 cterm=none
|
||||
" text showing what mode you are in
|
||||
hi ModeMsg guifg=#76d5f8 guibg=NONE gui=none
|
||||
hi ModeMsg ctermfg=117 ctermbg=NONE cterm=none
|
||||
" the '~' and '@' and showbreak, '>' double wide char doesn't fit on line
|
||||
hi NonText guifg=#404040 gui=none
|
||||
hi NonText ctermfg=235 cterm=none
|
||||
" the hit-enter prompt (show more output) and yes/no questions
|
||||
hi Question guifg=fg gui=none
|
||||
hi Question ctermfg=fg cterm=none
|
||||
" meta and special keys used with map, unprintable characters
|
||||
hi SpecialKey guifg=#404040
|
||||
hi SpecialKey ctermfg=237
|
||||
" titles for output from :set all, :autocmd, etc
|
||||
hi Title guifg=#62bdde gui=none
|
||||
hi Title ctermfg=74 cterm=none
|
||||
"hi Title guifg=#5ec8e5 gui=none
|
||||
" warning messages
|
||||
hi WarningMsg guifg=#e5786d gui=none
|
||||
hi WarningMsg ctermfg=173 cterm=none
|
||||
" current match in the wildmenu completion
|
||||
hi WildMenu guifg=#cae682 guibg=#363946 gui=bold,underline
|
||||
hi WildMenu ctermfg=16 ctermbg=186 cterm=bold
|
||||
|
||||
|
||||
" Diff
|
||||
" ----
|
||||
" added line
|
||||
hi DiffAdd guifg=#80a090 guibg=#313c36 gui=none
|
||||
hi DiffAdd ctermfg=108 ctermbg=22 cterm=none
|
||||
" changed line
|
||||
hi DiffChange guifg=NONE guibg=#4a343a gui=none
|
||||
hi DiffChange ctermfg=fg ctermbg=52 cterm=none
|
||||
" deleted line
|
||||
hi DiffDelete guifg=#6c6661 guibg=#3c3631 gui=none
|
||||
hi DiffDelete ctermfg=59 ctermbg=58 cterm=none
|
||||
" changed text within line
|
||||
hi DiffText guifg=#f05060 guibg=#4a343a gui=bold
|
||||
hi DiffText ctermfg=203 ctermbg=52 cterm=bold
|
||||
|
||||
|
||||
" Folds
|
||||
" -----
|
||||
" line used for closed folds
|
||||
hi Folded guifg=#91d6f8 guibg=#363946 gui=none
|
||||
hi Folded ctermfg=117 ctermbg=238 cterm=none
|
||||
" column on side used to indicated open and closed folds
|
||||
hi FoldColumn guifg=#91d6f8 guibg=#363946 gui=none
|
||||
hi FoldColumn ctermfg=117 ctermbg=238 cterm=none
|
||||
|
||||
|
||||
" Search
|
||||
" ------
|
||||
" highlight incremental search text; also highlight text replaced with :s///c
|
||||
hi IncSearch guifg=#66ffff gui=reverse
|
||||
hi IncSearch ctermfg=87 cterm=reverse
|
||||
" hlsearch (last search pattern), also used for quickfix
|
||||
hi Search guibg=#ffaa33 gui=none
|
||||
hi Search ctermbg=214 cterm=none
|
||||
|
||||
|
||||
" Popup Menu
|
||||
" ----------
|
||||
" normal item in popup
|
||||
hi Pmenu guifg=#e0e0e0 guibg=#303840 gui=none
|
||||
hi Pmenu ctermfg=253 ctermbg=233 cterm=none
|
||||
" selected item in popup
|
||||
hi PmenuSel guifg=#cae682 guibg=#505860 gui=none
|
||||
hi PmenuSel ctermfg=186 ctermbg=237 cterm=none
|
||||
" scrollbar in popup
|
||||
hi PMenuSbar guibg=#505860 gui=none
|
||||
hi PMenuSbar ctermbg=59 cterm=none
|
||||
" thumb of the scrollbar in the popup
|
||||
hi PMenuThumb guibg=#808890 gui=none
|
||||
hi PMenuThumb ctermbg=102 cterm=none
|
||||
|
||||
|
||||
" Status Line
|
||||
" -----------
|
||||
" status line for current window
|
||||
hi StatusLine guifg=#e0e0e0 guibg=#363946 gui=bold
|
||||
hi StatusLine ctermfg=254 ctermbg=237 cterm=bold
|
||||
" status line for non-current windows
|
||||
hi StatusLineNC guifg=#767986 guibg=#363946 gui=none
|
||||
hi StatusLineNC ctermfg=244 ctermbg=237 cterm=none
|
||||
|
||||
|
||||
" Tab Lines
|
||||
" ---------
|
||||
" tab pages line, not active tab page label
|
||||
hi TabLine guifg=#b6bf98 guibg=#363946 gui=none
|
||||
hi TabLine ctermfg=244 ctermbg=236 cterm=none
|
||||
" tab pages line, where there are no labels
|
||||
hi TabLineFill guifg=#cfcfaf guibg=#363946 gui=none
|
||||
hi TabLineFill ctermfg=187 ctermbg=236 cterm=none
|
||||
" tab pages line, active tab page label
|
||||
hi TabLineSel guifg=#efefef guibg=#414658 gui=bold
|
||||
hi TabLineSel ctermfg=254 ctermbg=236 cterm=bold
|
||||
|
||||
|
||||
" Visual
|
||||
" ------
|
||||
" visual mode selection
|
||||
hi Visual guifg=NONE guibg=#364458
|
||||
hi Visual ctermfg=NONE ctermbg=24
|
||||
" visual mode selection when vim is not owning the selection (x11 only)
|
||||
hi VisualNOS guifg=fg gui=underline
|
||||
hi VisualNOS ctermfg=fg cterm=underline
|
||||
267
colors/tolerable256.vim
Normal file
267
colors/tolerable256.vim
Normal file
@@ -0,0 +1,267 @@
|
||||
" Vim color file
|
||||
" Maintainer: Ian Langworth
|
||||
" Last Change: 2004 Dec 24
|
||||
" Email: <langworth.com>
|
||||
|
||||
" Color settings inspired by BBEdit for Mac OS, plus I liked
|
||||
" the low-contrast comments from the 'oceandeep' colorscheme
|
||||
"
|
||||
" gryf: Nice colorscheme for printing in white, or to generate html in dark on
|
||||
" bright. Added functions for converting it into terminal 256xterm codes.
|
||||
|
||||
set background=light
|
||||
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
if !has("gui_running") && &t_Co != 88 && &t_Co != 256
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:colors_name="tolerable"
|
||||
|
||||
" functions {{{
|
||||
" returns an approximate grey index for the given grey level
|
||||
fun! <SID>grey_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 23
|
||||
return 0
|
||||
elseif a:x < 69
|
||||
return 1
|
||||
elseif a:x < 103
|
||||
return 2
|
||||
elseif a:x < 127
|
||||
return 3
|
||||
elseif a:x < 150
|
||||
return 4
|
||||
elseif a:x < 173
|
||||
return 5
|
||||
elseif a:x < 196
|
||||
return 6
|
||||
elseif a:x < 219
|
||||
return 7
|
||||
elseif a:x < 243
|
||||
return 8
|
||||
else
|
||||
return 9
|
||||
endif
|
||||
else
|
||||
if a:x < 14
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 8) / 10
|
||||
let l:m = (a:x - 8) % 10
|
||||
if l:m < 5
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual grey level represented by the grey index
|
||||
fun! <SID>grey_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 46
|
||||
elseif a:n == 2
|
||||
return 92
|
||||
elseif a:n == 3
|
||||
return 115
|
||||
elseif a:n == 4
|
||||
return 139
|
||||
elseif a:n == 5
|
||||
return 162
|
||||
elseif a:n == 6
|
||||
return 185
|
||||
elseif a:n == 7
|
||||
return 208
|
||||
elseif a:n == 8
|
||||
return 231
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 8 + (a:n * 10)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given grey index
|
||||
fun! <SID>grey_color(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 9
|
||||
return 79
|
||||
else
|
||||
return 79 + a:n
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 25
|
||||
return 231
|
||||
else
|
||||
return 231 + a:n
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns an approximate color index for the given color level
|
||||
fun! <SID>rgb_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 69
|
||||
return 0
|
||||
elseif a:x < 172
|
||||
return 1
|
||||
elseif a:x < 230
|
||||
return 2
|
||||
else
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
if a:x < 75
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 55) / 40
|
||||
let l:m = (a:x - 55) % 40
|
||||
if l:m < 20
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual color level for the given color index
|
||||
fun! <SID>rgb_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 139
|
||||
elseif a:n == 2
|
||||
return 205
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 55 + (a:n * 40)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given R/G/B color indices
|
||||
fun! <SID>rgb_color(x, y, z)
|
||||
if &t_Co == 88
|
||||
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
||||
else
|
||||
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the given R/G/B color levels
|
||||
fun! <SID>color(r, g, b)
|
||||
" get the closest grey
|
||||
let l:gx = <SID>grey_number(a:r)
|
||||
let l:gy = <SID>grey_number(a:g)
|
||||
let l:gz = <SID>grey_number(a:b)
|
||||
|
||||
" get the closest color
|
||||
let l:x = <SID>rgb_number(a:r)
|
||||
let l:y = <SID>rgb_number(a:g)
|
||||
let l:z = <SID>rgb_number(a:b)
|
||||
|
||||
if l:gx == l:gy && l:gy == l:gz
|
||||
" there are two possibilities
|
||||
let l:dgr = <SID>grey_level(l:gx) - a:r
|
||||
let l:dgg = <SID>grey_level(l:gy) - a:g
|
||||
let l:dgb = <SID>grey_level(l:gz) - a:b
|
||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||
let l:dr = <SID>rgb_level(l:gx) - a:r
|
||||
let l:dg = <SID>rgb_level(l:gy) - a:g
|
||||
let l:db = <SID>rgb_level(l:gz) - a:b
|
||||
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
||||
if l:dgrey < l:drgb
|
||||
" use the grey
|
||||
return <SID>grey_color(l:gx)
|
||||
else
|
||||
" use the color
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
else
|
||||
" only one possibility
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the 'rrggbb' hex string
|
||||
fun! <SID>rgb(rgb)
|
||||
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
|
||||
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
|
||||
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
|
||||
return <SID>color(l:r, l:g, l:b)
|
||||
endfun
|
||||
|
||||
" sets the highlighting for the given group
|
||||
fun! <SID>X(group, fg, bg, attr)
|
||||
if a:fg != ""
|
||||
exec "hi ".a:group." guifg=#".a:fg." ctermfg=".<SID>rgb(a:fg)
|
||||
endif
|
||||
if a:bg != ""
|
||||
exec "hi ".a:group." guibg=#".a:bg." ctermbg=".<SID>rgb(a:bg)
|
||||
endif
|
||||
if a:attr != ""
|
||||
if a:attr == 'italic'
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=none"
|
||||
else
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=".a:attr
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
" }}}
|
||||
|
||||
call <SID>X("Cursor", "006400", "", "none")
|
||||
call <SID>X("CursorLine", "", "eeeeee", "none")
|
||||
call <SID>X("CursorColumn", "", "eeeeee", "none")
|
||||
|
||||
call <SID>X("Normal", "000000", "ffffff", "none")
|
||||
call <SID>X("NonText", "ffae1b", "", "none")
|
||||
|
||||
call <SID>X("Statement", "0000ff", "", "none")
|
||||
call <SID>X("Special", "ff0000", "", "none")
|
||||
call <SID>X("Constant", "8b0000", "", "none")
|
||||
call <SID>X("Comment", "555555", "", "none")
|
||||
call <SID>X("Preproc", "008b8b", "", "none")
|
||||
call <SID>X("Type", "8b008b", "", "none")
|
||||
call <SID>X("Identifier", "006400", "", "none")
|
||||
call <SID>X("Title", "000000", "", "none")
|
||||
|
||||
call <SID>X("StatusLine", "ffffff", "333333", "none")
|
||||
call <SID>X("StatusLineNC", "ffffff", "333333", "none")
|
||||
call <SID>X("VertSplit", "ffffff", "333333", "none")
|
||||
|
||||
call <SID>X("Visual", "000000", "00ff00", "none")
|
||||
call <SID>X("Search", "", "ffff00", "none")
|
||||
call <SID>X("Directory", "00008b", "", "none")
|
||||
call <SID>X("WarningMsg", "ff0000", "", "none")
|
||||
call <SID>X("Error", "ffffff", "ff0000", "none")
|
||||
call <SID>X("Todo", "000000", "ffff00", "none")
|
||||
|
||||
call <SID>X("MoreMsg", "", "", "none")
|
||||
call <SID>X("ModeMsg", "", "", "none")
|
||||
|
||||
" vim:set ts=4 sw=4 noet fdm=marker:
|
||||
51
colors/wombat.vim
Normal file
51
colors/wombat.vim
Normal file
@@ -0,0 +1,51 @@
|
||||
" Maintainer: Lars H. Nielsen (dengmao@gmail.com)
|
||||
" Last Change: January 22 2007
|
||||
|
||||
set background=dark
|
||||
|
||||
hi clear
|
||||
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "wombat"
|
||||
|
||||
|
||||
" Vim >= 7.0 specific colors
|
||||
if version >= 700
|
||||
hi CursorLine guibg=#2d2d2d
|
||||
hi CursorColumn guibg=#2d2d2d
|
||||
hi MatchParen guifg=#f6f3e8 guibg=#857b6f gui=bold
|
||||
hi Pmenu guifg=#f6f3e8 guibg=#444444
|
||||
hi PmenuSel guifg=#000000 guibg=#cae682
|
||||
endif
|
||||
|
||||
" General colors
|
||||
hi Cursor guifg=NONE guibg=#656565 gui=none
|
||||
hi Normal guifg=#f6f3e8 guibg=#242424 gui=none
|
||||
hi NonText guifg=#808080 guibg=#303030 gui=none
|
||||
hi LineNr guifg=#857b6f guibg=#000000 gui=none
|
||||
hi StatusLine guifg=#f6f3e8 guibg=#444444 gui=italic
|
||||
hi StatusLineNC guifg=#857b6f guibg=#444444 gui=none
|
||||
hi VertSplit guifg=#444444 guibg=#444444 gui=none
|
||||
hi Folded guibg=#384048 guifg=#a0a8b0 gui=none
|
||||
hi Title guifg=#f6f3e8 guibg=NONE gui=bold
|
||||
hi Visual guifg=#f6f3e8 guibg=#444444 gui=none
|
||||
hi SpecialKey guifg=#808080 guibg=#343434 gui=none
|
||||
|
||||
" Syntax highlighting
|
||||
hi Comment guifg=#99968b gui=italic
|
||||
hi Todo guifg=#8f8f8f gui=italic
|
||||
hi Constant guifg=#e5786d gui=none
|
||||
hi String guifg=#95e454 gui=italic
|
||||
hi Identifier guifg=#cae682 gui=none
|
||||
hi Function guifg=#cae682 gui=none
|
||||
hi Type guifg=#cae682 gui=none
|
||||
hi Statement guifg=#8ac6f2 gui=none
|
||||
hi Keyword guifg=#8ac6f2 gui=none
|
||||
hi PreProc guifg=#e5786d gui=none
|
||||
hi Number guifg=#e5786d gui=none
|
||||
hi Special guifg=#e7f6da gui=none
|
||||
|
||||
|
||||
359
colors/wombat256.vim
Normal file
359
colors/wombat256.vim
Normal file
@@ -0,0 +1,359 @@
|
||||
" Vim color file
|
||||
" Maintainer: David Liang (bmdavll at gmail dot com)
|
||||
" Last Change: November 28 2008
|
||||
"
|
||||
" wombat256.vim - a modified version of Wombat by Lars Nielsen that also
|
||||
" works on xterms with 88 or 256 colors. The algorithm for approximating the
|
||||
" GUI colors with the xterm palette is from desert256.vim by Henry So Jr.
|
||||
|
||||
set background=dark
|
||||
|
||||
if version > 580
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
endif
|
||||
|
||||
let g:colors_name = "wombat256"
|
||||
|
||||
if !has("gui_running") && &t_Co != 88 && &t_Co != 256
|
||||
finish
|
||||
endif
|
||||
|
||||
" functions {{{
|
||||
" returns an approximate grey index for the given grey level
|
||||
fun <SID>grey_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 23
|
||||
return 0
|
||||
elseif a:x < 69
|
||||
return 1
|
||||
elseif a:x < 103
|
||||
return 2
|
||||
elseif a:x < 127
|
||||
return 3
|
||||
elseif a:x < 150
|
||||
return 4
|
||||
elseif a:x < 173
|
||||
return 5
|
||||
elseif a:x < 196
|
||||
return 6
|
||||
elseif a:x < 219
|
||||
return 7
|
||||
elseif a:x < 243
|
||||
return 8
|
||||
else
|
||||
return 9
|
||||
endif
|
||||
else
|
||||
if a:x < 14
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 8) / 10
|
||||
let l:m = (a:x - 8) % 10
|
||||
if l:m < 5
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual grey level represented by the grey index
|
||||
fun <SID>grey_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 46
|
||||
elseif a:n == 2
|
||||
return 92
|
||||
elseif a:n == 3
|
||||
return 115
|
||||
elseif a:n == 4
|
||||
return 139
|
||||
elseif a:n == 5
|
||||
return 162
|
||||
elseif a:n == 6
|
||||
return 185
|
||||
elseif a:n == 7
|
||||
return 208
|
||||
elseif a:n == 8
|
||||
return 231
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 8 + (a:n * 10)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given grey index
|
||||
fun <SID>grey_color(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 9
|
||||
return 79
|
||||
else
|
||||
return 79 + a:n
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 25
|
||||
return 231
|
||||
else
|
||||
return 231 + a:n
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns an approximate color index for the given color level
|
||||
fun <SID>rgb_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 69
|
||||
return 0
|
||||
elseif a:x < 172
|
||||
return 1
|
||||
elseif a:x < 230
|
||||
return 2
|
||||
else
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
if a:x < 75
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 55) / 40
|
||||
let l:m = (a:x - 55) % 40
|
||||
if l:m < 20
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual color level for the given color index
|
||||
fun <SID>rgb_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 139
|
||||
elseif a:n == 2
|
||||
return 205
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 55 + (a:n * 40)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given R/G/B color indices
|
||||
fun <SID>rgb_color(x, y, z)
|
||||
if &t_Co == 88
|
||||
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
||||
else
|
||||
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the given R/G/B color levels
|
||||
fun <SID>color(r, g, b)
|
||||
" get the closest grey
|
||||
let l:gx = <SID>grey_number(a:r)
|
||||
let l:gy = <SID>grey_number(a:g)
|
||||
let l:gz = <SID>grey_number(a:b)
|
||||
|
||||
" get the closest color
|
||||
let l:x = <SID>rgb_number(a:r)
|
||||
let l:y = <SID>rgb_number(a:g)
|
||||
let l:z = <SID>rgb_number(a:b)
|
||||
|
||||
if l:gx == l:gy && l:gy == l:gz
|
||||
" there are two possibilities
|
||||
let l:dgr = <SID>grey_level(l:gx) - a:r
|
||||
let l:dgg = <SID>grey_level(l:gy) - a:g
|
||||
let l:dgb = <SID>grey_level(l:gz) - a:b
|
||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||
let l:dr = <SID>rgb_level(l:gx) - a:r
|
||||
let l:dg = <SID>rgb_level(l:gy) - a:g
|
||||
let l:db = <SID>rgb_level(l:gz) - a:b
|
||||
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
||||
if l:dgrey < l:drgb
|
||||
" use the grey
|
||||
return <SID>grey_color(l:gx)
|
||||
else
|
||||
" use the color
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
else
|
||||
" only one possibility
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the 'rrggbb' hex string
|
||||
fun <SID>rgb(rgb)
|
||||
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
|
||||
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
|
||||
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
|
||||
return <SID>color(l:r, l:g, l:b)
|
||||
endfun
|
||||
|
||||
" sets the highlighting for the given group
|
||||
fun <SID>X(group, fg, bg, attr)
|
||||
if a:fg != ""
|
||||
exec "hi ".a:group." guifg=#".a:fg." ctermfg=".<SID>rgb(a:fg)
|
||||
endif
|
||||
if a:bg != ""
|
||||
exec "hi ".a:group." guibg=#".a:bg." ctermbg=".<SID>rgb(a:bg)
|
||||
endif
|
||||
if a:attr != ""
|
||||
if a:attr == 'italic'
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=none"
|
||||
else
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=".a:attr
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
" }}}
|
||||
|
||||
" italic only in gui and only where font is not fixed-misc!
|
||||
|
||||
if has("gui_running") && &guifont !~ "Fixed"
|
||||
let s:italic = "italic"
|
||||
else
|
||||
let s:italic = "none"
|
||||
endif
|
||||
|
||||
|
||||
" X(fg, bg, attr)
|
||||
call <SID>X("Normal", "dddddd", "242424", "none")
|
||||
call <SID>X("NonText", "4c4c36", "", "none")
|
||||
call <SID>X("Cursor", "222222", "ecee90", "none")
|
||||
call <SID>X("CursorLine", "", "32322e", "none")
|
||||
call <SID>X("CursorColumn", "", "2d2d2d", "")
|
||||
"CursorIM
|
||||
"Question
|
||||
"IncSearch
|
||||
call <SID>X("Search", "444444", "af87d7", "")
|
||||
call <SID>X("MatchParen", "ecee90", "857b6f", "bold")
|
||||
call <SID>X("SpecialKey", "6c6c6c", "2d2d2d", "none")
|
||||
call <SID>X("Visual", "ecee90", "597418", "none")
|
||||
call <SID>X("LineNr", "857b6f", "121212", "none")
|
||||
call <SID>X("SignColumn", "", "121212", "none")
|
||||
call <SID>X("Folded", "a0a8b0", "404048", "none")
|
||||
call <SID>X("Title", "f6f3e8", "", "bold")
|
||||
call <SID>X("VertSplit", "444444", "444444", "none")
|
||||
call <SID>X("StatusLine", "f6f3e8", "444444", s:italic)
|
||||
call <SID>X("StatusLineNC", "857b6f", "444444", "none")
|
||||
"Scrollbar
|
||||
"Tooltip
|
||||
"Menu
|
||||
"WildMenu
|
||||
call <SID>X("Pmenu", "f6f3e8", "444444", "")
|
||||
call <SID>X("PmenuSel", "121212", "caeb82", "")
|
||||
call <SID>X("WarningMsg", "ff0000", "", "")
|
||||
"ErrorMsg
|
||||
"ModeMsg
|
||||
"MoreMsg
|
||||
"Directory
|
||||
"DiffAdd
|
||||
"DiffChange
|
||||
"DiffDelete
|
||||
"DiffText
|
||||
|
||||
" syntax highlighting
|
||||
call <SID>X("Number", "e5786d", "", "none")
|
||||
call <SID>X("Constant", "e5786d", "", "none")
|
||||
call <SID>X("String", "95e454", "", s:italic)
|
||||
call <SID>X("Comment", "c0bc6c", "", s:italic)
|
||||
call <SID>X("Identifier", "caeb82", "", "none")
|
||||
call <SID>X("Keyword", "87afff", "", "none")
|
||||
call <SID>X("Statement", "87afff", "", "none")
|
||||
call <SID>X("Function", "caeb82", "", "none")
|
||||
call <SID>X("PreProc", "e5786d", "", "none")
|
||||
call <SID>X("Type", "caeb82", "", "none")
|
||||
call <SID>X("Special", "ffdead", "", "none")
|
||||
call <SID>X("Todo", "857b6f", "", s:italic)
|
||||
"Underlined
|
||||
"Error
|
||||
"Ignore
|
||||
hi! link VisualNOS Visual
|
||||
hi! link FoldColumn Folded
|
||||
hi! link TabLineSel StatusLine
|
||||
hi! link TabLineFill StatusLineNC
|
||||
hi! link TabLine StatusLineNC
|
||||
call <SID>X("TabLineSel", "f6f3e8", "", "none")
|
||||
|
||||
" Python Highlighting for python.vim
|
||||
"call <SID>X("pythonCoding", "ff0086", "", "none")
|
||||
"call <SID>X("pythonRun", "ff0086", "", "none")
|
||||
"call <SID>X("pythonBuiltinObji", "2b6ba2", "", "bold")
|
||||
"call <SID>X("pythonBuiltinFunc", "2b6ba2", "", "bold")
|
||||
"call <SID>X("pythonException", "ee0000", "", "bold")
|
||||
"call <SID>X("pythonExClass", "66cd66", "", "bold")
|
||||
"call <SID>X("pythonSpaceError", "270000", "", "none")
|
||||
"call <SID>X("pythonDocTest", "2f5f49", "", "none")
|
||||
"call <SID>X("pythonDocTest2", "3b916a", "", "none")
|
||||
"call <SID>X("pythonFunction", "ee0000", "", "bold")
|
||||
"call <SID>X("pythonClass", "ff0086", "", "bold")
|
||||
|
||||
call <SID>X("ShowMarksHLl", "ab8042", "121212", "bold")
|
||||
"call <SID>X("ShowMarksHLu", "ab4242", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLu", "aaab42", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLo", "42ab47", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLm", "aaab42", "121212", "bold")
|
||||
|
||||
" Diff colors
|
||||
"call <SID>X("DiffAdd", "", "1d1d50", "bold")
|
||||
"call <SID>X("DiffText", "", "9f1e1e", "bold")
|
||||
"call <SID>X("DiffDelete", "", "1d5050", "bold")
|
||||
"call <SID>X("DiffChange", "", "4c1c4c", "bold")
|
||||
|
||||
call <SID>X("DiffAdd", "", "646464", "bold")
|
||||
call <SID>X("DiffText", "", "bf5f00", "bold")
|
||||
call <SID>X("DiffDelete", "343434", "101010", "bold")
|
||||
call <SID>X("DiffChange", "", "424242", "bold")
|
||||
|
||||
" DiffAdd xxx term=bold ctermbg=4
|
||||
" DiffChange xxx term=bold ctermbg=5
|
||||
" DiffDelete xxx term=bold ctermfg=12 ctermbg=6
|
||||
" DiffText xxx term=reverse cterm=bold ctermbg=9
|
||||
|
||||
if ! has('gui_running')
|
||||
" spell, make it underline, and less bright colors. only for terminal
|
||||
call <SID>X("SpellBad", "", "880000", "underline")
|
||||
call <SID>X("SpellCap", "", "000088", "underline")
|
||||
call <SID>X("SpellRare", "", "880088", "underline")
|
||||
call <SID>X("SpellLocal", "", "008888", "underline")
|
||||
endif
|
||||
|
||||
" delete functions {{{
|
||||
delf <SID>X
|
||||
delf <SID>rgb
|
||||
delf <SID>color
|
||||
delf <SID>rgb_color
|
||||
delf <SID>rgb_level
|
||||
delf <SID>rgb_number
|
||||
delf <SID>grey_color
|
||||
delf <SID>grey_level
|
||||
delf <SID>grey_number
|
||||
" }}}
|
||||
|
||||
" vim:set ts=4 sw=4 noet fdm=marker:
|
||||
348
colors/wombat256_.vim
Normal file
348
colors/wombat256_.vim
Normal file
@@ -0,0 +1,348 @@
|
||||
" Vim color file
|
||||
" Maintainer: David Liang (bmdavll at gmail dot com)
|
||||
" Last Change: November 28 2008
|
||||
"
|
||||
" wombat256.vim - a modified version of Wombat by Lars Nielsen that also
|
||||
" works on xterms with 88 or 256 colors. The algorithm for approximating the
|
||||
" GUI colors with the xterm palette is from desert256.vim by Henry So Jr.
|
||||
|
||||
set background=dark
|
||||
|
||||
if version > 580
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
endif
|
||||
|
||||
let g:colors_name = "wombat256"
|
||||
|
||||
if !has("gui_running") && &t_Co != 88 && &t_Co != 256
|
||||
finish
|
||||
endif
|
||||
|
||||
" functions {{{
|
||||
" returns an approximate grey index for the given grey level
|
||||
fun <SID>grey_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 23
|
||||
return 0
|
||||
elseif a:x < 69
|
||||
return 1
|
||||
elseif a:x < 103
|
||||
return 2
|
||||
elseif a:x < 127
|
||||
return 3
|
||||
elseif a:x < 150
|
||||
return 4
|
||||
elseif a:x < 173
|
||||
return 5
|
||||
elseif a:x < 196
|
||||
return 6
|
||||
elseif a:x < 219
|
||||
return 7
|
||||
elseif a:x < 243
|
||||
return 8
|
||||
else
|
||||
return 9
|
||||
endif
|
||||
else
|
||||
if a:x < 14
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 8) / 10
|
||||
let l:m = (a:x - 8) % 10
|
||||
if l:m < 5
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual grey level represented by the grey index
|
||||
fun <SID>grey_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 46
|
||||
elseif a:n == 2
|
||||
return 92
|
||||
elseif a:n == 3
|
||||
return 115
|
||||
elseif a:n == 4
|
||||
return 139
|
||||
elseif a:n == 5
|
||||
return 162
|
||||
elseif a:n == 6
|
||||
return 185
|
||||
elseif a:n == 7
|
||||
return 208
|
||||
elseif a:n == 8
|
||||
return 231
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 8 + (a:n * 10)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given grey index
|
||||
fun <SID>grey_color(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 9
|
||||
return 79
|
||||
else
|
||||
return 79 + a:n
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 25
|
||||
return 231
|
||||
else
|
||||
return 231 + a:n
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns an approximate color index for the given color level
|
||||
fun <SID>rgb_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 69
|
||||
return 0
|
||||
elseif a:x < 172
|
||||
return 1
|
||||
elseif a:x < 230
|
||||
return 2
|
||||
else
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
if a:x < 75
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 55) / 40
|
||||
let l:m = (a:x - 55) % 40
|
||||
if l:m < 20
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual color level for the given color index
|
||||
fun <SID>rgb_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 139
|
||||
elseif a:n == 2
|
||||
return 205
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 55 + (a:n * 40)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given R/G/B color indices
|
||||
fun <SID>rgb_color(x, y, z)
|
||||
if &t_Co == 88
|
||||
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
||||
else
|
||||
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the given R/G/B color levels
|
||||
fun <SID>color(r, g, b)
|
||||
" get the closest grey
|
||||
let l:gx = <SID>grey_number(a:r)
|
||||
let l:gy = <SID>grey_number(a:g)
|
||||
let l:gz = <SID>grey_number(a:b)
|
||||
|
||||
" get the closest color
|
||||
let l:x = <SID>rgb_number(a:r)
|
||||
let l:y = <SID>rgb_number(a:g)
|
||||
let l:z = <SID>rgb_number(a:b)
|
||||
|
||||
if l:gx == l:gy && l:gy == l:gz
|
||||
" there are two possibilities
|
||||
let l:dgr = <SID>grey_level(l:gx) - a:r
|
||||
let l:dgg = <SID>grey_level(l:gy) - a:g
|
||||
let l:dgb = <SID>grey_level(l:gz) - a:b
|
||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||
let l:dr = <SID>rgb_level(l:gx) - a:r
|
||||
let l:dg = <SID>rgb_level(l:gy) - a:g
|
||||
let l:db = <SID>rgb_level(l:gz) - a:b
|
||||
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
||||
if l:dgrey < l:drgb
|
||||
" use the grey
|
||||
return <SID>grey_color(l:gx)
|
||||
else
|
||||
" use the color
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
else
|
||||
" only one possibility
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the 'rrggbb' hex string
|
||||
fun <SID>rgb(rgb)
|
||||
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
|
||||
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
|
||||
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
|
||||
return <SID>color(l:r, l:g, l:b)
|
||||
endfun
|
||||
|
||||
" sets the highlighting for the given group
|
||||
fun <SID>X(group, fg, bg, attr)
|
||||
if a:fg != ""
|
||||
exec "hi ".a:group." guifg=#".a:fg." ctermfg=".<SID>rgb(a:fg)
|
||||
endif
|
||||
if a:bg != ""
|
||||
exec "hi ".a:group." guibg=#".a:bg." ctermbg=".<SID>rgb(a:bg)
|
||||
endif
|
||||
if a:attr != ""
|
||||
if a:attr == 'italic'
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=none"
|
||||
else
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=".a:attr
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
" }}}
|
||||
|
||||
" X(fg, bg, attr)
|
||||
call <SID>X("Normal", "dddddd", "242424", "none")
|
||||
call <SID>X("NonText", "4c4c36", "", "none")
|
||||
call <SID>X("Cursor", "222222", "ecee90", "none")
|
||||
call <SID>X("CursorLine", "", "32322e", "none")
|
||||
call <SID>X("CursorColumn", "", "2d2d2d", "")
|
||||
"CursorIM
|
||||
"Question
|
||||
"IncSearch
|
||||
call <SID>X("Search", "444444", "af87d7", "")
|
||||
call <SID>X("MatchParen", "ecee90", "857b6f", "bold")
|
||||
call <SID>X("SpecialKey", "6c6c6c", "2d2d2d", "none")
|
||||
call <SID>X("Visual", "ecee90", "597418", "none")
|
||||
call <SID>X("LineNr", "857b6f", "121212", "none")
|
||||
call <SID>X("SignColumn", "", "121212", "none")
|
||||
call <SID>X("Folded", "a0a8b0", "404048", "none")
|
||||
call <SID>X("Title", "f6f3e8", "", "bold")
|
||||
call <SID>X("VertSplit", "444444", "444444", "none")
|
||||
call <SID>X("StatusLine", "f6f3e8", "444444", "italic")
|
||||
call <SID>X("StatusLineNC", "857b6f", "444444", "none")
|
||||
"Scrollbar
|
||||
"Tooltip
|
||||
"Menu
|
||||
"WildMenu
|
||||
call <SID>X("Pmenu", "f6f3e8", "444444", "")
|
||||
call <SID>X("PmenuSel", "121212", "caeb82", "")
|
||||
call <SID>X("WarningMsg", "ff0000", "", "")
|
||||
"ErrorMsg
|
||||
"ModeMsg
|
||||
"MoreMsg
|
||||
"Directory
|
||||
"DiffAdd
|
||||
"DiffChange
|
||||
"DiffDelete
|
||||
"DiffText
|
||||
|
||||
" syntax highlighting
|
||||
call <SID>X("Number", "e5786d", "", "none")
|
||||
call <SID>X("Constant", "e5786d", "", "none")
|
||||
call <SID>X("String", "95e454", "", "italic")
|
||||
call <SID>X("Comment", "c0bc6c", "", "italic")
|
||||
call <SID>X("Identifier", "caeb82", "", "none")
|
||||
call <SID>X("Keyword", "87afff", "", "none")
|
||||
call <SID>X("Statement", "87afff", "", "none")
|
||||
call <SID>X("Function", "caeb82", "", "none")
|
||||
call <SID>X("PreProc", "e5786d", "", "none")
|
||||
call <SID>X("Type", "caeb82", "", "none")
|
||||
call <SID>X("Special", "ffdead", "", "none")
|
||||
call <SID>X("Todo", "857b6f", "", "italic")
|
||||
"Underlined
|
||||
"Error
|
||||
"Ignore
|
||||
hi! link VisualNOS Visual
|
||||
hi! link FoldColumn Folded
|
||||
hi! link TabLineSel StatusLine
|
||||
hi! link TabLineFill StatusLineNC
|
||||
hi! link TabLine StatusLineNC
|
||||
call <SID>X("TabLineSel", "f6f3e8", "", "none")
|
||||
|
||||
" Python Highlighting for python.vim
|
||||
"call <SID>X("pythonCoding", "ff0086", "", "none")
|
||||
"call <SID>X("pythonRun", "ff0086", "", "none")
|
||||
"call <SID>X("pythonBuiltinObji", "2b6ba2", "", "bold")
|
||||
"call <SID>X("pythonBuiltinFunc", "2b6ba2", "", "bold")
|
||||
"call <SID>X("pythonException", "ee0000", "", "bold")
|
||||
"call <SID>X("pythonExClass", "66cd66", "", "bold")
|
||||
"call <SID>X("pythonSpaceError", "270000", "", "none")
|
||||
"call <SID>X("pythonDocTest", "2f5f49", "", "none")
|
||||
"call <SID>X("pythonDocTest2", "3b916a", "", "none")
|
||||
"call <SID>X("pythonFunction", "ee0000", "", "bold")
|
||||
"call <SID>X("pythonClass", "ff0086", "", "bold")
|
||||
|
||||
call <SID>X("ShowMarksHLl", "ab8042", "121212", "bold")
|
||||
"call <SID>X("ShowMarksHLu", "ab4242", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLu", "aaab42", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLo", "42ab47", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLm", "aaab42", "121212", "bold")
|
||||
|
||||
" Diff colors
|
||||
"call <SID>X("DiffAdd", "", "1d1d50", "bold")
|
||||
"call <SID>X("DiffText", "", "9f1e1e", "bold")
|
||||
"call <SID>X("DiffDelete", "", "1d5050", "bold")
|
||||
"call <SID>X("DiffChange", "", "4c1c4c", "bold")
|
||||
|
||||
call <SID>X("DiffAdd", "", "646464", "bold")
|
||||
call <SID>X("DiffText", "", "bf5f00", "bold")
|
||||
call <SID>X("DiffDelete", "343434", "101010", "bold")
|
||||
call <SID>X("DiffChange", "", "424242", "bold")
|
||||
|
||||
" DiffAdd xxx term=bold ctermbg=4
|
||||
" DiffChange xxx term=bold ctermbg=5
|
||||
" DiffDelete xxx term=bold ctermfg=12 ctermbg=6
|
||||
" DiffText xxx term=reverse cterm=bold ctermbg=9
|
||||
|
||||
" spell, make it underline, and less bright colors
|
||||
call <SID>X("SpellBad", "", "880000", "underline")
|
||||
call <SID>X("SpellCap", "", "000088", "underline")
|
||||
call <SID>X("SpellRare", "", "880088", "underline")
|
||||
call <SID>X("SpellLocal", "", "008888", "underline")
|
||||
|
||||
" delete functions {{{
|
||||
delf <SID>X
|
||||
delf <SID>rgb
|
||||
delf <SID>color
|
||||
delf <SID>rgb_color
|
||||
delf <SID>rgb_level
|
||||
delf <SID>rgb_number
|
||||
delf <SID>grey_color
|
||||
delf <SID>grey_level
|
||||
delf <SID>grey_number
|
||||
" }}}
|
||||
|
||||
" vim:set ts=4 sw=4 noet fdm=marker:
|
||||
359
colors/wombat256grf.vim
Normal file
359
colors/wombat256grf.vim
Normal file
@@ -0,0 +1,359 @@
|
||||
" Vim color file
|
||||
" Maintainer: David Liang (bmdavll at gmail dot com)
|
||||
" Last Change: November 28 2008
|
||||
"
|
||||
" wombat256.vim - a modified version of Wombat by Lars Nielsen that also
|
||||
" works on xterms with 88 or 256 colors. The algorithm for approximating the
|
||||
" GUI colors with the xterm palette is from desert256.vim by Henry So Jr.
|
||||
|
||||
set background=dark
|
||||
|
||||
if version > 580
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
endif
|
||||
|
||||
let g:colors_name = "wombat256"
|
||||
|
||||
if !has("gui_running") && &t_Co != 88 && &t_Co != 256
|
||||
finish
|
||||
endif
|
||||
|
||||
" functions {{{
|
||||
" returns an approximate grey index for the given grey level
|
||||
fun <SID>grey_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 23
|
||||
return 0
|
||||
elseif a:x < 69
|
||||
return 1
|
||||
elseif a:x < 103
|
||||
return 2
|
||||
elseif a:x < 127
|
||||
return 3
|
||||
elseif a:x < 150
|
||||
return 4
|
||||
elseif a:x < 173
|
||||
return 5
|
||||
elseif a:x < 196
|
||||
return 6
|
||||
elseif a:x < 219
|
||||
return 7
|
||||
elseif a:x < 243
|
||||
return 8
|
||||
else
|
||||
return 9
|
||||
endif
|
||||
else
|
||||
if a:x < 14
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 8) / 10
|
||||
let l:m = (a:x - 8) % 10
|
||||
if l:m < 5
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual grey level represented by the grey index
|
||||
fun <SID>grey_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 46
|
||||
elseif a:n == 2
|
||||
return 92
|
||||
elseif a:n == 3
|
||||
return 115
|
||||
elseif a:n == 4
|
||||
return 139
|
||||
elseif a:n == 5
|
||||
return 162
|
||||
elseif a:n == 6
|
||||
return 185
|
||||
elseif a:n == 7
|
||||
return 208
|
||||
elseif a:n == 8
|
||||
return 231
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 8 + (a:n * 10)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given grey index
|
||||
fun <SID>grey_color(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 9
|
||||
return 79
|
||||
else
|
||||
return 79 + a:n
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 16
|
||||
elseif a:n == 25
|
||||
return 231
|
||||
else
|
||||
return 231 + a:n
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns an approximate color index for the given color level
|
||||
fun <SID>rgb_number(x)
|
||||
if &t_Co == 88
|
||||
if a:x < 69
|
||||
return 0
|
||||
elseif a:x < 172
|
||||
return 1
|
||||
elseif a:x < 230
|
||||
return 2
|
||||
else
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
if a:x < 75
|
||||
return 0
|
||||
else
|
||||
let l:n = (a:x - 55) / 40
|
||||
let l:m = (a:x - 55) % 40
|
||||
if l:m < 20
|
||||
return l:n
|
||||
else
|
||||
return l:n + 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the actual color level for the given color index
|
||||
fun <SID>rgb_level(n)
|
||||
if &t_Co == 88
|
||||
if a:n == 0
|
||||
return 0
|
||||
elseif a:n == 1
|
||||
return 139
|
||||
elseif a:n == 2
|
||||
return 205
|
||||
else
|
||||
return 255
|
||||
endif
|
||||
else
|
||||
if a:n == 0
|
||||
return 0
|
||||
else
|
||||
return 55 + (a:n * 40)
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index for the given R/G/B color indices
|
||||
fun <SID>rgb_color(x, y, z)
|
||||
if &t_Co == 88
|
||||
return 16 + (a:x * 16) + (a:y * 4) + a:z
|
||||
else
|
||||
return 16 + (a:x * 36) + (a:y * 6) + a:z
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the given R/G/B color levels
|
||||
fun <SID>color(r, g, b)
|
||||
" get the closest grey
|
||||
let l:gx = <SID>grey_number(a:r)
|
||||
let l:gy = <SID>grey_number(a:g)
|
||||
let l:gz = <SID>grey_number(a:b)
|
||||
|
||||
" get the closest color
|
||||
let l:x = <SID>rgb_number(a:r)
|
||||
let l:y = <SID>rgb_number(a:g)
|
||||
let l:z = <SID>rgb_number(a:b)
|
||||
|
||||
if l:gx == l:gy && l:gy == l:gz
|
||||
" there are two possibilities
|
||||
let l:dgr = <SID>grey_level(l:gx) - a:r
|
||||
let l:dgg = <SID>grey_level(l:gy) - a:g
|
||||
let l:dgb = <SID>grey_level(l:gz) - a:b
|
||||
let l:dgrey = (l:dgr * l:dgr) + (l:dgg * l:dgg) + (l:dgb * l:dgb)
|
||||
let l:dr = <SID>rgb_level(l:gx) - a:r
|
||||
let l:dg = <SID>rgb_level(l:gy) - a:g
|
||||
let l:db = <SID>rgb_level(l:gz) - a:b
|
||||
let l:drgb = (l:dr * l:dr) + (l:dg * l:dg) + (l:db * l:db)
|
||||
if l:dgrey < l:drgb
|
||||
" use the grey
|
||||
return <SID>grey_color(l:gx)
|
||||
else
|
||||
" use the color
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
else
|
||||
" only one possibility
|
||||
return <SID>rgb_color(l:x, l:y, l:z)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" returns the palette index to approximate the 'rrggbb' hex string
|
||||
fun <SID>rgb(rgb)
|
||||
let l:r = ("0x" . strpart(a:rgb, 0, 2)) + 0
|
||||
let l:g = ("0x" . strpart(a:rgb, 2, 2)) + 0
|
||||
let l:b = ("0x" . strpart(a:rgb, 4, 2)) + 0
|
||||
return <SID>color(l:r, l:g, l:b)
|
||||
endfun
|
||||
|
||||
" sets the highlighting for the given group
|
||||
fun <SID>X(group, fg, bg, attr)
|
||||
if a:fg != ""
|
||||
exec "hi ".a:group." guifg=#".a:fg." ctermfg=".<SID>rgb(a:fg)
|
||||
endif
|
||||
if a:bg != ""
|
||||
exec "hi ".a:group." guibg=#".a:bg." ctermbg=".<SID>rgb(a:bg)
|
||||
endif
|
||||
if a:attr != ""
|
||||
if a:attr == 'italic'
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=none"
|
||||
else
|
||||
exec "hi ".a:group." gui=".a:attr." cterm=".a:attr
|
||||
endif
|
||||
endif
|
||||
endfun
|
||||
" }}}
|
||||
|
||||
" italic only in gui and only where font is not fixed-misc!
|
||||
|
||||
if has("gui_running") && &guifont !~ "Fixed"
|
||||
let s:italic = "italic"
|
||||
else
|
||||
let s:italic = "none"
|
||||
endif
|
||||
|
||||
|
||||
" X(fg, bg, attr)
|
||||
call <SID>X("Normal", "dddddd", "242424", "none")
|
||||
call <SID>X("NonText", "4c4c36", "", "none")
|
||||
call <SID>X("Cursor", "222222", "ecee90", "none")
|
||||
call <SID>X("CursorLine", "", "32322e", "none")
|
||||
call <SID>X("CursorColumn", "", "2d2d2d", "")
|
||||
"CursorIM
|
||||
"Question
|
||||
"IncSearch
|
||||
call <SID>X("Search", "444444", "af87d7", "")
|
||||
call <SID>X("MatchParen", "ecee90", "857b6f", "bold")
|
||||
call <SID>X("SpecialKey", "6c6c6c", "2d2d2d", "none")
|
||||
call <SID>X("Visual", "ecee90", "597418", "none")
|
||||
call <SID>X("LineNr", "857b6f", "121212", "none")
|
||||
call <SID>X("SignColumn", "", "121212", "none")
|
||||
call <SID>X("Folded", "a0a8b0", "404048", "none")
|
||||
call <SID>X("Title", "f6f3e8", "", "bold")
|
||||
call <SID>X("VertSplit", "444444", "444444", "none")
|
||||
call <SID>X("StatusLine", "f6f3e8", "444444", s:italic)
|
||||
call <SID>X("StatusLineNC", "857b6f", "444444", "none")
|
||||
"Scrollbar
|
||||
"Tooltip
|
||||
"Menu
|
||||
"WildMenu
|
||||
call <SID>X("Pmenu", "f6f3e8", "444444", "")
|
||||
call <SID>X("PmenuSel", "121212", "caeb82", "")
|
||||
call <SID>X("WarningMsg", "ff0000", "", "")
|
||||
"ErrorMsg
|
||||
"ModeMsg
|
||||
"MoreMsg
|
||||
"Directory
|
||||
"DiffAdd
|
||||
"DiffChange
|
||||
"DiffDelete
|
||||
"DiffText
|
||||
|
||||
" syntax highlighting
|
||||
call <SID>X("Number", "e5786d", "", "none")
|
||||
call <SID>X("Constant", "e5786d", "", "none")
|
||||
call <SID>X("String", "95e454", "", s:italic)
|
||||
call <SID>X("Comment", "c0bc6c", "", s:italic)
|
||||
call <SID>X("Identifier", "caeb82", "", "none")
|
||||
call <SID>X("Keyword", "87afff", "", "none")
|
||||
call <SID>X("Statement", "87afff", "", "none")
|
||||
call <SID>X("Function", "caeb82", "", "none")
|
||||
call <SID>X("PreProc", "e5786d", "", "none")
|
||||
call <SID>X("Type", "caeb82", "", "none")
|
||||
call <SID>X("Special", "ffdead", "", "none")
|
||||
call <SID>X("Todo", "857b6f", "", s:italic)
|
||||
"Underlined
|
||||
"Error
|
||||
"Ignore
|
||||
hi! link VisualNOS Visual
|
||||
hi! link FoldColumn Folded
|
||||
hi! link TabLineSel StatusLine
|
||||
hi! link TabLineFill StatusLineNC
|
||||
hi! link TabLine StatusLineNC
|
||||
call <SID>X("TabLineSel", "f6f3e8", "", "none")
|
||||
|
||||
" Python Highlighting for python.vim
|
||||
"call <SID>X("pythonCoding", "ff0086", "", "none")
|
||||
"call <SID>X("pythonRun", "ff0086", "", "none")
|
||||
"call <SID>X("pythonBuiltinObji", "2b6ba2", "", "bold")
|
||||
"call <SID>X("pythonBuiltinFunc", "2b6ba2", "", "bold")
|
||||
"call <SID>X("pythonException", "ee0000", "", "bold")
|
||||
"call <SID>X("pythonExClass", "66cd66", "", "bold")
|
||||
"call <SID>X("pythonSpaceError", "270000", "", "none")
|
||||
"call <SID>X("pythonDocTest", "2f5f49", "", "none")
|
||||
"call <SID>X("pythonDocTest2", "3b916a", "", "none")
|
||||
"call <SID>X("pythonFunction", "ee0000", "", "bold")
|
||||
"call <SID>X("pythonClass", "ff0086", "", "bold")
|
||||
|
||||
call <SID>X("ShowMarksHLl", "ab8042", "121212", "bold")
|
||||
"call <SID>X("ShowMarksHLu", "ab4242", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLu", "aaab42", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLo", "42ab47", "121212", "bold")
|
||||
call <SID>X("ShowMarksHLm", "aaab42", "121212", "bold")
|
||||
|
||||
" Diff colors
|
||||
"call <SID>X("DiffAdd", "", "1d1d50", "bold")
|
||||
"call <SID>X("DiffText", "", "9f1e1e", "bold")
|
||||
"call <SID>X("DiffDelete", "", "1d5050", "bold")
|
||||
"call <SID>X("DiffChange", "", "4c1c4c", "bold")
|
||||
|
||||
call <SID>X("DiffAdd", "", "646464", "bold")
|
||||
call <SID>X("DiffText", "", "bf5f00", "bold")
|
||||
call <SID>X("DiffDelete", "343434", "101010", "bold")
|
||||
call <SID>X("DiffChange", "", "424242", "bold")
|
||||
|
||||
" DiffAdd xxx term=bold ctermbg=4
|
||||
" DiffChange xxx term=bold ctermbg=5
|
||||
" DiffDelete xxx term=bold ctermfg=12 ctermbg=6
|
||||
" DiffText xxx term=reverse cterm=bold ctermbg=9
|
||||
|
||||
if ! has('gui_running')
|
||||
" spell, make it underline, and less bright colors. only for terminal
|
||||
call <SID>X("SpellBad", "", "880000", "underline")
|
||||
call <SID>X("SpellCap", "", "000088", "underline")
|
||||
call <SID>X("SpellRare", "", "880088", "underline")
|
||||
call <SID>X("SpellLocal", "", "008888", "underline")
|
||||
endif
|
||||
|
||||
" delete functions {{{
|
||||
delf <SID>X
|
||||
delf <SID>rgb
|
||||
delf <SID>color
|
||||
delf <SID>rgb_color
|
||||
delf <SID>rgb_level
|
||||
delf <SID>rgb_number
|
||||
delf <SID>grey_color
|
||||
delf <SID>grey_level
|
||||
delf <SID>grey_number
|
||||
" }}}
|
||||
|
||||
" vim:set ts=4 sw=4 noet fdm=marker:
|
||||
14
compiler/rubber.vim
Normal file
14
compiler/rubber.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
" Vim compiler file
|
||||
" Compiler: pdf creator out of LaTeX files using rubber
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
endif
|
||||
|
||||
let current_compiler = "rubber"
|
||||
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
CompilerSet makeprg=rubber\ -d\ %
|
||||
"CompilerSet efm=%f:%l:\ [%t]%m,%f:%l:%m
|
||||
|
||||
1222
doc/NERD_tree.txt
Normal file
1222
doc/NERD_tree.txt
Normal file
File diff suppressed because it is too large
Load Diff
561
doc/delimitMate.txt
Normal file
561
doc/delimitMate.txt
Normal file
@@ -0,0 +1,561 @@
|
||||
*delimitMate* Trying to keep those beasts at bay! v.2.0 *delimitMate.txt*
|
||||
|
||||
========================================================================= ~
|
||||
==== ========= ========================== ===== ===================== ~
|
||||
==== ========= ========================== === ===================== ~
|
||||
==== ========= ===================== === = = ========== ========= ~
|
||||
==== === === == == = = === == == == == === === === == ~
|
||||
== == = == ====== ======= === ===== == = === === = = ~
|
||||
= = == == == == = = == === === ===== ===== === === = ~
|
||||
= = == ===== == == = = == === === ===== === === === ==== ~
|
||||
= = == = == == == = = == === === ===== == = === === = = ~
|
||||
== === === == == = = == === == ===== === === === == ~
|
||||
========================================================================= ~
|
||||
|
||||
REFERENCE MANUAL *
|
||||
|
||||
==============================================================================
|
||||
0.- CONTENTS *delimitMate-contents*
|
||||
|
||||
1. Introduction____________________________|delimitMateIntro|
|
||||
2. Functionality___________________________|delimitMateFunctionality|
|
||||
2.1 Automatic closing & exiting________|delimitMateAutoClose|
|
||||
2.2 Expansion of space and CR__________|delimitMateExpansion|
|
||||
2.3 Backspace__________________________|delimitMateBackspace|
|
||||
2.4 Visual wrapping____________________|delimitMateVisualWrapping|
|
||||
2.5 Smart Quotes_______________________|delimitMateSmartQuotes|
|
||||
3. Customization___________________________|delimitMateOptions|
|
||||
3.1 Option summary_____________________|delimitMateOptionSummary|
|
||||
3.2 Options details____________________|delimitMateOptionDetails|
|
||||
4. Commands________________________________|delimitMateCommands|
|
||||
5. Functions_______________________________|delimitMateFunctions|
|
||||
6. TODO list_______________________________|delimitMateTodo|
|
||||
7. Maintainer______________________________|delimitMateMaintainer|
|
||||
8. Credits_________________________________|delimitMateCredits|
|
||||
9. History_________________________________|delimitMateHistory|
|
||||
|
||||
==============================================================================
|
||||
1.- INTRODUCTION *delimitMateIntro*
|
||||
|
||||
The delimitMate plugin tries to provide some not so dumb help in the work with
|
||||
delimiters (brackets, quotes, etc.), with some optional auto-completions and
|
||||
expansions.
|
||||
|
||||
When automatic closing is enabled, if an opening delimiter is inserted
|
||||
delimitMate inserts the closing pair and places the cursor between them. When
|
||||
automatic closing is disabled, no closing delimiters is inserted by
|
||||
delimitMate, but if a pair of delimiters is typed, the cursor is placed in the
|
||||
middle. Also, to get out of a pair of delimiters just type shift+tab or the
|
||||
right delimiter and the cursor will jump to the right.
|
||||
|
||||
If the cursor is inside an empty pair of delimiters, typing <Space> will
|
||||
insert two spaces and the cursor will be placed in the middle; typing <CR>
|
||||
will insert to car retunrs and place the cursor in the middle line, between
|
||||
the delimiters.
|
||||
|
||||
All of the operations are undo/redo-wise safe.
|
||||
|
||||
==============================================================================
|
||||
2. FUNCTIONALITY *delimitMateFunctionality*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.1 AUTOMATIC CLOSING AND EXITING *delimitMateAutoClose*
|
||||
|
||||
With automatic closing enabled, if an opening delimiter is inserted the plugin
|
||||
inserts the closing delimiter and places the cursor between the pair. With
|
||||
automatic closing disabled, no closing delimiters is inserted by delimitMate,
|
||||
but when a pair of delimiters is typed, the cursor is placed in the middle.
|
||||
|
||||
When the cursor is inside an empty pair or located next to the left of a
|
||||
closing delimiter, the cursor is placed outside the pair to the right of the
|
||||
closing delimiter.
|
||||
|
||||
Unless |'delimitMate_matchpairs'| or |'delimitMate_quotes'|are set, this
|
||||
script uses the values in '&matchpairs' to identify the pairs, and ", ' and `
|
||||
for quotes respectively.
|
||||
|
||||
The following table shows the behaviour, this applies to quotes too (the final
|
||||
position of the cursor is represented by a "|"):
|
||||
|
||||
With auto-close: >
|
||||
Type | You get
|
||||
====================
|
||||
( | (|)
|
||||
–––––––––|––––––––––
|
||||
() | ()|
|
||||
–––––––––|––––––––––
|
||||
(<S-Tab> | ()|
|
||||
<
|
||||
Without auto-close: >
|
||||
|
||||
Type | You get
|
||||
=====================
|
||||
() | (|)
|
||||
–––––––––-|––––––––––
|
||||
()) | ()|
|
||||
–––––––––-|––––––––––
|
||||
()<S-Tab> | ()|
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
2.2 EXPANSION OF SPACE AND CAR RETURN *delimitMateExpansion*
|
||||
|
||||
When the cursor is inside an empty pair of delimiters, <Space> and <CR> can be
|
||||
expanded, see |'delimitMate_expand_space'| and
|
||||
|'delimitMate_expand_cr'|:
|
||||
|
||||
Expand <Space> to: >
|
||||
|
||||
<Space><Space><Left> | You get
|
||||
====================================
|
||||
(|) | ( | )
|
||||
<
|
||||
Expand <CR> to: >
|
||||
|
||||
<CR><CR><Up> | You get
|
||||
============================
|
||||
(|) | (
|
||||
| |
|
||||
| )
|
||||
<
|
||||
|
||||
Since <Space> and <CR> are used everywhere, I have made the functions involved
|
||||
in expansions global, so they can be used to make custom mappings. Read
|
||||
|delimitMateFunctions| for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.3 BACKSPACE *delimitMateBackspace*
|
||||
|
||||
If you press backspace inside an empty pair, both delimiters are deleted. If
|
||||
you type shift + backspace instead, only the closing delimiter will be
|
||||
deleted.
|
||||
|
||||
e.g. typing at the "|": >
|
||||
|
||||
What | Before | After
|
||||
==============================================
|
||||
<BS> | call expand(|) | call expand|
|
||||
---------|------------------|-----------------
|
||||
<S-BS> | call expand(|) | call expand(|
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.4 WRAPPING OF VISUAL SELECTION *delimitMateVisualWrapping*
|
||||
|
||||
When visual mode is active this script allows for the selection to be enclosed
|
||||
with delimiters. But, since brackets have special meaning in visual mode, a
|
||||
leader (the value of 'mapleader' by default) should precede the delimiter.
|
||||
This feature doesn't currently work on blockwise visual mode, any suggestions
|
||||
will be welcome.
|
||||
|
||||
e.g. (selection represented between square brackets): >
|
||||
|
||||
Selected text | After \"
|
||||
=============================================
|
||||
An [absurd] example! | An "absurd" example!
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
2.5 SMART QUOTES *delimitMateSmartQuotes*
|
||||
|
||||
Only one quote will be inserted following a quote, a "\" or an alphanumeric
|
||||
character. This should cover closing quotes, escaped quotes and apostrophes.
|
||||
Except for apostrophes, this feature can be disabled setting the option
|
||||
|'delimitMate_smart_quotes'| to 0.
|
||||
|
||||
e.g. typing at the "|": >
|
||||
|
||||
What | Before | After
|
||||
=======================================
|
||||
" | "String| | "String"|
|
||||
" | let i = "| | let i = "|"
|
||||
' | I| | I'|
|
||||
<
|
||||
==============================================================================
|
||||
3. CUSTOMIZATION *delimitMateOptions*
|
||||
|
||||
You can create your own mappings for some features using the global functions.
|
||||
Read |DelimitMateFunctions| for more info.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.1 OPTIONS SUMMARY *delimitMateOptionSummary*
|
||||
|
||||
The behaviour of this script can be customized setting the following options
|
||||
in your vimrc file. You can use local options to set the configuration for
|
||||
specific file types, see |delimitMateOptionDetails| for examples.
|
||||
|
||||
|'loaded_delimitMate'| Turns off the script.
|
||||
|
||||
|'delimitMate_autoclose'| Tells delimitMate whether to automagically
|
||||
insert the closing delimiter.
|
||||
|
||||
|'delimitMate_matchpairs'| Tells delimitMate which characters are
|
||||
matching pairs.
|
||||
|
||||
|'delimitMate_quotes'| Tells delimitMate which quotes should be
|
||||
used.
|
||||
|
||||
|'delimitMate_visual_leader'| Sets the leader to be used in visual mode.
|
||||
|
||||
|'delimitMate_expand_cr'| Turns on/off the expansion of <CR>.
|
||||
|
||||
|'delimitMate_expand_space'| Turns on/off the expansion of <Space>.
|
||||
|
||||
|'delimitMate_excluded_ft'| Turns off the script for the given file types.
|
||||
|
||||
|'delimitMate_apostrophes'| Tells delimitMate how it should "fix"
|
||||
balancing of single quotes when used as
|
||||
apostrophes. NOTE: Not needed any more, kept
|
||||
for compatibility with older versions.
|
||||
|
||||
|'delimitMate_smart_quotes'| Turns on/off the "smart quotes" feature.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
3.2 OPTIONS DETAILS *delimitMateOptionDetails*
|
||||
|
||||
Add the shown lines to your vimrc file in order to set the below options.
|
||||
Local options take precedence over global ones and can be used along with
|
||||
autocmd to modify delimitMate's behavior for specific file types.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'loaded_delimitMate'*
|
||||
*'b:loaded_delimitMate'*
|
||||
This option prevents delimitMate from loading.
|
||||
e.g.: >
|
||||
let loaded_delimitMate = 1
|
||||
au FileType mail let b:loaded_delimitMate = 1
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_autoclose'*
|
||||
*'b:delimitMate_autoclose'*
|
||||
Values: 0 or 1. ~
|
||||
Default: 1 ~
|
||||
|
||||
If this option is set to 0, delimitMate will not add a closing delimiter
|
||||
automagically. See |delimitMateAutoClose| for details.
|
||||
e.g.: >
|
||||
let delimitMate_autoclose = 0
|
||||
au FileType mail let b:delimitMate_autoclose = 0
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_matchpairs'*
|
||||
*'b:delimitMate_matchpairs'*
|
||||
Values: A string with |matchpairs| syntax. ~
|
||||
Default: &matchpairs ~
|
||||
|
||||
Use this option to tell delimitMate which characters should be considered
|
||||
matching pairs. Read |delimitMateAutoClose| for details.
|
||||
e.g: >
|
||||
let delimitMate = "(:),[:],{:},<:>"
|
||||
au FileType vim,html let b:delimitMate_matchpairs = "(:),[:],{:},<:>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_quotes'*
|
||||
*'b:delimitMate_quotes'*
|
||||
Values: A string of characters separated by spaces. ~
|
||||
Default: "\" ' `" ~
|
||||
|
||||
Use this option to tell delimitMate which characters should be considered as
|
||||
quotes. Read |delimitMateAutoClose| for details.
|
||||
e.g.: >
|
||||
let b:delimitMate_quotes = "\" ' ` *"
|
||||
au FileType html let b:delimitMate_quotes = "\" '"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_visual_leader'*
|
||||
*'b:delimitMate_visual_leader'*
|
||||
Values: Any character. ~
|
||||
Default: q ~
|
||||
|
||||
The value of this option will be used to wrap the selection in visual mode
|
||||
when followed by a delimiter. Read |delimitMateVisualWrap| for details.
|
||||
e.g: >
|
||||
let delimitMate_visual_leader = "f"
|
||||
au FileType html let b:delimitMate_visual_leader = "f"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_expand_cr'*
|
||||
*'b:delimitMate_expand_cr'*
|
||||
Values: 1 or 0 ~
|
||||
Default: 0 ~
|
||||
|
||||
This option turns on/off the expansion of <CR>. Read |delimitMateExpansion|
|
||||
for details.
|
||||
e.g.: >
|
||||
let b:delimitMate_expand_cr = "\<CR>\<CR>\<Up>"
|
||||
au FileType mail let b:delimitMate_expand_cr = "\<CR>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_expand_space'*
|
||||
*'b:delimitMate_expand_space'*
|
||||
Values: A key mapping. ~
|
||||
Default: "\<Space>" ~
|
||||
|
||||
This option turns on/off the expansion of <Space>. Read |delimitMateExpansion|
|
||||
for details.
|
||||
e.g.: >
|
||||
let delimitMate_expand_space = "\<Space>\<Space>\<Left>"
|
||||
au FileType tcl let b:delimitMate_expand_space = "\<Space>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_excluded_ft'*
|
||||
Values: A string of file type names separated by single commas. ~
|
||||
Default: Empty. ~
|
||||
|
||||
This options turns delimitMate off for the listed file types, use this option
|
||||
only if you don't want any of the features it provides on those file types.
|
||||
e.g.: >
|
||||
let delimitMate_excluded_ft = "mail,txt"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
*'delimitMate_apostrophes'*
|
||||
Values: Strings separated by ":". ~
|
||||
Default: No longer used. ~
|
||||
|
||||
NOTE: This feature is turned off by default, it's been kept for compatibility
|
||||
with older version, read |delimitMateSmartQuotes| for details.
|
||||
If auto-close is enabled, this option tells delimitMate how to try to fix the
|
||||
balancing of single quotes when used as apostrophes. The values of this option
|
||||
are strings of text where a single quote would be used as an apostrophe (e.g.:
|
||||
the "n't" of wouldn't or can't) separated by ":". Set it to an empty string to
|
||||
disable this feature.
|
||||
e.g.: >
|
||||
let delimitMate_apostrophes = ""
|
||||
au FileType tcl let delimitMate_apostrophes = ""
|
||||
<
|
||||
==============================================================================
|
||||
4. COMMANDS *delimitMateCommands*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
:DelimitMateReload *:DelimitMateReload*
|
||||
|
||||
Re-sets all the mappings used for this script, use it if any option has been
|
||||
changed or if the filetype option hasn't been set yet.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
:DelimitMateTest *:DelimitMateTest*
|
||||
|
||||
This command tests every mapping set-up for this script, useful for testing
|
||||
custom configurations.
|
||||
|
||||
The following output corresponds to the default values, it will be different
|
||||
depending on your configuration. "Open & close:" represents the final result
|
||||
when the closing delimiter has been inserted, either manually or
|
||||
automatically, see |delimitMateExpansion|. "Delete:" typing backspace in an
|
||||
empty pair, see |delimitMateBackspace|. "Exit:" typing a closing delimiter
|
||||
inside a pair of delimiters, see |delimitMateAutoclose|. "Space:" the
|
||||
expansion, if any, of space, see |delimitMateExpansion|. "Visual-L",
|
||||
"Visual-R" and "Visual" shows visual wrapping, see
|
||||
|delimitMateVisualWrapping|. "Car return:" the expansion of car return, see
|
||||
|delimitMateExpansion|. The cursor's position at the end of every test is
|
||||
represented by an "|": >
|
||||
|
||||
* AUTOCLOSE:
|
||||
Open & close: (|)
|
||||
Delete: |
|
||||
Exit: ()|
|
||||
Space: ( |)
|
||||
Visual-L: (v)
|
||||
Visual-R: (v)
|
||||
Car return: (
|
||||
|)
|
||||
|
||||
Open & close: {|}
|
||||
Delete: |
|
||||
Exit: {}|
|
||||
Space: { |}
|
||||
Visual-L: {v}
|
||||
Visual-R: {v}
|
||||
Car return: {
|
||||
|}
|
||||
|
||||
Open & close: [|]
|
||||
Delete: |
|
||||
Exit: []|
|
||||
Space: [ |]
|
||||
Visual-L: [v]
|
||||
Visual-R: [v]
|
||||
Car return: [
|
||||
|]
|
||||
|
||||
Open & close: "|"
|
||||
Delete: |
|
||||
Exit: ""|
|
||||
Space: " |"
|
||||
Visual: "v"
|
||||
Car return: "
|
||||
|"
|
||||
|
||||
Open & close: '|'
|
||||
Delete: |
|
||||
Exit: ''|
|
||||
Space: ' |'
|
||||
Visual: 'v'
|
||||
Car return: '
|
||||
|'
|
||||
|
||||
Open & close: `|`
|
||||
Delete: |
|
||||
Exit: ``|
|
||||
Space: ` |`
|
||||
Visual: `v`
|
||||
Car return: `
|
||||
|`
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
5. FUNCTIONS *delimitMateFunctions*
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
delimitMate_WithinEmptyPair() *delimitMate_WithinEmptyPair*
|
||||
|
||||
Returns 1 if the cursor is inside an empty pair, 0 otherwise.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
DelimitMate_ExpandReturn() *DelimitMate_ExpandReturn()*
|
||||
|
||||
Returns the expansion for <CR>.
|
||||
|
||||
e.g.: This mapping could be used to select an item on a pop-up menu or expand
|
||||
<CR> inside an empty pair: >
|
||||
|
||||
inoremap <expr> <CR> pumvisible() ? "\<c-y>" :
|
||||
\ DelimitMate_WithinEmptyPair ?
|
||||
\ DelimitMate_ExpandReturn() : "\<CR>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
DelimitMate_ExpandSpace() *DelimitMate_ExpandSpace()*
|
||||
|
||||
Returns the expansion for <Space>.
|
||||
e.g.: >
|
||||
|
||||
inoremap <expr> <Space> DelimitMate_WithinEmptyPair() ?
|
||||
\ DelimitMate_ExpandSpace() : "\<Space>"
|
||||
<
|
||||
------------------------------------------------------------------------------
|
||||
DelimitMate_ShouldJump() *DelimitMate_ShouldJump()*
|
||||
|
||||
Returns 1 if there is a closing delimiter or a quote to the right of the
|
||||
cursor, 0 otherwise.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
DelimitMate_JumpAny() *DelimitMate_JumpAny()*
|
||||
|
||||
This function returns a mapping that will make the cursor jump to the right.
|
||||
e.g.: You can use this to create your own mapping to jump over any delimiter.
|
||||
>
|
||||
inoremap <expr> <C-Tab> DelimitMate_ShouldJump() ?
|
||||
\ DelimitMate_JumpAny() : "\<C-Tab>"
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
6. TODO LIST *delimitMateTodo*
|
||||
|
||||
- Automatic set-up by file type.
|
||||
- Make visual wrapping work on blockwise visual mode.
|
||||
- Limit behaviour by region.
|
||||
|
||||
==============================================================================
|
||||
7. MAINTAINER *delimitMateMaintainer*
|
||||
|
||||
Hi there! My name is Israel Chauca F. and I can be reached at:
|
||||
mailto:israelchauca@gmail.com
|
||||
|
||||
Feel free to send me any suggestions and/or comments about this plugin, I'll
|
||||
be very pleased to read them.
|
||||
|
||||
==============================================================================
|
||||
8. CREDITS *delimitMateCredits*
|
||||
|
||||
Some of the code that make this script is modified or just shamelessly copied
|
||||
from the following sources:
|
||||
|
||||
- Ian McCracken
|
||||
Post titled: Vim, Part II: Matching Pairs:
|
||||
http://concisionandconcinnity.blogspot.com/
|
||||
|
||||
- Aristotle Pagaltzis
|
||||
From the comments on the previous blog post and from:
|
||||
http://gist.github.com/144619
|
||||
|
||||
- Vim Scripts:
|
||||
http://www.vim.org/scripts
|
||||
|
||||
This script was inspired by the auto-completion of delimiters of TextMate.
|
||||
|
||||
==============================================================================
|
||||
9. HISTORY *delimitMateHistory*
|
||||
|
||||
Version Date Release notes ~
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
2.0 2010-04-01 * New features:
|
||||
- All features are redo/undo-wise safe.
|
||||
- A single quote typed after an alphanumeric
|
||||
character is considered an apostrophe and one
|
||||
single quote is inserted.
|
||||
- A quote typed after another quote inserts a single
|
||||
quote and the cursor jumps to the middle.
|
||||
- <S-Tab> jumps out of any empty pair.
|
||||
- <CR> and <Space> expansions are fixed, but the
|
||||
functions used for it are global and can be used in
|
||||
custom mappings. The previous system is still
|
||||
active if you have any of the expansion options
|
||||
set.
|
||||
- <S-Backspace> deletes the closing delimiter.
|
||||
|
||||
* Fixed bug:
|
||||
- s:vars were being used to store buffer options.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.6 2009-10-10 Now delimitMate tries to fix the balancing of single
|
||||
quotes when used as apostrophes. You can read
|
||||
|delimitMate_apostrophes| for details.
|
||||
Fixed an error when |b:delimitMate_expand_space|
|
||||
wasn't set but |delimitMate_expand_space| wasn't.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.5 2009-10-05 Fix: delimitMate should work correctly for files
|
||||
passed as arguments to Vim. Thanks to Ben Beuchler
|
||||
for helping to nail this bug.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.4 2009-09-27 Fix: delimitMate is now enabled on new buffers even
|
||||
if they don't have set the file type option or were
|
||||
opened directly from the terminal.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.3 2009-09-24 Now local options can be used along with autocmd
|
||||
for specific file type configurations.
|
||||
Fixes:
|
||||
- Unnamed register content is not lost on visual
|
||||
mode.
|
||||
- Use noremap where appropiate.
|
||||
- Wrapping a single empty line works as expected.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.2 2009-09-07 Fixes:
|
||||
- When inside nested empty pairs, deleting the
|
||||
innermost left delimiter would delete all right
|
||||
contiguous delimiters.
|
||||
- When inside an empty pair, inserting a left
|
||||
delimiter wouldn't insert the right one, instead
|
||||
the cursor would jump to the right.
|
||||
- New buffer inside the current window wouldn't
|
||||
have the mappings set.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.1 2009-08-25 Fixed an error that ocurred when mapleader wasn't
|
||||
set and added support for GetLatestScripts
|
||||
auto-detection.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
1.0 2009-08-23 Initial upload.
|
||||
|
||||
|---------|------------|-----------------------------------------------------|
|
||||
|
||||
|
||||
... |"| _ _ . . ___ ~
|
||||
o,*,(o o) _|_|_ o' \,=./ `o . .:::. /_\ `* ~
|
||||
8(o o)(_)Ooo (o o) (o o) :(o o): . (o o) ~
|
||||
---ooO-(_)---Ooo----ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo- ~
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:formatoptions+=tcroqn:autoindent:
|
||||
1149
doc/fuf.jax
Normal file
1149
doc/fuf.jax
Normal file
File diff suppressed because it is too large
Load Diff
1562
doc/fuf.txt
Normal file
1562
doc/fuf.txt
Normal file
File diff suppressed because it is too large
Load Diff
251
doc/mark.txt
Normal file
251
doc/mark.txt
Normal file
@@ -0,0 +1,251 @@
|
||||
*mark.txt* Highlight several words in different colors simultaneously.
|
||||
|
||||
MARK by Ingo Karkat
|
||||
(original version by Yuheng Xie)
|
||||
*mark.vim*
|
||||
description |mark-description|
|
||||
usage |mark-usage|
|
||||
installation |mark-installation|
|
||||
configuration |mark-configuration|
|
||||
integration |mark-integration|
|
||||
limitations |mark-limitations|
|
||||
known problems |mark-known-problems|
|
||||
todo |mark-todo|
|
||||
history |mark-history|
|
||||
|
||||
==============================================================================
|
||||
DESCRIPTION *mark-description*
|
||||
|
||||
This script adds mappings and a :Mark command to highlight several words in
|
||||
different colors simultaneously, similar to the built-in 'hlsearch'
|
||||
highlighting of search results and the * |star| command. For example, when you
|
||||
are browsing a big program file, you could highlight multiple identifiers in
|
||||
parallel. This will make it easier to trace the source code.
|
||||
|
||||
This is a continuation of vimscript #1238 by Yuheng Xie, who apparently
|
||||
doesn't maintain his original version anymore and cannot be reached via the
|
||||
email address in his profile. This script offers the following advantages over
|
||||
the original:
|
||||
- Much faster, all colored words can now be highlighted, no more clashes with
|
||||
syntax highlighting (due to use of matchadd()).
|
||||
- Many bug fixes.
|
||||
- Jumps behave like the built-in search, including wrap and error messages.
|
||||
- Like the built-in commands, jumps take an optional [count] to quickly skip
|
||||
over some marks.
|
||||
|
||||
RELATED WORKS *
|
||||
- MultipleSearch (vimscript #479) can highlight in a single window and in all
|
||||
buffers, but still relies on the :syntax highlighting method, which is
|
||||
slower and less reliable.
|
||||
- http://vim.wikia.com/wiki/Highlight_multiple_words offers control over the
|
||||
color used by mapping the 1-9 keys on the numeric keypad, persistence, and
|
||||
highlights only a single window.
|
||||
|
||||
==============================================================================
|
||||
USAGE *mark-usage*
|
||||
|
||||
Highlighting:
|
||||
|
||||
<Leader>m Mark or unmark the word under the cursor, similar to
|
||||
the |star| command.
|
||||
{Visual}<Leader>m Mark or unmark the visual selection.
|
||||
<Leader>r Manually input a regular expression to highlight.
|
||||
{Visual}<Leader>r (Based on the visual selection.)
|
||||
In accordance with the built-in |star| command,
|
||||
all these mappings use 'ignorecase', but not
|
||||
'smartcase'.
|
||||
<Leader>n Clear the mark under the cursor / all marks.
|
||||
*:Mark*
|
||||
:Mark {pattern} Mark or unmark {pattern}.
|
||||
For implementation reasons, {pattern} cannot use the
|
||||
'smartcase' setting, only 'ignorecase'.
|
||||
:Mark Clear all marks.
|
||||
|
||||
Searching:
|
||||
|
||||
[count]* [count]#
|
||||
[count]<Leader>* [count]<Leader>#
|
||||
[count]<Leader>/ [count]<Leader>?
|
||||
Use these six keys to jump to the [count]'th next /
|
||||
previous occurrence of a mark.
|
||||
You could also use Vim's / and ? to search, since the
|
||||
mark patterns are (optionally, see configuration)
|
||||
added to the search history, too.
|
||||
|
||||
Cursor over mark Cursor not over mark
|
||||
---------------------------------------------------------------------------
|
||||
<Leader>* Jump to the next occurrence of Jump to the next occurrence of
|
||||
current mark, and remember it "last mark".
|
||||
as "last mark".
|
||||
|
||||
<Leader>/ Jump to the next occurrence of Same as left.
|
||||
ANY mark.
|
||||
|
||||
* If <Leader>* is the most recently Do Vim's original * command.
|
||||
used, do a <Leader>*; otherwise
|
||||
(<Leader>/ is the most recently
|
||||
used), do a <Leader>/.
|
||||
|
||||
Note: When the cursor is on a mark, the backwards
|
||||
search does not jump to the beginning of the current
|
||||
mark (like the built-in search), but to the previous
|
||||
mark. The entire mark text is treated as one entity.
|
||||
|
||||
==============================================================================
|
||||
INSTALLATION *mark-installation*
|
||||
|
||||
This script is packaged as a|vimball|. If you have the "gunzip" decompressor
|
||||
in your PATH, simply edit the *.vba.gz package in Vim; otherwise, decompress
|
||||
the archive first, e.g. using WinZip. Inside Vim, install by sourcing the
|
||||
vimball or via the|:UseVimball|command. >
|
||||
vim mark.vba.gz
|
||||
:so %
|
||||
To uninstall, use the|:RmVimball|command.
|
||||
|
||||
DEPENDENCIES *mark-dependencies*
|
||||
|
||||
- Requires Vim 7.1 with "matchadd()", or Vim 7.2 or higher.
|
||||
|
||||
==============================================================================
|
||||
CONFIGURATION *mark-configuration*
|
||||
|
||||
You may define your own colors or more than the default 6 highlightings in
|
||||
your vimrc file (or anywhere before this plugin is sourced), in the following
|
||||
form (where N = 1..): >
|
||||
highlight MarkWordN ctermbg=Cyan ctermfg=Black guibg=#8CCBEA guifg=Black
|
||||
<
|
||||
The search type highlighting (in the search message) can be changed via: >
|
||||
highlight link SearchSpecialSearchType MoreMsg
|
||||
<
|
||||
By default, any marked words are also added to the search (/) and input (@)
|
||||
history; if you don't want that, remove the corresponding symbols from: >
|
||||
let g:mwHistAdd = "/@"
|
||||
<
|
||||
You can use different mappings by mapping to the <Plug>Mark... mappings before
|
||||
this plugin is sourced. To remove the default overriding of * and #, use: >
|
||||
nmap <Plug>IgnoreMarkSearchNext <Plug>MarkSearchNext
|
||||
nmap <Plug>IgnoreMarkSearchPrev <Plug>MarkSearchPrev
|
||||
<
|
||||
==============================================================================
|
||||
INTEGRATION *mark-integration*
|
||||
|
||||
==============================================================================
|
||||
LIMITATIONS *mark-limitations*
|
||||
|
||||
- If the 'ignorecase' setting is changed, there will be discrepancies between
|
||||
the highlighted marks and subsequent jumps to marks.
|
||||
- If {pattern} in a :Mark command contains atoms that change the semantics of
|
||||
the entire (|/\c|, |/\C|) or following (|/\v|,|/\V|, |/\M|) regular
|
||||
expression, there may be discrepancies between the highlighted marks and
|
||||
subsequent jumps to marks.
|
||||
|
||||
KNOWN PROBLEMS *mark-known-problems*
|
||||
|
||||
TODO *mark-todo*
|
||||
|
||||
IDEAS *mark-ideas*
|
||||
|
||||
Taken from an alternative implementation at
|
||||
http://vim.wikia.com/wiki/Highlight_multiple_words:
|
||||
- Allow to specify the highlight group number via :Mark [n] {regexp}
|
||||
- Use keys 1-9 on the numeric keypad to toggle a highlight group number.
|
||||
- Persist the patterns in a uppercase global variable across Vim sessions.
|
||||
|
||||
==============================================================================
|
||||
HISTORY *mark-history*
|
||||
|
||||
2.3.3 19-Feb-2010
|
||||
- BUG: Clearing of an accidental zero-width match (e.g. via :Mark \zs) results
|
||||
in endless loop. Thanks to Andy Wokula for the patch.
|
||||
|
||||
2.3.2 17-Nov-2009
|
||||
- BUG: Creation of literal pattern via '\V' in {Visual}<Leader>m mapping
|
||||
collided with individual escaping done in <Leader>m mapping so that an
|
||||
escaped '\*' would be interpreted as a multi item when both modes are used
|
||||
for marking. Thanks to Andy Wokula for the patch.
|
||||
|
||||
2.3.1 06-Jul-2009
|
||||
- Now working correctly when 'smartcase' is set. All mappings and the :Mark
|
||||
command use 'ignorecase', but not 'smartcase'.
|
||||
|
||||
2.3.0 04-Jul-2009
|
||||
- All jump commands now take an optional [count], so you can quickly skip over
|
||||
some marks, as with the built-in */# and n/N commands. For this, the entire
|
||||
core search algorithm has been rewritten. The script's logic has been
|
||||
simplified through the use of Vim 7 features like Lists.
|
||||
- Now also printing a Vim-alike search error message when 'nowrapscan' is set.
|
||||
|
||||
2.2.0 02-Jul-2009
|
||||
- Split off functions into autoload script.
|
||||
- Initialization of global variables and autocommands is now done lazily on
|
||||
the first use, not during loading of the plugin. This reduces Vim startup
|
||||
time and footprint as long as the functionality isn't yet used.
|
||||
- Split off documentation into separate help file. Now packaging as VimBall.
|
||||
|
||||
|
||||
2.1.0 06-Jun-2009
|
||||
- Replaced highlighting via :syntax with matchadd() / matchdelete(). This
|
||||
requires Vim 7.2 / 7.1 with patches. This method is faster, there are no
|
||||
more clashes with syntax highlighting (:match always has preference), and
|
||||
the background highlighting does not disappear under 'cursorline'.
|
||||
- Using winrestcmd() to fix effects of :windo: By entering a window, its
|
||||
height is potentially increased from 0 to 1.
|
||||
- Handling multiple tabs by calling s:UpdateScope() on the TabEnter event.
|
||||
|
||||
2.0.0 01-Jun-2009
|
||||
- Now using Vim List for g:mwWord and thus requiring Vim 7. g:mwCycle is now
|
||||
zero-based, but the syntax groups "MarkWordx" are still one-based.
|
||||
- Factored :syntax operations out of s:DoMark() and s:UpdateMark() so that
|
||||
they can all be done in a single :windo.
|
||||
- Normal mode <Plug>MarkSet now has the same semantics as its visual mode
|
||||
cousin: If the cursor is on an existing mark, the mark is removed.
|
||||
Beforehand, one could only remove a visually selected mark via again
|
||||
selecting it. Now, one simply can invoke the mapping when on such a mark.
|
||||
|
||||
1.6.1 31-May-2009
|
||||
Publication of improved version by Ingo Karkat.
|
||||
- Now prepending search type ("any-mark", "same-mark", "new-mark") for better
|
||||
identification.
|
||||
- Retired the algorithm in s:PrevWord in favor of simply using <cword>, which
|
||||
makes mark.vim work like the * command. At the end of a line, non-keyword
|
||||
characters may now be marked; the previous algorithm preferred any preceding
|
||||
word.
|
||||
- BF: If 'iskeyword' contains characters that have a special meaning in a
|
||||
regexp (e.g. [.*]), these are now escaped properly.
|
||||
- Highlighting can now actually be overridden in the vimrc (anywhere _before_
|
||||
sourcing this script) by using ':hi def'.
|
||||
- Added missing setter for re-inclusion guard.
|
||||
|
||||
1.5.0 01-Sep-2008
|
||||
Bug fixes and enhancements by Ingo Karkat.
|
||||
- Added <Plug>MarkAllClear (without a default mapping), which clears all
|
||||
marks, even when the cursor is on a mark.
|
||||
- Added <Plug>... mappings for hard-coded \*, \#, \/, \?, * and #, to allow
|
||||
re-mapping and disabling. Beforehand, there were some <Plug>... mappings
|
||||
and hard-coded ones; now, everything can be customized.
|
||||
- BF: Using :autocmd without <bang> to avoid removing _all_ autocmds for the
|
||||
BufWinEnter event. (Using a custom :augroup would be even better.)
|
||||
- BF: Explicitly defining s:current_mark_position; some execution paths left
|
||||
it undefined, causing errors.
|
||||
- ENH: Make the match according to the 'ignorecase' setting, like the star
|
||||
command.
|
||||
- ENH: The jumps to the next/prev occurrence now print 'search hit BOTTOM,
|
||||
continuing at TOP" and "Pattern not found:..." messages, like the * and n/N
|
||||
Vim search commands.
|
||||
- ENH: Jumps now open folds if the occurrence is inside a closed fold, just
|
||||
like n/N do.
|
||||
|
||||
1.1.8-g 25-Apr-2008
|
||||
Last version published by Yuheng Xie on vim.org.
|
||||
|
||||
1.1.2 22-Mar-2005
|
||||
Initial version published by Yuheng Xie on vim.org.
|
||||
|
||||
==============================================================================
|
||||
Copyright: (C) 2005-2008 by Yuheng Xie
|
||||
(C) 2008-2010 by Ingo Karkat
|
||||
The VIM LICENSE applies to this script; see|copyright|.
|
||||
|
||||
Maintainer: Ingo Karkat <ingo@karkat.de>
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
414
doc/pi_getscript.txt
Normal file
414
doc/pi_getscript.txt
Normal file
@@ -0,0 +1,414 @@
|
||||
*pi_getscript.txt* For Vim version 7.0. Last change: 2008 Jan 07
|
||||
>
|
||||
GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr.
|
||||
<
|
||||
Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz>
|
||||
(remove NOSPAM from the email address)
|
||||
*GetLatestVimScripts-copyright*
|
||||
Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *glvs-copyright*
|
||||
The VIM LICENSE applies to getscript.vim and
|
||||
pi_getscript.txt (see |copyright|) except use
|
||||
"getscript" instead of "Vim". No warranty, express or implied.
|
||||
Use At-Your-Own-Risk.
|
||||
|
||||
Getscript is a plugin that simplifies retrieval of the latest versions of the
|
||||
scripts that you yourself use! Typing |:GLVS| will invoke getscript; it will
|
||||
then use the <GetLatestVimScripts.dat> (see |GetLatestVimScripts_dat|) file to
|
||||
get the latest versions of scripts listed therein from http://vim.sf.net/.
|
||||
|
||||
==============================================================================
|
||||
1. Contents *glvs-contents* *glvs* *getscript*
|
||||
*GetLatestVimScripts*
|
||||
|
||||
1. Contents........................................: |glvs-contents|
|
||||
2. GetLatestVimScripts -- Getting Started..........: |glvs-install|
|
||||
3. GetLatestVimScripts Usage.......................: |glvs-usage|
|
||||
4. GetLatestVimScripts Data File...................: |glvs-data|
|
||||
5. GetLatestVimScripts Friendly Plugins............: |glvs-plugins|
|
||||
6. GetLatestVimScripts AutoInstall.................: |glvs-autoinstall|
|
||||
7. GetLatestViMScripts Options.....................: |glvs-options|
|
||||
8. GetLatestVimScripts Algorithm...................: |glvs-alg|
|
||||
9. GetLatestVimScripts History.....................: |glvs-hist|
|
||||
|
||||
|
||||
==============================================================================
|
||||
2. GetLatestVimScripts -- Getting Started *getscript-start*
|
||||
*getlatestvimscripts-install*
|
||||
|
||||
VERSION FROM VIM DISTRIBUTION *glvs-dist-install*
|
||||
|
||||
Vim 7.0 does not include the GetLatestVimScripts.dist file which
|
||||
serves as an example and a template. So, you'll need to create
|
||||
your own! See |GetLatestVimScripts_dat|.
|
||||
|
||||
VERSION FROM VIM SF NET *glvs-install*
|
||||
|
||||
NOTE: The last step, that of renaming/moving the GetLatestVimScripts.dist
|
||||
file, is for those who have just downloaded GetLatestVimScripts.tar.bz2 for
|
||||
the first time.
|
||||
|
||||
The GetLatestVimScripts.dist file serves as an example and a template for your
|
||||
own personal list. Feel free to remove all the scripts mentioned within it;
|
||||
the "important" part of it is the first two lines.
|
||||
|
||||
Your computer needs to have wget for GetLatestVimScripts to do its work.
|
||||
|
||||
1. if compressed: gunzip getscript.vba.gz
|
||||
2. Unix:
|
||||
vim getscript.vba
|
||||
:so %
|
||||
:q
|
||||
cd ~/.vim/GetLatest
|
||||
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
|
||||
(edit GetLatestVimScripts.dat to install your own personal
|
||||
list of desired plugins -- see |GetLatestVimScripts_dat|)
|
||||
|
||||
3. Windows:
|
||||
vim getscript.vba
|
||||
:so %
|
||||
:q
|
||||
cd **path-to-vimfiles**/GetLatest
|
||||
mv GetLatestVimScripts.dist GetLatestVimScripts.dat
|
||||
(edit GetLatestVimScripts.dat to install your own personal
|
||||
list of desired plugins -- see |GetLatestVimScripts_dat|)
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. GetLatestVimScripts Usage *glvs-usage* *:GLVS*
|
||||
|
||||
Unless its been defined elsewhere, >
|
||||
:GLVS
|
||||
will invoke GetLatestVimScripts(). If some other plugin has defined that
|
||||
command, then you may type
|
||||
>
|
||||
:GetLatestVimScripts
|
||||
<
|
||||
The script will attempt to update and, if permitted, will automatically
|
||||
install scripts from http://vim.sourceforge.net/. To do so it will peruse a
|
||||
file,
|
||||
>
|
||||
.vim/GetLatest/GetLatestVimScripts.dat (unix)
|
||||
<
|
||||
or >
|
||||
..wherever..\vimfiles\GetLatest\GetLatestVimScripts.dat (windows)
|
||||
(see |glvs-data|), and examine plugins in your [.vim|vimfiles]/plugin
|
||||
directory (see |glvs-plugins|).
|
||||
|
||||
Scripts which have been downloaded will appear in the
|
||||
~/.vim/GetLatest (unix) or ..wherever..\vimfiles\GetLatest (windows)
|
||||
subdirectory. GetLatestVimScripts will attempt to automatically
|
||||
install them if you have the following line in your <.vimrc>: >
|
||||
|
||||
let g:GetLatestVimScripts_allowautoinstall=1
|
||||
|
||||
The <GetLatestVimScripts.dat> file will be automatically be updated to
|
||||
reflect the latest version of script(s) so downloaded.
|
||||
(also see |glvs-options|)
|
||||
|
||||
|
||||
==============================================================================
|
||||
4. GetLatestVimScripts Data File *getscript-data* *glvs-data*
|
||||
*:GetLatestVimScripts_dat*
|
||||
The data file <GetLatestVimScripts.dat> must have for its first two lines
|
||||
the following text:
|
||||
>
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
<
|
||||
Following those two lines are three columns; the first two are numeric
|
||||
followed by a text column. The GetLatest/GetLatestVimScripts.dist file
|
||||
contains an example of such a data file. Anything following a #... is
|
||||
ignored, so you may embed comments in the file.
|
||||
|
||||
The first number on each line gives the script's ScriptID. When you're about
|
||||
to use a web browser to look at scripts on http://vim.sf.net/, just before you
|
||||
click on the script's link, you'll see a line resembling
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=40
|
||||
|
||||
The "40" happens to be a ScriptID that GetLatestVimScripts needs to
|
||||
download the associated page.
|
||||
|
||||
The second number on each line gives the script's SourceID. The SourceID
|
||||
records the count of uploaded scripts as determined by vim.sf.net; hence it
|
||||
serves to indicate "when" a script was uploaded. Setting the SourceID to 1
|
||||
insures that GetLatestVimScripts will assume that the script it has is
|
||||
out-of-date.
|
||||
|
||||
The SourceID is extracted by GetLatestVimScripts from the script's page on
|
||||
vim.sf.net; whenever its greater than the one stored in the
|
||||
GetLatestVimScripts.dat file, the script will be downloaded
|
||||
(see |GetLatestVimScripts_dat|).
|
||||
|
||||
If your script's author has included a special comment line in his/her plugin,
|
||||
the plugin itself will be used by GetLatestVimScripts to build your
|
||||
<GetLatestVimScripts.dat> file, including any dependencies on other scripts it
|
||||
may have. As an example, consider: >
|
||||
|
||||
" GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
|
||||
|
||||
This comment line tells getscript.vim to check vimscript #884 and that the
|
||||
script is automatically installable. Getscript will also use this line to
|
||||
help build the GetLatestVimScripts.dat file, by including a line such as: >
|
||||
|
||||
884 1 AutoAlign.vim
|
||||
<
|
||||
in it an AutoAlign.vim line isn't already in GetLatestVimScripts.dat file.
|
||||
See |glvs-plugins| for more. Thus, GetLatestVimScripts thus provides a
|
||||
comprehensive ability to keep your plugins up-to-date!
|
||||
|
||||
*GetLatestVimScripts_dat*
|
||||
As an example of a <GetLatestVimScripts.dat> file:
|
||||
>
|
||||
ScriptID SourceID Filename
|
||||
--------------------------
|
||||
294 1 Align.vim
|
||||
120 2 decho.vim
|
||||
40 3 DrawIt.tar.gz
|
||||
451 4 EasyAccents.vim
|
||||
195 5 engspchk.vim
|
||||
642 6 GetLatestVimScripts.vim
|
||||
489 7 Manpageview.vim
|
||||
<
|
||||
Note: the first two lines are required, but essentially act as comments.
|
||||
|
||||
|
||||
==============================================================================
|
||||
5. GetLatestVimScripts Friendly Plugins *getscript-plugins* *glvs-plugins*
|
||||
|
||||
If a plugin author includes the following comment anywhere in their plugin,
|
||||
GetLatestVimScripts will find it and use it to automatically build the user's
|
||||
GetLatestVimScripts.dat files:
|
||||
>
|
||||
src_id
|
||||
v
|
||||
" GetLatestVimScripts: ### ### yourscriptname
|
||||
^
|
||||
scriptid
|
||||
<
|
||||
As an author, you should include such a line in to refer to your own script
|
||||
plus any additional lines describing any plugin dependencies it may have.
|
||||
Same format, of course!
|
||||
|
||||
If your command is auto-installable (see |glvs-autoinstall|), and most scripts
|
||||
are, then you may include :AutoInstall: at the start of "yourscriptname".
|
||||
|
||||
GetLatestVimScripts commands for those scripts are then appended, if not
|
||||
already present, to the user's GetLatest/GetLatestVimScripts.dat file. Its a
|
||||
relatively painless way to automate the acquisition of any scripts your
|
||||
plugins depend upon.
|
||||
|
||||
Now, as an author, you probably don't want GetLatestVimScripts to download
|
||||
your own scripts for you yourself, thereby overwriting your not-yet-released
|
||||
hard work. GetLatestVimScripts provides a solution for this: put
|
||||
>
|
||||
0 0 yourscriptname
|
||||
<
|
||||
into your <GetLatestVimScripts.dat> file and GetLatestVimScripts will skip
|
||||
examining the "yourscriptname" scripts for those GetLatestVimScripts comment
|
||||
lines. As a result, those lines won't be inadvertently installed into your
|
||||
<GetLatestVimScripts.dat> file and subsequently used to download your own
|
||||
scripts. This is especially important to do if you've included the
|
||||
:AutoInstall: option.
|
||||
|
||||
Be certain to use the same "yourscriptname" in the "0 0 yourscriptname" line
|
||||
as you've used in your GetLatestVimScripts comment!
|
||||
|
||||
|
||||
==============================================================================
|
||||
6. GetLatestVimScripts AutoInstall *getscript-autoinstall*
|
||||
*glvs-autoinstall*
|
||||
|
||||
GetLatestVimScripts now supports "AutoInstall". Not all scripts are
|
||||
supportive of auto-install, as they may have special things you need to do to
|
||||
install them (please refer to the script's "install" directions). On the
|
||||
other hand, most scripts will be auto-installable.
|
||||
|
||||
To let GetLatestVimScripts do an autoinstall, the data file's comment field
|
||||
should begin with (surrounding blanks are ignored): >
|
||||
|
||||
:AutoInstall:
|
||||
<
|
||||
Both colons are needed, and it should begin the comment (yourscriptname)
|
||||
field.
|
||||
|
||||
One may prevent any autoinstalling by putting the following line in your
|
||||
<.vimrc>: >
|
||||
|
||||
let g:GetLatestVimScripts_allowautoinstall= 0
|
||||
<
|
||||
With :AutoInstall: enabled, as it is by default, files which end with
|
||||
|
||||
---.tar.bz2 : decompressed & untarred in .vim/ directory
|
||||
---.vba.bz2 : decompressed in .vim/ directory, then vimball handles it
|
||||
---.vim.bz2 : decompressed & moved into .vim/plugin directory
|
||||
---.tar.gz : decompressed & untarred in .vim/ directory
|
||||
---.vba.gz : decompressed in .vim/ directory, then vimball handles it
|
||||
---.vim.gz : decompressed & moved into .vim/plugin directory
|
||||
---.vba : unzipped in .vim/ directory
|
||||
---.vim : moved to .vim/plugin directory
|
||||
---.zip : unzipped in .vim/ directory
|
||||
|
||||
and which merely need to have their components placed by the untar/gunzip or
|
||||
move-to-plugin-directory process should be auto-installable. Vimballs, of
|
||||
course, should always be auto-installable.
|
||||
|
||||
When is a script not auto-installable? Let me give an example:
|
||||
|
||||
.vim/after/syntax/blockhl.vim
|
||||
|
||||
The <blockhl.vim> script provides block highlighting for C/C++ programs; it is
|
||||
available at:
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=104
|
||||
|
||||
Currently, vim's after/syntax only supports by-filetype scripts (in
|
||||
blockhl.vim's case, that's after/syntax/c.vim). Hence, auto-install would
|
||||
possibly overwrite the current user's after/syntax/c.vim file.
|
||||
|
||||
In my own case, I use <aftersyntax.vim> (renamed to after/syntax/c.vim) to
|
||||
allow a after/syntax/c/ directory:
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=1023
|
||||
|
||||
The script allows multiple syntax files to exist separately in the
|
||||
after/syntax/c subdirectory. I can't bundle aftersyntax.vim in and build an
|
||||
appropriate tarball for auto-install because of the potential for the
|
||||
after/syntax/c.vim contained in it to overwrite a user's c.vim.
|
||||
|
||||
|
||||
==============================================================================
|
||||
7. GetLatestVimScripts Options *glvs-options*
|
||||
>
|
||||
g:GetLatestVimScripts_wget
|
||||
< default= "wget"
|
||||
This variable holds the name of the command for obtaining
|
||||
scripts.
|
||||
>
|
||||
g:GetLatestVimScripts_options
|
||||
< default= "-q -O"
|
||||
This variable holds the options to be used with the
|
||||
g:GetLatestVimScripts_wget command.
|
||||
>
|
||||
g:getLatestVimScripts_allowautoinstall
|
||||
< default= 1
|
||||
This variable indicates whether GetLatestVimScripts is allowed
|
||||
to attempt to automatically install scripts. Note that it
|
||||
doesn't understand vimballs (yet). Furthermore, the plugin
|
||||
author has to have explicitly indicated that his/her plugin
|
||||
is automatically installable.
|
||||
|
||||
|
||||
==============================================================================
|
||||
8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg*
|
||||
|
||||
The Vim sourceforge page dynamically creates a page by keying off of the
|
||||
so-called script-id. Within the webpage of
|
||||
|
||||
http://vim.sourceforge.net/scripts/script.php?script_id=40
|
||||
|
||||
is a line specifying the latest source-id (src_id). The source identifier
|
||||
numbers are always increasing, hence if the src_id is greater than the one
|
||||
recorded for the script in GetLatestVimScripts then it's time to download a
|
||||
newer copy of that script.
|
||||
|
||||
GetLatestVimScripts will then download the script and update its internal
|
||||
database of script ids, source ids, and scriptnames.
|
||||
|
||||
The AutoInstall process will:
|
||||
|
||||
Move the file from GetLatest/ to the following directory
|
||||
Unix : $HOME/.vim
|
||||
Windows: $HOME\vimfiles
|
||||
if the downloaded file ends with ".bz2"
|
||||
bunzip2 it
|
||||
else if the downloaded file ends with ".gz"
|
||||
gunzip it
|
||||
if the resulting file ends with ".zip"
|
||||
unzip it
|
||||
else if the resulting file ends with ".tar"
|
||||
tar -oxvf it
|
||||
else if the resulting file ends with ".vim"
|
||||
move it to the plugin subdirectory
|
||||
|
||||
|
||||
==============================================================================
|
||||
9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1
|
||||
|
||||
v29 Jan 07, 2008 : * Bram M pointed out that cpo is a global option and that
|
||||
getscriptPlugin.vim was setting it but not restoring it.
|
||||
v28 Jan 02, 2008 : * improved shell quoting character handling, cygwin
|
||||
interface, register-a bypass
|
||||
Oct 29, 2007 * Bill McCarthy suggested a change to getscript that avoids
|
||||
creating pop-up windows
|
||||
v24 Apr 16, 2007 : * removed save&restore of the fo option during script
|
||||
loading
|
||||
v23 Nov 03, 2006 : * ignores comments (#...)
|
||||
* handles vimballs
|
||||
v22 Oct 13, 2006 : * supports automatic use of curl if wget is not
|
||||
available
|
||||
v21 May 01, 2006 : * now takes advantage of autoloading.
|
||||
v20 Dec 23, 2005 : * Eric Haarbauer found&fixed a bug with unzip use;
|
||||
unzip needs the -o flag to overwrite.
|
||||
v19 Nov 28, 2005 : * v18's GetLatestVimScript line accessed the wrong
|
||||
script! Fixed.
|
||||
v18 Mar 21, 2005 : * bugfix to automatic database construction
|
||||
* bugfix - nowrapscan caused an error
|
||||
(tnx to David Green for the fix)
|
||||
Apr 01, 2005 * if shell is bash, "mv" instead of "ren" used in
|
||||
:AutoInstall:s, even though its o/s is windows
|
||||
Apr 01, 2005 * when downloading errors occurred, GLVS was
|
||||
terminating early. It now just goes on to trying
|
||||
the next script (after trying three times to
|
||||
download a script description page)
|
||||
Apr 20, 2005 * bugfix - when a failure to download occurred,
|
||||
GetLatestVimScripts would stop early and claim that
|
||||
everything was current. Fixed.
|
||||
v17 Aug 25, 2004 : * g:GetLatestVimScripts_allowautoinstall, which
|
||||
defaults to 1, can be used to prevent all
|
||||
:AutoInstall:
|
||||
v16 Aug 25, 2004 : * made execution of bunzip2/gunzip/tar/zip silent
|
||||
* fixed bug with :AutoInstall: use of helptags
|
||||
v15 Aug 24, 2004 : * bugfix: the "0 0 comment" download prevention wasn't
|
||||
always preventing downloads (just usually). Fixed.
|
||||
v14 Aug 24, 2004 : * bugfix -- helptags was using dotvim, rather than
|
||||
s:dotvim. Fixed.
|
||||
v13 Aug 23, 2004 : * will skip downloading a file if its scriptid or srcid
|
||||
is zero. Useful for script authors; that way their
|
||||
own GetLatestVimScripts activity won't overwrite
|
||||
their scripts.
|
||||
v12 Aug 23, 2004 : * bugfix - a "return" got left in the distribution that
|
||||
was intended only for testing. Removed, now works.
|
||||
* :AutoInstall: implemented
|
||||
v11 Aug 20, 2004 : * GetLatestVimScripts is now a plugin:
|
||||
* :GetLatestVimScripts command
|
||||
* (runtimepath)/GetLatest/GetLatestVimScripts.dat
|
||||
now holds scripts that need updating
|
||||
v10 Apr 19, 2004 : * moved history from script to doc
|
||||
v9 Jan 23, 2004 : windows (win32/win16/win95) will use
|
||||
double quotes ("") whereas other systems will use
|
||||
single quotes ('') around the urls in calls via wget
|
||||
v8 Dec 01, 2003 : makes three tries at downloading
|
||||
v7 Sep 02, 2003 : added error messages if "Click on..." or "src_id="
|
||||
not found in downloaded webpage
|
||||
Uses t_ti, t_te, and rs to make progress visible
|
||||
v6 Aug 06, 2003 : final status messages now display summary of work
|
||||
( "Downloaded someqty scripts" or
|
||||
"Everything was current")
|
||||
Now GetLatestVimScripts is careful about downloading
|
||||
GetLatestVimScripts.vim itself!
|
||||
(goes to <NEW_GetLatestVimScripts.vim>)
|
||||
v5 Aug 04, 2003 : missing an endif near bottom
|
||||
v4 Jun 17, 2003 : redraw! just before each "considering" message
|
||||
v3 May 27, 2003 : Protects downloaded files from errant shell
|
||||
expansions with single quotes: '...'
|
||||
v2 May 14, 2003 : extracts name of item to be obtained from the
|
||||
script file. Uses it instead of comment field
|
||||
for output filename; comment is used in the
|
||||
"considering..." line and is now just a comment!
|
||||
* Fixed a bug: a string-of-numbers is not the
|
||||
same as a number, so I added zero to them
|
||||
and they became numbers. Fixes comparison.
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:fdm=marker
|
||||
710
doc/project.txt
Normal file
710
doc/project.txt
Normal file
@@ -0,0 +1,710 @@
|
||||
*project.txt* Plugin for managing multiple projects with multiple sources
|
||||
For Vim version 6.x and Vim version 7.x.
|
||||
Last Change: Fri 13 Oct 2006 10:20:13 AM EDT
|
||||
|
||||
|
||||
By Aric Blumer
|
||||
aricvim email-at-sign charter.net
|
||||
|
||||
*project* *project-plugin*
|
||||
Contents:
|
||||
|
||||
Commands...................|project-invoking|
|
||||
Inheritance.............|project-inheritance|
|
||||
Mappings...................|project-mappings|
|
||||
Adding Mappings.....|project-adding-mappings|
|
||||
Settings...................|project-settings|
|
||||
Example File................|project-example|
|
||||
Tips...........................|project-tips|
|
||||
|
||||
|
||||
You can use this plugin's basic functionality to set up a list of
|
||||
frequently-accessed files for easy navigation. The list of files will be
|
||||
displayed in a window on the left side of the Vim window, and you can press
|
||||
<Return> or double-click on filenames in the list to open the files. I find
|
||||
this easier to use than having to navigate a directory hierarchy with the
|
||||
|file-explorer|.
|
||||
|
||||
You can also instruct the Plugin to change to a directory and to run Vim
|
||||
scripts when you select a file. These scripts can, for example, modify the
|
||||
environment to include compilers in $PATH. This makes it very easy to use
|
||||
quickfix with multiple projects that use different environments.
|
||||
|
||||
Other features include:
|
||||
o Loading/Unloading all the files in a Project (\l, \L, \w, and \W)
|
||||
o Grepping all the files in a Project (\g and \G)
|
||||
o Running a user-specified script on a file (can be used to launch an
|
||||
external program on the file) (\1 through \9)
|
||||
o Running a user-specified script on all the files in a Project
|
||||
(\f1-\f9 and \F1-\F9)
|
||||
o High degree of user-configurability
|
||||
o Also works with |netrw| using the XXXX://... notation where XXXX is
|
||||
ftp, rcp, scp, or http.
|
||||
|
||||
All of this is specified within a simple text file and a few global variables
|
||||
in your vimrc file.
|
||||
|
||||
You must set 'nocompatible' in your |vimrc| file to use this plugin. You can
|
||||
stop the plugin from being loaded by setting the "loaded_project" variable: >
|
||||
:let loaded_project = 1
|
||||
|
||||
|
||||
==============================================================================
|
||||
COMMANDS *project-invoking*
|
||||
|
||||
You can use the plugin by placing it in your plugin directory (e.g.,
|
||||
~/.vim/plugin). See |add-global-plugin|. When you start vim the next time, you
|
||||
then enter the command >
|
||||
:Project
|
||||
or >
|
||||
:Project {file}
|
||||
|
||||
If you do not specify the filename, $HOME/.vimprojects is used.
|
||||
|
||||
To have Vim come up with the Project Window enabled automatically (say, from a
|
||||
GUI launcher), run Vim like this: [g]vim +Project
|
||||
|
||||
Note that you can invoke :Project on only one file at a time. If you wish to
|
||||
change the Project File, do a :bwipe in the Project Buffer, then re-invoke the
|
||||
Plugin as described above.
|
||||
|
||||
Several Projects can be kept and displayed in the same file, each in a fold
|
||||
delimited by { and } (see |fold.txt|). There can be any number of nested
|
||||
folds to provide you with a Project hierarchy. Any line without a { or a } in
|
||||
the file is considered to be a filename. Blank lines are ignored, and any
|
||||
text after a # is ignored.
|
||||
|
||||
Because the plugin uses standard Vim folds, you can use any of the
|
||||
|fold-commands|. You can double-click on the first line of a fold to open and
|
||||
close it. You can select a file to open by putting the cursor on its name and
|
||||
pressing <Return> or by double-clicking on it. The plugin will create a new
|
||||
window to the right or use the |CTRL-W_p| equivalent if it exists.
|
||||
|
||||
*project-syntax*
|
||||
Each Project Entry has this form:
|
||||
|
||||
project_entry ::=
|
||||
<Description>={projpath} [{options}] {
|
||||
[ filename ]
|
||||
[ project_entry ]
|
||||
}
|
||||
|
||||
{options} is one or more of the following (on the same line):
|
||||
CD={path}
|
||||
in={filename}
|
||||
out={filename}
|
||||
filter="{pat}"
|
||||
flags={flag}
|
||||
|
||||
Note that a project_entry can reside within a project_entry. This allows you
|
||||
to set up a hierarchy within your Project.
|
||||
|
||||
The <Description> will be displayed in the foldtext and cannot contain "=".
|
||||
There can be no space character directly on either side of the =.
|
||||
|
||||
The {projpath} is the path in which the files listed in the Project's fold
|
||||
will be found, and it may contain environment variables. If the path is a
|
||||
relative path, then the plugin constructs the whole path from the Project's
|
||||
parent, grandparent, etc., all the way up the hierarchy. An outermost
|
||||
project_entry must have an absolute path. See the |project-inheritance|
|
||||
example below. {projpath} may contain spaces, but they must be escaped like
|
||||
normal Vim escapes. Here are two examples of the same directory:
|
||||
>
|
||||
Example=/my/directory/with\ spaces {
|
||||
}
|
||||
Example="/my/directory/with spaces" {
|
||||
}
|
||||
|
||||
I recommend this for Windows<77>: >
|
||||
|
||||
Example="c:\My Documents" {
|
||||
}
|
||||
|
||||
But Vim is smart enough to do this, too: >
|
||||
|
||||
Example=c:\My\ Documents {
|
||||
}
|
||||
|
||||
CD= provides the directory that Vim will change to when you select a file in
|
||||
that fold (using |:cd|). This allows you, for example, to enter |:make| to use
|
||||
the local Makefile. A CD=. means that Vim will make {projpath} or its
|
||||
inherited equivalent the current working directory. When CD is omitted, the
|
||||
directory is not changed. There can be no space on either side of the =. The
|
||||
value of CD can also be a relative path from a parent's CD. See the
|
||||
|project-inheritance| example below. This directive is ignored for |netrw|
|
||||
projects. Spaces are allowed in the path as for {projpath}.
|
||||
|
||||
in= and out= provide the means to run arbitrary Vim scripts whenever you enter
|
||||
or leave a file's buffer (see the |BufEnter| and |BufLeave| autocommand
|
||||
events). The idea is to have a Vim script that sets up or tears down the
|
||||
environment for the Project like this:
|
||||
|
||||
in.vim: >
|
||||
let $PROJECT_HOME='~/my_project'
|
||||
" Put the compiler in $PATH
|
||||
if $PATH !~ '/path/to/my/compiler'
|
||||
let $PATH=$PATH.':/path/to/my/compiler'
|
||||
endif
|
||||
|
||||
out.vim: >
|
||||
" Remove compiler from $PATH
|
||||
if $PATH =~ '/path/to/my/compiler'
|
||||
let $PATH=substitute($PATH, ':/path/to/my/compiler', '', 'g')
|
||||
endif
|
||||
|
||||
Then you can use :make with the proper environment depending on what file you
|
||||
are currently editing. If the path to the script is relative, then it is
|
||||
relative from {projpath}. These directives are inherited by Subprojects
|
||||
unless the Subproject specifies its own. For use with |netrw| projects, the
|
||||
paths specified for in= and out= must be absolute and local.
|
||||
|
||||
filter= specifies a |glob()| file pattern. It is used to regenerate the list
|
||||
of files in a Project fold when using the \r (<LocalLeader>r) map in the
|
||||
Project Window. The filter value must be in quotes because it can contain
|
||||
multiple file patterns. If filter is omitted, then the * pattern is used.
|
||||
There can be no space on either side of the =. A Subproject will inherit the
|
||||
filter of its parent unless it specifies its own filter.
|
||||
|
||||
flags= provides the means to enable/disable features for a particular fold.
|
||||
The general mnemonic scheme is for lower case to turn something off and upper
|
||||
case to turn something on. {flag} can contain any of the following
|
||||
characters:
|
||||
|
||||
flag Description ~
|
||||
|
||||
l Turn off recursion for this fold for \L. Subfolds are also
|
||||
blocked from the recursion.
|
||||
|
||||
r Turn off refresh. When present, do not refresh this fold when
|
||||
\r or \R is used. This does not affect subfold recursion.
|
||||
|
||||
S Turn on sorting for refresh and create.
|
||||
|
||||
s Turn off sorting for refresh and create.
|
||||
|
||||
T Turn on top gravity. Forces folds to the top of the current
|
||||
fold when refreshing. It has the same affect as the 'T' flag
|
||||
in g:proj_flags, but controls the feature on a per-fold basis.
|
||||
|
||||
t Turn off top gravity. Forces folds to the bottom of the
|
||||
current fold when refreshing.
|
||||
|
||||
w Turn off recursion for this fold for \W. Subfolds are also
|
||||
blocked from the recursion.
|
||||
|
||||
|
||||
Flags are not inherited by Subprojects.
|
||||
|
||||
Any text outside a fold is ignored.
|
||||
|
||||
|
||||
==============================================================================
|
||||
INHERITANCE *project-inheritance*
|
||||
|
||||
It's best to show inheritance by comparing these two Project Files:
|
||||
>
|
||||
Parent=~/my_project CD=. filter="Make* *.mk" flags=r {
|
||||
Child1=c_code {
|
||||
}
|
||||
Child2=include CD=. filter="*.h" {
|
||||
}
|
||||
}
|
||||
|
||||
Child1's path is "~/my_project/c_code" because ~/my_project is inherited. It
|
||||
also inherits the CD from Parent. Since Parent has CD=., the Parent's cwd is
|
||||
"~/my_project". Child1 therefore inherits a CD of "~/my_project". Finally,
|
||||
Child1 inherits the filter from Parent. The flags are not inherited.
|
||||
|
||||
Child2 only inherits the "~/my_project" from Parent.
|
||||
|
||||
Thus, the example above is exactly equivalent to this:
|
||||
>
|
||||
Parent=~/my_project CD=. filter="Make* *.mk" flags=r {
|
||||
Child1=~/my_project/c_code CD=~/my_project filter="Make* *.mk" {
|
||||
}
|
||||
Child2=~/my_project/include CD=~/my_project/include filter="*.h" {
|
||||
}
|
||||
}
|
||||
|
||||
(For a real Project, Child1 would not want to inherit its parent's filter, but
|
||||
this example shows the concept.) You can always enter \i to display what the
|
||||
cursor's project inherits.
|
||||
|
||||
|
||||
==============================================================================
|
||||
MAPPINGS *project-mappings*
|
||||
|
||||
Map Action ~
|
||||
|
||||
\r Refreshes the Project fold that the cursor is in by placing in the
|
||||
fold all the files that match the filter. The Project is refreshed
|
||||
using an indent of one space for every foldlevel in the hierarchy.
|
||||
|
||||
You may place a "# pragma keep" (without the quotes) at the end of a
|
||||
line, and the file entry on that line will not be removed when you
|
||||
refresh. This is useful, for example, when you have . as an entry so
|
||||
you can easily browse the directory.
|
||||
|
||||
Note that this mapping is actually <LocalLeader>r, and the default of
|
||||
|<LocalLeader>| is \.
|
||||
|
||||
This does not work for Projects using |netrw|.
|
||||
|
||||
\R Executes \r recursively in the current fold and all folds below.
|
||||
This does not work for Projects using |netrw|.
|
||||
|
||||
\c Creates a Project fold entry. It asks for the description, the path
|
||||
to the files, the CD parameter, and the filename |glob()| pattern.
|
||||
From this information, it will create the Project Entry below the
|
||||
cursor.
|
||||
|
||||
This does not work for Projects using |netrw|.
|
||||
|
||||
\C Creates a Project fold entry like \c, but recursively includes all the
|
||||
subdirectories.
|
||||
|
||||
<Return>
|
||||
Select a file to open in the |CTRL-W_p| window or in a new window. If
|
||||
the cursor is on a fold, open or close it.
|
||||
|
||||
<S-Return>
|
||||
\s
|
||||
Same as <Return> but horizontally split the target window.
|
||||
<LocalLeader>s is provided for those terminals that don't recognize
|
||||
<S-Return>.
|
||||
|
||||
\S
|
||||
Load all files in a project by doing horizontal splits.
|
||||
|
||||
<C-Return>
|
||||
\o
|
||||
Same as <Return> but ensure that the opened file is the only other
|
||||
window. <LocalLeader>o is provided for those terminals that don't
|
||||
recognize <C-Return>.
|
||||
|
||||
<M-Return>
|
||||
\v
|
||||
Same as <Return> but only display the file--the cursor stays in the
|
||||
Project Window.
|
||||
|
||||
<2-LeftMouse>
|
||||
(Double-click) If on a closed fold, open it. If on an open fold
|
||||
boundary, close it. If on a filename, open the file in the |CTRL-W_p|
|
||||
window or in a new window.
|
||||
|
||||
<S-2-LeftMouse>
|
||||
Same as <S-Return>.
|
||||
|
||||
<C-2-LeftMouse>
|
||||
Same as <C-Return>.
|
||||
|
||||
<RightMouse>
|
||||
Increase the width of the Project Window by g:proj_window_increment or
|
||||
toggle between a width of
|
||||
g:proj_window_width + g:proj_window_increment
|
||||
and
|
||||
g:proj_window_width.
|
||||
|
||||
Whether you toggle or monotonically increase the width is determined
|
||||
by the 't' flag of the g:proj_flags variable (see |project-flags|).
|
||||
|
||||
Note that a Right Mouse click will not automatically place the cursor
|
||||
in the Project Window if it is in a different window. The window will
|
||||
go back to the g:proj_window_width width when you leave the window.
|
||||
|
||||
<space> Same as <RightMouse>
|
||||
|
||||
<CTRL-Up>
|
||||
\<Up>
|
||||
Move the text or fold under the cursor up one row. This may not work
|
||||
in a terminal because the terminal is unaware of this key combination.
|
||||
<LocalLeader><Up> is provided for those terminals that don't recognize
|
||||
<C-Up>.
|
||||
|
||||
|
||||
<CTRL-Down>
|
||||
\<Down>
|
||||
Move the text or fold under the cursor down one row. This may not work
|
||||
in a terminal because the terminal is unaware of this key combination.
|
||||
<LocalLeader><Down> is provided for those terminals that don't
|
||||
recognize <C-Down>.
|
||||
|
||||
\i Show in the status line the completely resolved and inherited
|
||||
parameters for the fold the cursor is in. This is intended for
|
||||
debugging your relative path and inherited parameters for manually
|
||||
entered Projects.
|
||||
|
||||
\I Show in the status line the completely resolved filename. Uses the
|
||||
Project_GetFname(line('.')) function.
|
||||
|
||||
\1 - \9
|
||||
Run the command specified in g:proj_run{x} where {x} is the number
|
||||
of the key. See the documentation of g:proj_run1 below.
|
||||
|
||||
\f1-\f9
|
||||
Run the command specified in g:proj_run_fold{x} where {x} is the
|
||||
number of the key. The command is run on the files at the current
|
||||
Project level. See the |project-settings| below.
|
||||
|
||||
\F1-\F9
|
||||
Run the command specified in g:proj_run_fold{x} where {x} is the
|
||||
number of the key. The command is run on the files at the current
|
||||
Project level and all Subprojects. See the |project-settings| below.
|
||||
|
||||
\0 Display the commands that are defined for \1 through \9.
|
||||
|
||||
\f0 Display the commands that are defined for \f1 through \f9 and \F1
|
||||
through \F0. Same as \F0.
|
||||
|
||||
\l Load all the files in the current Project level into Vim. While files
|
||||
are being loaded, you may press any key to stop.
|
||||
|
||||
\L Load all the files in the current Project and all Subprojects into
|
||||
Vim. Use this mapping with caution--I wouldn't suggest using \L to
|
||||
load a Project with thousands of files. (BTW, my Project file has more
|
||||
than 5,300 files in it!) While files are being loaded, you may press
|
||||
any key to stop.
|
||||
|
||||
\w Wipe all the files in the current Project level from Vim. (If files
|
||||
are modified, they will be saved first.) While files are being wiped,
|
||||
you may press any key to stop.
|
||||
|
||||
\W Wipe all the files in the current Project and all Subprojects from
|
||||
Vim. (If files are modified, they will be saved first.) While files
|
||||
are being wiped, you may press any key to stop.
|
||||
|
||||
\g Grep all the files in the current Project level.
|
||||
|
||||
\G Grep all the files in the current Project level and all Subprojects.
|
||||
|
||||
\e Set up the Environment for the Project File as though you had selected
|
||||
it with <Return>. This allows you to do a \e and a :make without
|
||||
having to open any files in the project.
|
||||
|
||||
\E Explore (using |file-explorer|) the directory of the project the
|
||||
cursor is in. Does not work with netrw.
|
||||
|
||||
<F12> When the 'g' flag is present in g:proj_flags (see |project-flags|)
|
||||
this key toggles the Project Window open and closed. You may remap
|
||||
this toggle function by putting the following in your vimrc and
|
||||
replacing <Leader>P with whatever key combination you wish:
|
||||
|
||||
nmap <silent> <Leader>P <Plug>ToggleProject
|
||||
|
||||
Note that the Project Plugin remaps :help because the Help Window and the
|
||||
Project Window get into a fight over placement. The mapping avoids the
|
||||
problem.
|
||||
|
||||
==============================================================================
|
||||
ADDING MAPPINGS *project-adding-mappings*
|
||||
|
||||
You can add your own mappings or change the mappings of the plugin by placing
|
||||
them in the file $HOME/.vimproject_mappings. This file, if it exists, will be
|
||||
sourced when the plugin in loaded. Here is an example that will count the
|
||||
number of entries in a project when you press \K (Kount, C is taken :-): >
|
||||
|
||||
function! s:Wc()
|
||||
let b:loadcount=0
|
||||
function! SpawnExec(infoline, fname, lineno, data)
|
||||
let b:loadcount = b:loadcount + 1
|
||||
if getchar(0) != 0 | let b:stop_everything=1 | endif
|
||||
endfunction
|
||||
call Project_ForEach(1, line('.'), "*SpawnExec", 0, '')
|
||||
delfunction SpawnExec
|
||||
echon b:loadcount." Files\r"
|
||||
unlet b:loadcount
|
||||
if exists("b:stop_everything")
|
||||
unlet b:stop_everything
|
||||
echon "Aborted.\r"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <buffer> <silent> <LocalLeader>K :call <SID>Wc()<CR>
|
||||
|
||||
Here's another example of how I integrated the use of perforce with the plugin
|
||||
in my $HOME/.vimproject_mappings:
|
||||
>
|
||||
function! s:DoP4(cmd)
|
||||
let name=Project_GetFname(line('.'))
|
||||
let dir=substitute(name, '\(.*\)/.*', '\1', 'g')
|
||||
exec 'cd '.dir
|
||||
exec "!".a:cmd.' '.Project_GetFname(line('.'))
|
||||
cd -
|
||||
endfunction
|
||||
|
||||
nmap <buffer> <silent> \pa :call <SID>DoP4("p4add")<CR>
|
||||
nmap <buffer> <silent> \pe :call <SID>DoP4("p4edit")<CR>
|
||||
<
|
||||
(Note that I CD to the directory the file is in so I can pick of the $P4CONFIG
|
||||
file. See the perforce documentation.)
|
||||
|
||||
This creates the mappings \pe to check out the file for edit and \pa to add
|
||||
the file to the depot.
|
||||
|
||||
Here is another example where I remap the <Return> mapping to use an external
|
||||
program to launch a special kind of file (in this case, it launches ee to view
|
||||
a jpg file). It is a bit contrived, but it works.
|
||||
>
|
||||
let s:sid = substitute(maparg('<Return>', 'n'), '.*\(<SNR>.\{-}\)_.*', '\1', '')
|
||||
function! s:LaunchOrWhat()
|
||||
let fname=Project_GetFname(line('.'))
|
||||
if fname =~ '\.jpg$'
|
||||
exec 'silent! !ee "'.fname.'"&'
|
||||
else
|
||||
call {s:sid}_DoFoldOrOpenEntry('', 'e')
|
||||
endif
|
||||
endfunction
|
||||
nnoremap <buffer> <silent> <Return> \|:call <SID>LaunchOrWhat()<CR>
|
||||
<
|
||||
If the file ends in .jpg, the external program is launched, otherwise the
|
||||
original mapping of <Return> is run.
|
||||
|
||||
==============================================================================
|
||||
SETTINGS *project-settings*
|
||||
|
||||
You can set these variables in your vimrc file before the plugin is loaded to
|
||||
change its default behavior
|
||||
|
||||
g:proj_window_width
|
||||
The width of the Project Window that the plugin attempts to maintain.
|
||||
Default: 24
|
||||
|
||||
The Project Plugin is not always successful in keeping the window
|
||||
where I want it with the size specified here, but it does a decent
|
||||
job.
|
||||
|
||||
g:proj_window_increment
|
||||
The increment by which to increase the width of the Project Window
|
||||
when pressing <space> or clicking the <LeftMouse>. Default: 100
|
||||
(See |project-mappings|.)
|
||||
|
||||
*project-flags*
|
||||
g:proj_flags
|
||||
Default: "imst"
|
||||
Various flags to control the behavior of the Project Plugin. This
|
||||
variable can contain any of the following character flags.
|
||||
|
||||
flag Description ~
|
||||
|
||||
b When present, use the |browse()| when selecting directories
|
||||
for \c and \C. This is off by default for Windows, because
|
||||
the windows browser does not allow you to select directories.
|
||||
|
||||
c When present, the Project Window will automatically close when
|
||||
you select a file.
|
||||
|
||||
F Float the Project Window. That is, turn off automatic
|
||||
resizing and placement. This allows placement between other
|
||||
windows that wish to share similar placement at the side of
|
||||
the screen. It is also particularly helpful for external
|
||||
window managers.
|
||||
|
||||
g When present, the mapping for <F12> will be created to toggle
|
||||
the Project Window open and closed.
|
||||
|
||||
i When present, display the filename and the current working
|
||||
directory in the command line when a file is selected for
|
||||
opening.
|
||||
|
||||
l When present, the Project Plugin will use the |:lcd| command
|
||||
rather than |:cd| to change directories when you select a file
|
||||
to open. This flag is really obsolete and not of much use
|
||||
because of L below.
|
||||
|
||||
L Similar to l, but install a BufEnter/Leave |:autocommand| to
|
||||
ensure that the current working directory is changed to the
|
||||
one specified in the fold CD specification whenever that
|
||||
buffer is active. (|:lcd| only changes the CWD for a window,
|
||||
not a buffer.)
|
||||
|
||||
m Turn on mapping of the |CTRL-W_o| and |CTRL-W_CTRL_O| normal
|
||||
mode commands to make the current buffer the only visible
|
||||
buffer, but keep the Project Window visible, too.
|
||||
|
||||
n When present, numbers will be turned on for the project
|
||||
window.
|
||||
|
||||
s When present, the Project Plugin will use syntax highlighting
|
||||
in the Project Window.
|
||||
|
||||
S Turn on sorting for refresh and create.
|
||||
|
||||
t When present, toggle the size of the window rather than just
|
||||
increase the size when pressing <space> or right-clicking.
|
||||
See the entry for <RightMouse> in |project-mappings|.
|
||||
|
||||
T When present, put Subproject folds at the top of the fold when
|
||||
refreshing.
|
||||
|
||||
v When present, use :vimgrep rather than :grep when using \G.
|
||||
|
||||
g:proj_run1 ... g:proj_run9
|
||||
Contains a Vim command to execute on the file. See the
|
||||
mappings of \1 to \9 above.
|
||||
|
||||
%f is replaced with the full path and filename
|
||||
%F is replaced with the full path and filename with spaces
|
||||
quoted
|
||||
%n is replaced with the filename alone
|
||||
%N is replaced with the filename alone with spaces quoted
|
||||
%h is replaced with the home directory
|
||||
%H is replaced with the home directory with spaces quoted
|
||||
%r is replaced with the directory relative to the CD path
|
||||
%R is replaced with the directory relative to the CD path
|
||||
with spaces quoted
|
||||
%d is replaced with the CD directory.
|
||||
%D is replaced with the CD directory.with spaces quoted
|
||||
%% is replaced with a single % that is not used in
|
||||
expansion.
|
||||
|
||||
(Deprecated: %s is also replaced with the full path and
|
||||
filename for backward compatibility.)
|
||||
|
||||
For example, gvim will be launched on the file under the
|
||||
cursor when you enter \3 if the following is in your vimrc
|
||||
file: >
|
||||
let g:proj_run3='silent !gvim %f'
|
||||
< Here are a few other examples: >
|
||||
let g:proj_run1='!p4 edit %f'
|
||||
let g:proj_run2='!p4 add %f'
|
||||
let g:proj_run4="echo 'Viewing %f'|sil !xterm -e less %f &"
|
||||
<
|
||||
On Windows systems you will want to put the %f, %h, and %d in
|
||||
single quotes to avoid \ escaping.
|
||||
|
||||
g:proj_run_fold1 ... g:proj_run_fold9
|
||||
Contains a Vim command to execute on the files in a fold. See
|
||||
the mappings of \f1 to \f9 and \F1 to \F9 above.
|
||||
|
||||
%f is the filename, %h is replaced with the project home
|
||||
directory, and %d is replaced with the CD directory. Multiple
|
||||
filenames can be handled in two ways:
|
||||
|
||||
The first (default) way is to have %f replaced with all the
|
||||
absolute filenames, and the command is run once. The second
|
||||
is to have the command run for each of the non-absolute
|
||||
filenames (%f is replaced with one filename at a time). To
|
||||
select the second behavior, put an '*' character at the
|
||||
beginning of the g:proj_run_fold{x} variable. (The '*' is
|
||||
stripped before the command is run.)
|
||||
|
||||
For example, note the difference between the following: >
|
||||
let g:proj_run_fold3="*echo '%h/%f'"
|
||||
let g:proj_run_fold4="echo '%f'"
|
||||
<
|
||||
Note that on Windows systems, you will want the %f, %h, and %c
|
||||
within single quotes, or the \ in the paths will cause
|
||||
problems. The alternative is to put them in |escape()|.
|
||||
|
||||
|
||||
==============================================================================
|
||||
PROJECT EXAMPLE FILE *project-example*
|
||||
|
||||
Here is an example ~/.vimprojects file: >
|
||||
|
||||
1 My Project=~/c/project CD=. in=in.vim out=out.vim flags=r {
|
||||
2 Makefile
|
||||
3 in.vim
|
||||
4 out.vim
|
||||
5 GUI Files=. filter="gui*.c gui*.h" {
|
||||
6 gui_window.c
|
||||
7 gui_dialog.c
|
||||
8 gui_list.c
|
||||
9 gui.h # Header file
|
||||
10 }
|
||||
11 Database Files=. filter="data*.c data*.h" {
|
||||
12 data_read.c
|
||||
13 data_write.c
|
||||
14 data.h
|
||||
15 }
|
||||
16 OS-Specific Files {
|
||||
17 Win32=. filter="os_win32*.c os_win32*.h" {
|
||||
18 os_win32_gui.c
|
||||
19 os_win32_io.c
|
||||
20 }
|
||||
21 Unix=. filter="os_unix*.c os_unix*.h" {
|
||||
22 os_unix_gui.c
|
||||
23 os_unix_io.c
|
||||
24 }
|
||||
25 }
|
||||
26 }
|
||||
|
||||
(Don't type in the line numbers, of course.)
|
||||
|
||||
|
||||
==============================================================================
|
||||
TIPS ON USING PROJECT PLUGIN *project-tips*
|
||||
|
||||
1. You can create a Project Entry by entering this: >
|
||||
|
||||
Label=~/wherever CD=. filter="*.c *.h" {
|
||||
}
|
||||
<
|
||||
Then you can put the cursor in the fold and press \r. The script will fill
|
||||
in the files (C files in this case) from this directory for you. This is
|
||||
equivalent to \c without any dialogs.
|
||||
|
||||
2. You can edit the Project File at any time to add, remove, or reorder files
|
||||
in the Project list.
|
||||
|
||||
3. If the Project Window ever gets closed, you can just enter >
|
||||
:Project
|
||||
< to bring it back again. (You don't need to give it the filename; the
|
||||
plugin remembers.)
|
||||
|
||||
If you have the 'm' flag set in g:proj_flags, then you get the Project
|
||||
Window to show up again by pressing |CTRL-W_o|. This, of course, will
|
||||
close any other windows that may be open that the cursor is not in.
|
||||
|
||||
4. Adding files to a Project is very easy. To add, for example, the 'more.c'
|
||||
file to the Project, just insert the filename in the Project Entry then
|
||||
hit <Return> on it.
|
||||
|
||||
5. When |quickfix| loads files, it is not equivalent to pressing <Return> on
|
||||
a filename, so the directory will not be changed and the scripts will not
|
||||
be run. (If I could make this otherwise, I would.) The solution is to use
|
||||
the \L key to load all of the files in the Project before running
|
||||
quickfix.
|
||||
|
||||
6. If the Project window gets a bit cluttered with folds partially
|
||||
open/closed, you can press |zM| to close everything and tidy it up.
|
||||
|
||||
7. For advanced users, I am exporting the function Project_GetAllFnames()
|
||||
which returns all the filenames within a fold and optionally all its
|
||||
Subprojects. Also, I export Project_ForEach() for running a function for
|
||||
each filename in the project. See the code for examples on how to use
|
||||
these. Finally, I export Project_GetFname(line_number) so that you can
|
||||
write your own mappings and get the filename for it.
|
||||
|
||||
8. Some people have asked how to do a global mapping to take the cursor to
|
||||
the Project window. One of my goals for the plugin is for it to be as
|
||||
self-contained as possible, so I'm not going to add it by default. But you
|
||||
can put this in your vimrc:
|
||||
>
|
||||
nmap <silent> <Leader>P :Project<CR>
|
||||
|
||||
<
|
||||
9. You can put the . entry in a project, and it will launch the
|
||||
|file-explorer| plugin on the directory. To avoid removal when you
|
||||
refresh, make the entry look like this:
|
||||
>
|
||||
. # pragma keep
|
||||
<
|
||||
==============================================================================
|
||||
THANKS
|
||||
|
||||
The following people have sent me patches to help with the Project
|
||||
Plugin development:
|
||||
|
||||
Tomas Zellerin
|
||||
Lawrence Kesteloot
|
||||
Dave Eggum
|
||||
A Harrison
|
||||
Thomas Link
|
||||
Richard Bair
|
||||
Eric Arnold
|
||||
Peter Jones
|
||||
Eric Van Dewoestine
|
||||
|
||||
|
||||
vim:ts=8 sw=8 noexpandtab tw=78 ft=help:
|
||||
264
doc/showmarks.txt
Normal file
264
doc/showmarks.txt
Normal file
@@ -0,0 +1,264 @@
|
||||
*showmarks.txt* Visually show the location of marks
|
||||
|
||||
By Anthony Kruize <trandor@labyrinth.net.au>
|
||||
Michael Geddes <michaelrgeddes@optushome.com.au>
|
||||
|
||||
|
||||
ShowMarks provides a visual representation of |marks| local to a buffer.
|
||||
Marks are useful for jumping back and forth between interesting points in a
|
||||
buffer, but can be hard to keep track of without any way to see where you have
|
||||
placed them.
|
||||
|
||||
ShowMarks hopefully makes life easier by placing a |sign| in the
|
||||
leftmost column of the buffer. The sign indicates the label of the mark and
|
||||
its location.
|
||||
|
||||
ShowMarks is activated by the |CursorHold| |autocommand| which is triggered
|
||||
every |updatetime| milliseconds. This is set to 4000(4 seconds) by default.
|
||||
If this is too slow, setting it to a lower value will make it more responsive.
|
||||
|
||||
Note: This plugin requires Vim 6.x compiled with the |+signs| feature.
|
||||
|
||||
===============================================================================
|
||||
1. Contents *showmarks* *showmarks-contents*
|
||||
|
||||
1. Contents |showmarks-contents|
|
||||
2. Configuration |showmarks-configuration|
|
||||
3. Highlighting |showmarks-highlighting|
|
||||
4. Key mappings |showmarks-mappings|
|
||||
5. Commands |showmarks-commands|
|
||||
6. ChangeLog |showmarks-changelog|
|
||||
|
||||
Appendix
|
||||
A. Using marks |marks|
|
||||
B. Using signs |sign|
|
||||
C. Defining updatetime |updatetime|
|
||||
D. Defining a mapleader |mapleader|
|
||||
E. Defining highlighting |highlight|
|
||||
|
||||
===============================================================================
|
||||
2. Configuration *showmarks-configuration*
|
||||
|
||||
ShowMarks can be configured to suit your needs.
|
||||
The following options can be added to your |vimrc| to change how ShowMarks
|
||||
behaves:
|
||||
|
||||
*'showmarks_enable'*
|
||||
'showmarks_enable' boolean (default: 1)
|
||||
global
|
||||
This option enables or disables ShowMarks on startup. Normally ShowMarks
|
||||
will be enabled when Vim starts, setting this to 0 will disable ShowMarks
|
||||
by default.
|
||||
ShowMarks can be turned back on using the |ShowMarksToggle| command.
|
||||
|
||||
*'showmarks_include'*
|
||||
'showmarks_include' string (default:
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.'`^<>[]{}()\"")
|
||||
global or local to buffer
|
||||
This option specifies which marks will be shown and in which order if
|
||||
placed on the same line. Marks earlier in the list take precedence over
|
||||
marks later in the list.
|
||||
This option can also be specified as a buffer option which will override
|
||||
the global version.
|
||||
|
||||
NOTE: When including the " mark, it must be escaped with a \.
|
||||
|
||||
For example to only include marks 'abcdefzxABHJio', in that order:
|
||||
>
|
||||
let g:showmarks_include="abcdefzxABJio"
|
||||
<
|
||||
To override this for a particular buffer with 'ABCDhj.'^':
|
||||
>
|
||||
let b:showmarks_include="abcdefzxABJio"
|
||||
<
|
||||
*'showmarks_ignore_type'*
|
||||
'showmarks_ignore_type' string (default: "hq")
|
||||
global
|
||||
This option defines which types of buffers should be ignored.
|
||||
Each type is represented by a letter. This option is not case-sensitive.
|
||||
Valid buffer types are:
|
||||
- h : Help
|
||||
- m : Non-modifiable
|
||||
- p : Preview
|
||||
- q : Quickfix
|
||||
- r : Readonly
|
||||
|
||||
For example to ignore help, preview and readonly files:
|
||||
>
|
||||
let g:showmarks_ignore_type="hpr"
|
||||
<
|
||||
*'showmarks_ignore_name'*
|
||||
'showmarks_textlower' string (default: ">" )
|
||||
global
|
||||
This option defines how the marks a-z will be displayed.
|
||||
A maximum of two characters can be defined.
|
||||
To include the mark in the text use a tab(\t) character. A single
|
||||
character will display as the mark with the character suffixed (same as
|
||||
"\t<character>"). Specifying two characters will simply display those two
|
||||
characters.
|
||||
|
||||
Some examples:
|
||||
To display the mark with a > suffixed: >
|
||||
let g:showmarks_textlower="\t>"
|
||||
< or >
|
||||
let g:showmarks_textlower=">"
|
||||
<
|
||||
To display the mark with a ( prefixed: >
|
||||
let g:showmarks_textlower="(\t"
|
||||
<
|
||||
To display two > characters: >
|
||||
let g:showmarks_textlower=">>"
|
||||
<
|
||||
*'showmarks_textupper'*
|
||||
'showmarks_textupper' string (default: ">")
|
||||
global
|
||||
This option defines how the marks A-Z will be displayed. It behaves the same
|
||||
as the |'showmarks_textlower'| option.
|
||||
|
||||
*'showmarks_textother'*
|
||||
'showmarks_textother' string (default: ">")
|
||||
global
|
||||
This option defines how all other marks will be displayed. It behaves the
|
||||
same as the |'showmarks_textlower'| option.
|
||||
|
||||
'showmarks_hlline_lower' boolean (default: 0) *'showmarks_hlline_lower'*
|
||||
global
|
||||
This option defines whether the entire line a lowercase mark is on will
|
||||
be highlighted.
|
||||
|
||||
'showmarks_hlline_upper' boolean (default: 0) *'showmarks_hlline_upper'*
|
||||
global
|
||||
This option defines whether the entire line an uppercase mark is on will
|
||||
be highlighted.
|
||||
|
||||
'showmarks_hlline_other' boolean (default: 0) *'showmarks_hlline_other'*
|
||||
global
|
||||
This option defines whether the entire line other marks are on will be
|
||||
highlighted.
|
||||
|
||||
===============================================================================
|
||||
3. Highlighting *showmarks-highlighting*
|
||||
|
||||
Four highlighting groups are used by ShowMarks to define the colours used to
|
||||
highlight each of the marks.
|
||||
|
||||
- ShowMarksHLl : This group is used to highlight all the lowercase marks.
|
||||
- ShowMarksHLu : This group is used to highlight all the uppercase marks.
|
||||
- ShowMarksHLo : This group is used to highlight all other marks.
|
||||
- ShowMarksHLm : This group is used when multiple marks are on the same line.
|
||||
|
||||
You can define your own highlighting by overriding these groups in your |vimrc|.
|
||||
For example: >
|
||||
|
||||
highlight ShowMarksHLl guifg=red guibg=green
|
||||
<
|
||||
Will set all lowercase marks to be red on green when running in GVim.
|
||||
See |highlight| for more information.
|
||||
|
||||
===============================================================================
|
||||
4. Mappings *showmarks-mappings*
|
||||
|
||||
The following mappings are setup by default:
|
||||
|
||||
<Leader>mt - Toggles ShowMarks on and off.
|
||||
<Leader>mo - Forces ShowMarks on.
|
||||
<Leader>mh - Clears the mark at the current line.
|
||||
<Leader>ma - Clears all marks in the current buffer.
|
||||
<Leader>mm - Places the next available mark on the current line.
|
||||
|
||||
(see |mapleader| for how to setup the mapleader variable.)
|
||||
|
||||
===============================================================================
|
||||
5. Commands *showmarks-commands*
|
||||
|
||||
*ShowMarksToggle*
|
||||
:ShowMarksToggle
|
||||
This command will toggle the display of marks on or off.
|
||||
|
||||
|
||||
:ShowMarksOn *ShowMarksOn*
|
||||
This command will force the display of marks on.
|
||||
|
||||
*ShowMarksClearMark*
|
||||
:ShowMarksClearMark
|
||||
This command will clear the mark on the current line.
|
||||
It doesn't actually remove the mark, it simply moves it to line 1 and
|
||||
removes the sign.
|
||||
|
||||
*ShowMarksClearAll*
|
||||
:ShowMarksClearAll
|
||||
This command will clear all marks in the current buffer.
|
||||
It doesn't actually remove the marks, it simply moves them to line 1 and
|
||||
removes the signs.
|
||||
|
||||
*ShowMarksPlaceMark*
|
||||
:ShowMarksPlaceMark
|
||||
This command will place the next available mark on the current line. This
|
||||
effectively automates mark placement so you don't have to remember which
|
||||
marks are placed or not. Hidden marks are considered to be available.
|
||||
NOTE: Only marks a-z are supported by this function.
|
||||
|
||||
===============================================================================
|
||||
6. ChangeLog *showmarks-changelog*
|
||||
|
||||
2.2 - 2004-08-17
|
||||
Fixed highlighting of the A-Z marks when ignorecase is on. (Mike Kelly)
|
||||
Fixed the delay with ShowMarks triggering when entering a buffer for the
|
||||
first time. (Mikolaj Machowski)
|
||||
Added support for highlighting the entire line where a mark is placed.
|
||||
Now uses HelpExtractor by Charles E. Campbell to install the help file.
|
||||
|
||||
2.1 - 2004-03-04
|
||||
Added ShowMarksOn. It forces ShowMarks to be enabled whether it's on or not.
|
||||
(Gary Holloway)
|
||||
Marks now have a definable order of precedence for when mulitple alpha marks
|
||||
have been placed on the same line. A new highlight group, ShowMarksHLm is
|
||||
used to identify this situation. (Gary Holloway)
|
||||
- showmarks_include has changed accordingly.
|
||||
- ShowMarksHL is now ShowMarksHLl.
|
||||
ShowMarksPlaceMark now places marks in the order specified by
|
||||
showmarks_include. (Gary Holloway)
|
||||
showmarks_include can now be specified per buffer. (Gary Holloway)
|
||||
|
||||
2.0 - 2003-08-11
|
||||
Added ability to ignore buffers by type.
|
||||
Fixed toggling ShowMarks off when switching buffers.
|
||||
ShowMarksHideMark and ShowMarksHideAll have been renamed to
|
||||
ShowMarksClearMark and ShowMarksClearAll.
|
||||
Marks a-z, A-Z and others now have different highlighting from each other.
|
||||
Added support for all other marks. (Gary Holloway)
|
||||
Enhanced customization of how marks are displayed by allowing a prefix to
|
||||
be specified.(Gary Holloway & Anthony Kruize)
|
||||
Fixed CursorHold autocmd triggering even when ShowMarks is disabled.
|
||||
(Charles E. Campbell)
|
||||
|
||||
1.5 - 2002-07-16
|
||||
Added ability to customize how the marks are displayed.
|
||||
|
||||
1.4 - 2002-05-29
|
||||
Added support for placing the next available mark.
|
||||
(Thanks to Shishir Ramam for the idea)
|
||||
Added support for hiding all marks.
|
||||
Marks on line 1 are no longer shown. This stops hidden marks from
|
||||
reappearing when the file is opened again.
|
||||
Added a help file.
|
||||
|
||||
1.3 - 2002-05-20
|
||||
Fixed toggling ShowMarks not responding immediately.
|
||||
Added user commands for toggling/hiding marks.
|
||||
Added ability to disable ShowMarks by default.
|
||||
|
||||
1.2 - 2002-03-06
|
||||
Added a check that Vim was compiled with +signs support.
|
||||
Added the ability to define which marks are shown.
|
||||
Removed debugging code that was accidently left in.
|
||||
|
||||
1.1 - 2002-02-05
|
||||
Added support for the A-Z marks.
|
||||
Fixed sign staying placed if the line it was on is deleted.
|
||||
Clear autocommands before making new ones.
|
||||
|
||||
1.0 - 2001-11-20
|
||||
First release.
|
||||
|
||||
vim:tw=78:ts=8:ft=help
|
||||
286
doc/snipMate.txt
Normal file
286
doc/snipMate.txt
Normal file
@@ -0,0 +1,286 @@
|
||||
*snipMate.txt* Plugin for using TextMate-style snippets in Vim.
|
||||
|
||||
snipMate *snippet* *snippets* *snipMate*
|
||||
Last Change: July 13, 2009
|
||||
|
||||
|snipMate-description| Description
|
||||
|snipMate-syntax| Snippet syntax
|
||||
|snipMate-usage| Usage
|
||||
|snipMate-settings| Settings
|
||||
|snipMate-features| Features
|
||||
|snipMate-disadvantages| Disadvantages to TextMate
|
||||
|snipMate-contact| Contact
|
||||
|
||||
For Vim version 7.0 or later.
|
||||
This plugin only works if 'compatible' is not set.
|
||||
{Vi does not have any of these features.}
|
||||
|
||||
==============================================================================
|
||||
DESCRIPTION *snipMate-description*
|
||||
|
||||
snipMate.vim implements some of TextMate's snippets features in Vim. A
|
||||
snippet is a piece of often-typed text that you can insert into your
|
||||
document using a trigger word followed by a <tab>.
|
||||
|
||||
For instance, in a C file using the default installation of snipMate.vim, if
|
||||
you type "for<tab>" in insert mode, it will expand a typical for loop in C: >
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
To go to the next item in the loop, simply <tab> over to it; if there is
|
||||
repeated code, such as the "i" variable in this example, you can simply
|
||||
start typing once it's highlighted and all the matches specified in the
|
||||
snippet will be updated. To go in reverse, use <shift-tab>.
|
||||
|
||||
==============================================================================
|
||||
SYNTAX *snippet-syntax*
|
||||
|
||||
Snippets can be defined in two ways. They can be in their own file, named
|
||||
after their trigger in 'snippets/<filetype>/<trigger>.snippet', or they can be
|
||||
defined together in a 'snippets/<filetype>.snippets' file. Note that dotted
|
||||
'filetype' syntax is supported -- e.g., you can use >
|
||||
|
||||
:set ft=html.eruby
|
||||
|
||||
to activate snippets for both HTML and eRuby for the current file.
|
||||
|
||||
The syntax for snippets in *.snippets files is the following: >
|
||||
|
||||
snippet trigger
|
||||
expanded text
|
||||
more expanded text
|
||||
|
||||
Note that the first hard tab after the snippet trigger is required, and not
|
||||
expanded in the actual snippet. The syntax for *.snippet files is the same,
|
||||
only without the trigger declaration and starting indentation.
|
||||
|
||||
Also note that snippets must be defined using hard tabs. They can be expanded
|
||||
to spaces later if desired (see |snipMate-indenting|).
|
||||
|
||||
"#" is used as a line-comment character in *.snippets files; however, they can
|
||||
only be used outside of a snippet declaration. E.g.: >
|
||||
|
||||
# this is a correct comment
|
||||
snippet trigger
|
||||
expanded text
|
||||
snippet another_trigger
|
||||
# this isn't a comment!
|
||||
expanded text
|
||||
<
|
||||
This should hopefully be obvious with the included syntax highlighting.
|
||||
|
||||
*snipMate-${#}*
|
||||
Tab stops ~
|
||||
|
||||
By default, the cursor is placed at the end of a snippet. To specify where the
|
||||
cursor is to be placed next, use "${#}", where the # is the number of the tab
|
||||
stop. E.g., to place the cursor first on the id of a <div> tag, and then allow
|
||||
the user to press <tab> to go to the middle of it:
|
||||
>
|
||||
snippet div
|
||||
<div id="${1}">
|
||||
${2}
|
||||
</div>
|
||||
<
|
||||
*snipMate-placeholders* *snipMate-${#:}* *snipMate-$#*
|
||||
Placeholders ~
|
||||
|
||||
Placeholder text can be supplied using "${#:text}", where # is the number of
|
||||
the tab stop. This text then can be copied throughout the snippet using "$#",
|
||||
given # is the same number as used before. So, to make a C for loop: >
|
||||
|
||||
snippet for
|
||||
for (${2:i}; $2 < ${1:count}; $1++) {
|
||||
${4}
|
||||
}
|
||||
|
||||
This will cause "count" to first be selected and change if the user starts
|
||||
typing. When <tab> is pressed, the "i" in ${2}'s position will be selected;
|
||||
all $2 variables will default to "i" and automatically be updated if the user
|
||||
starts typing.
|
||||
NOTE: "$#" syntax is used only for variables, not for tab stops as in TextMate.
|
||||
|
||||
Variables within variables are also possible. For instance: >
|
||||
|
||||
snippet opt
|
||||
<option value="${1:option}">${2:$1}</option>
|
||||
|
||||
Will, as usual, cause "option" to first be selected and update all the $1
|
||||
variables if the user starts typing. Since one of these variables is inside of
|
||||
${2}, this text will then be used as a placeholder for the next tab stop,
|
||||
allowing the user to change it if he wishes.
|
||||
|
||||
To copy a value throughout a snippet without supplying default text, simply
|
||||
use the "${#:}" construct without the text; e.g.: >
|
||||
|
||||
snippet foo
|
||||
${1:}bar$1
|
||||
< *snipMate-commands*
|
||||
Interpolated Vim Script ~
|
||||
|
||||
Snippets can also contain Vim script commands that are executed (via |eval()|)
|
||||
when the snippet is inserted. Commands are given inside backticks (`...`); for
|
||||
TextMates's functionality, use the |system()| function. E.g.: >
|
||||
|
||||
snippet date
|
||||
`system("date +%Y-%m-%d")`
|
||||
|
||||
will insert the current date, assuming you are on a Unix system. Note that you
|
||||
can also (and should) use |strftime()| for this example.
|
||||
|
||||
Filename([{expr}] [, {defaultText}]) *snipMate-filename* *Filename()*
|
||||
|
||||
Since the current filename is used often in snippets, a default function
|
||||
has been defined for it in snipMate.vim, appropriately called Filename().
|
||||
|
||||
With no arguments, the default filename without an extension is returned;
|
||||
the first argument specifies what to place before or after the filename,
|
||||
and the second argument supplies the default text to be used if the file
|
||||
has not been named. "$1" in the first argument is replaced with the filename;
|
||||
if you only want the filename to be returned, the first argument can be left
|
||||
blank. Examples: >
|
||||
|
||||
snippet filename
|
||||
`Filename()`
|
||||
snippet filename_with_default
|
||||
`Filename('', 'name')`
|
||||
snippet filename_foo
|
||||
`filename('$1_foo')`
|
||||
|
||||
The first example returns the filename if it the file has been named, and an
|
||||
empty string if it hasn't. The second returns the filename if it's been named,
|
||||
and "name" if it hasn't. The third returns the filename followed by "_foo" if
|
||||
it has been named, and an empty string if it hasn't.
|
||||
|
||||
*multi_snip*
|
||||
To specify that a snippet can have multiple matches in a *.snippets file, use
|
||||
this syntax: >
|
||||
|
||||
snippet trigger A description of snippet #1
|
||||
expand this text
|
||||
snippet trigger A description of snippet #2
|
||||
expand THIS text!
|
||||
|
||||
In this example, when "trigger<tab>" is typed, a numbered menu containing all
|
||||
of the descriptions of the "trigger" will be shown; when the user presses the
|
||||
corresponding number, that snippet will then be expanded.
|
||||
|
||||
To create a snippet with multiple matches using *.snippet files,
|
||||
simply place all the snippets in a subdirectory with the trigger name:
|
||||
'snippets/<filetype>/<trigger>/<name>.snippet'.
|
||||
|
||||
==============================================================================
|
||||
USAGE *snipMate-usage*
|
||||
|
||||
*'snippets'* *g:snippets_dir*
|
||||
Snippets are by default looked for any 'snippets' directory in your
|
||||
'runtimepath'. Typically, it is located at '~/.vim/snippets/' on *nix or
|
||||
'$HOME\vimfiles\snippets\' on Windows. To change that location or add another
|
||||
one, change the g:snippets_dir variable in your |.vimrc| to your preferred
|
||||
directory, or use the |ExtractSnips()|function. This will be used by the
|
||||
|globpath()| function, and so accepts the same syntax as it (e.g.,
|
||||
comma-separated paths).
|
||||
|
||||
ExtractSnipsFile({directory}, {filetype}) *ExtractSnipsFile()* *.snippets*
|
||||
|
||||
ExtractSnipsFile() extracts the specified *.snippets file for the given
|
||||
filetype. A .snippets file contains multiple snippet declarations for the
|
||||
filetype. It is further explained above, in |snippet-syntax|.
|
||||
|
||||
ExtractSnips({directory}, {filetype}) *ExtractSnips()* *.snippet*
|
||||
|
||||
ExtractSnips() extracts *.snippet files from the specified directory and
|
||||
defines them as snippets for the given filetype. The directory tree should
|
||||
look like this: 'snippets/<filetype>/<trigger>.snippet'. If the snippet has
|
||||
multiple matches, it should look like this:
|
||||
'snippets/<filetype>/<trigger>/<name>.snippet' (see |multi_snip|).
|
||||
|
||||
*ResetSnippets()*
|
||||
The ResetSnippets() function removes all snippets from memory. This is useful
|
||||
to put at the top of a snippet setup file for if you would like to |:source|
|
||||
it multiple times.
|
||||
|
||||
*list-snippets* *i_CTRL-R_<Tab>*
|
||||
If you would like to see what snippets are available, simply type <c-r><tab>
|
||||
in the current buffer to show a list via |popupmenu-completion|.
|
||||
|
||||
==============================================================================
|
||||
SETTINGS *snipMate-settings* *g:snips_author*
|
||||
|
||||
The g:snips_author string (similar to $TM_FULLNAME in TextMate) should be set
|
||||
to your name; it can then be used in snippets to automatically add it. E.g.: >
|
||||
|
||||
let g:snips_author = 'Hubert Farnsworth'
|
||||
snippet name
|
||||
`g:snips_author`
|
||||
<
|
||||
*snipMate-expandtab* *snipMate-indenting*
|
||||
If you would like your snippets to be expanded using spaces instead of tabs,
|
||||
just enable 'expandtab' and set 'softtabstop' to your preferred amount of
|
||||
spaces. If 'softtabstop' is not set, 'shiftwidth' is used instead.
|
||||
|
||||
*snipMate-remap*
|
||||
snipMate does not come with a setting to customize the trigger key, but you
|
||||
can remap it easily in the two lines it's defined in the 'after' directory
|
||||
under 'plugin/snipMate.vim'. For instance, to change the trigger key
|
||||
to CTRL-J, just change this: >
|
||||
|
||||
ino <tab> <c-r>=TriggerSnippet()<cr>
|
||||
snor <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
|
||||
|
||||
to this: >
|
||||
ino <c-j> <c-r>=TriggerSnippet()<cr>
|
||||
snor <c-j> <esc>i<right><c-r>=TriggerSnippet()<cr>
|
||||
|
||||
==============================================================================
|
||||
FEATURES *snipMate-features*
|
||||
|
||||
snipMate.vim has the following features among others:
|
||||
- The syntax of snippets is very similar to TextMate's, allowing
|
||||
easy conversion.
|
||||
- The position of the snippet is kept transparently (i.e. it does not use
|
||||
markers/placeholders written to the buffer), which allows you to escape
|
||||
out of an incomplete snippet, something particularly useful in Vim.
|
||||
- Variables in snippets are updated as-you-type.
|
||||
- Snippets can have multiple matches.
|
||||
- Snippets can be out of order. For instance, in a do...while loop, the
|
||||
condition can be added before the code.
|
||||
- [New] File-based snippets are supported.
|
||||
- [New] Triggers after non-word delimiters are expanded, e.g. "foo"
|
||||
in "bar.foo".
|
||||
- [New] <shift-tab> can now be used to jump tab stops in reverse order.
|
||||
|
||||
==============================================================================
|
||||
DISADVANTAGES *snipMate-disadvantages*
|
||||
|
||||
snipMate.vim currently has the following disadvantages to TextMate's snippets:
|
||||
- There is no $0; the order of tab stops must be explicitly stated.
|
||||
- Placeholders within placeholders are not possible. E.g.: >
|
||||
|
||||
'<div${1: id="${2:some_id}}">${3}</div>'
|
||||
<
|
||||
In TextMate this would first highlight ' id="some_id"', and if
|
||||
you hit delete it would automatically skip ${2} and go to ${3}
|
||||
on the next <tab>, but if you didn't delete it it would highlight
|
||||
"some_id" first. You cannot do this in snipMate.vim.
|
||||
- Regex cannot be performed on variables, such as "${1/.*/\U&}"
|
||||
- Placeholders cannot span multiple lines.
|
||||
- Activating snippets in different scopes of the same file is
|
||||
not possible.
|
||||
|
||||
Perhaps some of these features will be added in a later release.
|
||||
|
||||
==============================================================================
|
||||
CONTACT *snipMate-contact* *snipMate-author*
|
||||
|
||||
To contact the author (Michael Sanders), please email:
|
||||
msanders42+snipmate <at> gmail <dot> com
|
||||
|
||||
I greatly appreciate any suggestions or improvements offered for the script.
|
||||
|
||||
==============================================================================
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
1501
doc/taglist.txt
Normal file
1501
doc/taglist.txt
Normal file
File diff suppressed because it is too large
Load Diff
625
doc/tags
Normal file
625
doc/tags
Normal file
@@ -0,0 +1,625 @@
|
||||
'NERDChristmasTree' NERD_tree.txt /*'NERDChristmasTree'*
|
||||
'NERDTreeAutoCenter' NERD_tree.txt /*'NERDTreeAutoCenter'*
|
||||
'NERDTreeAutoCenterThreshold' NERD_tree.txt /*'NERDTreeAutoCenterThreshold'*
|
||||
'NERDTreeBookmarksFile' NERD_tree.txt /*'NERDTreeBookmarksFile'*
|
||||
'NERDTreeCaseSensitiveSort' NERD_tree.txt /*'NERDTreeCaseSensitiveSort'*
|
||||
'NERDTreeChDirMode' NERD_tree.txt /*'NERDTreeChDirMode'*
|
||||
'NERDTreeHighlightCursorline' NERD_tree.txt /*'NERDTreeHighlightCursorline'*
|
||||
'NERDTreeHijackNetrw' NERD_tree.txt /*'NERDTreeHijackNetrw'*
|
||||
'NERDTreeIgnore' NERD_tree.txt /*'NERDTreeIgnore'*
|
||||
'NERDTreeMouseMode' NERD_tree.txt /*'NERDTreeMouseMode'*
|
||||
'NERDTreeQuitOnOpen' NERD_tree.txt /*'NERDTreeQuitOnOpen'*
|
||||
'NERDTreeShowBookmarks' NERD_tree.txt /*'NERDTreeShowBookmarks'*
|
||||
'NERDTreeShowFiles' NERD_tree.txt /*'NERDTreeShowFiles'*
|
||||
'NERDTreeShowHidden' NERD_tree.txt /*'NERDTreeShowHidden'*
|
||||
'NERDTreeShowLineNumbers' NERD_tree.txt /*'NERDTreeShowLineNumbers'*
|
||||
'NERDTreeSortOrder' NERD_tree.txt /*'NERDTreeSortOrder'*
|
||||
'NERDTreeStatusline' NERD_tree.txt /*'NERDTreeStatusline'*
|
||||
'NERDTreeWinPos' NERD_tree.txt /*'NERDTreeWinPos'*
|
||||
'NERDTreeWinSize' NERD_tree.txt /*'NERDTreeWinSize'*
|
||||
'Tlist_Auto_Highlight_Tag' taglist.txt /*'Tlist_Auto_Highlight_Tag'*
|
||||
'Tlist_Auto_Open' taglist.txt /*'Tlist_Auto_Open'*
|
||||
'Tlist_Auto_Update' taglist.txt /*'Tlist_Auto_Update'*
|
||||
'Tlist_Close_On_Select' taglist.txt /*'Tlist_Close_On_Select'*
|
||||
'Tlist_Compact_Format' taglist.txt /*'Tlist_Compact_Format'*
|
||||
'Tlist_Ctags_Cmd' taglist.txt /*'Tlist_Ctags_Cmd'*
|
||||
'Tlist_Display_Prototype' taglist.txt /*'Tlist_Display_Prototype'*
|
||||
'Tlist_Display_Tag_Scope' taglist.txt /*'Tlist_Display_Tag_Scope'*
|
||||
'Tlist_Enable_Fold_Column' taglist.txt /*'Tlist_Enable_Fold_Column'*
|
||||
'Tlist_Exit_OnlyWindow' taglist.txt /*'Tlist_Exit_OnlyWindow'*
|
||||
'Tlist_File_Fold_Auto_Close' taglist.txt /*'Tlist_File_Fold_Auto_Close'*
|
||||
'Tlist_GainFocus_On_ToggleOpen' taglist.txt /*'Tlist_GainFocus_On_ToggleOpen'*
|
||||
'Tlist_Highlight_Tag_On_BufEnter' taglist.txt /*'Tlist_Highlight_Tag_On_BufEnter'*
|
||||
'Tlist_Inc_Winwidth' taglist.txt /*'Tlist_Inc_Winwidth'*
|
||||
'Tlist_Max_Submenu_Items' taglist.txt /*'Tlist_Max_Submenu_Items'*
|
||||
'Tlist_Max_Tag_Length' taglist.txt /*'Tlist_Max_Tag_Length'*
|
||||
'Tlist_Process_File_Always' taglist.txt /*'Tlist_Process_File_Always'*
|
||||
'Tlist_Show_Menu' taglist.txt /*'Tlist_Show_Menu'*
|
||||
'Tlist_Show_One_File' taglist.txt /*'Tlist_Show_One_File'*
|
||||
'Tlist_Sort_Type' taglist.txt /*'Tlist_Sort_Type'*
|
||||
'Tlist_Use_Horiz_Window' taglist.txt /*'Tlist_Use_Horiz_Window'*
|
||||
'Tlist_Use_Right_Window' taglist.txt /*'Tlist_Use_Right_Window'*
|
||||
'Tlist_Use_SingleClick' taglist.txt /*'Tlist_Use_SingleClick'*
|
||||
'Tlist_WinHeight' taglist.txt /*'Tlist_WinHeight'*
|
||||
'Tlist_WinWidth' taglist.txt /*'Tlist_WinWidth'*
|
||||
'b:delimitMate_autoclose' delimitMate.txt /*'b:delimitMate_autoclose'*
|
||||
'b:delimitMate_expand_cr' delimitMate.txt /*'b:delimitMate_expand_cr'*
|
||||
'b:delimitMate_expand_space' delimitMate.txt /*'b:delimitMate_expand_space'*
|
||||
'b:delimitMate_matchpairs' delimitMate.txt /*'b:delimitMate_matchpairs'*
|
||||
'b:delimitMate_quotes' delimitMate.txt /*'b:delimitMate_quotes'*
|
||||
'b:delimitMate_visual_leader' delimitMate.txt /*'b:delimitMate_visual_leader'*
|
||||
'b:loaded_delimitMate' delimitMate.txt /*'b:loaded_delimitMate'*
|
||||
'delimitMate_apostrophes' delimitMate.txt /*'delimitMate_apostrophes'*
|
||||
'delimitMate_autoclose' delimitMate.txt /*'delimitMate_autoclose'*
|
||||
'delimitMate_excluded_ft' delimitMate.txt /*'delimitMate_excluded_ft'*
|
||||
'delimitMate_expand_cr' delimitMate.txt /*'delimitMate_expand_cr'*
|
||||
'delimitMate_expand_space' delimitMate.txt /*'delimitMate_expand_space'*
|
||||
'delimitMate_matchpairs' delimitMate.txt /*'delimitMate_matchpairs'*
|
||||
'delimitMate_quotes' delimitMate.txt /*'delimitMate_quotes'*
|
||||
'delimitMate_visual_leader' delimitMate.txt /*'delimitMate_visual_leader'*
|
||||
'loaded_delimitMate' delimitMate.txt /*'loaded_delimitMate'*
|
||||
'loaded_nerd_tree' NERD_tree.txt /*'loaded_nerd_tree'*
|
||||
'showmarks_enable' showmarks.txt /*'showmarks_enable'*
|
||||
'showmarks_hlline_lower' showmarks.txt /*'showmarks_hlline_lower'*
|
||||
'showmarks_hlline_other' showmarks.txt /*'showmarks_hlline_other'*
|
||||
'showmarks_hlline_upper' showmarks.txt /*'showmarks_hlline_upper'*
|
||||
'showmarks_ignore_name' showmarks.txt /*'showmarks_ignore_name'*
|
||||
'showmarks_ignore_type' showmarks.txt /*'showmarks_ignore_type'*
|
||||
'showmarks_include' showmarks.txt /*'showmarks_include'*
|
||||
'showmarks_textother' showmarks.txt /*'showmarks_textother'*
|
||||
'showmarks_textupper' showmarks.txt /*'showmarks_textupper'*
|
||||
'snippets' snipMate.txt /*'snippets'*
|
||||
.snippet snipMate.txt /*.snippet*
|
||||
.snippets snipMate.txt /*.snippets*
|
||||
:CVSEdit vcscommand.txt /*:CVSEdit*
|
||||
:CVSEditors vcscommand.txt /*:CVSEditors*
|
||||
:CVSUnedit vcscommand.txt /*:CVSUnedit*
|
||||
:CVSWatch vcscommand.txt /*:CVSWatch*
|
||||
:CVSWatchAdd vcscommand.txt /*:CVSWatchAdd*
|
||||
:CVSWatchOff vcscommand.txt /*:CVSWatchOff*
|
||||
:CVSWatchOn vcscommand.txt /*:CVSWatchOn*
|
||||
:CVSWatchRemove vcscommand.txt /*:CVSWatchRemove*
|
||||
:CVSWatchers vcscommand.txt /*:CVSWatchers*
|
||||
:DelimitMateReload delimitMate.txt /*:DelimitMateReload*
|
||||
:DelimitMateTest delimitMate.txt /*:DelimitMateTest*
|
||||
:FufAddBookmark fuf.txt /*:FufAddBookmark*
|
||||
:FufAddBookmarkAsSelectedText fuf.txt /*:FufAddBookmarkAsSelectedText*
|
||||
:FufBookmark fuf.txt /*:FufBookmark*
|
||||
:FufBuffer fuf.txt /*:FufBuffer*
|
||||
:FufChangeList fuf.txt /*:FufChangeList*
|
||||
:FufDir fuf.txt /*:FufDir*
|
||||
:FufDirWithCurrentBufferDir fuf.txt /*:FufDirWithCurrentBufferDir*
|
||||
:FufDirWithFullCwd fuf.txt /*:FufDirWithFullCwd*
|
||||
:FufEditInfo fuf.txt /*:FufEditInfo*
|
||||
: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*
|
||||
:FufQuickfix fuf.txt /*:FufQuickfix*
|
||||
:FufRenewCache fuf.txt /*:FufRenewCache*
|
||||
:FufTag fuf.txt /*:FufTag*
|
||||
:FufTagWithCursorWord fuf.txt /*:FufTagWithCursorWord*
|
||||
:FufTaggedFile fuf.txt /*:FufTaggedFile*
|
||||
:GLVS pi_getscript.txt /*:GLVS*
|
||||
:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat*
|
||||
:Mark mark.txt /*:Mark*
|
||||
:NERDTree NERD_tree.txt /*:NERDTree*
|
||||
:NERDTreeClose NERD_tree.txt /*:NERDTreeClose*
|
||||
:NERDTreeFind NERD_tree.txt /*:NERDTreeFind*
|
||||
:NERDTreeFromBookmark NERD_tree.txt /*:NERDTreeFromBookmark*
|
||||
:NERDTreeMirror NERD_tree.txt /*:NERDTreeMirror*
|
||||
:NERDTreeToggle NERD_tree.txt /*:NERDTreeToggle*
|
||||
:TlistAddFiles taglist.txt /*:TlistAddFiles*
|
||||
:TlistAddFilesRecursive taglist.txt /*:TlistAddFilesRecursive*
|
||||
:TlistClose taglist.txt /*:TlistClose*
|
||||
:TlistDebug taglist.txt /*:TlistDebug*
|
||||
:TlistHighlightTag taglist.txt /*:TlistHighlightTag*
|
||||
:TlistLock taglist.txt /*:TlistLock*
|
||||
:TlistMessages taglist.txt /*:TlistMessages*
|
||||
:TlistOpen taglist.txt /*:TlistOpen*
|
||||
:TlistSessionLoad taglist.txt /*:TlistSessionLoad*
|
||||
:TlistSessionSave taglist.txt /*:TlistSessionSave*
|
||||
:TlistShowPrototype taglist.txt /*:TlistShowPrototype*
|
||||
:TlistShowTag taglist.txt /*:TlistShowTag*
|
||||
:TlistToggle taglist.txt /*:TlistToggle*
|
||||
:TlistUndebug taglist.txt /*:TlistUndebug*
|
||||
:TlistUnlock taglist.txt /*:TlistUnlock*
|
||||
:TlistUpdate taglist.txt /*:TlistUpdate*
|
||||
:VCSAdd vcscommand.txt /*:VCSAdd*
|
||||
:VCSAnnotate vcscommand.txt /*:VCSAnnotate*
|
||||
:VCSBlame vcscommand.txt /*:VCSBlame*
|
||||
:VCSCommit vcscommand.txt /*:VCSCommit*
|
||||
:VCSDelete vcscommand.txt /*:VCSDelete*
|
||||
:VCSDiff vcscommand.txt /*:VCSDiff*
|
||||
:VCSGotoOriginal vcscommand.txt /*:VCSGotoOriginal*
|
||||
:VCSInfo vcscommand.txt /*:VCSInfo*
|
||||
:VCSLock vcscommand.txt /*:VCSLock*
|
||||
:VCSLog vcscommand.txt /*:VCSLog*
|
||||
:VCSRemove vcscommand.txt /*:VCSRemove*
|
||||
:VCSRevert vcscommand.txt /*:VCSRevert*
|
||||
:VCSReview vcscommand.txt /*:VCSReview*
|
||||
:VCSStatus vcscommand.txt /*:VCSStatus*
|
||||
:VCSUnlock vcscommand.txt /*:VCSUnlock*
|
||||
:VCSUpdate vcscommand.txt /*:VCSUpdate*
|
||||
:VCSVimDiff vcscommand.txt /*:VCSVimDiff*
|
||||
:VWS vimwiki.txt /*:VWS*
|
||||
:Vimwiki2HTML vimwiki.txt /*:Vimwiki2HTML*
|
||||
:VimwikiAll2HTML vimwiki.txt /*:VimwikiAll2HTML*
|
||||
:VimwikiDeleteWord vimwiki.txt /*:VimwikiDeleteWord*
|
||||
:VimwikiFollowWord vimwiki.txt /*:VimwikiFollowWord*
|
||||
:VimwikiGoBackWord vimwiki.txt /*:VimwikiGoBackWord*
|
||||
:VimwikiGoHome vimwiki.txt /*:VimwikiGoHome*
|
||||
:VimwikiMakeDiaryNote vimwiki.txt /*:VimwikiMakeDiaryNote*
|
||||
:VimwikiNextWord vimwiki.txt /*:VimwikiNextWord*
|
||||
:VimwikiPrevWord vimwiki.txt /*:VimwikiPrevWord*
|
||||
:VimwikiRenameWord vimwiki.txt /*:VimwikiRenameWord*
|
||||
:VimwikiSearch vimwiki.txt /*:VimwikiSearch*
|
||||
:VimwikiSplitWord vimwiki.txt /*:VimwikiSplitWord*
|
||||
:VimwikiTabGoHome vimwiki.txt /*:VimwikiTabGoHome*
|
||||
:VimwikiTabMakeDiaryNote vimwiki.txt /*:VimwikiTabMakeDiaryNote*
|
||||
:VimwikiTable vimwiki.txt /*:VimwikiTable*
|
||||
:VimwikiToggleListItem vimwiki.txt /*:VimwikiToggleListItem*
|
||||
:VimwikiUISelect vimwiki.txt /*:VimwikiUISelect*
|
||||
:VimwikiVSplitWord vimwiki.txt /*:VimwikiVSplitWord*
|
||||
DelimitMate_ExpandReturn() delimitMate.txt /*DelimitMate_ExpandReturn()*
|
||||
DelimitMate_ExpandSpace() delimitMate.txt /*DelimitMate_ExpandSpace()*
|
||||
DelimitMate_JumpAny() delimitMate.txt /*DelimitMate_JumpAny()*
|
||||
DelimitMate_ShouldJump() delimitMate.txt /*DelimitMate_ShouldJump()*
|
||||
ExtractSnips() snipMate.txt /*ExtractSnips()*
|
||||
ExtractSnipsFile() snipMate.txt /*ExtractSnipsFile()*
|
||||
Filename() snipMate.txt /*Filename()*
|
||||
GetLatestVimScripts pi_getscript.txt /*GetLatestVimScripts*
|
||||
GetLatestVimScripts-copyright pi_getscript.txt /*GetLatestVimScripts-copyright*
|
||||
GetLatestVimScripts_dat pi_getscript.txt /*GetLatestVimScripts_dat*
|
||||
NERDTree NERD_tree.txt /*NERDTree*
|
||||
NERDTree-? NERD_tree.txt /*NERDTree-?*
|
||||
NERDTree-A NERD_tree.txt /*NERDTree-A*
|
||||
NERDTree-B NERD_tree.txt /*NERDTree-B*
|
||||
NERDTree-C NERD_tree.txt /*NERDTree-C*
|
||||
NERDTree-C-J NERD_tree.txt /*NERDTree-C-J*
|
||||
NERDTree-C-K NERD_tree.txt /*NERDTree-C-K*
|
||||
NERDTree-D NERD_tree.txt /*NERDTree-D*
|
||||
NERDTree-F NERD_tree.txt /*NERDTree-F*
|
||||
NERDTree-I NERD_tree.txt /*NERDTree-I*
|
||||
NERDTree-J NERD_tree.txt /*NERDTree-J*
|
||||
NERDTree-K NERD_tree.txt /*NERDTree-K*
|
||||
NERDTree-O NERD_tree.txt /*NERDTree-O*
|
||||
NERDTree-P NERD_tree.txt /*NERDTree-P*
|
||||
NERDTree-R NERD_tree.txt /*NERDTree-R*
|
||||
NERDTree-T NERD_tree.txt /*NERDTree-T*
|
||||
NERDTree-U NERD_tree.txt /*NERDTree-U*
|
||||
NERDTree-X NERD_tree.txt /*NERDTree-X*
|
||||
NERDTree-cd NERD_tree.txt /*NERDTree-cd*
|
||||
NERDTree-contents NERD_tree.txt /*NERDTree-contents*
|
||||
NERDTree-e NERD_tree.txt /*NERDTree-e*
|
||||
NERDTree-f NERD_tree.txt /*NERDTree-f*
|
||||
NERDTree-gi NERD_tree.txt /*NERDTree-gi*
|
||||
NERDTree-go NERD_tree.txt /*NERDTree-go*
|
||||
NERDTree-gs NERD_tree.txt /*NERDTree-gs*
|
||||
NERDTree-i NERD_tree.txt /*NERDTree-i*
|
||||
NERDTree-m NERD_tree.txt /*NERDTree-m*
|
||||
NERDTree-o NERD_tree.txt /*NERDTree-o*
|
||||
NERDTree-p NERD_tree.txt /*NERDTree-p*
|
||||
NERDTree-q NERD_tree.txt /*NERDTree-q*
|
||||
NERDTree-r NERD_tree.txt /*NERDTree-r*
|
||||
NERDTree-s NERD_tree.txt /*NERDTree-s*
|
||||
NERDTree-t NERD_tree.txt /*NERDTree-t*
|
||||
NERDTree-u NERD_tree.txt /*NERDTree-u*
|
||||
NERDTree-x NERD_tree.txt /*NERDTree-x*
|
||||
NERDTreeAPI NERD_tree.txt /*NERDTreeAPI*
|
||||
NERDTreeAbout NERD_tree.txt /*NERDTreeAbout*
|
||||
NERDTreeAddKeyMap() NERD_tree.txt /*NERDTreeAddKeyMap()*
|
||||
NERDTreeAddMenuItem() NERD_tree.txt /*NERDTreeAddMenuItem()*
|
||||
NERDTreeAddMenuSeparator() NERD_tree.txt /*NERDTreeAddMenuSeparator()*
|
||||
NERDTreeAddSubmenu() NERD_tree.txt /*NERDTreeAddSubmenu()*
|
||||
NERDTreeBookmarkCommands NERD_tree.txt /*NERDTreeBookmarkCommands*
|
||||
NERDTreeBookmarkTable NERD_tree.txt /*NERDTreeBookmarkTable*
|
||||
NERDTreeBookmarks NERD_tree.txt /*NERDTreeBookmarks*
|
||||
NERDTreeChangelog NERD_tree.txt /*NERDTreeChangelog*
|
||||
NERDTreeCredits NERD_tree.txt /*NERDTreeCredits*
|
||||
NERDTreeFunctionality NERD_tree.txt /*NERDTreeFunctionality*
|
||||
NERDTreeGlobalCommands NERD_tree.txt /*NERDTreeGlobalCommands*
|
||||
NERDTreeInvalidBookmarks NERD_tree.txt /*NERDTreeInvalidBookmarks*
|
||||
NERDTreeKeymapAPI NERD_tree.txt /*NERDTreeKeymapAPI*
|
||||
NERDTreeLicense NERD_tree.txt /*NERDTreeLicense*
|
||||
NERDTreeMappings NERD_tree.txt /*NERDTreeMappings*
|
||||
NERDTreeMenu NERD_tree.txt /*NERDTreeMenu*
|
||||
NERDTreeMenuAPI NERD_tree.txt /*NERDTreeMenuAPI*
|
||||
NERDTreeOptionDetails NERD_tree.txt /*NERDTreeOptionDetails*
|
||||
NERDTreeOptionSummary NERD_tree.txt /*NERDTreeOptionSummary*
|
||||
NERDTreeOptions NERD_tree.txt /*NERDTreeOptions*
|
||||
NERDTreeRender() NERD_tree.txt /*NERDTreeRender()*
|
||||
NERD_tree.txt NERD_tree.txt /*NERD_tree.txt*
|
||||
ResetSnippets() snipMate.txt /*ResetSnippets()*
|
||||
ShowMarksClearAll showmarks.txt /*ShowMarksClearAll*
|
||||
ShowMarksClearMark showmarks.txt /*ShowMarksClearMark*
|
||||
ShowMarksOn showmarks.txt /*ShowMarksOn*
|
||||
ShowMarksPlaceMark showmarks.txt /*ShowMarksPlaceMark*
|
||||
ShowMarksToggle showmarks.txt /*ShowMarksToggle*
|
||||
Tlist_Get_Tag_Prototype_By_Line() taglist.txt /*Tlist_Get_Tag_Prototype_By_Line()*
|
||||
Tlist_Get_Tagname_By_Line() taglist.txt /*Tlist_Get_Tagname_By_Line()*
|
||||
Tlist_Set_App() taglist.txt /*Tlist_Set_App()*
|
||||
Tlist_Update_File_Tags() taglist.txt /*Tlist_Update_File_Tags()*
|
||||
VCSCommandCVSDiffOpt vcscommand.txt /*VCSCommandCVSDiffOpt*
|
||||
VCSCommandCVSExec vcscommand.txt /*VCSCommandCVSExec*
|
||||
VCSCommandCommitOnWrite vcscommand.txt /*VCSCommandCommitOnWrite*
|
||||
VCSCommandDeleteOnHide vcscommand.txt /*VCSCommandDeleteOnHide*
|
||||
VCSCommandDiffSplit vcscommand.txt /*VCSCommandDiffSplit*
|
||||
VCSCommandDisableAll vcscommand.txt /*VCSCommandDisableAll*
|
||||
VCSCommandDisableExtensionMappings vcscommand.txt /*VCSCommandDisableExtensionMappings*
|
||||
VCSCommandDisableMappings vcscommand.txt /*VCSCommandDisableMappings*
|
||||
VCSCommandEdit vcscommand.txt /*VCSCommandEdit*
|
||||
VCSCommandEnableBufferSetup vcscommand.txt /*VCSCommandEnableBufferSetup*
|
||||
VCSCommandMapPrefix vcscommand.txt /*VCSCommandMapPrefix*
|
||||
VCSCommandMappings vcscommand.txt /*VCSCommandMappings*
|
||||
VCSCommandResultBufferNameExtension vcscommand.txt /*VCSCommandResultBufferNameExtension*
|
||||
VCSCommandResultBufferNameFunction vcscommand.txt /*VCSCommandResultBufferNameFunction*
|
||||
VCSCommandSVKExec vcscommand.txt /*VCSCommandSVKExec*
|
||||
VCSCommandSVNDiffExt vcscommand.txt /*VCSCommandSVNDiffExt*
|
||||
VCSCommandSVNDiffOpt vcscommand.txt /*VCSCommandSVNDiffOpt*
|
||||
VCSCommandSVNExec vcscommand.txt /*VCSCommandSVNExec*
|
||||
VCSCommandSplit vcscommand.txt /*VCSCommandSplit*
|
||||
VCSCommandVCSTypeOverride vcscommand.txt /*VCSCommandVCSTypeOverride*
|
||||
VimwikiWeblinkHandler vimwiki.txt /*VimwikiWeblinkHandler*
|
||||
abc fuf.txt /*abc*
|
||||
b:VCSCommandCommand vcscommand.txt /*b:VCSCommandCommand*
|
||||
b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer*
|
||||
b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile*
|
||||
b:VCSCommandVCSType vcscommand.txt /*b:VCSCommandVCSType*
|
||||
cvscommand-changes vcscommand.txt /*cvscommand-changes*
|
||||
delimitMate delimitMate.txt /*delimitMate*
|
||||
delimitMate-contents delimitMate.txt /*delimitMate-contents*
|
||||
delimitMate.txt delimitMate.txt /*delimitMate.txt*
|
||||
delimitMateAutoClose delimitMate.txt /*delimitMateAutoClose*
|
||||
delimitMateBackspace delimitMate.txt /*delimitMateBackspace*
|
||||
delimitMateCommands delimitMate.txt /*delimitMateCommands*
|
||||
delimitMateCredits delimitMate.txt /*delimitMateCredits*
|
||||
delimitMateExpansion delimitMate.txt /*delimitMateExpansion*
|
||||
delimitMateFunctionality delimitMate.txt /*delimitMateFunctionality*
|
||||
delimitMateFunctions delimitMate.txt /*delimitMateFunctions*
|
||||
delimitMateHistory delimitMate.txt /*delimitMateHistory*
|
||||
delimitMateIntro delimitMate.txt /*delimitMateIntro*
|
||||
delimitMateMaintainer delimitMate.txt /*delimitMateMaintainer*
|
||||
delimitMateOptionDetails delimitMate.txt /*delimitMateOptionDetails*
|
||||
delimitMateOptionSummary delimitMate.txt /*delimitMateOptionSummary*
|
||||
delimitMateOptions delimitMate.txt /*delimitMateOptions*
|
||||
delimitMateSmartQuotes delimitMate.txt /*delimitMateSmartQuotes*
|
||||
delimitMateTodo delimitMate.txt /*delimitMateTodo*
|
||||
delimitMateVisualWrapping delimitMate.txt /*delimitMateVisualWrapping*
|
||||
delimitMate_WithinEmptyPair delimitMate.txt /*delimitMate_WithinEmptyPair*
|
||||
fuf fuf.txt /*fuf*
|
||||
fuf-abbreviation fuf.txt /*fuf-abbreviation*
|
||||
fuf-about fuf.txt /*fuf-about*
|
||||
fuf-author fuf.txt /*fuf-author*
|
||||
fuf-bookmark-mode fuf.txt /*fuf-bookmark-mode*
|
||||
fuf-buffer-mode fuf.txt /*fuf-buffer-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-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-information-file fuf.txt /*fuf-information-file*
|
||||
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-Bookmark-mode fuf.txt /*fuf-options-for-Bookmark-mode*
|
||||
fuf-options-for-all-modes fuf.txt /*fuf-options-for-all-modes*
|
||||
fuf-options-for-buffer-mode fuf.txt /*fuf-options-for-buffer-mode*
|
||||
fuf-options-for-changelist-mode fuf.txt /*fuf-options-for-changelist-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-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_bookmark_keyDelete fuf.txt /*g:fuf_bookmark_keyDelete*
|
||||
g:fuf_bookmark_prompt fuf.txt /*g:fuf_bookmark_prompt*
|
||||
g:fuf_bookmark_searchRange fuf.txt /*g:fuf_bookmark_searchRange*
|
||||
g:fuf_bookmark_switchOrder fuf.txt /*g:fuf_bookmark_switchOrder*
|
||||
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_changelist_prompt fuf.txt /*g:fuf_changelist_prompt*
|
||||
g:fuf_changelist_switchOrder fuf.txt /*g:fuf_changelist_switchOrder*
|
||||
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_help_cache_dir fuf.txt /*g:fuf_help_cache_dir*
|
||||
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_infoFile fuf.txt /*g:fuf_infoFile*
|
||||
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_maxItem fuf.txt /*g:fuf_mrufile_maxItem*
|
||||
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_smartBs fuf.txt /*g:fuf_smartBs*
|
||||
g:fuf_splitPathMatching fuf.txt /*g:fuf_splitPathMatching*
|
||||
g:fuf_tag_cache_dir fuf.txt /*g:fuf_tag_cache_dir*
|
||||
g:fuf_tag_prompt fuf.txt /*g:fuf_tag_prompt*
|
||||
g:fuf_tag_switchOrder fuf.txt /*g:fuf_tag_switchOrder*
|
||||
g:fuf_taggedfile_cache_dir fuf.txt /*g:fuf_taggedfile_cache_dir*
|
||||
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*
|
||||
g:snippets_dir snipMate.txt /*g:snippets_dir*
|
||||
g:snips_author snipMate.txt /*g:snips_author*
|
||||
g:vimwiki_auto_checkbox vimwiki.txt /*g:vimwiki_auto_checkbox*
|
||||
g:vimwiki_badsyms vimwiki.txt /*g:vimwiki_badsyms*
|
||||
g:vimwiki_browsers vimwiki.txt /*g:vimwiki_browsers*
|
||||
g:vimwiki_camel_case vimwiki.txt /*g:vimwiki_camel_case*
|
||||
g:vimwiki_fold_lists vimwiki.txt /*g:vimwiki_fold_lists*
|
||||
g:vimwiki_fold_trailing_empty_lines vimwiki.txt /*g:vimwiki_fold_trailing_empty_lines*
|
||||
g:vimwiki_folding vimwiki.txt /*g:vimwiki_folding*
|
||||
g:vimwiki_global_ext vimwiki.txt /*g:vimwiki_global_ext*
|
||||
g:vimwiki_hl_cb_checked vimwiki.txt /*g:vimwiki_hl_cb_checked*
|
||||
g:vimwiki_hl_headers vimwiki.txt /*g:vimwiki_hl_headers*
|
||||
g:vimwiki_list vimwiki.txt /*g:vimwiki_list*
|
||||
g:vimwiki_list_ignore_newline vimwiki.txt /*g:vimwiki_list_ignore_newline*
|
||||
g:vimwiki_listsyms vimwiki.txt /*g:vimwiki_listsyms*
|
||||
g:vimwiki_lower vimwiki.txt /*g:vimwiki_lower*
|
||||
g:vimwiki_menu vimwiki.txt /*g:vimwiki_menu*
|
||||
g:vimwiki_stripsym vimwiki.txt /*g:vimwiki_stripsym*
|
||||
g:vimwiki_table_auto_fmt vimwiki.txt /*g:vimwiki_table_auto_fmt*
|
||||
g:vimwiki_upper vimwiki.txt /*g:vimwiki_upper*
|
||||
g:vimwiki_use_calendar vimwiki.txt /*g:vimwiki_use_calendar*
|
||||
g:vimwiki_use_mouse vimwiki.txt /*g:vimwiki_use_mouse*
|
||||
g:vimwiki_w32_dir_enc vimwiki.txt /*g:vimwiki_w32_dir_enc*
|
||||
getlatestvimscripts-install pi_getscript.txt /*getlatestvimscripts-install*
|
||||
getscript pi_getscript.txt /*getscript*
|
||||
getscript-autoinstall pi_getscript.txt /*getscript-autoinstall*
|
||||
getscript-data pi_getscript.txt /*getscript-data*
|
||||
getscript-history pi_getscript.txt /*getscript-history*
|
||||
getscript-plugins pi_getscript.txt /*getscript-plugins*
|
||||
getscript-start pi_getscript.txt /*getscript-start*
|
||||
glvs pi_getscript.txt /*glvs*
|
||||
glvs-alg pi_getscript.txt /*glvs-alg*
|
||||
glvs-algorithm pi_getscript.txt /*glvs-algorithm*
|
||||
glvs-autoinstall pi_getscript.txt /*glvs-autoinstall*
|
||||
glvs-contents pi_getscript.txt /*glvs-contents*
|
||||
glvs-copyright pi_getscript.txt /*glvs-copyright*
|
||||
glvs-data pi_getscript.txt /*glvs-data*
|
||||
glvs-dist-install pi_getscript.txt /*glvs-dist-install*
|
||||
glvs-hist pi_getscript.txt /*glvs-hist*
|
||||
glvs-install pi_getscript.txt /*glvs-install*
|
||||
glvs-options pi_getscript.txt /*glvs-options*
|
||||
glvs-plugins pi_getscript.txt /*glvs-plugins*
|
||||
glvs-usage pi_getscript.txt /*glvs-usage*
|
||||
i_CTRL-R_<Tab> snipMate.txt /*i_CTRL-R_<Tab>*
|
||||
list-snippets snipMate.txt /*list-snippets*
|
||||
mark-configuration mark.txt /*mark-configuration*
|
||||
mark-dependencies mark.txt /*mark-dependencies*
|
||||
mark-description mark.txt /*mark-description*
|
||||
mark-history mark.txt /*mark-history*
|
||||
mark-ideas mark.txt /*mark-ideas*
|
||||
mark-installation mark.txt /*mark-installation*
|
||||
mark-integration mark.txt /*mark-integration*
|
||||
mark-known-problems mark.txt /*mark-known-problems*
|
||||
mark-limitations mark.txt /*mark-limitations*
|
||||
mark-todo mark.txt /*mark-todo*
|
||||
mark-usage mark.txt /*mark-usage*
|
||||
mark.txt mark.txt /*mark.txt*
|
||||
mark.vim mark.txt /*mark.vim*
|
||||
multi_snip snipMate.txt /*multi_snip*
|
||||
pi_getscript.txt pi_getscript.txt /*pi_getscript.txt*
|
||||
project project.txt /*project*
|
||||
project-adding-mappings project.txt /*project-adding-mappings*
|
||||
project-example project.txt /*project-example*
|
||||
project-flags project.txt /*project-flags*
|
||||
project-inheritance project.txt /*project-inheritance*
|
||||
project-invoking project.txt /*project-invoking*
|
||||
project-mappings project.txt /*project-mappings*
|
||||
project-plugin project.txt /*project-plugin*
|
||||
project-settings project.txt /*project-settings*
|
||||
project-syntax project.txt /*project-syntax*
|
||||
project-tips project.txt /*project-tips*
|
||||
project.txt project.txt /*project.txt*
|
||||
showmarks showmarks.txt /*showmarks*
|
||||
showmarks-changelog showmarks.txt /*showmarks-changelog*
|
||||
showmarks-commands showmarks.txt /*showmarks-commands*
|
||||
showmarks-configuration showmarks.txt /*showmarks-configuration*
|
||||
showmarks-contents showmarks.txt /*showmarks-contents*
|
||||
showmarks-highlighting showmarks.txt /*showmarks-highlighting*
|
||||
showmarks-mappings showmarks.txt /*showmarks-mappings*
|
||||
showmarks.txt showmarks.txt /*showmarks.txt*
|
||||
snipMate snipMate.txt /*snipMate*
|
||||
snipMate-$# snipMate.txt /*snipMate-$#*
|
||||
snipMate-${#:} snipMate.txt /*snipMate-${#:}*
|
||||
snipMate-${#} snipMate.txt /*snipMate-${#}*
|
||||
snipMate-author snipMate.txt /*snipMate-author*
|
||||
snipMate-commands snipMate.txt /*snipMate-commands*
|
||||
snipMate-contact snipMate.txt /*snipMate-contact*
|
||||
snipMate-description snipMate.txt /*snipMate-description*
|
||||
snipMate-disadvantages snipMate.txt /*snipMate-disadvantages*
|
||||
snipMate-expandtab snipMate.txt /*snipMate-expandtab*
|
||||
snipMate-features snipMate.txt /*snipMate-features*
|
||||
snipMate-filename snipMate.txt /*snipMate-filename*
|
||||
snipMate-indenting snipMate.txt /*snipMate-indenting*
|
||||
snipMate-placeholders snipMate.txt /*snipMate-placeholders*
|
||||
snipMate-remap snipMate.txt /*snipMate-remap*
|
||||
snipMate-settings snipMate.txt /*snipMate-settings*
|
||||
snipMate-usage snipMate.txt /*snipMate-usage*
|
||||
snipMate.txt snipMate.txt /*snipMate.txt*
|
||||
snippet snipMate.txt /*snippet*
|
||||
snippet-syntax snipMate.txt /*snippet-syntax*
|
||||
snippets snipMate.txt /*snippets*
|
||||
taglist-commands taglist.txt /*taglist-commands*
|
||||
taglist-debug taglist.txt /*taglist-debug*
|
||||
taglist-extend taglist.txt /*taglist-extend*
|
||||
taglist-faq taglist.txt /*taglist-faq*
|
||||
taglist-functions taglist.txt /*taglist-functions*
|
||||
taglist-install taglist.txt /*taglist-install*
|
||||
taglist-internet taglist.txt /*taglist-internet*
|
||||
taglist-intro taglist.txt /*taglist-intro*
|
||||
taglist-keys taglist.txt /*taglist-keys*
|
||||
taglist-license taglist.txt /*taglist-license*
|
||||
taglist-menu taglist.txt /*taglist-menu*
|
||||
taglist-options taglist.txt /*taglist-options*
|
||||
taglist-requirements taglist.txt /*taglist-requirements*
|
||||
taglist-session taglist.txt /*taglist-session*
|
||||
taglist-todo taglist.txt /*taglist-todo*
|
||||
taglist-using taglist.txt /*taglist-using*
|
||||
taglist.txt taglist.txt /*taglist.txt*
|
||||
vcscommand vcscommand.txt /*vcscommand*
|
||||
vcscommand-buffer-management vcscommand.txt /*vcscommand-buffer-management*
|
||||
vcscommand-buffer-variables vcscommand.txt /*vcscommand-buffer-variables*
|
||||
vcscommand-bugs vcscommand.txt /*vcscommand-bugs*
|
||||
vcscommand-commands vcscommand.txt /*vcscommand-commands*
|
||||
vcscommand-config vcscommand.txt /*vcscommand-config*
|
||||
vcscommand-contents vcscommand.txt /*vcscommand-contents*
|
||||
vcscommand-customize vcscommand.txt /*vcscommand-customize*
|
||||
vcscommand-events vcscommand.txt /*vcscommand-events*
|
||||
vcscommand-install vcscommand.txt /*vcscommand-install*
|
||||
vcscommand-intro vcscommand.txt /*vcscommand-intro*
|
||||
vcscommand-manual vcscommand.txt /*vcscommand-manual*
|
||||
vcscommand-mappings vcscommand.txt /*vcscommand-mappings*
|
||||
vcscommand-mappings-override vcscommand.txt /*vcscommand-mappings-override*
|
||||
vcscommand-naming vcscommand.txt /*vcscommand-naming*
|
||||
vcscommand-options vcscommand.txt /*vcscommand-options*
|
||||
vcscommand-ssh vcscommand.txt /*vcscommand-ssh*
|
||||
vcscommand-ssh-config vcscommand.txt /*vcscommand-ssh-config*
|
||||
vcscommand-ssh-env vcscommand.txt /*vcscommand-ssh-env*
|
||||
vcscommand-ssh-other vcscommand.txt /*vcscommand-ssh-other*
|
||||
vcscommand-ssh-wrapper vcscommand.txt /*vcscommand-ssh-wrapper*
|
||||
vcscommand-statusline vcscommand.txt /*vcscommand-statusline*
|
||||
vcscommand.txt vcscommand.txt /*vcscommand.txt*
|
||||
vimwiki vimwiki.txt /*vimwiki*
|
||||
vimwiki-author vimwiki.txt /*vimwiki-author*
|
||||
vimwiki-calendar vimwiki.txt /*vimwiki-calendar*
|
||||
vimwiki-changelog vimwiki.txt /*vimwiki-changelog*
|
||||
vimwiki-commands vimwiki.txt /*vimwiki-commands*
|
||||
vimwiki-contents vimwiki.txt /*vimwiki-contents*
|
||||
vimwiki-diary vimwiki.txt /*vimwiki-diary*
|
||||
vimwiki-folding vimwiki.txt /*vimwiki-folding*
|
||||
vimwiki-global-commands vimwiki.txt /*vimwiki-global-commands*
|
||||
vimwiki-global-mappings vimwiki.txt /*vimwiki-global-mappings*
|
||||
vimwiki-help vimwiki.txt /*vimwiki-help*
|
||||
vimwiki-license vimwiki.txt /*vimwiki-license*
|
||||
vimwiki-local-commands vimwiki.txt /*vimwiki-local-commands*
|
||||
vimwiki-local-mappings vimwiki.txt /*vimwiki-local-mappings*
|
||||
vimwiki-mappings vimwiki.txt /*vimwiki-mappings*
|
||||
vimwiki-multiple-wikies vimwiki.txt /*vimwiki-multiple-wikies*
|
||||
vimwiki-option-auto_export vimwiki.txt /*vimwiki-option-auto_export*
|
||||
vimwiki-option-css_name vimwiki.txt /*vimwiki-option-css_name*
|
||||
vimwiki-option-diary_header vimwiki.txt /*vimwiki-option-diary_header*
|
||||
vimwiki-option-diary_index vimwiki.txt /*vimwiki-option-diary_index*
|
||||
vimwiki-option-diary_link_count vimwiki.txt /*vimwiki-option-diary_link_count*
|
||||
vimwiki-option-diary_rel_path vimwiki.txt /*vimwiki-option-diary_rel_path*
|
||||
vimwiki-option-ext vimwiki.txt /*vimwiki-option-ext*
|
||||
vimwiki-option-gohome vimwiki.txt /*vimwiki-option-gohome*
|
||||
vimwiki-option-html_footer vimwiki.txt /*vimwiki-option-html_footer*
|
||||
vimwiki-option-html_header vimwiki.txt /*vimwiki-option-html_header*
|
||||
vimwiki-option-index vimwiki.txt /*vimwiki-option-index*
|
||||
vimwiki-option-maxhi vimwiki.txt /*vimwiki-option-maxhi*
|
||||
vimwiki-option-nested_syntaxes vimwiki.txt /*vimwiki-option-nested_syntaxes*
|
||||
vimwiki-option-path vimwiki.txt /*vimwiki-option-path*
|
||||
vimwiki-option-path_html vimwiki.txt /*vimwiki-option-path_html*
|
||||
vimwiki-option-syntax vimwiki.txt /*vimwiki-option-syntax*
|
||||
vimwiki-options vimwiki.txt /*vimwiki-options*
|
||||
vimwiki-placeholders vimwiki.txt /*vimwiki-placeholders*
|
||||
vimwiki-prerequisites vimwiki.txt /*vimwiki-prerequisites*
|
||||
vimwiki-syntax vimwiki.txt /*vimwiki-syntax*
|
||||
vimwiki-syntax-blockquotes vimwiki.txt /*vimwiki-syntax-blockquotes*
|
||||
vimwiki-syntax-comments vimwiki.txt /*vimwiki-syntax-comments*
|
||||
vimwiki-syntax-headers vimwiki.txt /*vimwiki-syntax-headers*
|
||||
vimwiki-syntax-links vimwiki.txt /*vimwiki-syntax-links*
|
||||
vimwiki-syntax-lists vimwiki.txt /*vimwiki-syntax-lists*
|
||||
vimwiki-syntax-paragraphs vimwiki.txt /*vimwiki-syntax-paragraphs*
|
||||
vimwiki-syntax-preformatted vimwiki.txt /*vimwiki-syntax-preformatted*
|
||||
vimwiki-syntax-tables vimwiki.txt /*vimwiki-syntax-tables*
|
||||
vimwiki-syntax-typefaces vimwiki.txt /*vimwiki-syntax-typefaces*
|
||||
vimwiki-table-mappings vimwiki.txt /*vimwiki-table-mappings*
|
||||
vimwiki-table-of-contents vimwiki.txt /*vimwiki-table-of-contents*
|
||||
vimwiki-tables vimwiki.txt /*vimwiki-tables*
|
||||
vimwiki-temporary-wiki vimwiki.txt /*vimwiki-temporary-wiki*
|
||||
vimwiki-text-objects vimwiki.txt /*vimwiki-text-objects*
|
||||
vimwiki-toc vimwiki.txt /*vimwiki-toc*
|
||||
vimwiki-todo-lists vimwiki.txt /*vimwiki-todo-lists*
|
||||
vimwiki.txt vimwiki.txt /*vimwiki.txt*
|
||||
vimwiki_- vimwiki.txt /*vimwiki_-*
|
||||
vimwiki_<Backspace> vimwiki.txt /*vimwiki_<Backspace>*
|
||||
vimwiki_<C-CR> vimwiki.txt /*vimwiki_<C-CR>*
|
||||
vimwiki_<C-Space> vimwiki.txt /*vimwiki_<C-Space>*
|
||||
vimwiki_<CR> vimwiki.txt /*vimwiki_<CR>*
|
||||
vimwiki_<Leader>wd vimwiki.txt /*vimwiki_<Leader>wd*
|
||||
vimwiki_<Leader>wr vimwiki.txt /*vimwiki_<Leader>wr*
|
||||
vimwiki_<S-CR> vimwiki.txt /*vimwiki_<S-CR>*
|
||||
vimwiki_<S-Tab> vimwiki.txt /*vimwiki_<S-Tab>*
|
||||
vimwiki_<Tab> vimwiki.txt /*vimwiki_<Tab>*
|
||||
vimwiki_= vimwiki.txt /*vimwiki_=*
|
||||
vimwiki_gqq vimwiki.txt /*vimwiki_gqq*
|
||||
vimwiki_gww vimwiki.txt /*vimwiki_gww*
|
||||
vimwiki_i_<CR> vimwiki.txt /*vimwiki_i_<CR>*
|
||||
vimwiki_i_<Tab> vimwiki.txt /*vimwiki_i_<Tab>*
|
||||
viwmiki-global-options vimwiki.txt /*viwmiki-global-options*
|
||||
viwmiki-local-options vimwiki.txt /*viwmiki-local-options*
|
||||
143
doc/tags-ja
Normal file
143
doc/tags-ja
Normal file
@@ -0,0 +1,143 @@
|
||||
!_TAG_FILE_ENCODING utf-8 //
|
||||
:FufAddBookmark fuf.jax /*:FufAddBookmark*
|
||||
:FufAddBookmarkAsSelectedText fuf.jax /*:FufAddBookmarkAsSelectedText*
|
||||
:FufBookmark fuf.jax /*:FufBookmark*
|
||||
:FufBuffer fuf.jax /*:FufBuffer*
|
||||
:FufChangeList fuf.jax /*:FufChangeList*
|
||||
:FufDir fuf.jax /*:FufDir*
|
||||
:FufDirWithCurrentBufferDir fuf.jax /*:FufDirWithCurrentBufferDir*
|
||||
:FufDirWithFullCwd fuf.jax /*:FufDirWithFullCwd*
|
||||
:FufEditInfo fuf.jax /*:FufEditInfo*
|
||||
: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*
|
||||
: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-abbreviation fuf.jax /*fuf-abbreviation*
|
||||
fuf-about fuf.jax /*fuf-about*
|
||||
fuf-author fuf.jax /*fuf-author*
|
||||
fuf-bookmark-mode fuf.jax /*fuf-bookmark-mode*
|
||||
fuf-buffer-mode fuf.jax /*fuf-buffer-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-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-information-file fuf.jax /*fuf-information-file*
|
||||
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-Bookmark-mode fuf.jax /*fuf-options-for-Bookmark-mode*
|
||||
fuf-options-for-all-modes fuf.jax /*fuf-options-for-all-modes*
|
||||
fuf-options-for-buffer-mode fuf.jax /*fuf-options-for-buffer-mode*
|
||||
fuf-options-for-changelist-mode fuf.jax /*fuf-options-for-changelist-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-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_bookmark_keyDelete fuf.jax /*g:fuf_bookmark_keyDelete*
|
||||
g:fuf_bookmark_prompt fuf.jax /*g:fuf_bookmark_prompt*
|
||||
g:fuf_bookmark_searchRange fuf.jax /*g:fuf_bookmark_searchRange*
|
||||
g:fuf_bookmark_switchOrder fuf.jax /*g:fuf_bookmark_switchOrder*
|
||||
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_changelist_prompt fuf.jax /*g:fuf_changelist_prompt*
|
||||
g:fuf_changelist_switchOrder fuf.jax /*g:fuf_changelist_switchOrder*
|
||||
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_help_cache_dir fuf.jax /*g:fuf_help_cache_dir*
|
||||
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_infoFile fuf.jax /*g:fuf_infoFile*
|
||||
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_maxItem fuf.jax /*g:fuf_mrufile_maxItem*
|
||||
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_smartBs fuf.jax /*g:fuf_smartBs*
|
||||
g:fuf_splitPathMatching fuf.jax /*g:fuf_splitPathMatching*
|
||||
g:fuf_tag_cache_dir fuf.jax /*g:fuf_tag_cache_dir*
|
||||
g:fuf_tag_prompt fuf.jax /*g:fuf_tag_prompt*
|
||||
g:fuf_tag_switchOrder fuf.jax /*g:fuf_tag_switchOrder*
|
||||
g:fuf_taggedfile_cache_dir fuf.jax /*g:fuf_taggedfile_cache_dir*
|
||||
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*
|
||||
819
doc/vcscommand.txt
Normal file
819
doc/vcscommand.txt
Normal file
@@ -0,0 +1,819 @@
|
||||
*vcscommand.txt* vcscommand
|
||||
Copyright (c) 2007 Bob Hiestand
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
For instructions on installing this file, type
|
||||
:help add-local-help
|
||||
inside Vim.
|
||||
|
||||
Author: Bob Hiestand <bob.hiestand@gmail.com>
|
||||
Credits: Benji Fisher's excellent MatchIt documentation
|
||||
|
||||
==============================================================================
|
||||
1. Contents *vcscommand-contents*
|
||||
|
||||
Installation : |vcscommand-install|
|
||||
vcscommand Intro : |vcscommand|
|
||||
vcscommand Manual : |vcscommand-manual|
|
||||
Customization : |vcscommand-customize|
|
||||
SSH "integration" : |vcscommand-ssh|
|
||||
Changes from cvscommand : |cvscommand-changes|
|
||||
Bugs : |vcscommand-bugs|
|
||||
|
||||
==============================================================================
|
||||
|
||||
2. vcscommand Installation *vcscommand-install*
|
||||
|
||||
The vcscommand plugin comprises five files: vcscommand.vim, vcssvn.vim,
|
||||
vcscvs.vim, vcssvk.vim and vcscommand.txt (this file). In order to install
|
||||
the plugin, place the vcscommand.vim, vcssvn.vim, vcssvk.vim, and vcscvs.vim
|
||||
files into a plugin directory in your runtime path (please see
|
||||
|add-global-plugin| and |'runtimepath'|.
|
||||
|
||||
This help file can be included in the VIM help system by copying it into a
|
||||
'doc' directory in your runtime path and then executing the |:helptags|
|
||||
command, specifying the full path of the 'doc' directory. Please see
|
||||
|add-local-help| for more details.
|
||||
|
||||
vcscommand may be customized by setting variables, creating maps, and
|
||||
specifying event handlers. Please see |vcscommand-customize| for more
|
||||
details.
|
||||
|
||||
==============================================================================
|
||||
|
||||
3. vcscommand Intro *vcscommand*
|
||||
*vcscommand-intro*
|
||||
|
||||
The vcscommand plugin provides global ex commands for manipulating
|
||||
version-controlled source files, currently those controlled either by CVS or
|
||||
Subversion. In general, each command operates on the current buffer and
|
||||
accomplishes a separate source control function, such as update, commit, log,
|
||||
and others (please see |vcscommand-commands| for a list of all available
|
||||
commands). The results of each operation are displayed in a scratch buffer.
|
||||
Several buffer variables are defined for those scratch buffers (please see
|
||||
|vcscommand-buffer-variables|).
|
||||
|
||||
The notion of "current file" means either the current buffer, or, in the case
|
||||
of a directory buffer (such as Explorer or netrw buffers), the directory (and
|
||||
all subdirectories) represented by the the buffer.
|
||||
|
||||
For convenience, any vcscommand invoked on a vcscommand scratch buffer acts as
|
||||
though it was invoked on the original file and splits the screen so that the
|
||||
output appears in a new window.
|
||||
|
||||
Many of the commands accept revisions as arguments. By default, most operate
|
||||
on the most recent revision on the current branch if no revision is specified.
|
||||
|
||||
Each vcscommand is mapped to a key sequence starting with the |<Leader>|
|
||||
keystroke. The default mappings may be overridden by supplying different
|
||||
mappings before the plugin is loaded, such as in the vimrc, in the standard
|
||||
fashion for plugin mappings. For examples, please see
|
||||
|vcscommand-mappings-override|.
|
||||
|
||||
The vcscommand plugin may be configured in several ways. For more details,
|
||||
please see |vcscommand-customize|.
|
||||
|
||||
==============================================================================
|
||||
|
||||
4. vcscommand Manual *vcscommand-manual*
|
||||
|
||||
4.1 vcscommand commands *vcscommand-commands*
|
||||
|
||||
vcscommand defines the following commands:
|
||||
|
||||
|:VCSAdd|
|
||||
|:VCSAnnotate|
|
||||
|:VCSBlame|
|
||||
|:VCSCommit|
|
||||
|:VCSDelete|
|
||||
|:VCSDiff|
|
||||
|:VCSGotoOriginal|
|
||||
|:VCSLog|
|
||||
|:VCSRemove|
|
||||
|:VCSRevert|
|
||||
|:VCSReview|
|
||||
|:VCSStatus|
|
||||
|:VCSUpdate|
|
||||
|:VCSVimDiff|
|
||||
|
||||
The following commands are specific to CVS files:
|
||||
|
||||
|:CVSEdit|
|
||||
|:CVSEditors|
|
||||
|:CVSUnedit|
|
||||
|:CVSWatch|
|
||||
|:CVSWatchAdd|
|
||||
|:CVSWatchOn|
|
||||
|:CVSWatchOff|
|
||||
|:CVSWatchRemove|
|
||||
|:CVSWatchers|
|
||||
|
||||
:VCSAdd *:VCSAdd*
|
||||
|
||||
This command adds the current file to source control. Please note, this does
|
||||
not commit the newly-added file. All parameters to the command are passed to
|
||||
the underlying VCS.
|
||||
|
||||
:VCSAnnotate[!] *:VCSAnnotate*
|
||||
|
||||
This command displays the current file with each line annotated with the
|
||||
version in which it was most recently changed. If an argument is given, the
|
||||
argument is used as a revision number to display. If not given an argument,
|
||||
it uses the most recent version of the file (on the current branch, if under
|
||||
CVS control). Additionally, if the current buffer is a VCSAnnotate buffer
|
||||
already, the version number on the current line is used.
|
||||
|
||||
If '!' is used, the view of the annotated buffer is split so that the
|
||||
annotation is in a separate window from the content, and each is highlighted
|
||||
separately.
|
||||
|
||||
For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero,
|
||||
will cause the above behavior to change. Instead of annotating the version on
|
||||
the current line, the parent revision is used instead, crossing branches if
|
||||
necessary.
|
||||
|
||||
With no arguments the cursor will jump to the line in the annotated buffer
|
||||
corresponding to the current line in the source buffer.
|
||||
|
||||
:VCSBlame[!] *:VCSBlame*
|
||||
|
||||
Alias for |:VCSAnnotate|.
|
||||
|
||||
:VCSCommit[!] *:VCSCommit*
|
||||
|
||||
This command commits changes to the current file to source control.
|
||||
|
||||
If called with arguments, the arguments are the log message.
|
||||
|
||||
If '!' is used, an empty log message is committed.
|
||||
|
||||
If called with no arguments, this is a two-step command. The first step opens
|
||||
a buffer to accept a log message. When that buffer is written, it is
|
||||
automatically closed and the file is committed using the information from that
|
||||
log message. The commit can be abandoned if the log message buffer is deleted
|
||||
or wiped before being written.
|
||||
|
||||
Alternatively, the mapping that is used to invoke :VCSCommit (by default
|
||||
|<Leader>|cc, please see |vcscommand-mappings|) can be used in the log message
|
||||
buffer in Normal mode to immediately commit. This is useful if the
|
||||
|VCSCommandCommitOnWrite| variable is set to 0 to disable the normal
|
||||
commit-on-write behavior.
|
||||
|
||||
:VCSDelete *:VCSDelete*
|
||||
|
||||
Deletes the current file and removes it from source control. All parameters
|
||||
to the command are passed to the underlying VCS.
|
||||
|
||||
:VCSDiff *:VCSDiff*
|
||||
|
||||
With no arguments, this displays the differences between the current file and
|
||||
its parent version under source control in a new scratch buffer.
|
||||
|
||||
With one argument, the diff is performed on the current file against the
|
||||
specified revision.
|
||||
|
||||
With two arguments, the diff is performed between the specified revisions of
|
||||
the current file.
|
||||
|
||||
For CVS, this command uses the |VCSCommandCVSDiffOpt| variable to specify diff
|
||||
options. If that variable does not exist, a plugin-specific default is used.
|
||||
If you wish to have no options, then set it to the empty string.
|
||||
|
||||
For SVN, this command uses the |VCSCommandSVNDiffOpt| variable to specify diff
|
||||
options. If that variable does not exist, the SVN default is used.
|
||||
Additionally, |VCSCommandSVNDiffExt| can be used to select an external diff
|
||||
application.
|
||||
|
||||
:VCSGotoOriginal *:VCSGotoOriginal*
|
||||
|
||||
This command jumps to the source buffer if the current buffer is a VCS scratch
|
||||
buffer.
|
||||
|
||||
:VCSGotoOriginal!
|
||||
|
||||
Like ":VCSGotoOriginal" but also executes :bufwipeout on all VCS scrach
|
||||
buffers associated with the original file.
|
||||
|
||||
:VCSInfo *:VCSInfo*
|
||||
|
||||
This command displays extended information about the current file in a new
|
||||
scratch buffer.
|
||||
|
||||
:VCSLock *:VCSLock*
|
||||
|
||||
This command locks the current file in order to prevent other users from
|
||||
concurrently modifying it. The exact semantics of this command depend on the
|
||||
underlying VCS. This does nothing in CVS. All parameters are passed to the
|
||||
underlying VCS.
|
||||
|
||||
:VCSLog *:VCSLog*
|
||||
|
||||
Displays the version history of the current file in a new scratch buffer. If
|
||||
there is one parameter supplied, it is taken as as a revision parameters to be
|
||||
passed through to the underlying VCS. Otherwise, all parameters are passed to
|
||||
the underlying VCS.
|
||||
|
||||
:VCSRemove *:VCSRemove*
|
||||
|
||||
Alias for |:VCSDelete|.
|
||||
|
||||
:VCSRevert *:VCSRevert*
|
||||
|
||||
This command replaces the current file with the most recent version from the
|
||||
repository in order to wipe out any undesired changes.
|
||||
|
||||
:VCSReview *:VCSReview*
|
||||
|
||||
Displays a particular version of the current file in a new scratch buffer. If
|
||||
no argument is given, the most recent version of the file on the current
|
||||
branch is retrieved.
|
||||
|
||||
:VCSStatus *:VCSStatus*
|
||||
|
||||
Displays versioning information about the current file in a new scratch
|
||||
buffer. All parameters are passed to the underlying VCS.
|
||||
|
||||
|
||||
:VCSUnlock *:VCSUnlock*
|
||||
|
||||
Unlocks the current file in order to allow other users from concurrently
|
||||
modifying it. The exact semantics of this command depend on the underlying
|
||||
VCS. All parameters are passed to the underlying VCS.
|
||||
|
||||
:VCSUpdate *:VCSUpdate*
|
||||
|
||||
Updates the current file with any relevant changes from the repository. This
|
||||
intentionally does not automatically reload the current buffer, though vim
|
||||
should prompt the user to do so if the underlying file is altered by this
|
||||
command.
|
||||
|
||||
:VCSVimDiff *:VCSVimDiff*
|
||||
|
||||
Uses vimdiff to display differences between versions of the current file.
|
||||
|
||||
If no revision is specified, the most recent version of the file on the
|
||||
current branch is used. With one argument, that argument is used as the
|
||||
revision as above. With two arguments, the differences between the two
|
||||
revisions is displayed using vimdiff.
|
||||
|
||||
With either zero or one argument, the original buffer is used to perform the
|
||||
vimdiff. When the scratch buffer is closed, the original buffer will be
|
||||
returned to normal mode.
|
||||
|
||||
Once vimdiff mode is started using the above methods, additional vimdiff
|
||||
buffers may be added by passing a single version argument to the command.
|
||||
There may be up to 4 vimdiff buffers total.
|
||||
|
||||
Using the 2-argument form of the command resets the vimdiff to only those 2
|
||||
versions. Additionally, invoking the command on a different file will close
|
||||
the previous vimdiff buffers.
|
||||
|
||||
:CVSEdit *:CVSEdit*
|
||||
|
||||
This command performs "cvs edit" on the current file. Yes, the output buffer
|
||||
in this case is almost completely useless.
|
||||
|
||||
:CVSEditors *:CVSEditors*
|
||||
|
||||
This command performs "cvs edit" on the current file.
|
||||
|
||||
:CVSUnedit *:CVSUnedit*
|
||||
|
||||
Performs "cvs unedit" on the current file. Again, yes, the output buffer here
|
||||
is basically useless.
|
||||
|
||||
:CVSWatch *:CVSWatch*
|
||||
|
||||
This command takes an argument which must be one of [on|off|add|remove]. The
|
||||
command performs "cvs watch" with the given argument on the current file.
|
||||
|
||||
:CVSWatchAdd *:CVSWatchAdd*
|
||||
|
||||
This command is an alias for ":CVSWatch add"
|
||||
|
||||
:CVSWatchOn *:CVSWatchOn*
|
||||
|
||||
This command is an alias for ":CVSWatch on"
|
||||
|
||||
:CVSWatchOff *:CVSWatchOff*
|
||||
|
||||
This command is an alias for ":CVSWatch off"
|
||||
|
||||
:CVSWatchRemove *:CVSWatchRemove*
|
||||
|
||||
This command is an alias for ":CVSWatch remove"
|
||||
|
||||
:CVSWatchers *:CVSWatchers*
|
||||
|
||||
This command performs "cvs watchers" on the current file.
|
||||
|
||||
4.2 Mappings *vcscommand-mappings*
|
||||
|
||||
By default, a mapping is defined for each command. These mappings execute the
|
||||
default (no-argument) form of each command.
|
||||
|
||||
|<Leader>|ca VCSAdd
|
||||
|<Leader>|cn VCSAnnotate
|
||||
|<Leader>|cN VCSAnnotate!
|
||||
|<Leader>|cc VCSCommit
|
||||
|<Leader>|cD VCSDelete
|
||||
|<Leader>|cd VCSDiff
|
||||
|<Leader>|cg VCSGotoOriginal
|
||||
|<Leader>|cG VCSGotoOriginal!
|
||||
|<Leader>|ci VCSInfo
|
||||
|<Leader>|cl VCSLog
|
||||
|<Leader>|cL VCSLock
|
||||
|<Leader>|cr VCSReview
|
||||
|<Leader>|cs VCSStatus
|
||||
|<Leader>|cu VCSUpdate
|
||||
|<Leader>|cU VCSUnlock
|
||||
|<Leader>|cv VCSVimDiff
|
||||
|
||||
Only for CVS buffers:
|
||||
|
||||
|<Leader>|ce CVSEdit
|
||||
|<Leader>|cE CVSEditors
|
||||
|<Leader>|ct CVSUnedit
|
||||
|<Leader>|cwv CVSWatchers
|
||||
|<Leader>|cwa CVSWatchAdd
|
||||
|<Leader>|cwn CVSWatchOn
|
||||
|<Leader>|cwf CVSWatchOff
|
||||
|<Leader>|cwf CVSWatchRemove
|
||||
|
||||
*vcscommand-mappings-override*
|
||||
|
||||
The default mappings can be overridden by user-provided instead by mapping to
|
||||
<Plug>CommandName. This is especially useful when these mappings collide with
|
||||
other existing mappings (vim will warn of this during plugin initialization,
|
||||
but will not clobber the existing mappings).
|
||||
|
||||
There are three methods for controlling mapping:
|
||||
|
||||
First, maps can be overriden for individual commands. For instance, to
|
||||
override the default mapping for :VCSAdd to set it to '\add', add the
|
||||
following to the vimrc:
|
||||
|
||||
nmap \add <Plug>VCSAdd
|
||||
|
||||
Second, the default map prefix ('<Leader>c') can be overridden by defining the
|
||||
|VCSCommandMapPrefix| variable.
|
||||
|
||||
Third, the entire set of default maps can be overridden by defining the
|
||||
|VCSCommandMappings| variable.
|
||||
|
||||
|
||||
4.3 Automatic buffer variables *vcscommand-buffer-variables*
|
||||
|
||||
Several buffer variables are defined in each vcscommand result buffer. These
|
||||
may be useful for additional customization in callbacks defined in the event
|
||||
handlers (please see |vcscommand-events|).
|
||||
|
||||
The following variables are automatically defined:
|
||||
|
||||
b:VCSCommandOriginalBuffer *b:VCSCommandOriginalBuffer*
|
||||
|
||||
This variable is set to the buffer number of the source file.
|
||||
|
||||
b:VCSCommandCommand *b:VCSCommandCommand*
|
||||
|
||||
This variable is set to the name of the vcscommand that created the result
|
||||
buffer.
|
||||
|
||||
b:VCSCommandSourceFile *b:VCSCommandSourceFile*
|
||||
|
||||
This variable is set to the name of the original file under source control.
|
||||
|
||||
b:VCSCommandVCSType *b:VCSCommandVCSType*
|
||||
|
||||
This variable is set to the type of the source control. This variable is also
|
||||
set on the original file itself.
|
||||
==============================================================================
|
||||
|
||||
5. Configuration and customization *vcscommand-customize*
|
||||
*vcscommand-config*
|
||||
|
||||
The vcscommand plugin can be configured in several ways: by setting
|
||||
configuration variables (see |vcscommand-options|) or by defining vcscommand
|
||||
event handlers (see |vcscommand-events|). Additionally, the vcscommand plugin
|
||||
supports a customized status line (see |vcscommand-statusline| and
|
||||
|vcscommand-buffer-management|).
|
||||
|
||||
5.1 vcscommand configuration variables *vcscommand-options*
|
||||
|
||||
Several variables affect the plugin's behavior. These variables are checked
|
||||
at time of execution, and may be defined at the window, buffer, or global
|
||||
level and are checked in that order of precedence.
|
||||
|
||||
|
||||
The following variables are available:
|
||||
|
||||
|VCSCommandCommitOnWrite|
|
||||
|VCSCommandCVSDiffOpt|
|
||||
|VCSCommandCVSExec|
|
||||
|VCSCommandDeleteOnHide|
|
||||
|VCSCommandDiffSplit|
|
||||
|VCSCommandDisableAll|
|
||||
|VCSCommandDisableMappings|
|
||||
|VCSCommandDisableExtensionMappings|
|
||||
|VCSCommandEdit|
|
||||
|VCSCommandEnableBufferSetup|
|
||||
|VCSCommandMappings|
|
||||
|VCSCommandMapPrefix|
|
||||
|VCSCommandResultBufferNameExtension|
|
||||
|VCSCommandResultBufferNameFunction|
|
||||
|VCSCommandSplit|
|
||||
|VCSCommandSVKExec|
|
||||
|VCSCommandSVNDiffExt|
|
||||
|VCSCommandSVNDiffOpt|
|
||||
|VCSCommandSVNExec|
|
||||
|VCSCommandVCSTypeOverride|
|
||||
|
||||
VCSCommandCommitOnWrite *VCSCommandCommitOnWrite*
|
||||
|
||||
This variable, if set to a non-zero value, causes the pending commit
|
||||
to take place immediately as soon as the log message buffer is written.
|
||||
If set to zero, only the VCSCommit mapping will cause the pending commit to
|
||||
occur. If not set, it defaults to 1.
|
||||
|
||||
VCSCommandCVSExec *VCSCommandCVSExec*
|
||||
|
||||
This variable controls the executable used for all CVS commands If not set,
|
||||
it defaults to "cvs".
|
||||
|
||||
VCSCommandDeleteOnHide *VCSCommandDeleteOnHide*
|
||||
|
||||
This variable, if set to a non-zero value, causes the temporary result buffers
|
||||
to automatically delete themselves when hidden.
|
||||
|
||||
VCSCommandCVSDiffOpt *VCSCommandCVSDiffOpt*
|
||||
|
||||
This variable, if set, determines the options passed to the diff command of
|
||||
CVS. If not set, it defaults to 'u'.
|
||||
|
||||
VCSCommandDiffSplit *VCSCommandDiffSplit*
|
||||
|
||||
This variable overrides the |VCSCommandSplit| variable, but only for buffers
|
||||
created with |:VCSVimDiff|.
|
||||
|
||||
VCSCommandDisableAll *VCSCommandDisableAll*
|
||||
|
||||
This variable, if set, prevents the plugin or any extensions from loading at
|
||||
all. This is useful when a single runtime distribution is used on multiple
|
||||
systems with varying versions.
|
||||
|
||||
VCSCommandDisableMappings *VCSCommandDisableMappings*
|
||||
|
||||
This variable, if set to a non-zero value, prevents the default command
|
||||
mappings from being set. This supercedes
|
||||
|VCSCommandDisableExtensionMappings|.
|
||||
|
||||
VCSCommandDisableExtensionMappings *VCSCommandDisableExtensionMappings*
|
||||
|
||||
This variable, if set to a non-zero value, prevents the default command
|
||||
mappings from being set for commands specific to an individual VCS.
|
||||
|
||||
VCSCommandEdit *VCSCommandEdit*
|
||||
|
||||
This variable controls whether the original buffer is replaced ('edit') or
|
||||
split ('split'). If not set, it defaults to 'split'.
|
||||
|
||||
VCSCommandEnableBufferSetup *VCSCommandEnableBufferSetup*
|
||||
|
||||
This variable, if set to a non-zero value, activates VCS buffer management
|
||||
mode see (|vcscommand-buffer-management|). This mode means that the
|
||||
'VCSCommandBufferInfo' variable is filled with version information if the file
|
||||
is VCS-controlled. This is useful for displaying version information in the
|
||||
status bar.
|
||||
|
||||
VCSCommandMappings *VCSCommandMappings*
|
||||
|
||||
This variable, if set, overrides the default mappings used for shortcuts. It
|
||||
should be a List of 2-element Lists, each containing a shortcut and function
|
||||
name pair. The value of the '|VCSCommandMapPrefix|' variable will be added to
|
||||
each shortcut.
|
||||
|
||||
VCSCommandMapPrefix *VCSCommandMapPrefix*
|
||||
|
||||
This variable, if set, overrides the default mapping prefix ('<Leader>c').
|
||||
This allows customization of the mapping space used by the vcscommand
|
||||
shortcuts.
|
||||
|
||||
VCSCommandResultBufferNameExtension *VCSCommandResultBufferNameExtension*
|
||||
|
||||
This variable, if set to a non-blank value, is appended to the name of the VCS
|
||||
command output buffers. For example, '.vcs'. Using this option may help
|
||||
avoid problems caused by autocommands dependent on file extension.
|
||||
|
||||
VCSCommandResultBufferNameFunction *VCSCommandResultBufferNameFunction*
|
||||
|
||||
This variable, if set, specifies a custom function for naming VCS command
|
||||
output buffers. This function is expected to return the new buffer name, and
|
||||
will be passed the following arguments:
|
||||
|
||||
command - name of the VCS command being executed (such as 'Log' or
|
||||
'Diff').
|
||||
|
||||
originalBuffer - buffer number of the source file.
|
||||
|
||||
vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN').
|
||||
|
||||
statusText - extra text associated with the VCS action (such as version
|
||||
numbers).
|
||||
|
||||
VCSCommandSplit *VCSCommandSplit*
|
||||
|
||||
This variable controls the orientation of the various window splits that
|
||||
may occur.
|
||||
|
||||
If set to 'horizontal', the resulting windows will be on stacked on top of
|
||||
one another. If set to 'vertical', the resulting windows will be
|
||||
side-by-side. If not set, it defaults to 'horizontal' for all but
|
||||
VCSVimDiff windows. VCSVimDiff windows default to the user's 'diffopt'
|
||||
setting, if set, otherwise 'vertical'.
|
||||
|
||||
VCSCommandSVKExec *VCSCommandSVKExec*
|
||||
|
||||
This variable controls the executable used for all SVK commands If not set,
|
||||
it defaults to "svk".
|
||||
|
||||
VCSCommandSVNDiffExt *VCSCommandSVNDiffExt*
|
||||
|
||||
This variable, if set, is passed to SVN via the --diff-cmd command to select
|
||||
an external application for performing the diff.
|
||||
|
||||
VCSCommandSVNDiffOpt *VCSCommandSVNDiffOpt*
|
||||
|
||||
This variable, if set, determines the options passed with the '-x' parameter
|
||||
to the SVN diff command. If not set, no options are passed.
|
||||
|
||||
VCSCommandSVNExec *VCSCommandSVNExec*
|
||||
|
||||
This variable controls the executable used for all SVN commands If not set,
|
||||
it defaults to "svn".
|
||||
|
||||
VCSCommandVCSTypeOverride *VCSCommandVCSTypeOverride*
|
||||
|
||||
This variable allows the VCS type detection to be overridden on a path-by-path
|
||||
basis. The value of this variable is expected to be a List of Lists. Each
|
||||
item in the high-level List is a List containing two elements. The first
|
||||
element is a regular expression that will be matched against the full file
|
||||
name of a given buffer. If it matches, the second element will be used as the
|
||||
VCS type.
|
||||
|
||||
5.2 VCSCommand events *vcscommand-events*
|
||||
|
||||
For additional customization, vcscommand can trigger user-defined events.
|
||||
Event handlers are provided by defining User event autocommands (see
|
||||
|autocommand|, |User|) in the vcscommand group with patterns matching the
|
||||
event name.
|
||||
|
||||
For instance, the following could be added to the vimrc to provide a 'q'
|
||||
mapping to quit a vcscommand scratch buffer:
|
||||
|
||||
augroup VCSCommand
|
||||
au User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
|
||||
augroup END
|
||||
|
||||
The following hooks are available:
|
||||
|
||||
VCSBufferCreated This event is fired just after a vcscommand
|
||||
result buffer is created and populated. It is
|
||||
executed within the context of the vcscommand
|
||||
buffer. The vcscommand buffer variables may
|
||||
be useful for handlers of this event (please
|
||||
see |vcscommand-buffer-variables|).
|
||||
|
||||
VCSBufferSetup This event is fired just after vcscommand buffer
|
||||
setup occurs, if enabled.
|
||||
|
||||
VCSPluginInit This event is fired when the vcscommand plugin
|
||||
first loads.
|
||||
|
||||
VCSPluginFinish This event is fired just after the vcscommand
|
||||
plugin loads.
|
||||
|
||||
VCSVimDiffFinish This event is fired just after the VCSVimDiff
|
||||
command executes to allow customization of,
|
||||
for instance, window placement and focus.
|
||||
|
||||
Additionally, there is another hook which is used internally to handle loading
|
||||
the multiple scripts in order. This hook should probably not be used by an
|
||||
end user without a good idea of how it works. Among other things, any events
|
||||
associated with this hook are cleared after they are executed (during
|
||||
vcscommand.vim script initialization).
|
||||
|
||||
VCSLoadExtensions This event is fired just before the
|
||||
VCSPluginFinish. It is used internally to
|
||||
execute any commands from the VCS
|
||||
implementation plugins that needs to be
|
||||
deferred until the primary plugin is
|
||||
initialized.
|
||||
|
||||
5.3 vcscommand buffer naming *vcscommand-naming*
|
||||
|
||||
vcscommand result buffers use the following naming convention:
|
||||
[{VCS type} {VCS command} {Source file name}]
|
||||
|
||||
If additional buffers are created that would otherwise conflict, a
|
||||
distinguishing number is added:
|
||||
|
||||
[{VCS type} {VCS command} {Source file name}] (1,2, etc)
|
||||
|
||||
5.4 vcscommand status line support *vcscommand-statusline*
|
||||
|
||||
It is intended that the user will customize the |'statusline'| option to
|
||||
include vcscommand result buffer attributes. A sample function that may be
|
||||
used in the |'statusline'| option is provided by the plugin,
|
||||
VCSCommandGetStatusLine(). In order to use that function in the status line, do
|
||||
something like the following:
|
||||
|
||||
set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P
|
||||
|
||||
of which %{VCSCommandGetStatusLine()} is the relevant portion.
|
||||
|
||||
The sample VCSCommandGetStatusLine() function handles both vcscommand result
|
||||
buffers and VCS-managed files if vcscommand buffer management is enabled
|
||||
(please see |vcscommand-buffer-management|).
|
||||
|
||||
5.5 vcscommand buffer management *vcscommand-buffer-management*
|
||||
|
||||
The vcscommand plugin can operate in buffer management mode, which means that
|
||||
it attempts to set a buffer variable ('VCSCommandBufferInfo') upon entry into
|
||||
a buffer. This is rather slow because it means that the VCS will be invoked
|
||||
at each entry into a buffer (during the |BufEnter| autocommand).
|
||||
|
||||
This mode is disabled by default. In order to enable it, set the
|
||||
|VCSCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling
|
||||
this mode simply provides the buffer variable mentioned above. The user must
|
||||
explicitly include information from the variable in the |'statusline'| option
|
||||
if they are to appear in the status line (but see |vcscommand-statusline| for
|
||||
a simple way to do that).
|
||||
|
||||
The 'VCSCommandBufferInfo' variable is a list which contains, in order, the
|
||||
revision of the current file, the latest revision of the file in the
|
||||
repository, and (for CVS) the name of the branch. If those values cannot be
|
||||
determined, the list is a single element: 'Unknown'.
|
||||
|
||||
==============================================================================
|
||||
|
||||
6. SSH "integration" *vcscommand-ssh*
|
||||
|
||||
The following instructions are intended for use in integrating the
|
||||
vcscommand.vim plugin with an SSH-based CVS environment.
|
||||
|
||||
Familiarity with SSH and CVS are assumed.
|
||||
|
||||
These instructions assume that the intent is to have a message box pop up in
|
||||
order to allow the user to enter a passphrase. If, instead, the user is
|
||||
comfortable using certificate-based authentication, then only instructions
|
||||
6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then
|
||||
work transparently.
|
||||
|
||||
6.1 Environment settings *vcscommand-ssh-env*
|
||||
|
||||
6.1.1 CVSROOT should be set to something like:
|
||||
|
||||
:ext:user@host:/path_to_repository
|
||||
|
||||
6.1.2 CVS_RSH should be set to:
|
||||
|
||||
ssh
|
||||
|
||||
Together, those settings tell CVS to use ssh as the transport when
|
||||
performing CVS calls.
|
||||
|
||||
6.1.3 SSH_ASKPASS should be set to the password-dialog program. In my case,
|
||||
running gnome, it's set to:
|
||||
|
||||
/usr/libexec/openssh/gnome-ssh-askpass
|
||||
|
||||
This tells SSH how to get passwords if no input is available.
|
||||
|
||||
6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the cvs
|
||||
executable on the remote (server) machine.
|
||||
|
||||
6.2 CVS wrapper program *vcscommand-ssh-wrapper*
|
||||
|
||||
Now you need to convince SSH to use the password-dialog program. This means
|
||||
you need to execute SSH (and therefore CVS) without standard input. The
|
||||
following script is a simple perl wrapper that dissasociates the CVS command
|
||||
from the current terminal. Specific steps to do this may vary from system to
|
||||
system; the following example works for me on linux.
|
||||
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use POSIX qw(setsid);
|
||||
open STDIN, '/dev/null';
|
||||
fork and do {wait; exit;};
|
||||
setsid;
|
||||
exec('cvs', @ARGV);
|
||||
|
||||
6.3 Configuring vcscommand.vim *vcscommand-ssh-config*
|
||||
|
||||
At this point, you should be able to use your wrapper script to invoke CVS with
|
||||
various commands, and get the password dialog. All that's left is to make CVS
|
||||
use your newly-created wrapper script.
|
||||
|
||||
6.3.1 Tell vcscommand.vim what CVS executable to use. The easiest way to do this
|
||||
is globally, by putting the following in your .vimrc:
|
||||
|
||||
let VCSCommandCVSExec=/path/to/cvs/wrapper/script
|
||||
|
||||
6.4 Where to go from here *vcscommand-ssh-other*
|
||||
|
||||
The script given above works even when non-SSH CVS connections are used,
|
||||
except possibly when interactively entering the message for CVS commit log
|
||||
(depending on the editor you use... VIM works fine). Since the vcscommand.vim
|
||||
plugin handles that message without a terminal, the wrapper script can be used
|
||||
all the time.
|
||||
|
||||
This allows mixed-mode operation, where some work is done with SSH-based CVS
|
||||
repositories, and others with pserver or local access.
|
||||
|
||||
It is possible, though beyond the scope of the plugin, to dynamically set the
|
||||
CVS executable based on the CVSROOT for the file being edited. The user
|
||||
events provided (such as VCSBufferCreated and VCSBufferSetup) can be used to
|
||||
set a buffer-local value (b:VCSCommandCVSExec) to override the CVS executable
|
||||
on a file-by-file basis. Alternatively, much the same can be done (less
|
||||
automatically) by the various project-oriented plugins out there.
|
||||
|
||||
It is highly recommended for ease-of-use that certificates with no passphrase
|
||||
or ssh-agent are employed so that the user is not given the password prompt
|
||||
too often.
|
||||
|
||||
==============================================================================
|
||||
|
||||
7. Changes from cvscommand *cvscommand-changes*
|
||||
|
||||
1. Require Vim 7 in order to leverage several convenient features; also
|
||||
because I wanted to play with Vim 7.
|
||||
|
||||
2. Renamed commands to start with 'VCS' instead of 'CVS'. The exceptions are
|
||||
the 'CVSEdit' and 'CVSWatch' family of commands, which are specific to CVS.
|
||||
|
||||
3. Renamed options, events to start with 'VCSCommand'.
|
||||
|
||||
4. Removed option to jump to the parent version of the current line in an
|
||||
annotated buffer, as opposed to the version on the current line. This made
|
||||
little sense in the branching scheme used by subversion, where jumping to a
|
||||
parent branch required finding a different location in the repository. It
|
||||
didn't work consistently in CVS anyway.
|
||||
|
||||
5. Removed option to have nameless scratch buffers.
|
||||
|
||||
6. Changed default behavior of scratch buffers to split the window instead of
|
||||
displaying in the current window. This may still be overridden using the
|
||||
'VCSCommandEdit' option.
|
||||
|
||||
7. Split plugin into multiple plugins.
|
||||
|
||||
8. Added 'VCSLock' and 'VCSUnlock' commands. These are implemented for
|
||||
subversion but not for CVS. These were not kept specific to subversion as they
|
||||
seemed more general in nature and more likely to be supported by any future VCS
|
||||
supported by this plugin.
|
||||
|
||||
9. Changed name of buffer variables set by commands.
|
||||
|
||||
'b:cvsOrigBuffNR' became 'b:VCSCommandOriginalBuffer'
|
||||
'b:cvscmd' became 'b:VCSCommandCommand'
|
||||
|
||||
10. Added new automatic variables to command result buffers.
|
||||
|
||||
'b:VCSCommandSourceFile'
|
||||
'b:VCSCommandVCSType'
|
||||
|
||||
==============================================================================
|
||||
|
||||
8. Known bugs *vcscommand-bugs*
|
||||
|
||||
Please let me know if you run across any.
|
||||
|
||||
CVSUnedit may, if a file is changed from the repository, provide prompt text
|
||||
to determine whether the changes should be thrown away. Currently, that text
|
||||
shows up in the CVS result buffer as information; there is no way for the user
|
||||
to actually respond to the prompt and the CVS unedit command does nothing. If
|
||||
this really bothers anyone, please let me know.
|
||||
|
||||
VCSVimDiff, when using the original (real) source buffer as one of the diff
|
||||
buffers, uses some hacks to try to restore the state of the original buffer
|
||||
when the scratch buffer containing the other version is destroyed. There may
|
||||
still be bugs in here, depending on many configuration details.
|
||||
|
||||
vim:tw=78:ts=8:ft=help
|
||||
1844
doc/vimwiki.txt
Normal file
1844
doc/vimwiki.txt
Normal file
File diff suppressed because it is too large
Load Diff
BIN
doc2/test.png
Normal file
BIN
doc2/test.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
783
doc2/vst-s5.html
Normal file
783
doc2/vst-s5.html
Normal file
@@ -0,0 +1,783 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>Vim reStructured Text</title>
|
||||
<meta name="Generator" content="Vim reStructured Text 140 - Vim 7.2" />
|
||||
<meta name="Author" content="George V. Reilly <george@reilly.org>" />
|
||||
<meta name="Title" content="Vim reStructured Text - A Quick Introduction" />
|
||||
<meta name="Date" content="2006/05/12" />
|
||||
|
||||
<style type="text/css">
|
||||
/*<![CDATA[*/
|
||||
body { color: #000; background-color: #fff; margin: 0px 10%; min-width: 720px; font-family: Verdana, sans-serif;
|
||||
counter-reset: chapter section subsection subsubsection paragraph lchapter lsection lsubsection lsubsubsection lparagraph}
|
||||
div.footnote { border-left: 1px solid #000; margin-left: 0em; clear: both }
|
||||
div.ftext { position: relative; margin-left: 50px }
|
||||
div.fnumber { float: left; width: 40px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
|
||||
div.fnumber a { margin: 0px; padding: 0px }
|
||||
div.ctext { position: relative; margin-left: 100px }
|
||||
div.cnumber { float: left; width: 90px; padding: 0em; margin-left: 0.5em; margin-top: 0em }
|
||||
div.cnumber a { margin: 0px; padding: 0px }
|
||||
div.tip { border: 2px solid #0d0; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.warning, div.caution, div.danger, div.error { border: 2px solid #f00; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.note, div.hint, div.important { border: 2px solid #000; margin: 0.5em 2em 1em 2em; padding: 0em 1em }
|
||||
div.figure { display: block; padding: 1em; width: 400px; clear: both}
|
||||
div.topic { margin: 2em }
|
||||
div.vstsidebar, div.sidebar { border: 2px solid #aaa; color: #000; background-color: #ffffee; float: right; width: 40%; margin-left: 1em; margin-right: -1em; padding: 1em }
|
||||
span.strike { text-decoration: line-through }
|
||||
span.big { font-size: large }
|
||||
span.small { font-size: small }
|
||||
span.title { font-style: italic }
|
||||
span.notetitle { font-size: large; font-weight: 900; font-family: Verdana, sans-serif }
|
||||
p.toc { font-size: large; font-weight: 900 }
|
||||
p.notesubtitle { font-weight: 900; font-family: Verdana, sans-serif }
|
||||
p.attribution { font-style: italic; margin-left: 8em; text-indent: -1.4em }
|
||||
.vstright { float: right; margin: 1em }
|
||||
.vstleft { float: left; margin: 1em }
|
||||
.vstcenter { margin: 1em auto }
|
||||
blockquote.pull { font-size: large }
|
||||
p.rubric { font-size: large; margin-left: 2em }
|
||||
dd.normal { margin-bottom: 0.5em }
|
||||
dt.option { float: left; margin: 0em 0em 5px 2em; padding: 0px; font-family: monospace }
|
||||
dd.option { padding: 0px; margin: 0em 0em 5px 10em; text-indent: 0.5em }
|
||||
dd.option > p { margin: 0px }
|
||||
dd.normal > p { margin: 0px }
|
||||
table { border-collapse: collapse; margin: 0.5em 0em }
|
||||
thead, tfoot { text-align: center; font-weight: bold }
|
||||
td { border: 1px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td blockquote p{ margin: 0px; padding: 0px}
|
||||
td blockquote { margin: 0px; padding: 0px}
|
||||
table.vstbless td { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td > p { margin: 0px }
|
||||
table.field { border: 0px solid #000; margin-left: 2em; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fkey { font-weight: 900 }
|
||||
td.fval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fkey { font-weight: 900; border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
td.fdkey { text-align: center; font-weight: 900 }
|
||||
td.fdval { text-align: center; font-style: italic }
|
||||
td.fakey { text-align: center; font-weight: 900 }
|
||||
td.faval { border: 0px solid #000; padding: 0.25em; _top: 0%; vertical-align: top }
|
||||
hr { width: 80%; margin: 1.5em auto }
|
||||
h1 { text-align: center; clear: both }
|
||||
h2, h3, h4, h5, h6 { text-align: left; margin-top: 1em; clear: both }
|
||||
h2 { counter-reset: section subsection subsubsection paragraph }
|
||||
h3 { counter-reset: subsection subsubsection paragraph }
|
||||
h4 { counter-reset: subsubsection paragraph }
|
||||
h5 { counter-reset: paragraph }
|
||||
h1 a { color: #000; background-color: transparent }
|
||||
h2 a { color: #000; background-color: transparent }
|
||||
h3 a { color: #000; background-color: transparent }
|
||||
h4 a { color: #000; background-color: transparent }
|
||||
h5 a { color: #000; background-color: transparent }
|
||||
h6 a { color: #000; background-color: transparent }
|
||||
p.subh1 { text-align: center; font-size: 120%; font-variant: small-caps }
|
||||
p.subh2, p.subh3, p.subh4, p.subh5, p.subh6 { text-align: left; font-size: 120%; font-variant: small-caps }
|
||||
h2:before { content: counter(chapter)" "; counter-increment: chapter }
|
||||
h3:before { content: counter(chapter)"."counter(section)" "; counter-increment: section }
|
||||
h4:before { content: counter(chapter)"."counter(section)"."counter(subsection)" "; counter-increment: subsection }
|
||||
h5:before { content: counter(chapter)"."counter(section)"."counter(subsection)"."counter(subsubsection)" "; counter-increment: subsubsection }
|
||||
h6:before { content: counter(chapter)"."counter(section)"."counter(subsection)"."counter(subsubsection)"."counter(paragraph)" "; counter-increment: paragraph}
|
||||
li.h1 { margin-left: 0em }
|
||||
li.h2 { margin-left: 1em; counter-reset: lsection lsubsection lsubsubsection lparagraph }
|
||||
li.h3 { margin-left: 2em; counter-reset: lsubsection lsubsubsection lparagraph }
|
||||
li.h4 { margin-left: 3em; counter-reset: lsubsubsection lparagraph }
|
||||
li.h5 { margin-left: 4em; counter-reset: lparagraph }
|
||||
li.h2:before { content: counter(lchapter)" "; counter-increment: lchapter }
|
||||
li.h3:before { content: counter(lchapter)"."counter(lsection)" "; counter-increment: lsection }
|
||||
li.h4:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)" "; counter-increment: lsubsection }
|
||||
li.h5:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)"."counter(lsubsubsection)" "; counter-increment: lsubsubsection }
|
||||
li.h6:before { content: counter(lchapter)"."counter(lsection)"."counter(lsubsection)"."counter(lsubsubsection)"."counter(lparagraph)" "; counter-increment: lparagraph}
|
||||
li.h6 { margin-left: 5em }
|
||||
ol, ul { margin-bottom: 0.5em; margin-top: 0.5em }
|
||||
ol.loweralpha { list-style-type: lower-alpha }
|
||||
ol.upperalpha { list-style-type: upper-alpha }
|
||||
ol.lowerroman { list-style-type: lower-roman }
|
||||
ol.upperroman { list-style-type: upper-roman }
|
||||
ol.decimal { list-style-type: decimal }
|
||||
ul.square { list-style-type: square }
|
||||
ul.circle { list-style-type: circle }
|
||||
ul.disc { list-style-type: disc }
|
||||
li > p { margin: 0em }
|
||||
img { border: 1px solid #000; padding: 0em; display: block; margin: 1em auto }
|
||||
img.inline { border: 1px solid #000; padding: 0em; margin: 0em; display: inline }
|
||||
pre { color: #000; background-color: #eee; margin-left: 2em; clear: both; overflow: auto }
|
||||
div.unknown { font-family: monospace; color: #000; background-color: #fff; margin: 1em; padding: 1em; clear: both; border: 3px solid red}
|
||||
pre.quoted { color: #000; background-color: #eee; margin-left: 0em; clear: both; overflow: auto }
|
||||
pre.rawlatex { color: #000; background-color: #ddd; border: 1px solid #000; padding: 0.1em; clear: both; overflow: auto }
|
||||
pre.address { font-family: Verdana, sans-serif; display: inline; margin: 0px; color: #000; background-color: #fff; overflow: auto }
|
||||
span.target { text-decoration: underline }
|
||||
div.vstfooter hr { width: 100%; margin: 0px }
|
||||
div.vstfooter p { margin: 0px }
|
||||
/*]]>*/
|
||||
</style>
|
||||
<!-- configuration parameters -->
|
||||
<meta name="defaultView" content="slideshow" />
|
||||
<meta name="controlVis" content="hidden" />
|
||||
<meta name="version" content="S5 1.1" />
|
||||
<!-- style sheet links -->
|
||||
<link rel="stylesheet" href="s5ui/slides.css" type="text/css" media="projection" id="slideProj" />
|
||||
<link rel="stylesheet" href="s5ui/outline.css" type="text/css" media="screen" id="outlineStyle" />
|
||||
<link rel="stylesheet" href="s5ui/print.css" type="text/css" media="print" id="slidePrint" />
|
||||
<link rel="stylesheet" href="s5ui/opera.css" type="text/css" media="projection" id="operaFix" />
|
||||
<!-- S5 JS -->
|
||||
<script src="s5ui/slides.js" type="text/javascript"></script>
|
||||
<!-- VST-S5 -->
|
||||
<style type="text/css">
|
||||
/*<![CDATA[*/
|
||||
h1:before, h2:before, h3:before, h4:before, h5:before, h6:before { content: "" }
|
||||
/*]]>*/
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="layout">
|
||||
<div id="controls"><!-- DO NOT EDIT --></div>
|
||||
<div id="currentSlide"><!-- DO NOT EDIT --></div>
|
||||
<div id="header"></div>
|
||||
<div id="footer">
|
||||
<h1>Vim reStructured Text</h1>
|
||||
<h2>George V. Reilly <george@reilly.org> • 2006/05/12</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="presentation">
|
||||
|
||||
<!-- .. This is a comment
|
||||
-->
|
||||
<!-- .. Use ":Vst s5" to generate the HTML for this document
|
||||
-->
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="lvim-restructured-text">Vim reStructured Text</h1>
|
||||
<table class="field" summary="Field list"><tr><td class="fkey">Title:</td><td class="fval"> Vim reStructured Text - A Quick Introduction</td></tr>
|
||||
|
||||
<tr><td class="fkey">Author:</td><td class="fval"> George V. Reilly <george@reilly.org></td></tr>
|
||||
|
||||
<tr><td class="fkey">Date:</td><td class="fval"> 2006/05/12</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="lwhat-is-vst63">What is VST?</h1>
|
||||
|
||||
<p>
|
||||
<a href="http://skawina.eu.org/mikolaj/vst.html" title="VST">VST</a> is an easy way to produce:
|
||||
</p>
|
||||
|
||||
<ul class="circle">
|
||||
<li>
|
||||
|
||||
<p>
|
||||
HTML
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
S5 Slides, like this document
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
LaTeX and PDF
|
||||
</p>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
from <a href="http://docutils.sf.net" title="reStructured text">reStructured text</a>: plain text
|
||||
with minimal markup.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The powerful <a href="http://www.vim.org" title="Vim">Vim</a> editor is used to prepare the
|
||||
material.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Please read the <span id="lsource" title="source" class="target">source</span> of these slides to see how the effects used herein are
|
||||
achieved.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="lsimple-markup">Simple markup</h1>
|
||||
<ul class="square">
|
||||
<li>
|
||||
|
||||
<p>
|
||||
Bulleted Lists
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
Numeric lists (nested)
|
||||
</p>
|
||||
|
||||
|
||||
<ol class="decimal">
|
||||
<li>
|
||||
|
||||
<p>
|
||||
<strong>Bold</strong> text
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
<em>Italics</em> text
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
<code>typewriter</code> text
|
||||
</p>
|
||||
|
||||
|
||||
</li></ol>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<p>
|
||||
Subscripts, H<sub>2</sub>O.
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
Replacement -- Vim reStructured Text -- of text.
|
||||
</p>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="lblockquotes">Blockquotes</h1>
|
||||
|
||||
<p>
|
||||
You can embed blockquotes inside your text:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
Simple markup
|
||||
==============
|
||||
|
||||
+ Bulleted Lists
|
||||
+ Numeric lists (nested)
|
||||
|
||||
#. **Bold** text
|
||||
2. *Italics* text
|
||||
#. ``typewriter`` text
|
||||
|
||||
+ Replacement -- |VST| -- of text.
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
is most of the text of the previous slide.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="llinks">Links</h1>
|
||||
|
||||
<p>
|
||||
VST supports a variety of hyperlink notations.
|
||||
</p>
|
||||
|
||||
<ul class="circle">
|
||||
<li>
|
||||
|
||||
<p>
|
||||
Starting points: <a href="#lwhat-is-vst63" title="What is VST?">What is VST?</a>
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
<a href="http://skawina.eu.org/mikolaj/vst.html#lexternal-links" title="External links">External links</a>
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
Internal links, such as <a href="#lsource" title="source">source</a>
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
Standalone links, <a href="http://www.vim.org">http://www.vim.org</a>
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
<a href="http://skawina.eu.org/mikolaj/vst.html#lembedded-uris" title="Embedded URIs">Embedded URIs</a>
|
||||
</p>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
The full effect of these links cannot be seen in the S5 slides.
|
||||
Regenerate with <code>:Vst</code> instead.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="limages">Images</h1>
|
||||
<p>
|
||||
<a href="http://www.vim.org/">
|
||||
<img src="http://www.vim.org/images/vim_header.gif" alt="http://www.vim.org/images/vim_header.gif" title="Vim" />
|
||||
</a>
|
||||
</p>
|
||||
<div class="tip">
|
||||
<p><span class="notetitle">Tip</span></p>
|
||||
|
||||
<p>
|
||||
You can apply a variety of attributes to images.
|
||||
</p>
|
||||
|
||||
|
||||
<blockquote>
|
||||
|
||||
<p>
|
||||
If you need really fine control, you may need to use <code>.. raw:: html</code>
|
||||
</p>
|
||||
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="lsimple-tables">Simple Tables</h1>
|
||||
<table class="vstborder" summary=""><col width="12%" /><col width="12%" /><col width="12%" /><col width="12%" /><col width="12%" /><col width="12%" /><col width="12%" />
|
||||
<thead>
|
||||
<tr><td>
|
||||
|
||||
<p>
|
||||
su
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
mo
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
tu
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
we
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
th
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
fr
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
sa
|
||||
</p>
|
||||
|
||||
</td></tr>
|
||||
|
||||
</thead>
|
||||
<tr><td>
|
||||
</td><td>
|
||||
</td><td>
|
||||
</td><td>
|
||||
</td><td>
|
||||
</td><td>
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
1
|
||||
</p>
|
||||
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<p>
|
||||
2
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
3
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
4
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
5
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
6
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
7
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
8
|
||||
</p>
|
||||
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<p>
|
||||
9
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
10
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
11
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
12
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
13
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
14
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
15
|
||||
</p>
|
||||
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<p>
|
||||
16
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
17
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
18
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
19
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
20
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
21
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
22
|
||||
</p>
|
||||
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<p>
|
||||
23
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
24
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
25
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
26
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
27
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
28
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
29
|
||||
</p>
|
||||
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
|
||||
<p>
|
||||
30
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
31
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
</td><td>
|
||||
</td><td>
|
||||
</td><td>
|
||||
</td><td>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="lrich-tables">Rich Tables</h1>
|
||||
<table class="vstborder" summary=""><col width="34%" /><col width="26%" /><col width="29%" />
|
||||
<tr><td>
|
||||
|
||||
<p>
|
||||
Cells are
|
||||
separated
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
by bar with
|
||||
spaces around
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
<Space>|<Space>
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr><tr><td>
|
||||
|
||||
<p>
|
||||
<em>You</em> may use
|
||||
<strong>inline</strong>
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
markup,
|
||||
<a href="#llinks" title="links">links</a>
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
included.
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr><tr><td>
|
||||
|
||||
<p>
|
||||
You can use various
|
||||
types of structure
|
||||
elements:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
Welcome to world
|
||||
of preformatted
|
||||
text.
|
||||
</pre>
|
||||
|
||||
|
||||
</td><td>
|
||||
<ul class="disc">
|
||||
<li>
|
||||
|
||||
<p>
|
||||
like lists
|
||||
</p>
|
||||
|
||||
|
||||
<ul class="square">
|
||||
<li>
|
||||
|
||||
<p>
|
||||
various
|
||||
</p>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<p>
|
||||
embedded
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
one into
|
||||
other
|
||||
</p>
|
||||
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</td><td>
|
||||
|
||||
<p>
|
||||
VST will
|
||||
interpret them.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Even paragraphs.
|
||||
</p>
|
||||
|
||||
<ol class="decimal">
|
||||
<li>
|
||||
|
||||
<p>
|
||||
And
|
||||
</p>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
|
||||
<p>
|
||||
not
|
||||
</p>
|
||||
|
||||
|
||||
</li></ol>
|
||||
</td>
|
||||
</tr><tr><td colspan="2" style="text-align: center;">
|
||||
|
||||
<p>
|
||||
Text may span across several
|
||||
columns. Cell can be also empty ->
|
||||
</p>
|
||||
|
||||
</td><td>
|
||||
</td>
|
||||
</tr></table>
|
||||
</div>
|
||||
<div class="slide">
|
||||
<h1 id="lconclusion">Conclusion</h1>
|
||||
|
||||
<p>
|
||||
VST is an easy way to produce marked-up documents with easy-to-read source, in
|
||||
Vim.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This slideshow displays only a few features of VST. Be sure to read the
|
||||
<a href="http://skawina.eu.org/mikolaj/vst.html" title="manual">manual</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<!-- .. vim:set tw=78 ai fo+=n fo-=l:
|
||||
-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
145
doc2/vst-s5.txt
Normal file
145
doc2/vst-s5.txt
Normal file
@@ -0,0 +1,145 @@
|
||||
.. This is a comment
|
||||
.. Use ":Vst s5" to generate the HTML for this document
|
||||
|
||||
============================================
|
||||
Vim reStructured Text
|
||||
============================================
|
||||
|
||||
:Title: Vim reStructured Text - A Quick Introduction
|
||||
:Author: George V. Reilly <george@reilly.org>
|
||||
:Date: 2006/05/12
|
||||
|
||||
|
||||
What is VST?
|
||||
============
|
||||
|
||||
`VST <http://skawina.eu.org/mikolaj/vst.html>`_ is an easy way to produce:
|
||||
|
||||
* HTML
|
||||
* S5 Slides, like this document
|
||||
* LaTeX and PDF
|
||||
|
||||
from `reStructured text <http://docutils.sf.net>`_: plain text
|
||||
with minimal markup.
|
||||
|
||||
The powerful `Vim <http://www.vim.org>`_ editor is used to prepare the
|
||||
material.
|
||||
|
||||
Please read the _`source` of these slides to see how the effects used herein are
|
||||
achieved.
|
||||
|
||||
|
||||
Simple markup
|
||||
=============
|
||||
|
||||
+ Bulleted Lists
|
||||
+ Numeric lists (nested)
|
||||
|
||||
#. **Bold** text
|
||||
2. *Italics* text
|
||||
#. ``typewriter`` text
|
||||
|
||||
+ Subscripts, H\ :sub:`2`\ O.
|
||||
+ Replacement -- |VST| -- of text.
|
||||
|
||||
|
||||
Blockquotes
|
||||
===========
|
||||
|
||||
You can embed blockquotes inside your text::
|
||||
|
||||
Simple markup
|
||||
==============
|
||||
|
||||
+ Bulleted Lists
|
||||
+ Numeric lists (nested)
|
||||
|
||||
#. **Bold** text
|
||||
2. *Italics* text
|
||||
#. ``typewriter`` text
|
||||
|
||||
+ Replacement -- |VST| -- of text.
|
||||
|
||||
is most of the text of the previous slide.
|
||||
|
||||
|
||||
Links
|
||||
=====
|
||||
|
||||
VST supports a variety of hyperlink notations.
|
||||
|
||||
* Starting points: `What is VST?`_
|
||||
* `External links`_
|
||||
* Internal links, such as `source`_
|
||||
* Standalone links, http://www.vim.org
|
||||
* `Embedded URIs <http://skawina.eu.org/mikolaj/vst.html#lembedded-uris>`_
|
||||
|
||||
The full effect of these links cannot be seen in the S5 slides.
|
||||
Regenerate with ``:Vst`` instead.
|
||||
|
||||
.. _External links: http://skawina.eu.org/mikolaj/vst.html#lexternal-links
|
||||
|
||||
|
||||
Images
|
||||
======
|
||||
|
||||
.. image:: http://www.vim.org/images/vim_header.gif
|
||||
:title: Vim
|
||||
:target: http://www.vim.org/
|
||||
|
||||
.. tip:: You can apply a variety of attributes to images.
|
||||
|
||||
If you need really fine control, you may need to use ``.. raw:: html``
|
||||
|
||||
|
||||
Simple Tables
|
||||
=============
|
||||
|
||||
|
||||
== == == == == == ==
|
||||
su mo tu we th fr sa
|
||||
== == == == == == ==
|
||||
1
|
||||
2 3 4 5 6 7 8
|
||||
9 10 11 12 13 14 15
|
||||
16 17 18 19 20 21 22
|
||||
23 24 25 26 27 28 29
|
||||
30 31
|
||||
== == == == == == ==
|
||||
|
||||
|
||||
Rich Tables
|
||||
===========
|
||||
|
||||
+---------------------+----------------+------------------+
|
||||
| Cells are | by bar with | <Space>|<Space> |
|
||||
| separated | spaces around | |
|
||||
+---------------------+----------------+------------------+
|
||||
| *You* may use | markup, | included. |
|
||||
| **inline** | links_ | |
|
||||
+---------------------+----------------+------------------+
|
||||
| You can use various | - like lists | VST will |
|
||||
| types of structure | | interpret them. |
|
||||
| elements:: | + various | |
|
||||
| | | Even paragraphs. |
|
||||
| Welcome to world | - embedded | |
|
||||
| of preformatted | - one into | 1. And |
|
||||
| text. | other | 2. not |
|
||||
+---------------------+----------------+------------------+
|
||||
| Text may span across several | |
|
||||
| columns. Cell can be also empty -> | |
|
||||
+---------------------+----------------+------------------+
|
||||
|
||||
|
||||
Conclusion
|
||||
==========
|
||||
|
||||
VST is an easy way to produce marked-up documents with easy-to-read source, in
|
||||
Vim.
|
||||
|
||||
This slideshow displays only a few features of VST. Be sure to read the
|
||||
`manual <http://skawina.eu.org/mikolaj/vst.html>`_.
|
||||
|
||||
.. |VST| replace:: Vim reStructured Text
|
||||
|
||||
.. vim:set tw=78 ai fo+=n fo-=l ft=rst:
|
||||
2995
doc2/vst.txt
Normal file
2995
doc2/vst.txt
Normal file
File diff suppressed because it is too large
Load Diff
9
filetype.vim
Normal file
9
filetype.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" markdown filetype file
|
||||
if exists("did\_load\_filetypes")
|
||||
finish
|
||||
endif
|
||||
|
||||
augroup markdown
|
||||
au! BufRead,BufNewFile *.mkd setfiletype mkd
|
||||
augroup END
|
||||
|
||||
10
ftplugin/html_snip_helper.vim
Normal file
10
ftplugin/html_snip_helper.vim
Normal file
@@ -0,0 +1,10 @@
|
||||
" Helper function for (x)html snippets
|
||||
if exists('s:did_snip_helper') || &cp || !exists('loaded_snips')
|
||||
finish
|
||||
endif
|
||||
let s:did_snip_helper = 1
|
||||
|
||||
" Automatically closes tag if in xhtml
|
||||
fun! Close()
|
||||
return stridx(&ft, 'xhtml') == -1 ? '' : ' /'
|
||||
endf
|
||||
28
ftplugin/python/eclim_py.vim
Normal file
28
ftplugin/python/eclim_py.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
" ftplugin for python.
|
||||
" See: eclim_py plugin in plugins dir
|
||||
" Global Variables {{{
|
||||
|
||||
if !exists("g:EclimPythonValidate")
|
||||
let g:EclimPythonValidate = 1
|
||||
endif
|
||||
|
||||
" }}}
|
||||
|
||||
" Autocmds {{{
|
||||
|
||||
if g:EclimPythonValidate
|
||||
augroup eclim_python_validate
|
||||
autocmd! BufWritePost <buffer>
|
||||
autocmd BufWritePost <buffer> call Validate(1)
|
||||
augroup END
|
||||
endif
|
||||
|
||||
" }}}
|
||||
|
||||
if !exists(":Validate")
|
||||
command -nargs=0 -buffer Validate :call Validate(0)
|
||||
endif
|
||||
if !exists(":PyLint")
|
||||
command -nargs=0 -buffer PyLint :call PyLint()
|
||||
endif
|
||||
|
||||
226
ftplugin/python/pyflakes.vim
Normal file
226
ftplugin/python/pyflakes.vim
Normal file
@@ -0,0 +1,226 @@
|
||||
" pyflakes.vim - A script to highlight Python code on the fly with warnings
|
||||
" from Pyflakes, a Python lint tool.
|
||||
"
|
||||
" Place this script and the accompanying pyflakes directory in
|
||||
" .vim/ftplugin/python.
|
||||
"
|
||||
" See README for additional installation and information.
|
||||
"
|
||||
" Thanks to matlib.vim for ideas/code on interactive linting.
|
||||
"
|
||||
" Maintainer: Kevin Watters <kevin.watters@gmail.com>
|
||||
" Version: 0.1
|
||||
|
||||
if exists("b:did_pyflakes_plugin")
|
||||
finish " only load once
|
||||
else
|
||||
let b:did_pyflakes_plugin = 1
|
||||
endif
|
||||
|
||||
if !exists('g:pyflakes_builtins')
|
||||
let g:pyflakes_builtins = []
|
||||
endif
|
||||
|
||||
if !exists("b:did_python_init")
|
||||
let b:did_python_init = 0
|
||||
|
||||
if !has('python')
|
||||
echoerr "Error: the pyflakes.vim plugin requires Vim to be compiled with +python"
|
||||
finish
|
||||
endif
|
||||
|
||||
python << EOF
|
||||
import vim
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
if sys.version_info[:2] < (2, 5):
|
||||
raise AssertionError('Vim must be compiled with Python 2.5 or higher; you have ' + sys.version)
|
||||
|
||||
# get the directory this script is in: the pyflakes python module should be installed there.
|
||||
scriptdir = os.path.join(os.path.dirname(vim.eval('expand("<sfile>")')), 'pyflakes')
|
||||
sys.path.insert(0, scriptdir)
|
||||
|
||||
from pyflakes import checker, ast, messages
|
||||
from operator import attrgetter
|
||||
|
||||
class SyntaxError(messages.Message):
|
||||
message = 'could not compile: %s'
|
||||
def __init__(self, filename, lineno, col, message):
|
||||
messages.Message.__init__(self, filename, lineno, col)
|
||||
self.message_args = (message,)
|
||||
|
||||
class blackhole(object):
|
||||
write = flush = lambda *a, **k: None
|
||||
|
||||
def check(buffer):
|
||||
filename = buffer.name
|
||||
contents = '\n'.join(buffer[:]) + '\n'
|
||||
|
||||
vimenc = vim.eval('&encoding')
|
||||
if vimenc:
|
||||
contents = contents.decode(vimenc)
|
||||
|
||||
builtins = []
|
||||
try:
|
||||
builtins = eval(vim.eval('string(g:pyflakes_builtins)'))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
# TODO: use warnings filters instead of ignoring stderr
|
||||
old_stderr, sys.stderr = sys.stderr, blackhole()
|
||||
try:
|
||||
tree = ast.parse(contents, filename)
|
||||
finally:
|
||||
sys.stderr = old_stderr
|
||||
except:
|
||||
try:
|
||||
value = sys.exc_info()[1]
|
||||
lineno, offset, line = value[1][1:]
|
||||
except IndexError:
|
||||
lineno, offset, line = 1, 0, ''
|
||||
if line and line.endswith("\n"):
|
||||
line = line[:-1]
|
||||
|
||||
return [SyntaxError(filename, lineno, offset, str(value))]
|
||||
else:
|
||||
w = checker.Checker(tree, filename, builtins = builtins)
|
||||
w.messages.sort(key = attrgetter('lineno'))
|
||||
return w.messages
|
||||
|
||||
|
||||
def vim_quote(s):
|
||||
return s.replace("'", "''")
|
||||
EOF
|
||||
let b:did_python_init = 1
|
||||
endif
|
||||
|
||||
if !b:did_python_init
|
||||
finish
|
||||
endif
|
||||
|
||||
au BufLeave <buffer> call s:ClearPyflakes()
|
||||
|
||||
au BufEnter <buffer> call s:RunPyflakes()
|
||||
au InsertLeave <buffer> call s:RunPyflakes()
|
||||
au InsertEnter <buffer> call s:RunPyflakes()
|
||||
au BufWritePost <buffer> call s:RunPyflakes()
|
||||
|
||||
au CursorHold <buffer> call s:RunPyflakes()
|
||||
au CursorHoldI <buffer> call s:RunPyflakes()
|
||||
|
||||
au CursorHold <buffer> call s:GetPyflakesMessage()
|
||||
au CursorMoved <buffer> call s:GetPyflakesMessage()
|
||||
|
||||
if !exists("*s:PyflakesUpdate")
|
||||
function s:PyflakesUpdate()
|
||||
silent call s:RunPyflakes()
|
||||
call s:GetPyflakesMessage()
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" Call this function in your .vimrc to update PyFlakes
|
||||
if !exists(":PyflakesUpdate")
|
||||
command PyflakesUpdate :call s:PyflakesUpdate()
|
||||
endif
|
||||
|
||||
" Hook common text manipulation commands to update PyFlakes
|
||||
" TODO: is there a more general "text op" autocommand we could register
|
||||
" for here?
|
||||
noremap <buffer><silent> dd dd:PyflakesUpdate<CR>
|
||||
noremap <buffer><silent> dw dw:PyflakesUpdate<CR>
|
||||
noremap <buffer><silent> u u:PyflakesUpdate<CR>
|
||||
noremap <buffer><silent> <C-R> <C-R>:PyflakesUpdate<CR>
|
||||
|
||||
" WideMsg() prints [long] message up to (&columns-1) length
|
||||
" guaranteed without "Press Enter" prompt.
|
||||
if !exists("*s:WideMsg")
|
||||
function s:WideMsg(msg)
|
||||
let x=&ruler | let y=&showcmd
|
||||
set noruler noshowcmd
|
||||
redraw
|
||||
echo a:msg
|
||||
let &ruler=x | let &showcmd=y
|
||||
endfun
|
||||
endif
|
||||
|
||||
if !exists("*s:RunPyflakes")
|
||||
function s:RunPyflakes()
|
||||
highlight link PyFlakes SpellBad
|
||||
|
||||
if exists("b:cleared")
|
||||
if b:cleared == 0
|
||||
silent call s:ClearPyflakes()
|
||||
let b:cleared = 1
|
||||
endif
|
||||
else
|
||||
let b:cleared = 1
|
||||
endif
|
||||
|
||||
let b:matched = []
|
||||
let b:matchedlines = {}
|
||||
python << EOF
|
||||
for w in check(vim.current.buffer):
|
||||
vim.command('let s:matchDict = {}')
|
||||
vim.command("let s:matchDict['lineNum'] = " + str(w.lineno))
|
||||
vim.command("let s:matchDict['message'] = '%s'" % vim_quote(w.message % w.message_args))
|
||||
vim.command("let b:matchedlines[" + str(w.lineno) + "] = s:matchDict")
|
||||
|
||||
if w.col is None or isinstance(w, SyntaxError):
|
||||
# without column information, just highlight the whole line
|
||||
# (minus the newline)
|
||||
vim.command(r"let s:mID = matchadd('PyFlakes', '\%" + str(w.lineno) + r"l\n\@!')")
|
||||
else:
|
||||
# with a column number, highlight the first keyword there
|
||||
vim.command(r"let s:mID = matchadd('PyFlakes', '^\%" + str(w.lineno) + r"l\_.\{-}\zs\k\+\k\@!\%>" + str(w.col) + r"c')")
|
||||
|
||||
vim.command("call add(b:matched, s:matchDict)")
|
||||
EOF
|
||||
let b:cleared = 0
|
||||
endfunction
|
||||
end
|
||||
|
||||
" keep track of whether or not we are showing a message
|
||||
let b:showing_message = 0
|
||||
|
||||
if !exists("*s:GetPyflakesMessage")
|
||||
function s:GetPyflakesMessage()
|
||||
let s:cursorPos = getpos(".")
|
||||
|
||||
" Bail if RunPyflakes hasn't been called yet.
|
||||
if !exists('b:matchedlines')
|
||||
return
|
||||
endif
|
||||
|
||||
" if there's a message for the line the cursor is currently on, echo
|
||||
" it to the console
|
||||
if has_key(b:matchedlines, s:cursorPos[1])
|
||||
let s:pyflakesMatch = get(b:matchedlines, s:cursorPos[1])
|
||||
call s:WideMsg(s:pyflakesMatch['message'])
|
||||
let b:showing_message = 1
|
||||
return
|
||||
endif
|
||||
|
||||
" otherwise, if we're showing a message, clear it
|
||||
if b:showing_message == 1
|
||||
echo
|
||||
let b:showing_message = 0
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
|
||||
if !exists('*s:ClearPyflakes')
|
||||
function s:ClearPyflakes()
|
||||
let s:matches = getmatches()
|
||||
for s:matchId in s:matches
|
||||
if s:matchId['group'] == 'PyFlakes'
|
||||
call matchdelete(s:matchId['id'])
|
||||
endif
|
||||
endfor
|
||||
let b:matched = []
|
||||
let b:matchedlines = {}
|
||||
let b:cleared = 1
|
||||
endfunction
|
||||
endif
|
||||
|
||||
21
ftplugin/python/pyflakes/LICENSE
Normal file
21
ftplugin/python/pyflakes/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) 2005 Divmod, Inc., http://www.divmod.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
36
ftplugin/python/pyflakes/README.rst
Normal file
36
ftplugin/python/pyflakes/README.rst
Normal file
@@ -0,0 +1,36 @@
|
||||
pyflakes
|
||||
========
|
||||
|
||||
This version of PyFlakes_ has been improved to use Python's newer ``ast``
|
||||
module, instead of ``compiler``. So code checking happens faster, and will stay
|
||||
up to date with new language changes.
|
||||
|
||||
.. _PyFlakes: http://http://www.divmod.org/trac/wiki/DivmodPyflakes
|
||||
|
||||
TODO
|
||||
----
|
||||
|
||||
Importing several modules from the same package results in unnecessary warnings:
|
||||
|
||||
::
|
||||
|
||||
import a.b
|
||||
import a.c # Redefinition of unused "a" from line 1
|
||||
|
||||
The following construct for defining a function differently depending on some
|
||||
condition results in a redefinition warning:
|
||||
|
||||
::
|
||||
|
||||
if some_condition:
|
||||
def foo(): do_foo()
|
||||
else:
|
||||
def foo(): do_bar() # redefinition of function 'foo' from line 2
|
||||
|
||||
IDE Integration
|
||||
---------------
|
||||
|
||||
* vim: pyflakes-vim_
|
||||
|
||||
.. _pyflakes-vim: http://github.com/kevinw/pyflakes-vim
|
||||
|
||||
11
ftplugin/python/pyflakes/TODO
Normal file
11
ftplugin/python/pyflakes/TODO
Normal file
@@ -0,0 +1,11 @@
|
||||
- Check for methods that override other methods except that they vary by case.
|
||||
- assign/increment + unbound local error not caught
|
||||
def foo():
|
||||
bar = 5
|
||||
def meep():
|
||||
bar += 2
|
||||
meep()
|
||||
print bar
|
||||
|
||||
print foo()
|
||||
|
||||
4
ftplugin/python/pyflakes/bin/pyflakes
Normal file
4
ftplugin/python/pyflakes/bin/pyflakes
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from pyflakes.scripts.pyflakes import main
|
||||
main()
|
||||
0
ftplugin/python/pyflakes/pyflakes/__init__.py
Normal file
0
ftplugin/python/pyflakes/pyflakes/__init__.py
Normal file
BIN
ftplugin/python/pyflakes/pyflakes/__init__.pyc
Normal file
BIN
ftplugin/python/pyflakes/pyflakes/__init__.pyc
Normal file
Binary file not shown.
311
ftplugin/python/pyflakes/pyflakes/ast.py
Normal file
311
ftplugin/python/pyflakes/pyflakes/ast.py
Normal file
@@ -0,0 +1,311 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
ast
|
||||
~~~
|
||||
|
||||
The `ast` module helps Python applications to process trees of the Python
|
||||
abstract syntax grammar. The abstract syntax itself might change with
|
||||
each Python release; this module helps to find out programmatically what
|
||||
the current grammar looks like and allows modifications of it.
|
||||
|
||||
An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as
|
||||
a flag to the `compile()` builtin function or by using the `parse()`
|
||||
function from this module. The result will be a tree of objects whose
|
||||
classes all inherit from `ast.AST`.
|
||||
|
||||
A modified abstract syntax tree can be compiled into a Python code object
|
||||
using the built-in `compile()` function.
|
||||
|
||||
Additionally various helper functions are provided that make working with
|
||||
the trees simpler. The main intention of the helper functions and this
|
||||
module in general is to provide an easy to use interface for libraries
|
||||
that work tightly with the python syntax (template engines for example).
|
||||
|
||||
|
||||
:copyright: Copyright 2008 by Armin Ronacher.
|
||||
:license: Python License.
|
||||
"""
|
||||
from _ast import *
|
||||
from _ast import __version__
|
||||
|
||||
|
||||
def parse(expr, filename='<unknown>', mode='exec'):
|
||||
"""
|
||||
Parse an expression into an AST node.
|
||||
Equivalent to compile(expr, filename, mode, PyCF_ONLY_AST).
|
||||
"""
|
||||
return compile(expr, filename, mode, PyCF_ONLY_AST)
|
||||
|
||||
|
||||
def literal_eval(node_or_string):
|
||||
"""
|
||||
Safely evaluate an expression node or a string containing a Python
|
||||
expression. The string or node provided may only consist of the following
|
||||
Python literal structures: strings, numbers, tuples, lists, dicts, booleans,
|
||||
and None.
|
||||
"""
|
||||
_safe_names = {'None': None, 'True': True, 'False': False}
|
||||
if isinstance(node_or_string, basestring):
|
||||
node_or_string = parse(node_or_string, mode='eval')
|
||||
if isinstance(node_or_string, Expression):
|
||||
node_or_string = node_or_string.body
|
||||
def _convert(node):
|
||||
if isinstance(node, Str):
|
||||
return node.s
|
||||
elif isinstance(node, Num):
|
||||
return node.n
|
||||
elif isinstance(node, Tuple):
|
||||
return tuple(map(_convert, node.elts))
|
||||
elif isinstance(node, List):
|
||||
return list(map(_convert, node.elts))
|
||||
elif isinstance(node, Dict):
|
||||
return dict((_convert(k), _convert(v)) for k, v
|
||||
in zip(node.keys, node.values))
|
||||
elif isinstance(node, Name):
|
||||
if node.id in _safe_names:
|
||||
return _safe_names[node.id]
|
||||
raise ValueError('malformed string')
|
||||
return _convert(node_or_string)
|
||||
|
||||
|
||||
def dump(node, annotate_fields=True, include_attributes=False):
|
||||
"""
|
||||
Return a formatted dump of the tree in *node*. This is mainly useful for
|
||||
debugging purposes. The returned string will show the names and the values
|
||||
for fields. This makes the code impossible to evaluate, so if evaluation is
|
||||
wanted *annotate_fields* must be set to False. Attributes such as line
|
||||
numbers and column offsets are not dumped by default. If this is wanted,
|
||||
*include_attributes* can be set to True.
|
||||
"""
|
||||
def _format(node):
|
||||
if isinstance(node, AST):
|
||||
fields = [(a, _format(b)) for a, b in iter_fields(node)]
|
||||
rv = '%s(%s' % (node.__class__.__name__, ', '.join(
|
||||
('%s=%s' % field for field in fields)
|
||||
if annotate_fields else
|
||||
(b for a, b in fields)
|
||||
))
|
||||
if include_attributes and node._attributes:
|
||||
rv += fields and ', ' or ' '
|
||||
rv += ', '.join('%s=%s' % (a, _format(getattr(node, a)))
|
||||
for a in node._attributes)
|
||||
return rv + ')'
|
||||
elif isinstance(node, list):
|
||||
return '[%s]' % ', '.join(_format(x) for x in node)
|
||||
return repr(node)
|
||||
if not isinstance(node, AST):
|
||||
raise TypeError('expected AST, got %r' % node.__class__.__name__)
|
||||
return _format(node)
|
||||
|
||||
|
||||
def copy_location(new_node, old_node):
|
||||
"""
|
||||
Copy source location (`lineno` and `col_offset` attributes) from
|
||||
*old_node* to *new_node* if possible, and return *new_node*.
|
||||
"""
|
||||
for attr in 'lineno', 'col_offset':
|
||||
if attr in old_node._attributes and attr in new_node._attributes \
|
||||
and hasattr(old_node, attr):
|
||||
setattr(new_node, attr, getattr(old_node, attr))
|
||||
return new_node
|
||||
|
||||
|
||||
def fix_missing_locations(node):
|
||||
"""
|
||||
When you compile a node tree with compile(), the compiler expects lineno and
|
||||
col_offset attributes for every node that supports them. This is rather
|
||||
tedious to fill in for generated nodes, so this helper adds these attributes
|
||||
recursively where not already set, by setting them to the values of the
|
||||
parent node. It works recursively starting at *node*.
|
||||
"""
|
||||
def _fix(node, lineno, col_offset):
|
||||
if 'lineno' in node._attributes:
|
||||
if not hasattr(node, 'lineno'):
|
||||
node.lineno = lineno
|
||||
else:
|
||||
lineno = node.lineno
|
||||
if 'col_offset' in node._attributes:
|
||||
if not hasattr(node, 'col_offset'):
|
||||
node.col_offset = col_offset
|
||||
else:
|
||||
col_offset = node.col_offset
|
||||
for child in iter_child_nodes(node):
|
||||
_fix(child, lineno, col_offset)
|
||||
_fix(node, 1, 0)
|
||||
return node
|
||||
|
||||
def add_col_end(node):
|
||||
def _fix(node, next):
|
||||
children = list(iter_child_nodes(node))
|
||||
for i, child in enumerate(children):
|
||||
next_offset = children[i+1].col_offset if i < len(children) else next.col_offset
|
||||
child.col_end = next_offset
|
||||
|
||||
|
||||
def increment_lineno(node, n=1):
|
||||
"""
|
||||
Increment the line number of each node in the tree starting at *node* by *n*.
|
||||
This is useful to "move code" to a different location in a file.
|
||||
"""
|
||||
if 'lineno' in node._attributes:
|
||||
node.lineno = getattr(node, 'lineno', 0) + n
|
||||
for child in walk(node):
|
||||
if 'lineno' in child._attributes:
|
||||
child.lineno = getattr(child, 'lineno', 0) + n
|
||||
return node
|
||||
|
||||
|
||||
def iter_fields(node):
|
||||
"""
|
||||
Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
|
||||
that is present on *node*.
|
||||
"""
|
||||
if node._fields is None:
|
||||
return
|
||||
|
||||
for field in node._fields:
|
||||
try:
|
||||
yield field, getattr(node, field)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
def iter_child_nodes(node):
|
||||
"""
|
||||
Yield all direct child nodes of *node*, that is, all fields that are nodes
|
||||
and all items of fields that are lists of nodes.
|
||||
"""
|
||||
for name, field in iter_fields(node):
|
||||
if isinstance(field, AST):
|
||||
yield field
|
||||
elif isinstance(field, list):
|
||||
for item in field:
|
||||
if isinstance(item, AST):
|
||||
yield item
|
||||
|
||||
|
||||
def get_docstring(node, clean=True):
|
||||
"""
|
||||
Return the docstring for the given node or None if no docstring can
|
||||
be found. If the node provided does not have docstrings a TypeError
|
||||
will be raised.
|
||||
"""
|
||||
if not isinstance(node, (FunctionDef, ClassDef, Module)):
|
||||
raise TypeError("%r can't have docstrings" % node.__class__.__name__)
|
||||
if node.body and isinstance(node.body[0], Expr) and \
|
||||
isinstance(node.body[0].value, Str):
|
||||
if clean:
|
||||
import inspect
|
||||
return inspect.cleandoc(node.body[0].value.s)
|
||||
return node.body[0].value.s
|
||||
|
||||
|
||||
def walk(node):
|
||||
"""
|
||||
Recursively yield all child nodes of *node*, in no specified order. This is
|
||||
useful if you only want to modify nodes in place and don't care about the
|
||||
context.
|
||||
"""
|
||||
from collections import deque
|
||||
todo = deque([node])
|
||||
while todo:
|
||||
node = todo.popleft()
|
||||
todo.extend(iter_child_nodes(node))
|
||||
yield node
|
||||
|
||||
|
||||
class NodeVisitor(object):
|
||||
"""
|
||||
A node visitor base class that walks the abstract syntax tree and calls a
|
||||
visitor function for every node found. This function may return a value
|
||||
which is forwarded by the `visit` method.
|
||||
|
||||
This class is meant to be subclassed, with the subclass adding visitor
|
||||
methods.
|
||||
|
||||
Per default the visitor functions for the nodes are ``'visit_'`` +
|
||||
class name of the node. So a `TryFinally` node visit function would
|
||||
be `visit_TryFinally`. This behavior can be changed by overriding
|
||||
the `visit` method. If no visitor function exists for a node
|
||||
(return value `None`) the `generic_visit` visitor is used instead.
|
||||
|
||||
Don't use the `NodeVisitor` if you want to apply changes to nodes during
|
||||
traversing. For this a special visitor exists (`NodeTransformer`) that
|
||||
allows modifications.
|
||||
"""
|
||||
|
||||
def visit(self, node):
|
||||
"""Visit a node."""
|
||||
method = 'visit_' + node.__class__.__name__
|
||||
visitor = getattr(self, method, self.generic_visit)
|
||||
return visitor(node)
|
||||
|
||||
def generic_visit(self, node):
|
||||
"""Called if no explicit visitor function exists for a node."""
|
||||
for field, value in iter_fields(node):
|
||||
if isinstance(value, list):
|
||||
for item in value:
|
||||
if isinstance(item, AST):
|
||||
self.visit(item)
|
||||
elif isinstance(value, AST):
|
||||
self.visit(value)
|
||||
|
||||
|
||||
class NodeTransformer(NodeVisitor):
|
||||
"""
|
||||
A :class:`NodeVisitor` subclass that walks the abstract syntax tree and
|
||||
allows modification of nodes.
|
||||
|
||||
The `NodeTransformer` will walk the AST and use the return value of the
|
||||
visitor methods to replace or remove the old node. If the return value of
|
||||
the visitor method is ``None``, the node will be removed from its location,
|
||||
otherwise it is replaced with the return value. The return value may be the
|
||||
original node in which case no replacement takes place.
|
||||
|
||||
Here is an example transformer that rewrites all occurrences of name lookups
|
||||
(``foo``) to ``data['foo']``::
|
||||
|
||||
class RewriteName(NodeTransformer):
|
||||
|
||||
def visit_Name(self, node):
|
||||
return copy_location(Subscript(
|
||||
value=Name(id='data', ctx=Load()),
|
||||
slice=Index(value=Str(s=node.id)),
|
||||
ctx=node.ctx
|
||||
), node)
|
||||
|
||||
Keep in mind that if the node you're operating on has child nodes you must
|
||||
either transform the child nodes yourself or call the :meth:`generic_visit`
|
||||
method for the node first.
|
||||
|
||||
For nodes that were part of a collection of statements (that applies to all
|
||||
statement nodes), the visitor may also return a list of nodes rather than
|
||||
just a single node.
|
||||
|
||||
Usually you use the transformer like this::
|
||||
|
||||
node = YourTransformer().visit(node)
|
||||
"""
|
||||
|
||||
def generic_visit(self, node):
|
||||
for field, old_value in iter_fields(node):
|
||||
old_value = getattr(node, field, None)
|
||||
if isinstance(old_value, list):
|
||||
new_values = []
|
||||
for value in old_value:
|
||||
if isinstance(value, AST):
|
||||
value = self.visit(value)
|
||||
if value is None:
|
||||
continue
|
||||
elif not isinstance(value, AST):
|
||||
new_values.extend(value)
|
||||
continue
|
||||
new_values.append(value)
|
||||
old_value[:] = new_values
|
||||
elif isinstance(old_value, AST):
|
||||
new_node = self.visit(old_value)
|
||||
if new_node is None:
|
||||
delattr(node, field)
|
||||
else:
|
||||
setattr(node, field, new_node)
|
||||
return node
|
||||
BIN
ftplugin/python/pyflakes/pyflakes/ast.pyc
Normal file
BIN
ftplugin/python/pyflakes/pyflakes/ast.pyc
Normal file
Binary file not shown.
389
ftplugin/python/pyflakes/pyflakes/checker.py
Normal file
389
ftplugin/python/pyflakes/pyflakes/checker.py
Normal file
@@ -0,0 +1,389 @@
|
||||
import ast
|
||||
from pyflakes import messages
|
||||
import __builtin__
|
||||
|
||||
|
||||
allowed_before_future = (ast.Module, ast.ImportFrom, ast.Expr, ast.Str)
|
||||
defined_names = set(('__file__', '__builtins__'))
|
||||
|
||||
class Binding(object):
|
||||
"""
|
||||
@ivar used: pair of (L{Scope}, line-number) indicating the scope and
|
||||
line number that this binding was last used
|
||||
"""
|
||||
def __init__(self, name, source):
|
||||
self.name = name
|
||||
self.source = source
|
||||
self.used = False
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s object %r from line %r at 0x%x>' % (self.__class__.__name__,
|
||||
self.name,
|
||||
self.source.lineno,
|
||||
id(self))
|
||||
|
||||
class UnBinding(Binding):
|
||||
'''Created by the 'del' operator.'''
|
||||
|
||||
class Importation(Binding):
|
||||
def __init__(self, name, source):
|
||||
name = name.split('.')[0]
|
||||
super(Importation, self).__init__(name, source)
|
||||
|
||||
class Assignment(Binding):
|
||||
pass
|
||||
|
||||
class FunctionDefinition(Binding):
|
||||
pass
|
||||
|
||||
|
||||
class Scope(dict):
|
||||
import_starred = False # set to True when import * is found
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s at 0x%x %s>' % (self.__class__.__name__, id(self), dict.__repr__(self))
|
||||
|
||||
def __init__(self):
|
||||
super(Scope, self).__init__()
|
||||
|
||||
class ClassScope(Scope):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class FunctionScope(Scope):
|
||||
"""
|
||||
I represent a name scope for a function.
|
||||
|
||||
@ivar globals: Names declared 'global' in this function.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(FunctionScope, self).__init__()
|
||||
self.globals = {}
|
||||
|
||||
|
||||
|
||||
class ModuleScope(Scope):
|
||||
pass
|
||||
|
||||
class Checker(ast.NodeVisitor):
|
||||
def __init__(self, tree, filename='(none)', builtins = None):
|
||||
ast.NodeVisitor.__init__(self)
|
||||
|
||||
self.deferred = []
|
||||
self.dead_scopes = []
|
||||
self.messages = []
|
||||
self.filename = filename
|
||||
self.scope_stack = [ModuleScope()]
|
||||
self.futures_allowed = True
|
||||
self.builtins = frozenset(builtins or [])
|
||||
|
||||
self.visit(tree)
|
||||
for handler, scope in self.deferred:
|
||||
self.scope_stack = scope
|
||||
handler()
|
||||
del self.scope_stack[1:]
|
||||
self.pop_scope()
|
||||
self.check_dead_scopes()
|
||||
|
||||
def defer(self, callable):
|
||||
'''Schedule something to be called after just before completion.
|
||||
|
||||
This is used for handling function bodies, which must be deferred
|
||||
because code later in the file might modify the global scope. When
|
||||
`callable` is called, the scope at the time this is called will be
|
||||
restored, however it will contain any new bindings added to it.
|
||||
'''
|
||||
self.deferred.append( (callable, self.scope_stack[:]) )
|
||||
|
||||
def check_dead_scopes(self):
|
||||
# Check for modules that were imported but unused
|
||||
for scope in self.dead_scopes:
|
||||
for importation in scope.itervalues():
|
||||
if isinstance(importation, Importation) and not importation.used:
|
||||
self.report(messages.UnusedImport, importation.source.lineno, importation.name)
|
||||
|
||||
def push_function_scope(self):
|
||||
self.scope_stack.append(FunctionScope())
|
||||
|
||||
def push_class_scope(self):
|
||||
self.scope_stack.append(ClassScope())
|
||||
|
||||
def pop_scope(self):
|
||||
scope = self.scope_stack.pop()
|
||||
self.dead_scopes.append(scope)
|
||||
|
||||
@property
|
||||
def scope(self):
|
||||
return self.scope_stack[-1]
|
||||
|
||||
def report(self, message_class, *args, **kwargs):
|
||||
self.messages.append(message_class(self.filename, *args, **kwargs))
|
||||
|
||||
def visit_Import(self, node):
|
||||
for name_node in node.names:
|
||||
# "import bar as foo" -> name=bar, asname=foo
|
||||
name = name_node.asname or name_node.name
|
||||
self.add_binding(node, Importation(name, node))
|
||||
|
||||
def visit_GeneratorExp(self, node):
|
||||
for generator in node.generators:
|
||||
self.visit(generator.iter)
|
||||
self.assign_vars(generator.target)
|
||||
|
||||
for generator in node.generators:
|
||||
if hasattr(node, 'elt'):
|
||||
self.visit(node.elt)
|
||||
|
||||
self.visit_nodes(generator.ifs)
|
||||
|
||||
visit_ListComp = visit_GeneratorExp
|
||||
|
||||
def visit_For(self, node):
|
||||
'''
|
||||
Process bindings for loop variables.
|
||||
'''
|
||||
self.visit_nodes(node.iter)
|
||||
|
||||
for var in self.flatten(node.target):
|
||||
upval = self.scope.get(var.id)
|
||||
if isinstance(upval, Importation) and upval.used:
|
||||
self.report(messages.ImportShadowedByLoopVar,
|
||||
node.lineno, node.col_offset, var.id, upval.source.lineno)
|
||||
|
||||
self.add_binding(var, Assignment(var.id, var))
|
||||
|
||||
self.visit_nodes(node.body + node.orelse)
|
||||
|
||||
def visit_FunctionDef(self, node):
|
||||
|
||||
try:
|
||||
decorators = node.decorator_list
|
||||
except AttributeError:
|
||||
# Use .decorators for Python 2.5 compatibility
|
||||
decorators = node.decorators
|
||||
|
||||
self.visit_nodes(decorators)
|
||||
self.add_binding(node, FunctionDefinition(node.name, node))
|
||||
self.visit_Lambda(node)
|
||||
|
||||
def visit_Lambda(self, node):
|
||||
self.visit_nodes(node.args.defaults)
|
||||
|
||||
def run_function():
|
||||
self.push_function_scope()
|
||||
|
||||
# Check for duplicate arguments
|
||||
argnames = set()
|
||||
for arg in self.flatten(node.args.args):
|
||||
if arg.id in argnames:
|
||||
self.report(messages.DuplicateArgument, arg.lineno, arg.col_offset, arg.id)
|
||||
argnames.add(arg.id)
|
||||
|
||||
self.assign_vars(node.args.args, report_redef=False)
|
||||
if node.args.vararg is not None:
|
||||
self.add_binding(node, Assignment(node.args.vararg, node), False)
|
||||
if node.args.kwarg is not None:
|
||||
self.add_binding(node, Assignment(node.args.kwarg, node), False)
|
||||
self.visit_nodes(node.body)
|
||||
self.pop_scope()
|
||||
|
||||
self.defer(run_function)
|
||||
|
||||
def visit_Name(self, node):
|
||||
'''
|
||||
Locate names in locals / function / globals scopes.
|
||||
'''
|
||||
scope, name = self.scope, node.id
|
||||
|
||||
# try local scope
|
||||
import_starred = scope.import_starred
|
||||
try:
|
||||
scope[name].used = (scope, node.lineno, node.col_offset)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
return
|
||||
|
||||
# try enclosing function scopes
|
||||
for func_scope in self.scope_stack[-2:0:-1]:
|
||||
import_starred = import_starred or func_scope.import_starred
|
||||
if not isinstance(func_scope, FunctionScope):
|
||||
continue
|
||||
try:
|
||||
func_scope[name].used = (scope, node.lineno, node.col_offset)
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
return
|
||||
|
||||
# try global scope
|
||||
import_starred = import_starred or self.scope_stack[0].import_starred
|
||||
try:
|
||||
self.scope_stack[0][node.id].used = (scope, node.lineno, node.col_offset)
|
||||
except KeyError:
|
||||
if not import_starred and not self.is_builtin(name):
|
||||
self.report(messages.UndefinedName, node.lineno, node.col_offset, name)
|
||||
|
||||
def assign_vars(self, targets, report_redef=True):
|
||||
scope = self.scope
|
||||
|
||||
for target in self.flatten(targets):
|
||||
name = target.id
|
||||
# if the name hasn't already been defined in the current scope
|
||||
if isinstance(scope, FunctionScope) and name not in scope:
|
||||
# for each function or module scope above us
|
||||
for upscope in self.scope_stack[:-1]:
|
||||
if not isinstance(upscope, (FunctionScope, ModuleScope)):
|
||||
continue
|
||||
|
||||
upval = upscope.get(name)
|
||||
# if the name was defined in that scope, and the name has
|
||||
# been accessed already in the current scope, and hasn't
|
||||
# been declared global
|
||||
if upval is not None:
|
||||
if upval.used and upval.used[0] is scope and name not in scope.globals:
|
||||
# then it's probably a mistake
|
||||
self.report(messages.UndefinedLocal,
|
||||
upval.used[1], upval.used[2], name, upval.source.lineno, upval.source.col_offset)
|
||||
|
||||
self.add_binding(target, Assignment(name, target), report_redef)
|
||||
|
||||
def visit_Assign(self, node):
|
||||
for target in node.targets:
|
||||
self.visit_nodes(node.value)
|
||||
self.assign_vars(node.targets)
|
||||
|
||||
def visit_Delete(self, node):
|
||||
for target in self.flatten(node.targets):
|
||||
if isinstance(self.scope, FunctionScope) and target.id in self.scope.globals:
|
||||
del self.scope.globals[target.id]
|
||||
else:
|
||||
self.add_binding(target, UnBinding(target.id, target))
|
||||
|
||||
def visit_With(self, node):
|
||||
self.visit(node.context_expr)
|
||||
|
||||
# handle new bindings made by optional "as" part
|
||||
if node.optional_vars is not None:
|
||||
self.assign_vars(node.optional_vars)
|
||||
|
||||
self.visit_nodes(node.body)
|
||||
|
||||
def visit_ImportFrom(self, node):
|
||||
if node.module == '__future__':
|
||||
if not self.futures_allowed:
|
||||
self.report(messages.LateFutureImport, node.lineno, node.col_offset, [alias.name for alias in node.names])
|
||||
else:
|
||||
self.futures_allowed = False
|
||||
|
||||
for alias in node.names:
|
||||
if alias.name == '*':
|
||||
self.scope.import_starred = True
|
||||
self.report(messages.ImportStarUsed, node.lineno, node.col_offset, node.module)
|
||||
continue
|
||||
name = alias.asname or alias.name
|
||||
importation = Importation(name, node)
|
||||
if node.module == '__future__':
|
||||
importation.used = (self.scope, node.lineno, node.col_offset)
|
||||
self.add_binding(node, importation)
|
||||
|
||||
def visit_Global(self, node):
|
||||
'''
|
||||
Keep track of global declarations.
|
||||
'''
|
||||
scope = self.scope
|
||||
if isinstance(scope, FunctionScope):
|
||||
scope.globals.update(dict.fromkeys(node.names))
|
||||
|
||||
def visit_ClassDef(self, node):
|
||||
self.add_binding(node, Assignment(node.name, node))
|
||||
self.visit_nodes(node.bases)
|
||||
|
||||
self.push_class_scope()
|
||||
self.visit_nodes(node.body)
|
||||
self.pop_scope()
|
||||
|
||||
def visit_excepthandler(self, node):
|
||||
if node.type is not None:
|
||||
self.visit(node.type)
|
||||
if node.name is not None:
|
||||
self.assign_vars(node.name)
|
||||
self.visit_nodes(node.body)
|
||||
|
||||
visit_ExceptHandler = visit_excepthandler # in 2.6, this was CamelCased
|
||||
|
||||
def flatten(self, nodes):
|
||||
if isinstance(nodes, ast.Attribute):
|
||||
self.visit(nodes)
|
||||
return []
|
||||
elif isinstance(nodes, ast.Subscript):
|
||||
self.visit(nodes.value)
|
||||
self.visit(nodes.slice)
|
||||
return []
|
||||
elif isinstance(nodes, ast.Name):
|
||||
return [nodes]
|
||||
elif isinstance(nodes, (ast.Tuple, ast.List)):
|
||||
return self.flatten(nodes.elts)
|
||||
|
||||
flattened_nodes = []
|
||||
for node in nodes:
|
||||
if hasattr(node, 'elts'):
|
||||
flattened_nodes += self.flatten(node.elts)
|
||||
elif node is not None:
|
||||
flattened_nodes += self.flatten(node)
|
||||
|
||||
return flattened_nodes
|
||||
|
||||
def add_binding(self, node, value, report_redef=True):
|
||||
line, col, scope, name = node.lineno, node.col_offset, self.scope, value.name
|
||||
|
||||
# Check for a redefined function
|
||||
func = scope.get(name)
|
||||
if (isinstance(func, FunctionDefinition) and isinstance(value, FunctionDefinition)):
|
||||
self.report(messages.RedefinedFunction, line, name, func.source.lineno)
|
||||
|
||||
# Check for redefining an unused import
|
||||
if report_redef and not isinstance(scope, ClassScope):
|
||||
for up_scope in self.scope_stack[::-1]:
|
||||
upval = up_scope.get(name)
|
||||
if isinstance(upval, Importation) and not upval.used:
|
||||
self.report(messages.RedefinedWhileUnused, line, col, name, upval.source.lineno)
|
||||
|
||||
# Check for "del undefined_name"
|
||||
if isinstance(value, UnBinding):
|
||||
try:
|
||||
del scope[name]
|
||||
except KeyError:
|
||||
self.report(messages.UndefinedName, line, col, name)
|
||||
else:
|
||||
scope[name] = value
|
||||
|
||||
def visit(self, node):
|
||||
if not isinstance(node, allowed_before_future):
|
||||
self.futures_allowed = False
|
||||
|
||||
return super(Checker, self).visit(node)
|
||||
|
||||
def visit_nodes(self, nodes):
|
||||
try:
|
||||
nodes = list(getattr(nodes, 'elts', nodes))
|
||||
except TypeError:
|
||||
nodes = [nodes]
|
||||
|
||||
for node in nodes:
|
||||
self.visit(node)
|
||||
|
||||
def is_builtin(self, name):
|
||||
if hasattr(__builtin__, name):
|
||||
return True
|
||||
if name in defined_names:
|
||||
return True
|
||||
if name in self.builtins:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
BIN
ftplugin/python/pyflakes/pyflakes/checker.pyc
Normal file
BIN
ftplugin/python/pyflakes/pyflakes/checker.pyc
Normal file
Binary file not shown.
77
ftplugin/python/pyflakes/pyflakes/messages.py
Normal file
77
ftplugin/python/pyflakes/pyflakes/messages.py
Normal file
@@ -0,0 +1,77 @@
|
||||
# (c) 2005 Divmod, Inc. See LICENSE file for details
|
||||
|
||||
class Message(object):
|
||||
message = ''
|
||||
message_args = ()
|
||||
def __init__(self, filename, lineno, col = None):
|
||||
self.filename = filename
|
||||
self.lineno = lineno
|
||||
self.col = col
|
||||
def __str__(self):
|
||||
if self.col is not None:
|
||||
return '%s:%s(%d): %s' % (self.filename, self.lineno, self.col, self.message % self.message_args)
|
||||
else:
|
||||
return '%s:%s: %s' % (self.filename, self.lineno, self.message % self.message_args)
|
||||
|
||||
|
||||
class UnusedImport(Message):
|
||||
message = '%r imported but unused'
|
||||
def __init__(self, filename, lineno, name):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class RedefinedWhileUnused(Message):
|
||||
message = 'redefinition of unused %r from line %r'
|
||||
def __init__(self, filename, lineno, col, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class ImportShadowedByLoopVar(Message):
|
||||
message = 'import %r from line %r shadowed by loop variable'
|
||||
def __init__(self, filename, lineno, col, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno, col)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class ImportStarUsed(Message):
|
||||
message = "'from %s import *' used; unable to detect undefined names"
|
||||
def __init__(self, filename, lineno, col, modname):
|
||||
Message.__init__(self, filename, lineno, col)
|
||||
self.message_args = (modname,)
|
||||
|
||||
|
||||
class UndefinedName(Message):
|
||||
message = 'undefined name %r'
|
||||
def __init__(self, filename, lineno, col, name):
|
||||
Message.__init__(self, filename, lineno, col)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class UndefinedLocal(Message):
|
||||
message = "local variable %r (defined in enclosing scope on line %r) referenced before assignment"
|
||||
def __init__(self, filename, lineno, col, name, orig_lineno, orig_col):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class DuplicateArgument(Message):
|
||||
message = 'duplicate argument %r in function definition'
|
||||
def __init__(self, filename, lineno, col, name):
|
||||
Message.__init__(self, filename, lineno, col)
|
||||
self.message_args = (name,)
|
||||
|
||||
|
||||
class RedefinedFunction(Message):
|
||||
message = 'redefinition of function %r from line %r'
|
||||
def __init__(self, filename, lineno, name, orig_lineno):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (name, orig_lineno)
|
||||
|
||||
|
||||
class LateFutureImport(Message):
|
||||
message = 'future import(s) %r after other statements'
|
||||
def __init__(self, filename, lineno, col, names):
|
||||
Message.__init__(self, filename, lineno)
|
||||
self.message_args = (names,)
|
||||
BIN
ftplugin/python/pyflakes/pyflakes/messages.pyc
Normal file
BIN
ftplugin/python/pyflakes/pyflakes/messages.pyc
Normal file
Binary file not shown.
63
ftplugin/python/pyflakes/pyflakes/scripts/pyflakes.py
Normal file
63
ftplugin/python/pyflakes/pyflakes/scripts/pyflakes.py
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
"""
|
||||
Implementation of the command-line I{pyflakes} tool.
|
||||
"""
|
||||
|
||||
import _ast
|
||||
import sys
|
||||
import os
|
||||
|
||||
checker = __import__('pyflakes.checker').checker
|
||||
|
||||
def check(codeString, filename):
|
||||
try:
|
||||
tree = compile(codeString, filename, 'exec', _ast.PyCF_ONLY_AST)
|
||||
except (SyntaxError, IndentationError):
|
||||
value = sys.exc_info()[1]
|
||||
try:
|
||||
(lineno, offset, line) = value[1][1:]
|
||||
except IndexError:
|
||||
print >> sys.stderr, 'could not compile %r' % (filename,)
|
||||
return 1
|
||||
if line.endswith("\n"):
|
||||
line = line[:-1]
|
||||
print >> sys.stderr, '%s:%d: could not compile' % (filename, lineno)
|
||||
print >> sys.stderr, line
|
||||
print >> sys.stderr, " " * (offset-2), "^"
|
||||
return 1
|
||||
else:
|
||||
w = checker.Checker(tree, filename)
|
||||
w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
|
||||
for warning in w.messages:
|
||||
print warning
|
||||
return len(w.messages)
|
||||
|
||||
|
||||
def checkPath(filename):
|
||||
"""
|
||||
Check the given path, printing out any warnings detected.
|
||||
|
||||
@return: the number of warnings printed
|
||||
"""
|
||||
if os.path.exists(filename):
|
||||
return check(file(filename, 'U').read() + '\n', filename)
|
||||
else:
|
||||
print >> sys.stderr, '%s: no such file' % (filename,)
|
||||
return 1
|
||||
|
||||
def main():
|
||||
warnings = 0
|
||||
args = sys.argv[1:]
|
||||
if args:
|
||||
for arg in args:
|
||||
if os.path.isdir(arg):
|
||||
for dirpath, dirnames, filenames in os.walk(arg):
|
||||
for filename in filenames:
|
||||
if filename.endswith('.py'):
|
||||
warnings += checkPath(os.path.join(dirpath, filename))
|
||||
else:
|
||||
warnings += checkPath(arg)
|
||||
else:
|
||||
warnings += check(sys.stdin.read(), '<stdin>')
|
||||
|
||||
raise SystemExit(warnings > 0)
|
||||
0
ftplugin/python/pyflakes/pyflakes/test/__init__.py
Normal file
0
ftplugin/python/pyflakes/pyflakes/test/__init__.py
Normal file
24
ftplugin/python/pyflakes/pyflakes/test/harness.py
Normal file
24
ftplugin/python/pyflakes/pyflakes/test/harness.py
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
import textwrap
|
||||
|
||||
from twisted.trial import unittest
|
||||
|
||||
from pyflakes import checker, ast
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def flakes(self, input, *expectedOutputs):
|
||||
w = checker.Checker(ast.parse(textwrap.dedent(input)))
|
||||
outputs = [type(o) for o in w.messages]
|
||||
expectedOutputs = list(expectedOutputs)
|
||||
outputs.sort()
|
||||
expectedOutputs.sort()
|
||||
self.assert_(outputs == expectedOutputs, '''\
|
||||
for input:
|
||||
%s
|
||||
expected outputs:
|
||||
%s
|
||||
but got:
|
||||
%s''' % (input, repr(expectedOutputs), '\n'.join([str(o) for o in w.messages])))
|
||||
return w
|
||||
512
ftplugin/python/pyflakes/pyflakes/test/test_imports.py
Normal file
512
ftplugin/python/pyflakes/pyflakes/test/test_imports.py
Normal file
@@ -0,0 +1,512 @@
|
||||
|
||||
from sys import version_info
|
||||
|
||||
from pyflakes import messages as m
|
||||
from pyflakes.test import harness
|
||||
|
||||
class Test(harness.Test):
|
||||
|
||||
def test_unusedImport(self):
|
||||
self.flakes('import fu, bar', m.UnusedImport, m.UnusedImport)
|
||||
self.flakes('from baz import fu, bar', m.UnusedImport, m.UnusedImport)
|
||||
|
||||
def test_aliasedImport(self):
|
||||
self.flakes('import fu as FU, bar as FU', m.RedefinedWhileUnused, m.UnusedImport)
|
||||
self.flakes('from moo import fu as FU, bar as FU', m.RedefinedWhileUnused, m.UnusedImport)
|
||||
|
||||
def test_usedImport(self):
|
||||
self.flakes('import fu; print fu')
|
||||
self.flakes('from baz import fu; print fu')
|
||||
|
||||
def test_redefinedWhileUnused(self):
|
||||
self.flakes('import fu; fu = 3', m.RedefinedWhileUnused)
|
||||
self.flakes('import fu; del fu', m.RedefinedWhileUnused)
|
||||
self.flakes('import fu; fu, bar = 3', m.RedefinedWhileUnused)
|
||||
self.flakes('import fu; [fu, bar] = 3', m.RedefinedWhileUnused)
|
||||
|
||||
def test_redefinedByFunction(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def fu():
|
||||
pass
|
||||
''', m.RedefinedWhileUnused)
|
||||
|
||||
def test_redefinedInNestedFunction(self):
|
||||
"""
|
||||
Test that shadowing a global name with a nested function definition
|
||||
generates a warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
import fu
|
||||
def bar():
|
||||
def baz():
|
||||
def fu():
|
||||
pass
|
||||
''', m.RedefinedWhileUnused, m.UnusedImport)
|
||||
|
||||
def test_redefinedByClass(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
class fu:
|
||||
pass
|
||||
''', m.RedefinedWhileUnused)
|
||||
|
||||
def test_redefinedInClass(self):
|
||||
"""
|
||||
Test that shadowing a global with a class attribute does not produce a
|
||||
warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
import fu
|
||||
class bar:
|
||||
fu = 1
|
||||
print fu
|
||||
''')
|
||||
|
||||
def test_usedInFunction(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def fun():
|
||||
print fu
|
||||
''')
|
||||
|
||||
def test_shadowedByParameter(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def fun(fu):
|
||||
print fu
|
||||
''', m.UnusedImport)
|
||||
|
||||
self.flakes('''
|
||||
import fu
|
||||
def fun(fu):
|
||||
print fu
|
||||
print fu
|
||||
''')
|
||||
|
||||
def test_newAssignment(self):
|
||||
self.flakes('fu = None')
|
||||
|
||||
def test_usedInGetattr(self):
|
||||
self.flakes('import fu; fu.bar.baz')
|
||||
self.flakes('import fu; "bar".fu.baz', m.UnusedImport)
|
||||
|
||||
def test_usedInSlice(self):
|
||||
self.flakes('import fu; print fu.bar[1:]')
|
||||
|
||||
def test_usedInIfBody(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
if True: print fu
|
||||
''')
|
||||
|
||||
def test_usedInIfConditional(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
if fu: pass
|
||||
''')
|
||||
|
||||
def test_usedInElifConditional(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
if False: pass
|
||||
elif fu: pass
|
||||
''')
|
||||
|
||||
def test_usedInElse(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
if False: pass
|
||||
else: print fu
|
||||
''')
|
||||
|
||||
def test_usedInCall(self):
|
||||
self.flakes('import fu; fu.bar()')
|
||||
|
||||
def test_usedInClass(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
class bar:
|
||||
bar = fu
|
||||
''')
|
||||
|
||||
def test_usedInClassBase(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
class bar(object, fu.baz):
|
||||
pass
|
||||
''')
|
||||
|
||||
def test_notUsedInNestedScope(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def bleh():
|
||||
pass
|
||||
print fu
|
||||
''')
|
||||
|
||||
def test_usedInFor(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
for bar in range(9):
|
||||
print fu
|
||||
''')
|
||||
|
||||
def test_usedInForElse(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
for bar in range(10):
|
||||
pass
|
||||
else:
|
||||
print fu
|
||||
''')
|
||||
|
||||
def test_redefinedByFor(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
for fu in range(2):
|
||||
pass
|
||||
''', m.RedefinedWhileUnused)
|
||||
|
||||
def test_shadowedByFor(self):
|
||||
"""
|
||||
Test that shadowing a global name with a for loop variable generates a
|
||||
warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
import fu
|
||||
fu.bar()
|
||||
for fu in ():
|
||||
pass
|
||||
''', m.ImportShadowedByLoopVar)
|
||||
|
||||
def test_shadowedByForDeep(self):
|
||||
"""
|
||||
Test that shadowing a global name with a for loop variable nested in a
|
||||
tuple unpack generates a warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
import fu
|
||||
fu.bar()
|
||||
for (x, y, z, (a, b, c, (fu,))) in ():
|
||||
pass
|
||||
''', m.ImportShadowedByLoopVar)
|
||||
|
||||
def test_usedInReturn(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def fun():
|
||||
return fu
|
||||
''')
|
||||
|
||||
def test_usedInOperators(self):
|
||||
self.flakes('import fu; 3 + fu.bar')
|
||||
self.flakes('import fu; 3 % fu.bar')
|
||||
self.flakes('import fu; 3 - fu.bar')
|
||||
self.flakes('import fu; 3 * fu.bar')
|
||||
self.flakes('import fu; 3 ** fu.bar')
|
||||
self.flakes('import fu; 3 / fu.bar')
|
||||
self.flakes('import fu; 3 // fu.bar')
|
||||
self.flakes('import fu; -fu.bar')
|
||||
self.flakes('import fu; ~fu.bar')
|
||||
self.flakes('import fu; 1 == fu.bar')
|
||||
self.flakes('import fu; 1 | fu.bar')
|
||||
self.flakes('import fu; 1 & fu.bar')
|
||||
self.flakes('import fu; 1 ^ fu.bar')
|
||||
self.flakes('import fu; 1 >> fu.bar')
|
||||
self.flakes('import fu; 1 << fu.bar')
|
||||
|
||||
def test_usedInAssert(self):
|
||||
self.flakes('import fu; assert fu.bar')
|
||||
|
||||
def test_usedInSubscript(self):
|
||||
self.flakes('import fu; fu.bar[1]')
|
||||
|
||||
def test_usedInLogic(self):
|
||||
self.flakes('import fu; fu and False')
|
||||
self.flakes('import fu; fu or False')
|
||||
self.flakes('import fu; not fu.bar')
|
||||
|
||||
def test_usedInList(self):
|
||||
self.flakes('import fu; [fu]')
|
||||
|
||||
def test_usedInTuple(self):
|
||||
self.flakes('import fu; (fu,)')
|
||||
|
||||
def test_usedInTry(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
try: fu
|
||||
except: pass
|
||||
''')
|
||||
|
||||
def test_usedInExcept(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
try: fu
|
||||
except: pass
|
||||
''')
|
||||
|
||||
def test_redefinedByExcept(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
try: pass
|
||||
except Exception, fu: pass
|
||||
''', m.RedefinedWhileUnused)
|
||||
|
||||
def test_usedInRaise(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
raise fu.bar
|
||||
''')
|
||||
|
||||
def test_usedInYield(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def gen():
|
||||
yield fu
|
||||
''')
|
||||
|
||||
def test_usedInDict(self):
|
||||
self.flakes('import fu; {fu:None}')
|
||||
self.flakes('import fu; {1:fu}')
|
||||
|
||||
def test_usedInParameterDefault(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def f(bar=fu):
|
||||
pass
|
||||
''')
|
||||
|
||||
def test_usedInAttributeAssign(self):
|
||||
self.flakes('import fu; fu.bar = 1')
|
||||
|
||||
def test_usedInKeywordArg(self):
|
||||
self.flakes('import fu; fu.bar(stuff=fu)')
|
||||
|
||||
def test_usedInAssignment(self):
|
||||
self.flakes('import fu; bar=fu')
|
||||
self.flakes('import fu; n=0; n+=fu')
|
||||
|
||||
def test_usedInListComp(self):
|
||||
self.flakes('import fu; [fu for _ in range(1)]')
|
||||
self.flakes('import fu; [1 for _ in range(1) if fu]')
|
||||
|
||||
def test_redefinedByListComp(self):
|
||||
self.flakes('import fu; [1 for fu in range(1)]', m.RedefinedWhileUnused)
|
||||
|
||||
|
||||
def test_usedInTryFinally(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
try: pass
|
||||
finally: fu
|
||||
''')
|
||||
|
||||
self.flakes('''
|
||||
import fu
|
||||
try: fu
|
||||
finally: pass
|
||||
''')
|
||||
|
||||
def test_usedInWhile(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
while 0:
|
||||
fu
|
||||
''')
|
||||
|
||||
self.flakes('''
|
||||
import fu
|
||||
while fu: pass
|
||||
''')
|
||||
|
||||
def test_usedInGlobal(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def f(): global fu
|
||||
''', m.UnusedImport)
|
||||
|
||||
def test_usedInBackquote(self):
|
||||
self.flakes('import fu; `fu`')
|
||||
|
||||
def test_usedInExec(self):
|
||||
self.flakes('import fu; exec "print 1" in fu.bar')
|
||||
|
||||
def test_usedInLambda(self):
|
||||
self.flakes('import fu; lambda: fu')
|
||||
|
||||
def test_shadowedByLambda(self):
|
||||
self.flakes('import fu; lambda fu: fu', m.UnusedImport)
|
||||
|
||||
def test_usedInSliceObj(self):
|
||||
self.flakes('import fu; "meow"[::fu]')
|
||||
|
||||
def test_unusedInNestedScope(self):
|
||||
self.flakes('''
|
||||
def bar():
|
||||
import fu
|
||||
fu
|
||||
''', m.UnusedImport, m.UndefinedName)
|
||||
|
||||
def test_methodsDontUseClassScope(self):
|
||||
self.flakes('''
|
||||
class bar:
|
||||
import fu
|
||||
def fun(self):
|
||||
fu
|
||||
''', m.UnusedImport, m.UndefinedName)
|
||||
|
||||
def test_nestedFunctionsNestScope(self):
|
||||
self.flakes('''
|
||||
def a():
|
||||
def b():
|
||||
fu
|
||||
import fu
|
||||
''')
|
||||
|
||||
def test_nestedClassAndFunctionScope(self):
|
||||
self.flakes('''
|
||||
def a():
|
||||
import fu
|
||||
class b:
|
||||
def c(self):
|
||||
print fu
|
||||
''')
|
||||
|
||||
def test_importStar(self):
|
||||
self.flakes('from fu import *', m.ImportStarUsed)
|
||||
|
||||
def test_packageImport(self):
|
||||
self.flakes('import fu.bar; fu.bar')
|
||||
test_packageImport.todo = "this has been hacked to treat 'import fu.bar' as just 'import fu'"
|
||||
|
||||
def test_assignRHSFirst(self):
|
||||
self.flakes('import fu; fu = fu')
|
||||
self.flakes('import fu; fu, bar = fu')
|
||||
self.flakes('import fu; [fu, bar] = fu')
|
||||
self.flakes('import fu; fu += fu')
|
||||
|
||||
def test_tryingMultipleImports(self):
|
||||
self.flakes('''
|
||||
try:
|
||||
import fu
|
||||
except ImportError:
|
||||
import bar as fu
|
||||
''')
|
||||
test_tryingMultipleImports.todo = ''
|
||||
|
||||
def test_nonGlobalDoesNotRedefine(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def a():
|
||||
fu = 3
|
||||
fu
|
||||
''')
|
||||
|
||||
def test_functionsRunLater(self):
|
||||
self.flakes('''
|
||||
def a():
|
||||
fu
|
||||
import fu
|
||||
''')
|
||||
|
||||
def test_functionNamesAreBoundNow(self):
|
||||
self.flakes('''
|
||||
import fu
|
||||
def fu():
|
||||
fu
|
||||
fu
|
||||
''', m.RedefinedWhileUnused)
|
||||
|
||||
def test_ignoreNonImportRedefinitions(self):
|
||||
self.flakes('a = 1; a = 2')
|
||||
|
||||
def test_importingForImportError(self):
|
||||
self.flakes('''
|
||||
try:
|
||||
import fu
|
||||
except ImportError:
|
||||
pass
|
||||
''')
|
||||
test_importingForImportError.todo = ''
|
||||
|
||||
def test_explicitlyPublic(self):
|
||||
'''imports mentioned in __all__ are not unused'''
|
||||
self.flakes('import fu; __all__ = ["fu"]')
|
||||
test_explicitlyPublic.todo = "this would require importing the module or doing smarter parsing"
|
||||
|
||||
def test_importedInClass(self):
|
||||
'''Imports in class scope can be used through self'''
|
||||
self.flakes('''
|
||||
class c:
|
||||
import i
|
||||
def __init__(self):
|
||||
self.i
|
||||
''')
|
||||
test_importedInClass.todo = 'requires evaluating attribute access'
|
||||
|
||||
def test_futureImport(self):
|
||||
'''__future__ is special'''
|
||||
self.flakes('from __future__ import division')
|
||||
|
||||
def test_futureImportFirst(self):
|
||||
"""
|
||||
__future__ imports must come before anything else.
|
||||
"""
|
||||
self.flakes('''
|
||||
x = 5
|
||||
from __future__ import division
|
||||
''', m.LateFutureImport)
|
||||
|
||||
|
||||
|
||||
class Python24Tests(harness.Test):
|
||||
"""
|
||||
Tests for checking of syntax which is valid in Python 2.4 and newer.
|
||||
"""
|
||||
if version_info < (2, 4):
|
||||
skip = "Python 2.4 required for generator expression and decorator tests."
|
||||
|
||||
|
||||
def test_usedInGenExp(self):
|
||||
"""
|
||||
Using a global in a generator expression results in no warnings.
|
||||
"""
|
||||
self.flakes('import fu; (fu for _ in range(1))')
|
||||
self.flakes('import fu; (1 for _ in range(1) if fu)')
|
||||
|
||||
|
||||
def test_redefinedByGenExp(self):
|
||||
"""
|
||||
Re-using a global name as the loop variable for a generator
|
||||
expression results in a redefinition warning.
|
||||
"""
|
||||
self.flakes('import fu; (1 for fu in range(1))', m.RedefinedWhileUnused)
|
||||
|
||||
|
||||
def test_usedAsDecorator(self):
|
||||
"""
|
||||
Using a global name in a decorator statement results in no warnings,
|
||||
but using an undefined name in a decorator statement results in an
|
||||
undefined name warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
from interior import decorate
|
||||
@decorate
|
||||
def f():
|
||||
return "hello"
|
||||
''')
|
||||
|
||||
self.flakes('''
|
||||
from interior import decorate
|
||||
@decorate('value')
|
||||
def f():
|
||||
return "hello"
|
||||
''')
|
||||
|
||||
self.flakes('''
|
||||
@decorate
|
||||
def f():
|
||||
return "hello"
|
||||
''', m.UndefinedName)
|
||||
234
ftplugin/python/pyflakes/pyflakes/test/test_other.py
Normal file
234
ftplugin/python/pyflakes/pyflakes/test/test_other.py
Normal file
@@ -0,0 +1,234 @@
|
||||
# (c) 2005-2008 Divmod, Inc.
|
||||
# See LICENSE file for details
|
||||
|
||||
"""
|
||||
Tests for various Pyflakes behavior.
|
||||
"""
|
||||
|
||||
from sys import version_info
|
||||
|
||||
from pyflakes import messages as m
|
||||
from pyflakes.test import harness
|
||||
|
||||
|
||||
class Test(harness.Test):
|
||||
|
||||
def test_duplicateArgs(self):
|
||||
self.flakes('def fu(bar, bar): pass', m.DuplicateArgument)
|
||||
|
||||
def test_localReferencedBeforeAssignment(self):
|
||||
self.flakes('''
|
||||
a = 1
|
||||
def f():
|
||||
a; a=1
|
||||
f()
|
||||
''', m.UndefinedName)
|
||||
test_localReferencedBeforeAssignment.todo = 'this requires finding all assignments in the function body first'
|
||||
|
||||
def test_redefinedFunction(self):
|
||||
"""
|
||||
Test that shadowing a function definition with another one raises a
|
||||
warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
def a(): pass
|
||||
def a(): pass
|
||||
''', m.RedefinedFunction)
|
||||
|
||||
def test_redefinedClassFunction(self):
|
||||
"""
|
||||
Test that shadowing a function definition in a class suite with another
|
||||
one raises a warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
class A:
|
||||
def a(): pass
|
||||
def a(): pass
|
||||
''', m.RedefinedFunction)
|
||||
|
||||
def test_functionDecorator(self):
|
||||
"""
|
||||
Test that shadowing a function definition with a decorated version of
|
||||
that function does not raise a warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
from somewhere import somedecorator
|
||||
|
||||
def a(): pass
|
||||
a = somedecorator(a)
|
||||
''')
|
||||
|
||||
def test_classFunctionDecorator(self):
|
||||
"""
|
||||
Test that shadowing a function definition in a class suite with a
|
||||
decorated version of that function does not raise a warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
class A:
|
||||
def a(): pass
|
||||
a = classmethod(a)
|
||||
''')
|
||||
|
||||
def test_unaryPlus(self):
|
||||
'''Don't die on unary +'''
|
||||
self.flakes('+1')
|
||||
|
||||
|
||||
|
||||
class Python25Test(harness.Test):
|
||||
"""
|
||||
Tests for checking of syntax only available in Python 2.5 and newer.
|
||||
"""
|
||||
if version_info < (2, 5):
|
||||
skip = "Python 2.5 required for if-else and with tests"
|
||||
|
||||
def test_ifexp(self):
|
||||
"""
|
||||
Test C{foo if bar else baz} statements.
|
||||
"""
|
||||
self.flakes("a = 'moo' if True else 'oink'")
|
||||
self.flakes("a = foo if True else 'oink'", m.UndefinedName)
|
||||
self.flakes("a = 'moo' if True else bar", m.UndefinedName)
|
||||
|
||||
|
||||
def test_withStatementNoNames(self):
|
||||
"""
|
||||
No warnings are emitted for using inside or after a nameless C{with}
|
||||
statement a name defined beforehand.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
bar = None
|
||||
with open("foo"):
|
||||
bar
|
||||
bar
|
||||
''')
|
||||
|
||||
def test_withStatementSingleName(self):
|
||||
"""
|
||||
No warnings are emitted for using a name defined by a C{with} statement
|
||||
within the suite or afterwards.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
with open('foo') as bar:
|
||||
bar
|
||||
bar
|
||||
''')
|
||||
|
||||
|
||||
def test_withStatementTupleNames(self):
|
||||
"""
|
||||
No warnings are emitted for using any of the tuple of names defined by
|
||||
a C{with} statement within the suite or afterwards.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
with open('foo') as (bar, baz):
|
||||
bar, baz
|
||||
bar, baz
|
||||
''')
|
||||
|
||||
|
||||
def test_withStatementSingleNameUndefined(self):
|
||||
"""
|
||||
An undefined name warning is emitted if the name first defined by a
|
||||
C{with} statement is used before the C{with} statement.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
bar
|
||||
with open('foo') as bar:
|
||||
pass
|
||||
''', m.UndefinedName)
|
||||
|
||||
|
||||
def test_withStatementTupleNamesUndefined(self):
|
||||
"""
|
||||
An undefined name warning is emitted if a name first defined by a the
|
||||
tuple-unpacking form of the C{with} statement is used before the
|
||||
C{with} statement.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
baz
|
||||
with open('foo') as (bar, baz):
|
||||
pass
|
||||
''', m.UndefinedName)
|
||||
|
||||
|
||||
def test_withStatementSingleNameRedefined(self):
|
||||
"""
|
||||
A redefined name warning is emitted if a name bound by an import is
|
||||
rebound by the name defined by a C{with} statement.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
import bar
|
||||
with open('foo') as bar:
|
||||
pass
|
||||
''', m.RedefinedWhileUnused)
|
||||
|
||||
|
||||
def test_withStatementTupleNamesRedefined(self):
|
||||
"""
|
||||
A redefined name warning is emitted if a name bound by an import is
|
||||
rebound by one of the names defined by the tuple-unpacking form of a
|
||||
C{with} statement.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
import bar
|
||||
with open('foo') as (bar, baz):
|
||||
pass
|
||||
''', m.RedefinedWhileUnused)
|
||||
|
||||
|
||||
def test_withStatementUndefinedInside(self):
|
||||
"""
|
||||
An undefined name warning is emitted if a name is used inside the
|
||||
body of a C{with} statement without first being bound.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
with open('foo') as bar:
|
||||
baz
|
||||
''', m.UndefinedName)
|
||||
|
||||
|
||||
def test_withStatementNameDefinedInBody(self):
|
||||
"""
|
||||
A name defined in the body of a C{with} statement can be used after
|
||||
the body ends without warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
with open('foo') as bar:
|
||||
baz = 10
|
||||
baz
|
||||
''')
|
||||
|
||||
|
||||
def test_withStatementUndefinedInExpression(self):
|
||||
"""
|
||||
An undefined name warning is emitted if a name in the I{test}
|
||||
expression of a C{with} statement is undefined.
|
||||
"""
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
with bar as baz:
|
||||
pass
|
||||
''', m.UndefinedName)
|
||||
|
||||
self.flakes('''
|
||||
from __future__ import with_statement
|
||||
with bar as bar:
|
||||
pass
|
||||
''', m.UndefinedName)
|
||||
|
||||
def test_listNestedListComprehension(self):
|
||||
self.flakes('''
|
||||
root = [['213', '123'], ['4354']]
|
||||
foo = [int(c) for group in root for c in group]
|
||||
''')
|
||||
|
||||
48
ftplugin/python/pyflakes/pyflakes/test/test_script.py
Normal file
48
ftplugin/python/pyflakes/pyflakes/test/test_script.py
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
"""
|
||||
Tests for L{pyflakes.scripts.pyflakes}.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from StringIO import StringIO
|
||||
|
||||
from twisted.python.filepath import FilePath
|
||||
from twisted.trial.unittest import TestCase
|
||||
|
||||
from pyflakes.scripts.pyflakes import checkPath
|
||||
|
||||
def withStderrTo(stderr, f):
|
||||
"""
|
||||
Call C{f} with C{sys.stderr} redirected to C{stderr}.
|
||||
"""
|
||||
(outer, sys.stderr) = (sys.stderr, stderr)
|
||||
try:
|
||||
return f()
|
||||
finally:
|
||||
sys.stderr = outer
|
||||
|
||||
|
||||
|
||||
class CheckTests(TestCase):
|
||||
"""
|
||||
Tests for L{check} and L{checkPath} which check a file for flakes.
|
||||
"""
|
||||
def test_missingTrailingNewline(self):
|
||||
"""
|
||||
Source which doesn't end with a newline shouldn't cause any
|
||||
exception to be raised nor an error indicator to be returned by
|
||||
L{check}.
|
||||
"""
|
||||
fName = self.mktemp()
|
||||
FilePath(fName).setContent("def foo():\n\tpass\n\t")
|
||||
self.assertFalse(checkPath(fName))
|
||||
|
||||
|
||||
def test_checkPathNonExisting(self):
|
||||
"""
|
||||
L{checkPath} handles non-existing files.
|
||||
"""
|
||||
err = StringIO()
|
||||
count = withStderrTo(err, lambda: checkPath('extremo'))
|
||||
self.assertEquals(err.getvalue(), 'extremo: no such file\n')
|
||||
self.assertEquals(count, 1)
|
||||
182
ftplugin/python/pyflakes/pyflakes/test/test_undefined_names.py
Normal file
182
ftplugin/python/pyflakes/pyflakes/test/test_undefined_names.py
Normal file
@@ -0,0 +1,182 @@
|
||||
|
||||
from sys import version_info
|
||||
|
||||
from pyflakes import messages as m
|
||||
from pyflakes.test import harness
|
||||
|
||||
|
||||
class Test(harness.Test):
|
||||
def test_undefined(self):
|
||||
self.flakes('bar', m.UndefinedName)
|
||||
|
||||
def test_definedInListComp(self):
|
||||
self.flakes('[a for a in range(10) if a]')
|
||||
|
||||
|
||||
def test_functionsNeedGlobalScope(self):
|
||||
self.flakes('''
|
||||
class a:
|
||||
def b():
|
||||
fu
|
||||
fu = 1
|
||||
''')
|
||||
|
||||
def test_builtins(self):
|
||||
self.flakes('range(10)')
|
||||
|
||||
def test_magic_globals(self):
|
||||
self.flakes('__file__')
|
||||
|
||||
def test_globalImportStar(self):
|
||||
'''Can't find undefined names with import *'''
|
||||
self.flakes('from fu import *; bar', m.ImportStarUsed)
|
||||
|
||||
def test_localImportStar(self):
|
||||
'''A local import * still allows undefined names to be found in upper scopes'''
|
||||
self.flakes('''
|
||||
def a():
|
||||
from fu import *
|
||||
bar
|
||||
''', m.ImportStarUsed, m.UndefinedName)
|
||||
|
||||
def test_unpackedParameter(self):
|
||||
'''Unpacked function parameters create bindings'''
|
||||
self.flakes('''
|
||||
def a((bar, baz)):
|
||||
bar; baz
|
||||
''')
|
||||
|
||||
def test_definedByGlobal(self):
|
||||
'''"global" can make an otherwise undefined name in another function defined'''
|
||||
self.flakes('''
|
||||
def a(): global fu; fu = 1
|
||||
def b(): fu
|
||||
''')
|
||||
test_definedByGlobal.todo = ''
|
||||
|
||||
def test_del(self):
|
||||
'''del deletes bindings'''
|
||||
self.flakes('a = 1; del a; a', m.UndefinedName)
|
||||
|
||||
def test_delGlobal(self):
|
||||
'''del a global binding from a function'''
|
||||
self.flakes('''
|
||||
a = 1
|
||||
def f():
|
||||
global a
|
||||
del a
|
||||
a
|
||||
''')
|
||||
|
||||
def test_delUndefined(self):
|
||||
'''del an undefined name'''
|
||||
self.flakes('del a', m.UndefinedName)
|
||||
|
||||
def test_globalFromNestedScope(self):
|
||||
'''global names are available from nested scopes'''
|
||||
self.flakes('''
|
||||
a = 1
|
||||
def b():
|
||||
def c():
|
||||
a
|
||||
''')
|
||||
|
||||
def test_laterRedefinedGlobalFromNestedScope(self):
|
||||
"""
|
||||
Test that referencing a local name that shadows a global, before it is
|
||||
defined, generates a warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
a = 1
|
||||
def fun():
|
||||
a
|
||||
a = 2
|
||||
''', m.UndefinedLocal)
|
||||
|
||||
def test_laterRedefinedGlobalFromNestedScope2(self):
|
||||
"""
|
||||
Test that referencing a local name in a nested scope that shadows a
|
||||
global declared in an enclosing scope, before it is defined, generates
|
||||
a warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
a = 1
|
||||
def fun():
|
||||
global a
|
||||
def fun2():
|
||||
a
|
||||
a = 2
|
||||
''', m.UndefinedLocal)
|
||||
|
||||
|
||||
def test_doubleNestingReportsClosestName(self):
|
||||
"""
|
||||
Test that referencing a local name in a nested scope that shadows a
|
||||
variable declared in two different outer scopes before it is defined
|
||||
in the innermost scope generates an UnboundLocal warning which
|
||||
refers to the nearest shadowed name.
|
||||
"""
|
||||
exc = self.flakes('''
|
||||
def a():
|
||||
x = 1
|
||||
def b():
|
||||
x = 2 # line 5
|
||||
def c():
|
||||
x
|
||||
x = 3
|
||||
''', m.UndefinedLocal).messages[0]
|
||||
self.assertEqual(exc.message_args, ('x', 5))
|
||||
|
||||
|
||||
def test_laterRedefinedGlobalFromNestedScope3(self):
|
||||
"""
|
||||
Test that referencing a local name in a nested scope that shadows a
|
||||
global, before it is defined, generates a warning.
|
||||
"""
|
||||
self.flakes('''
|
||||
def fun():
|
||||
a = 1
|
||||
def fun2():
|
||||
a
|
||||
a = 1
|
||||
''', m.UndefinedLocal)
|
||||
|
||||
def test_nestedClass(self):
|
||||
'''nested classes can access enclosing scope'''
|
||||
self.flakes('''
|
||||
def f(foo):
|
||||
class C:
|
||||
bar = foo
|
||||
def f(self):
|
||||
return foo
|
||||
return C()
|
||||
|
||||
f(123).f()
|
||||
''')
|
||||
|
||||
def test_badNestedClass(self):
|
||||
'''free variables in nested classes must bind at class creation'''
|
||||
self.flakes('''
|
||||
def f():
|
||||
class C:
|
||||
bar = foo
|
||||
foo = 456
|
||||
|
||||
f()
|
||||
''', m.UndefinedName)
|
||||
|
||||
|
||||
|
||||
class Python24Test(harness.Test):
|
||||
"""
|
||||
Tests for checking of syntax which is valid in Python 2.4 and newer.
|
||||
"""
|
||||
if version_info < (2, 4):
|
||||
skip = "Python 2.4 required for generator expression tests."
|
||||
|
||||
def test_definedInGenExp(self):
|
||||
"""
|
||||
Using the loop variable of a generator expression results in no
|
||||
warnings.
|
||||
"""
|
||||
self.flakes('(a for a in xrange(10) if a)')
|
||||
19
ftplugin/python/pyflakes/setup.py
Normal file
19
ftplugin/python/pyflakes/setup.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
# (c) 2005 Divmod, Inc. See LICENSE file for details
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
setup(
|
||||
name="pyflakes",
|
||||
license="MIT",
|
||||
version="0.2.1",
|
||||
description="passive checker of Python programs",
|
||||
author="Phil Frost",
|
||||
maintainer="Moe Aboulkheir",
|
||||
maintainer_email="moe@divmod.com",
|
||||
url="http://www.divmod.org/projects/pyflakes",
|
||||
packages=["pyflakes", "pyflakes.scripts"],
|
||||
scripts=["bin/pyflakes"],
|
||||
long_description="""Pyflakes is program to analyze Python programs and detect various errors. It
|
||||
works by parsing the source file, not importing it, so it is safe to use on
|
||||
modules with side effects. It's also much faster.""")
|
||||
446
ftplugin/python/python_fn.vim
Normal file
446
ftplugin/python/python_fn.vim
Normal file
@@ -0,0 +1,446 @@
|
||||
" -*- vim -*-
|
||||
" FILE: python_fn.vim
|
||||
" LAST MODIFICATION: 2008-08-28 8:19pm
|
||||
" (C) Copyright 2001-2005 Mikael Berthe <bmikael@lists.lilotux.net>
|
||||
" Maintained by Jon Franklin <jvfranklin@gmail.com>
|
||||
" Version: 1.13
|
||||
|
||||
" USAGE:
|
||||
"
|
||||
" Save this file to $VIMFILES/ftplugin/python.vim. You can have multiple
|
||||
" python ftplugins by creating $VIMFILES/ftplugin/python and saving your
|
||||
" ftplugins in that directory. If saving this to the global ftplugin
|
||||
" directory, this is the recommended method, since vim ships with an
|
||||
" ftplugin/python.vim file already.
|
||||
" You can set the global variable "g:py_select_leading_comments" to 0
|
||||
" if you don't want to select comments preceding a declaration (these
|
||||
" are usually the description of the function/class).
|
||||
" You can set the global variable "g:py_select_trailing_comments" to 0
|
||||
" if you don't want to select comments at the end of a function/class.
|
||||
" If these variables are not defined, both leading and trailing comments
|
||||
" are selected.
|
||||
" Example: (in your .vimrc) "let g:py_select_leading_comments = 0"
|
||||
" You may want to take a look at the 'shiftwidth' option for the
|
||||
" shift commands...
|
||||
"
|
||||
" REQUIREMENTS:
|
||||
" vim (>= 7)
|
||||
"
|
||||
" Shortcuts:
|
||||
" ]t -- Jump to beginning of block
|
||||
" ]e -- Jump to end of block
|
||||
" ]v -- Select (Visual Line Mode) block
|
||||
" ]< -- Shift block to left
|
||||
" ]> -- Shift block to right
|
||||
" ]# -- Comment selection
|
||||
" ]u -- Uncomment selection
|
||||
" ]c -- Select current/previous class
|
||||
" ]d -- Select current/previous function
|
||||
" ]<up> -- Jump to previous line with the same/lower indentation
|
||||
" ]<down> -- Jump to next line with the same/lower indentation
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if exists("b:loaded_py_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:loaded_py_ftplugin = 1
|
||||
|
||||
map ]t :PBoB<CR>
|
||||
vmap ]t :<C-U>PBOB<CR>m'gv``
|
||||
map ]e :PEoB<CR>
|
||||
vmap ]e :<C-U>PEoB<CR>m'gv``
|
||||
|
||||
map ]v ]tV]e
|
||||
map ]< ]tV]e<
|
||||
vmap ]< <
|
||||
map ]> ]tV]e>
|
||||
vmap ]> >
|
||||
|
||||
map ]# :call PythonCommentSelection()<CR>
|
||||
vmap ]# :call PythonCommentSelection()<CR>
|
||||
map ]u :call PythonUncommentSelection()<CR>
|
||||
vmap ]u :call PythonUncommentSelection()<CR>
|
||||
|
||||
map ]c :call PythonSelectObject("class")<CR>
|
||||
map ]d :call PythonSelectObject("function")<CR>
|
||||
|
||||
map ]<up> :call PythonNextLine(-1)<CR>
|
||||
map ]<down> :call PythonNextLine(1)<CR>
|
||||
" You may prefer use <s-up> and <s-down>... :-)
|
||||
|
||||
" jump to previous class
|
||||
map ]J :call PythonDec("class", -1)<CR>
|
||||
vmap ]J :call PythonDec("class", -1)<CR>
|
||||
|
||||
" jump to next class
|
||||
map ]j :call PythonDec("class", 1)<CR>
|
||||
vmap ]j :call PythonDec("class", 1)<CR>
|
||||
|
||||
" jump to previous function
|
||||
map ]F :call PythonDec("function", -1)<CR>
|
||||
vmap ]F :call PythonDec("function", -1)<CR>
|
||||
|
||||
" jump to next function
|
||||
map ]f :call PythonDec("function", 1)<CR>
|
||||
vmap ]f :call PythonDec("function", 1)<CR>
|
||||
|
||||
|
||||
|
||||
" Menu entries
|
||||
nmenu <silent> &Python.Update\ IM-Python\ Menu
|
||||
\:call UpdateMenu()<CR>
|
||||
nmenu &Python.-Sep1- :
|
||||
nmenu <silent> &Python.Beginning\ of\ Block<Tab>[t
|
||||
\]t
|
||||
nmenu <silent> &Python.End\ of\ Block<Tab>]e
|
||||
\]e
|
||||
nmenu &Python.-Sep2- :
|
||||
nmenu <silent> &Python.Shift\ Block\ Left<Tab>]<
|
||||
\]<
|
||||
vmenu <silent> &Python.Shift\ Block\ Left<Tab>]<
|
||||
\]<
|
||||
nmenu <silent> &Python.Shift\ Block\ Right<Tab>]>
|
||||
\]>
|
||||
vmenu <silent> &Python.Shift\ Block\ Right<Tab>]>
|
||||
\]>
|
||||
nmenu &Python.-Sep3- :
|
||||
vmenu <silent> &Python.Comment\ Selection<Tab>]#
|
||||
\]#
|
||||
nmenu <silent> &Python.Comment\ Selection<Tab>]#
|
||||
\]#
|
||||
vmenu <silent> &Python.Uncomment\ Selection<Tab>]u
|
||||
\]u
|
||||
nmenu <silent> &Python.Uncomment\ Selection<Tab>]u
|
||||
\]u
|
||||
nmenu &Python.-Sep4- :
|
||||
nmenu <silent> &Python.Previous\ Class<Tab>]J
|
||||
\]J
|
||||
nmenu <silent> &Python.Next\ Class<Tab>]j
|
||||
\]j
|
||||
nmenu <silent> &Python.Previous\ Function<Tab>]F
|
||||
\]F
|
||||
nmenu <silent> &Python.Next\ Function<Tab>]f
|
||||
\]f
|
||||
nmenu &Python.-Sep5- :
|
||||
nmenu <silent> &Python.Select\ Block<Tab>]v
|
||||
\]v
|
||||
nmenu <silent> &Python.Select\ Function<Tab>]d
|
||||
\]d
|
||||
nmenu <silent> &Python.Select\ Class<Tab>]c
|
||||
\]c
|
||||
nmenu &Python.-Sep6- :
|
||||
nmenu <silent> &Python.Previous\ Line\ wrt\ indent<Tab>]<up>
|
||||
\]<up>
|
||||
nmenu <silent> &Python.Next\ Line\ wrt\ indent<Tab>]<down>
|
||||
\]<down>
|
||||
|
||||
:com! PBoB execute "normal ".PythonBoB(line('.'), -1, 1)."G"
|
||||
:com! PEoB execute "normal ".PythonBoB(line('.'), 1, 1)."G"
|
||||
:com! UpdateMenu call UpdateMenu()
|
||||
|
||||
|
||||
" Go to a block boundary (-1: previous, 1: next)
|
||||
" If force_sel_comments is true, 'g:py_select_trailing_comments' is ignored
|
||||
function! PythonBoB(line, direction, force_sel_comments)
|
||||
let ln = a:line
|
||||
let ind = indent(ln)
|
||||
let mark = ln
|
||||
let indent_valid = strlen(getline(ln))
|
||||
let ln = ln + a:direction
|
||||
if (a:direction == 1) && (!a:force_sel_comments) &&
|
||||
\ exists("g:py_select_trailing_comments") &&
|
||||
\ (!g:py_select_trailing_comments)
|
||||
let sel_comments = 0
|
||||
else
|
||||
let sel_comments = 1
|
||||
endif
|
||||
|
||||
while((ln >= 1) && (ln <= line('$')))
|
||||
if (sel_comments) || (match(getline(ln), "^\\s*#") == -1)
|
||||
if (!indent_valid)
|
||||
let indent_valid = strlen(getline(ln))
|
||||
let ind = indent(ln)
|
||||
let mark = ln
|
||||
else
|
||||
if (strlen(getline(ln)))
|
||||
if (indent(ln) < ind)
|
||||
break
|
||||
endif
|
||||
let mark = ln
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let ln = ln + a:direction
|
||||
endwhile
|
||||
|
||||
return mark
|
||||
endfunction
|
||||
|
||||
|
||||
" Go to previous (-1) or next (1) class/function definition
|
||||
function! PythonDec(obj, direction)
|
||||
if (a:obj == "class")
|
||||
let objregexp = "^\\s*class\\s\\+[a-zA-Z0-9_]\\+"
|
||||
\ . "\\s*\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*:"
|
||||
else
|
||||
let objregexp = "^\\s*def\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*:"
|
||||
endif
|
||||
let flag = "W"
|
||||
if (a:direction == -1)
|
||||
let flag = flag."b"
|
||||
endif
|
||||
let res = search(objregexp, flag)
|
||||
endfunction
|
||||
|
||||
|
||||
" Comment out selected lines
|
||||
" commentString is inserted in non-empty lines, and should be aligned with
|
||||
" the block
|
||||
function! PythonCommentSelection() range
|
||||
let commentString = "#"
|
||||
let cl = a:firstline
|
||||
let ind = 1000 " I hope nobody use so long lines! :)
|
||||
|
||||
" Look for smallest indent
|
||||
while (cl <= a:lastline)
|
||||
if strlen(getline(cl))
|
||||
let cind = indent(cl)
|
||||
let ind = ((ind < cind) ? ind : cind)
|
||||
endif
|
||||
let cl = cl + 1
|
||||
endwhile
|
||||
if (ind == 1000)
|
||||
let ind = 1
|
||||
else
|
||||
let ind = ind + 1
|
||||
endif
|
||||
|
||||
let cl = a:firstline
|
||||
execute ":".cl
|
||||
" Insert commentString in each non-empty line, in column ind
|
||||
while (cl <= a:lastline)
|
||||
if strlen(getline(cl))
|
||||
execute "normal ".ind."|i".commentString
|
||||
endif
|
||||
execute "normal \<Down>"
|
||||
let cl = cl + 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" Uncomment selected lines
|
||||
function! PythonUncommentSelection() range
|
||||
" commentString could be different than the one from CommentSelection()
|
||||
" For example, this could be "# \\="
|
||||
let commentString = "#"
|
||||
let cl = a:firstline
|
||||
while (cl <= a:lastline)
|
||||
let ul = substitute(getline(cl),
|
||||
\"\\(\\s*\\)".commentString."\\(.*\\)$", "\\1\\2", "")
|
||||
call setline(cl, ul)
|
||||
let cl = cl + 1
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
|
||||
" Select an object ("class"/"function")
|
||||
function! PythonSelectObject(obj)
|
||||
" Go to the object declaration
|
||||
normal $
|
||||
call PythonDec(a:obj, -1)
|
||||
let beg = line('.')
|
||||
|
||||
if !exists("g:py_select_leading_comments") || (g:py_select_leading_comments)
|
||||
let decind = indent(beg)
|
||||
let cl = beg
|
||||
while (cl>1)
|
||||
let cl = cl - 1
|
||||
if (indent(cl) == decind) && (getline(cl)[decind] == "#")
|
||||
let beg = cl
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
|
||||
if (a:obj == "class")
|
||||
let eod = "\\(^\\s*class\\s\\+[a-zA-Z0-9_]\\+\\s*"
|
||||
\ . "\\((\\([a-zA-Z0-9_,. \\t\\n]\\)*)\\)\\=\\s*\\)\\@<=:"
|
||||
else
|
||||
let eod = "\\(^\\s*def\\s\\+[a-zA-Z0-9_]\\+\\s*(\\_[^:#]*)\\s*\\)\\@<=:"
|
||||
endif
|
||||
" Look for the end of the declaration (not always the same line!)
|
||||
call search(eod, "")
|
||||
|
||||
" Is it a one-line definition?
|
||||
if match(getline('.'), "^\\s*\\(#.*\\)\\=$", col('.')) == -1
|
||||
let cl = line('.')
|
||||
execute ":".beg
|
||||
execute "normal V".cl."G"
|
||||
else
|
||||
" Select the whole block
|
||||
execute "normal \<Down>"
|
||||
let cl = line('.')
|
||||
execute ":".beg
|
||||
execute "normal V".PythonBoB(cl, 1, 0)."G"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
" Jump to the next line with the same (or lower) indentation
|
||||
" Useful for moving between "if" and "else", for example.
|
||||
function! PythonNextLine(direction)
|
||||
let ln = line('.')
|
||||
let ind = indent(ln)
|
||||
let indent_valid = strlen(getline(ln))
|
||||
let ln = ln + a:direction
|
||||
|
||||
while((ln >= 1) && (ln <= line('$')))
|
||||
if (!indent_valid) && strlen(getline(ln))
|
||||
break
|
||||
else
|
||||
if (strlen(getline(ln)))
|
||||
if (indent(ln) <= ind)
|
||||
break
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let ln = ln + a:direction
|
||||
endwhile
|
||||
|
||||
execute "normal ".ln."G"
|
||||
endfunction
|
||||
|
||||
function! UpdateMenu()
|
||||
" delete menu if it already exists, then rebuild it.
|
||||
" this is necessary in case you've got multiple buffers open
|
||||
" a future enhancement to this would be to make the menu aware of
|
||||
" all buffers currently open, and group classes and functions by buffer
|
||||
if exists("g:menuran")
|
||||
aunmenu IM-Python
|
||||
endif
|
||||
let restore_fe = &foldenable
|
||||
set nofoldenable
|
||||
" preserve disposition of window and cursor
|
||||
let cline=line('.')
|
||||
let ccol=col('.') - 1
|
||||
norm H
|
||||
let hline=line('.')
|
||||
" create the menu
|
||||
call MenuBuilder()
|
||||
" restore disposition of window and cursor
|
||||
exe "norm ".hline."Gzt"
|
||||
let dnscroll=cline-hline
|
||||
exe "norm ".dnscroll."j".ccol."l"
|
||||
let &foldenable = restore_fe
|
||||
endfunction
|
||||
|
||||
function! MenuBuilder()
|
||||
norm gg0
|
||||
let currentclass = -1
|
||||
let classlist = []
|
||||
let parentclass = ""
|
||||
while line(".") < line("$")
|
||||
" search for a class or function
|
||||
if match ( getline("."), '^\s*class\s\+[_a-zA-Z].*\|^\s*def\s\+[_a-zA-Z].*' ) != -1
|
||||
norm ^
|
||||
let linenum = line('.')
|
||||
let indentcol = col('.')
|
||||
norm "nye
|
||||
let classordef=@n
|
||||
norm w"nywge
|
||||
let objname=@n
|
||||
let parentclass = FindParentClass(classlist, indentcol)
|
||||
if classordef == "class"
|
||||
call AddClass(objname, linenum, parentclass)
|
||||
else " this is a function
|
||||
call AddFunction(objname, linenum, parentclass)
|
||||
endif
|
||||
" We actually created a menu, so lets set the global variable
|
||||
let g:menuran=1
|
||||
call RebuildClassList(classlist, [objname, indentcol], classordef)
|
||||
endif " line matched
|
||||
norm j
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" classlist contains the list of nested classes we are in.
|
||||
" in most cases it will be empty or contain a single class
|
||||
" but where a class is nested within another, it will contain 2 or more
|
||||
" this function adds or removes classes from the list based on indentation
|
||||
function! RebuildClassList(classlist, newclass, classordef)
|
||||
let i = len(a:classlist) - 1
|
||||
while i > -1
|
||||
if a:newclass[1] <= a:classlist[i][1]
|
||||
call remove(a:classlist, i)
|
||||
endif
|
||||
let i = i - 1
|
||||
endwhile
|
||||
if a:classordef == "class"
|
||||
call add(a:classlist, a:newclass)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" we found a class or function, determine its parent class based on
|
||||
" indentation and what's contained in classlist
|
||||
function! FindParentClass(classlist, indentcol)
|
||||
let i = 0
|
||||
let parentclass = ""
|
||||
while i < len(a:classlist)
|
||||
if a:indentcol <= a:classlist[i][1]
|
||||
break
|
||||
else
|
||||
if len(parentclass) == 0
|
||||
let parentclass = a:classlist[i][0]
|
||||
else
|
||||
let parentclass = parentclass.'\.'.a:classlist[i][0]
|
||||
endif
|
||||
endif
|
||||
let i = i + 1
|
||||
endwhile
|
||||
return parentclass
|
||||
endfunction
|
||||
|
||||
" add a class to the menu
|
||||
function! AddClass(classname, lineno, parentclass)
|
||||
if len(a:parentclass) > 0
|
||||
let classstring = a:parentclass.'\.'.a:classname
|
||||
else
|
||||
let classstring = a:classname
|
||||
endif
|
||||
exe 'menu IM-Python.classes.'.classstring.' :call <SID>JumpToAndUnfold('.a:lineno.')<CR>'
|
||||
endfunction
|
||||
|
||||
" add a function to the menu, grouped by member class
|
||||
function! AddFunction(functionname, lineno, parentclass)
|
||||
if len(a:parentclass) > 0
|
||||
let funcstring = a:parentclass.'.'.a:functionname
|
||||
else
|
||||
let funcstring = a:functionname
|
||||
endif
|
||||
exe 'menu IM-Python.functions.'.funcstring.' :call <SID>JumpToAndUnfold('.a:lineno.')<CR>'
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:JumpToAndUnfold(line)
|
||||
" Go to the right line
|
||||
execute 'normal '.a:line.'gg'
|
||||
" Check to see if we are in a fold
|
||||
let lvl = foldlevel(a:line)
|
||||
if lvl != 0
|
||||
" and if so, then expand the fold out, other wise, ignore this part.
|
||||
execute 'normal 15zo'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"" This one will work only on vim 6.2 because of the try/catch expressions.
|
||||
" function! s:JumpToAndUnfoldWithExceptions(line)
|
||||
" try
|
||||
" execute 'normal '.a:line.'gg15zo'
|
||||
" catch /^Vim\((\a\+)\)\=:E490:/
|
||||
" " Do nothing, just consume the error
|
||||
" endtry
|
||||
"endfunction
|
||||
|
||||
|
||||
" vim:set et sts=2 sw=2:
|
||||
|
||||
625
ftplugin/python/pythoncomplete.vim
Normal file
625
ftplugin/python/pythoncomplete.vim
Normal file
@@ -0,0 +1,625 @@
|
||||
"pythoncomplete.vim - Omni Completion for python
|
||||
" Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
|
||||
" Version: 0.9
|
||||
" Last Updated: 18 Jun 2009
|
||||
"
|
||||
" Changes
|
||||
" TODO:
|
||||
" 'info' item output can use some formatting work
|
||||
" Add an "unsafe eval" mode, to allow for return type evaluation
|
||||
" Complete basic syntax along with import statements
|
||||
" i.e. "import url<c-x,c-o>"
|
||||
" Continue parsing on invalid line??
|
||||
"
|
||||
" v 0.9
|
||||
" * Fixed docstring parsing for classes and functions
|
||||
" * Fixed parsing of *args and **kwargs type arguments
|
||||
" * Better function param parsing to handle things like tuples and
|
||||
" lambda defaults args
|
||||
"
|
||||
" v 0.8
|
||||
" * Fixed an issue where the FIRST assignment was always used instead of
|
||||
" using a subsequent assignment for a variable
|
||||
" * Fixed a scoping issue when working inside a parameterless function
|
||||
"
|
||||
"
|
||||
" v 0.7
|
||||
" * Fixed function list sorting (_ and __ at the bottom)
|
||||
" * Removed newline removal from docs. It appears vim handles these better in
|
||||
" recent patches
|
||||
"
|
||||
" v 0.6:
|
||||
" * Fixed argument completion
|
||||
" * Removed the 'kind' completions, as they are better indicated
|
||||
" with real syntax
|
||||
" * Added tuple assignment parsing (whoops, that was forgotten)
|
||||
" * Fixed import handling when flattening scope
|
||||
"
|
||||
" v 0.5:
|
||||
" Yeah, I skipped a version number - 0.4 was never public.
|
||||
" It was a bugfix version on top of 0.3. This is a complete
|
||||
" rewrite.
|
||||
"
|
||||
|
||||
if !has('python')
|
||||
echo "Error: Required vim compiled with +python"
|
||||
finish
|
||||
endif
|
||||
|
||||
function! pythoncomplete#Complete(findstart, base)
|
||||
"findstart = 1 when we need to get the text length
|
||||
if a:findstart == 1
|
||||
let line = getline('.')
|
||||
let idx = col('.')
|
||||
while idx > 0
|
||||
let idx -= 1
|
||||
let c = line[idx]
|
||||
if c =~ '\w'
|
||||
continue
|
||||
elseif ! c =~ '\.'
|
||||
let idx = -1
|
||||
break
|
||||
else
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
|
||||
return idx
|
||||
"findstart = 0 when we need to return the list of completions
|
||||
else
|
||||
"vim no longer moves the cursor upon completion... fix that
|
||||
let line = getline('.')
|
||||
let idx = col('.')
|
||||
let cword = ''
|
||||
while idx > 0
|
||||
let idx -= 1
|
||||
let c = line[idx]
|
||||
if c =~ '\w' || c =~ '\.'
|
||||
let cword = c . cword
|
||||
continue
|
||||
elseif strlen(cword) > 0 || idx == 0
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
execute "python vimcomplete('" . cword . "', '" . a:base . "')"
|
||||
return g:pythoncomplete_completions
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:DefPython()
|
||||
python << PYTHONEOF
|
||||
import sys, tokenize, cStringIO, types
|
||||
from token import NAME, DEDENT, NEWLINE, STRING
|
||||
|
||||
debugstmts=[]
|
||||
def dbg(s): debugstmts.append(s)
|
||||
def showdbg():
|
||||
for d in debugstmts: print "DBG: %s " % d
|
||||
|
||||
def vimcomplete(context,match):
|
||||
global debugstmts
|
||||
debugstmts = []
|
||||
try:
|
||||
import vim
|
||||
def complsort(x,y):
|
||||
try:
|
||||
xa = x['abbr']
|
||||
ya = y['abbr']
|
||||
if xa[0] == '_':
|
||||
if xa[1] == '_' and ya[0:2] == '__':
|
||||
return xa > ya
|
||||
elif ya[0:2] == '__':
|
||||
return -1
|
||||
elif y[0] == '_':
|
||||
return xa > ya
|
||||
else:
|
||||
return 1
|
||||
elif ya[0] == '_':
|
||||
return -1
|
||||
else:
|
||||
return xa > ya
|
||||
except:
|
||||
return 0
|
||||
cmpl = Completer()
|
||||
cmpl.evalsource('\n'.join(vim.current.buffer),vim.eval("line('.')"))
|
||||
all = cmpl.get_completions(context,match)
|
||||
all.sort(complsort)
|
||||
dictstr = '['
|
||||
# have to do this for double quoting
|
||||
for cmpl in all:
|
||||
dictstr += '{'
|
||||
for x in cmpl: dictstr += '"%s":"%s",' % (x,cmpl[x])
|
||||
dictstr += '"icase":0},'
|
||||
if dictstr[-1] == ',': dictstr = dictstr[:-1]
|
||||
dictstr += ']'
|
||||
#dbg("dict: %s" % dictstr)
|
||||
vim.command("silent let g:pythoncomplete_completions = %s" % dictstr)
|
||||
#dbg("Completion dict:\n%s" % all)
|
||||
except vim.error:
|
||||
dbg("VIM Error: %s" % vim.error)
|
||||
|
||||
class Completer(object):
|
||||
def __init__(self):
|
||||
self.compldict = {}
|
||||
self.parser = PyParser()
|
||||
|
||||
def evalsource(self,text,line=0):
|
||||
sc = self.parser.parse(text,line)
|
||||
src = sc.get_code()
|
||||
dbg("source: %s" % src)
|
||||
try: exec(src) in self.compldict
|
||||
except: dbg("parser: %s, %s" % (sys.exc_info()[0],sys.exc_info()[1]))
|
||||
for l in sc.locals:
|
||||
try: exec(l) in self.compldict
|
||||
except: dbg("locals: %s, %s [%s]" % (sys.exc_info()[0],sys.exc_info()[1],l))
|
||||
|
||||
def _cleanstr(self,doc):
|
||||
return doc.replace('"',' ').replace("'",' ')
|
||||
|
||||
def get_arguments(self,func_obj):
|
||||
def _ctor(obj):
|
||||
try: return class_ob.__init__.im_func
|
||||
except AttributeError:
|
||||
for base in class_ob.__bases__:
|
||||
rc = _find_constructor(base)
|
||||
if rc is not None: return rc
|
||||
return None
|
||||
|
||||
arg_offset = 1
|
||||
if type(func_obj) == types.ClassType: func_obj = _ctor(func_obj)
|
||||
elif type(func_obj) == types.MethodType: func_obj = func_obj.im_func
|
||||
else: arg_offset = 0
|
||||
|
||||
arg_text=''
|
||||
if type(func_obj) in [types.FunctionType, types.LambdaType]:
|
||||
try:
|
||||
cd = func_obj.func_code
|
||||
real_args = cd.co_varnames[arg_offset:cd.co_argcount]
|
||||
defaults = func_obj.func_defaults or ''
|
||||
defaults = map(lambda name: "=%s" % name, defaults)
|
||||
defaults = [""] * (len(real_args)-len(defaults)) + defaults
|
||||
items = map(lambda a,d: a+d, real_args, defaults)
|
||||
if func_obj.func_code.co_flags & 0x4:
|
||||
items.append("...")
|
||||
if func_obj.func_code.co_flags & 0x8:
|
||||
items.append("***")
|
||||
arg_text = (','.join(items)) + ')'
|
||||
|
||||
except:
|
||||
dbg("arg completion: %s: %s" % (sys.exc_info()[0],sys.exc_info()[1]))
|
||||
pass
|
||||
if len(arg_text) == 0:
|
||||
# The doc string sometimes contains the function signature
|
||||
# this works for alot of C modules that are part of the
|
||||
# standard library
|
||||
doc = func_obj.__doc__
|
||||
if doc:
|
||||
doc = doc.lstrip()
|
||||
pos = doc.find('\n')
|
||||
if pos > 0:
|
||||
sigline = doc[:pos]
|
||||
lidx = sigline.find('(')
|
||||
ridx = sigline.find(')')
|
||||
if lidx > 0 and ridx > 0:
|
||||
arg_text = sigline[lidx+1:ridx] + ')'
|
||||
if len(arg_text) == 0: arg_text = ')'
|
||||
return arg_text
|
||||
|
||||
def get_completions(self,context,match):
|
||||
dbg("get_completions('%s','%s')" % (context,match))
|
||||
stmt = ''
|
||||
if context: stmt += str(context)
|
||||
if match: stmt += str(match)
|
||||
try:
|
||||
result = None
|
||||
all = {}
|
||||
ridx = stmt.rfind('.')
|
||||
if len(stmt) > 0 and stmt[-1] == '(':
|
||||
result = eval(_sanitize(stmt[:-1]), self.compldict)
|
||||
doc = result.__doc__
|
||||
if doc is None: doc = ''
|
||||
args = self.get_arguments(result)
|
||||
return [{'word':self._cleanstr(args),'info':self._cleanstr(doc)}]
|
||||
elif ridx == -1:
|
||||
match = stmt
|
||||
all = self.compldict
|
||||
else:
|
||||
match = stmt[ridx+1:]
|
||||
stmt = _sanitize(stmt[:ridx])
|
||||
result = eval(stmt, self.compldict)
|
||||
all = dir(result)
|
||||
|
||||
dbg("completing: stmt:%s" % stmt)
|
||||
completions = []
|
||||
|
||||
try: maindoc = result.__doc__
|
||||
except: maindoc = ' '
|
||||
if maindoc is None: maindoc = ' '
|
||||
for m in all:
|
||||
if m == "_PyCmplNoType": continue #this is internal
|
||||
try:
|
||||
dbg('possible completion: %s' % m)
|
||||
if m.find(match) == 0:
|
||||
if result is None: inst = all[m]
|
||||
else: inst = getattr(result,m)
|
||||
try: doc = inst.__doc__
|
||||
except: doc = maindoc
|
||||
typestr = str(inst)
|
||||
if doc is None or doc == '': doc = maindoc
|
||||
|
||||
wrd = m[len(match):]
|
||||
c = {'word':wrd, 'abbr':m, 'info':self._cleanstr(doc)}
|
||||
if "function" in typestr:
|
||||
c['word'] += '('
|
||||
c['abbr'] += '(' + self._cleanstr(self.get_arguments(inst))
|
||||
elif "method" in typestr:
|
||||
c['word'] += '('
|
||||
c['abbr'] += '(' + self._cleanstr(self.get_arguments(inst))
|
||||
elif "module" in typestr:
|
||||
c['word'] += '.'
|
||||
elif "class" in typestr:
|
||||
c['word'] += '('
|
||||
c['abbr'] += '('
|
||||
completions.append(c)
|
||||
except:
|
||||
i = sys.exc_info()
|
||||
dbg("inner completion: %s,%s [stmt='%s']" % (i[0],i[1],stmt))
|
||||
return completions
|
||||
except:
|
||||
i = sys.exc_info()
|
||||
dbg("completion: %s,%s [stmt='%s']" % (i[0],i[1],stmt))
|
||||
return []
|
||||
|
||||
class Scope(object):
|
||||
def __init__(self,name,indent,docstr=''):
|
||||
self.subscopes = []
|
||||
self.docstr = docstr
|
||||
self.locals = []
|
||||
self.parent = None
|
||||
self.name = name
|
||||
self.indent = indent
|
||||
|
||||
def add(self,sub):
|
||||
#print 'push scope: [%s@%s]' % (sub.name,sub.indent)
|
||||
sub.parent = self
|
||||
self.subscopes.append(sub)
|
||||
return sub
|
||||
|
||||
def doc(self,str):
|
||||
""" Clean up a docstring """
|
||||
d = str.replace('\n',' ')
|
||||
d = d.replace('\t',' ')
|
||||
while d.find(' ') > -1: d = d.replace(' ',' ')
|
||||
while d[0] in '"\'\t ': d = d[1:]
|
||||
while d[-1] in '"\'\t ': d = d[:-1]
|
||||
dbg("Scope(%s)::docstr = %s" % (self,d))
|
||||
self.docstr = d
|
||||
|
||||
def local(self,loc):
|
||||
self._checkexisting(loc)
|
||||
self.locals.append(loc)
|
||||
|
||||
def copy_decl(self,indent=0):
|
||||
""" Copy a scope's declaration only, at the specified indent level - not local variables """
|
||||
return Scope(self.name,indent,self.docstr)
|
||||
|
||||
def _checkexisting(self,test):
|
||||
"Convienance function... keep out duplicates"
|
||||
if test.find('=') > -1:
|
||||
var = test.split('=')[0].strip()
|
||||
for l in self.locals:
|
||||
if l.find('=') > -1 and var == l.split('=')[0].strip():
|
||||
self.locals.remove(l)
|
||||
|
||||
def get_code(self):
|
||||
str = ""
|
||||
if len(self.docstr) > 0: str += '"""'+self.docstr+'"""\n'
|
||||
for l in self.locals:
|
||||
if l.startswith('import'): str += l+'\n'
|
||||
str += 'class _PyCmplNoType:\n def __getattr__(self,name):\n return None\n'
|
||||
for sub in self.subscopes:
|
||||
str += sub.get_code()
|
||||
for l in self.locals:
|
||||
if not l.startswith('import'): str += l+'\n'
|
||||
|
||||
return str
|
||||
|
||||
def pop(self,indent):
|
||||
#print 'pop scope: [%s] to [%s]' % (self.indent,indent)
|
||||
outer = self
|
||||
while outer.parent != None and outer.indent >= indent:
|
||||
outer = outer.parent
|
||||
return outer
|
||||
|
||||
def currentindent(self):
|
||||
#print 'parse current indent: %s' % self.indent
|
||||
return ' '*self.indent
|
||||
|
||||
def childindent(self):
|
||||
#print 'parse child indent: [%s]' % (self.indent+1)
|
||||
return ' '*(self.indent+1)
|
||||
|
||||
class Class(Scope):
|
||||
def __init__(self, name, supers, indent, docstr=''):
|
||||
Scope.__init__(self,name,indent, docstr)
|
||||
self.supers = supers
|
||||
def copy_decl(self,indent=0):
|
||||
c = Class(self.name,self.supers,indent, self.docstr)
|
||||
for s in self.subscopes:
|
||||
c.add(s.copy_decl(indent+1))
|
||||
return c
|
||||
def get_code(self):
|
||||
str = '%sclass %s' % (self.currentindent(),self.name)
|
||||
if len(self.supers) > 0: str += '(%s)' % ','.join(self.supers)
|
||||
str += ':\n'
|
||||
if len(self.docstr) > 0: str += self.childindent()+'"""'+self.docstr+'"""\n'
|
||||
if len(self.subscopes) > 0:
|
||||
for s in self.subscopes: str += s.get_code()
|
||||
else:
|
||||
str += '%spass\n' % self.childindent()
|
||||
return str
|
||||
|
||||
|
||||
class Function(Scope):
|
||||
def __init__(self, name, params, indent, docstr=''):
|
||||
Scope.__init__(self,name,indent, docstr)
|
||||
self.params = params
|
||||
def copy_decl(self,indent=0):
|
||||
return Function(self.name,self.params,indent, self.docstr)
|
||||
def get_code(self):
|
||||
str = "%sdef %s(%s):\n" % \
|
||||
(self.currentindent(),self.name,','.join(self.params))
|
||||
if len(self.docstr) > 0: str += self.childindent()+'"""'+self.docstr+'"""\n'
|
||||
str += "%spass\n" % self.childindent()
|
||||
return str
|
||||
|
||||
class PyParser:
|
||||
def __init__(self):
|
||||
self.top = Scope('global',0)
|
||||
self.scope = self.top
|
||||
|
||||
def _parsedotname(self,pre=None):
|
||||
#returns (dottedname, nexttoken)
|
||||
name = []
|
||||
if pre is None:
|
||||
tokentype, token, indent = self.next()
|
||||
if tokentype != NAME and token != '*':
|
||||
return ('', token)
|
||||
else: token = pre
|
||||
name.append(token)
|
||||
while True:
|
||||
tokentype, token, indent = self.next()
|
||||
if token != '.': break
|
||||
tokentype, token, indent = self.next()
|
||||
if tokentype != NAME: break
|
||||
name.append(token)
|
||||
return (".".join(name), token)
|
||||
|
||||
def _parseimportlist(self):
|
||||
imports = []
|
||||
while True:
|
||||
name, token = self._parsedotname()
|
||||
if not name: break
|
||||
name2 = ''
|
||||
if token == 'as': name2, token = self._parsedotname()
|
||||
imports.append((name, name2))
|
||||
while token != "," and "\n" not in token:
|
||||
tokentype, token, indent = self.next()
|
||||
if token != ",": break
|
||||
return imports
|
||||
|
||||
def _parenparse(self):
|
||||
name = ''
|
||||
names = []
|
||||
level = 1
|
||||
while True:
|
||||
tokentype, token, indent = self.next()
|
||||
if token in (')', ',') and level == 1:
|
||||
if '=' not in name: name = name.replace(' ', '')
|
||||
names.append(name.strip())
|
||||
name = ''
|
||||
if token == '(':
|
||||
level += 1
|
||||
name += "("
|
||||
elif token == ')':
|
||||
level -= 1
|
||||
if level == 0: break
|
||||
else: name += ")"
|
||||
elif token == ',' and level == 1:
|
||||
pass
|
||||
else:
|
||||
name += "%s " % str(token)
|
||||
return names
|
||||
|
||||
def _parsefunction(self,indent):
|
||||
self.scope=self.scope.pop(indent)
|
||||
tokentype, fname, ind = self.next()
|
||||
if tokentype != NAME: return None
|
||||
|
||||
tokentype, open, ind = self.next()
|
||||
if open != '(': return None
|
||||
params=self._parenparse()
|
||||
|
||||
tokentype, colon, ind = self.next()
|
||||
if colon != ':': return None
|
||||
|
||||
return Function(fname,params,indent)
|
||||
|
||||
def _parseclass(self,indent):
|
||||
self.scope=self.scope.pop(indent)
|
||||
tokentype, cname, ind = self.next()
|
||||
if tokentype != NAME: return None
|
||||
|
||||
super = []
|
||||
tokentype, next, ind = self.next()
|
||||
if next == '(':
|
||||
super=self._parenparse()
|
||||
elif next != ':': return None
|
||||
|
||||
return Class(cname,super,indent)
|
||||
|
||||
def _parseassignment(self):
|
||||
assign=''
|
||||
tokentype, token, indent = self.next()
|
||||
if tokentype == tokenize.STRING or token == 'str':
|
||||
return '""'
|
||||
elif token == '(' or token == 'tuple':
|
||||
return '()'
|
||||
elif token == '[' or token == 'list':
|
||||
return '[]'
|
||||
elif token == '{' or token == 'dict':
|
||||
return '{}'
|
||||
elif tokentype == tokenize.NUMBER:
|
||||
return '0'
|
||||
elif token == 'open' or token == 'file':
|
||||
return 'file'
|
||||
elif token == 'None':
|
||||
return '_PyCmplNoType()'
|
||||
elif token == 'type':
|
||||
return 'type(_PyCmplNoType)' #only for method resolution
|
||||
else:
|
||||
assign += token
|
||||
level = 0
|
||||
while True:
|
||||
tokentype, token, indent = self.next()
|
||||
if token in ('(','{','['):
|
||||
level += 1
|
||||
elif token in (']','}',')'):
|
||||
level -= 1
|
||||
if level == 0: break
|
||||
elif level == 0:
|
||||
if token in (';','\n'): break
|
||||
assign += token
|
||||
return "%s" % assign
|
||||
|
||||
def next(self):
|
||||
type, token, (lineno, indent), end, self.parserline = self.gen.next()
|
||||
if lineno == self.curline:
|
||||
#print 'line found [%s] scope=%s' % (line.replace('\n',''),self.scope.name)
|
||||
self.currentscope = self.scope
|
||||
return (type, token, indent)
|
||||
|
||||
def _adjustvisibility(self):
|
||||
newscope = Scope('result',0)
|
||||
scp = self.currentscope
|
||||
while scp != None:
|
||||
if type(scp) == Function:
|
||||
slice = 0
|
||||
#Handle 'self' params
|
||||
if scp.parent != None and type(scp.parent) == Class:
|
||||
slice = 1
|
||||
newscope.local('%s = %s' % (scp.params[0],scp.parent.name))
|
||||
for p in scp.params[slice:]:
|
||||
i = p.find('=')
|
||||
if len(p) == 0: continue
|
||||
pvar = ''
|
||||
ptype = ''
|
||||
if i == -1:
|
||||
pvar = p
|
||||
ptype = '_PyCmplNoType()'
|
||||
else:
|
||||
pvar = p[:i]
|
||||
ptype = _sanitize(p[i+1:])
|
||||
if pvar.startswith('**'):
|
||||
pvar = pvar[2:]
|
||||
ptype = '{}'
|
||||
elif pvar.startswith('*'):
|
||||
pvar = pvar[1:]
|
||||
ptype = '[]'
|
||||
|
||||
newscope.local('%s = %s' % (pvar,ptype))
|
||||
|
||||
for s in scp.subscopes:
|
||||
ns = s.copy_decl(0)
|
||||
newscope.add(ns)
|
||||
for l in scp.locals: newscope.local(l)
|
||||
scp = scp.parent
|
||||
|
||||
self.currentscope = newscope
|
||||
return self.currentscope
|
||||
|
||||
#p.parse(vim.current.buffer[:],vim.eval("line('.')"))
|
||||
def parse(self,text,curline=0):
|
||||
self.curline = int(curline)
|
||||
buf = cStringIO.StringIO(''.join(text) + '\n')
|
||||
self.gen = tokenize.generate_tokens(buf.readline)
|
||||
self.currentscope = self.scope
|
||||
|
||||
try:
|
||||
freshscope=True
|
||||
while True:
|
||||
tokentype, token, indent = self.next()
|
||||
#dbg( 'main: token=[%s] indent=[%s]' % (token,indent))
|
||||
|
||||
if tokentype == DEDENT or token == "pass":
|
||||
self.scope = self.scope.pop(indent)
|
||||
elif token == 'def':
|
||||
func = self._parsefunction(indent)
|
||||
if func is None:
|
||||
print "function: syntax error..."
|
||||
continue
|
||||
dbg("new scope: function")
|
||||
freshscope = True
|
||||
self.scope = self.scope.add(func)
|
||||
elif token == 'class':
|
||||
cls = self._parseclass(indent)
|
||||
if cls is None:
|
||||
print "class: syntax error..."
|
||||
continue
|
||||
freshscope = True
|
||||
dbg("new scope: class")
|
||||
self.scope = self.scope.add(cls)
|
||||
|
||||
elif token == 'import':
|
||||
imports = self._parseimportlist()
|
||||
for mod, alias in imports:
|
||||
loc = "import %s" % mod
|
||||
if len(alias) > 0: loc += " as %s" % alias
|
||||
self.scope.local(loc)
|
||||
freshscope = False
|
||||
elif token == 'from':
|
||||
mod, token = self._parsedotname()
|
||||
if not mod or token != "import":
|
||||
print "from: syntax error..."
|
||||
continue
|
||||
names = self._parseimportlist()
|
||||
for name, alias in names:
|
||||
loc = "from %s import %s" % (mod,name)
|
||||
if len(alias) > 0: loc += " as %s" % alias
|
||||
self.scope.local(loc)
|
||||
freshscope = False
|
||||
elif tokentype == STRING:
|
||||
if freshscope: self.scope.doc(token)
|
||||
elif tokentype == NAME:
|
||||
name,token = self._parsedotname(token)
|
||||
if token == '=':
|
||||
stmt = self._parseassignment()
|
||||
dbg("parseassignment: %s = %s" % (name, stmt))
|
||||
if stmt != None:
|
||||
self.scope.local("%s = %s" % (name,stmt))
|
||||
freshscope = False
|
||||
except StopIteration: #thrown on EOF
|
||||
pass
|
||||
except:
|
||||
dbg("parse error: %s, %s @ %s" %
|
||||
(sys.exc_info()[0], sys.exc_info()[1], self.parserline))
|
||||
return self._adjustvisibility()
|
||||
|
||||
def _sanitize(str):
|
||||
val = ''
|
||||
level = 0
|
||||
for c in str:
|
||||
if c in ('(','{','['):
|
||||
level += 1
|
||||
elif c in (']','}',')'):
|
||||
level -= 1
|
||||
elif level == 0:
|
||||
val += c
|
||||
return val
|
||||
|
||||
sys.path.extend(['.','..'])
|
||||
PYTHONEOF
|
||||
endfunction
|
||||
|
||||
call s:DefPython()
|
||||
" vim: set et ts=4:
|
||||
29
ftplugin/rst/word_utils.vim
Normal file
29
ftplugin/rst/word_utils.vim
Normal file
@@ -0,0 +1,29 @@
|
||||
function! WordFrequency() range
|
||||
let all = split(join(getline(a:firstline, a:lastline)), '\k\+')
|
||||
let frequencies = {}
|
||||
for word in all
|
||||
let frequencies[word] = get(frequencies, word, 0) + 1
|
||||
endfor
|
||||
new
|
||||
setlocal buftype=nofile bufhidden=hide noswapfile tabstop=4
|
||||
for [key,value] in items(frequencies)
|
||||
call append('$', value."\t".key)
|
||||
endfor
|
||||
sort i
|
||||
endfunction
|
||||
command! -range=% WordFrequency <line1>,<line2>call WordFrequency()
|
||||
|
||||
function! CreateDict() range
|
||||
let all = split(join(getline(a:firstline, a:lastline)), '[^A-Za-zęóąśłżźćńĘÓĄŚŁŻŹĆŃ]\+')
|
||||
let frequencies = {}
|
||||
for word in all
|
||||
let frequencies[word] = get(frequencies, word, 0) + 1
|
||||
endfor
|
||||
new
|
||||
setlocal buftype=nofile bufhidden=hide noswapfile
|
||||
for [key,value] in items(frequencies)
|
||||
call append('$', key)
|
||||
endfor
|
||||
sort i
|
||||
endfunction
|
||||
command! -range=% CreateDict <line1>,<line2>call CreateDict()
|
||||
322
ftplugin/vimwiki.vim
Normal file
322
ftplugin/vimwiki.vim
Normal file
@@ -0,0 +1,322 @@
|
||||
" Vimwiki filetype plugin file
|
||||
" Author: Maxim Kim <habamax@gmail.com>
|
||||
" Home: http://code.google.com/p/vimwiki/
|
||||
|
||||
if exists("b:did_ftplugin")
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1 " Don't load another plugin for this buffer
|
||||
|
||||
" UNDO list {{{
|
||||
" Reset the following options to undo this plugin.
|
||||
let b:undo_ftplugin = "setlocal ".
|
||||
\ "suffixesadd< isfname< comments< ".
|
||||
\ "autowriteall< ".
|
||||
\ "formatoptions< foldtext< ".
|
||||
\ "foldmethod< foldexpr< commentstring< "
|
||||
" UNDO }}}
|
||||
|
||||
" MISC STUFF {{{
|
||||
|
||||
setlocal autowriteall
|
||||
setlocal commentstring=<!--%s-->
|
||||
" MISC }}}
|
||||
|
||||
" GOTO FILE: gf {{{
|
||||
execute 'setlocal suffixesadd='.VimwikiGet('ext')
|
||||
setlocal isfname-=[,]
|
||||
" gf}}}
|
||||
|
||||
" Autocreate list items {{{
|
||||
" for list items, and list items with checkboxes
|
||||
if VimwikiGet('syntax') == 'default'
|
||||
setl comments=b:*,b:#,b:-
|
||||
setl formatlistpat=^\\s*[*#-]\\s*
|
||||
else
|
||||
setl comments=n:*,n:#
|
||||
endif
|
||||
setlocal formatoptions=tnro
|
||||
|
||||
inoremap <buffer> <expr> <CR> vimwiki_lst#insertCR()
|
||||
nnoremap <buffer> o :call vimwiki_lst#insertOo('o')<CR>a
|
||||
nnoremap <buffer> O :call vimwiki_lst#insertOo('O')<CR>a
|
||||
|
||||
" COMMENTS }}}
|
||||
|
||||
" FOLDING for headers and list items using expr fold method. {{{
|
||||
if g:vimwiki_folding == 1
|
||||
setlocal fdm=expr
|
||||
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
|
||||
setlocal foldtext=VimwikiFoldText()
|
||||
endif
|
||||
|
||||
function! VimwikiFoldLevel(lnum) "{{{
|
||||
let line = getline(a:lnum)
|
||||
|
||||
" Header folding...
|
||||
if line =~ g:vimwiki_rxHeader
|
||||
let n = vimwiki#count_first_sym(line)
|
||||
return '>'.n
|
||||
endif
|
||||
|
||||
if g:vimwiki_fold_trailing_empty_lines == 0
|
||||
if line =~ '^\s*$'
|
||||
let nnline = getline(nextnonblank(a:lnum + 1))
|
||||
if nnline =~ g:vimwiki_rxHeader
|
||||
let n = vimwiki#count_first_sym(nnline)
|
||||
return '<'.n
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
" List item folding...
|
||||
if g:vimwiki_fold_lists
|
||||
let base_level = s:get_base_level(a:lnum)
|
||||
|
||||
let rx_list_item = '\('.
|
||||
\ g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.
|
||||
\ '\)'
|
||||
|
||||
|
||||
if line =~ rx_list_item
|
||||
let [nnum, nline] = s:find_forward(rx_list_item, a:lnum)
|
||||
let level = s:get_li_level(a:lnum)
|
||||
let leveln = s:get_li_level(nnum)
|
||||
let adj = s:get_li_level(s:get_start_list(rx_list_item, a:lnum))
|
||||
|
||||
if leveln > level
|
||||
return ">".(base_level+leveln-adj)
|
||||
else
|
||||
return (base_level+level-adj)
|
||||
endif
|
||||
else
|
||||
" process multilined list items
|
||||
let [pnum, pline] = s:find_backward(rx_list_item, a:lnum)
|
||||
if pline =~ rx_list_item
|
||||
if indent(a:lnum) > indent(pnum)
|
||||
let level = s:get_li_level(pnum)
|
||||
let adj = s:get_li_level(s:get_start_list(rx_list_item, pnum))
|
||||
|
||||
let [nnum, nline] = s:find_forward(rx_list_item, a:lnum)
|
||||
if nline =~ rx_list_item
|
||||
let leveln = s:get_li_level(nnum)
|
||||
if leveln > level
|
||||
return (base_level+leveln-adj)
|
||||
endif
|
||||
endif
|
||||
|
||||
return (base_level+level-adj)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return base_level
|
||||
endif
|
||||
|
||||
return -1
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_base_level(lnum) "{{{
|
||||
let lnum = a:lnum - 1
|
||||
while lnum > 0
|
||||
if getline(lnum) =~ g:vimwiki_rxHeader
|
||||
return vimwiki#count_first_sym(getline(lnum))
|
||||
endif
|
||||
let lnum -= 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
function! s:find_forward(rx_item, lnum) "{{{
|
||||
let lnum = a:lnum + 1
|
||||
|
||||
while lnum <= line('$')
|
||||
let line = getline(lnum)
|
||||
if line =~ a:rx_item
|
||||
\ || line =~ '^\S'
|
||||
\ || line =~ g:vimwiki_rxHeader
|
||||
break
|
||||
endif
|
||||
let lnum += 1
|
||||
endwhile
|
||||
|
||||
return [lnum, getline(lnum)]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:find_backward(rx_item, lnum) "{{{
|
||||
let lnum = a:lnum - 1
|
||||
|
||||
while lnum > 1
|
||||
let line = getline(lnum)
|
||||
if line =~ a:rx_item
|
||||
\ || line =~ '^\S'
|
||||
break
|
||||
endif
|
||||
let lnum -= 1
|
||||
endwhile
|
||||
|
||||
return [lnum, getline(lnum)]
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_li_level(lnum) "{{{
|
||||
if VimwikiGet('syntax') == 'media'
|
||||
let level = vimwiki#count_first_sym(getline(a:lnum))
|
||||
else
|
||||
let level = (indent(a:lnum) / &sw)
|
||||
endif
|
||||
return level
|
||||
endfunction "}}}
|
||||
|
||||
function! s:get_start_list(rx_item, lnum) "{{{
|
||||
let lnum = a:lnum
|
||||
while lnum >= 1
|
||||
let line = getline(lnum)
|
||||
if line !~ a:rx_item && line =~ '^\S'
|
||||
return nextnonblank(lnum + 1)
|
||||
endif
|
||||
let lnum -= 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
function! VimwikiFoldText() "{{{
|
||||
let line = substitute(getline(v:foldstart), '\t',
|
||||
\ repeat(' ', &tabstop), 'g')
|
||||
return line.' ['.(v:foldend - v:foldstart).']'
|
||||
endfunction "}}}
|
||||
|
||||
" FOLDING }}}
|
||||
|
||||
" COMMANDS {{{
|
||||
command! -buffer Vimwiki2HTML
|
||||
\ call vimwiki_html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||
\ expand('%'))
|
||||
command! -buffer VimwikiAll2HTML
|
||||
\ call vimwiki_html#WikiAll2HTML(expand(VimwikiGet('path_html')))
|
||||
|
||||
command! -buffer VimwikiNextWord call vimwiki#WikiNextWord()
|
||||
command! -buffer VimwikiPrevWord call vimwiki#WikiPrevWord()
|
||||
command! -buffer VimwikiDeleteWord call vimwiki#WikiDeleteWord()
|
||||
command! -buffer VimwikiRenameWord call vimwiki#WikiRenameWord()
|
||||
command! -buffer VimwikiFollowWord call vimwiki#WikiFollowWord('nosplit')
|
||||
command! -buffer VimwikiGoBackWord call vimwiki#WikiGoBackWord()
|
||||
command! -buffer VimwikiSplitWord call vimwiki#WikiFollowWord('split')
|
||||
command! -buffer VimwikiVSplitWord call vimwiki#WikiFollowWord('vsplit')
|
||||
|
||||
command! -buffer -range VimwikiToggleListItem call vimwiki_lst#ToggleListItem(<line1>, <line2>)
|
||||
|
||||
exe 'command! -buffer -nargs=* VimwikiSearch vimgrep <args> '.
|
||||
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
|
||||
|
||||
exe 'command! -buffer -nargs=* VWS vimgrep <args> '.
|
||||
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
|
||||
|
||||
" table commands
|
||||
command! -buffer -nargs=* VimwikiTable call vimwiki_tbl#create(<f-args>)
|
||||
command! -buffer VimwikiTableAlignQ call vimwiki_tbl#align_or_cmd('gqq')
|
||||
command! -buffer VimwikiTableAlignW call vimwiki_tbl#align_or_cmd('gww')
|
||||
|
||||
" COMMANDS }}}
|
||||
|
||||
" KEYBINDINGS {{{
|
||||
if g:vimwiki_use_mouse
|
||||
nmap <buffer> <S-LeftMouse> <NOP>
|
||||
nmap <buffer> <C-LeftMouse> <NOP>
|
||||
noremap <silent><buffer> <2-LeftMouse> :VimwikiFollowWord<CR>
|
||||
noremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitWord<CR>
|
||||
noremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitWord<CR>
|
||||
noremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackWord<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto('<Plug>VimwikiFollowWord')
|
||||
nmap <silent><buffer> <CR> <Plug>VimwikiFollowWord
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiFollowWord :VimwikiFollowWord<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiSplitWord')
|
||||
nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitWord
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiSplitWord :VimwikiSplitWord<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiVSplitWord')
|
||||
nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitWord
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiVSplitWord :VimwikiVSplitWord<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiGoBackWord')
|
||||
nmap <silent><buffer> <BS> <Plug>VimwikiGoBackWord
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiGoBackWord :VimwikiGoBackWord<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiNextWord')
|
||||
nmap <silent><buffer> <TAB> <Plug>VimwikiNextWord
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiNextWord :VimwikiNextWord<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiPrevWord')
|
||||
nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevWord
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiPrevWord :VimwikiPrevWord<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiDeleteWord')
|
||||
nmap <silent><buffer> <Leader>wd <Plug>VimwikiDeleteWord
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiDeleteWord :VimwikiDeleteWord<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiRenameWord')
|
||||
nmap <silent><buffer> <Leader>wr <Plug>VimwikiRenameWord
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiRenameWord :VimwikiRenameWord<CR>
|
||||
|
||||
if !hasmapto('<Plug>VimwikiToggleListItem')
|
||||
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
|
||||
vmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
|
||||
if has("unix")
|
||||
nmap <silent><buffer> <C-@> <Plug>VimwikiToggleListItem
|
||||
endif
|
||||
endif
|
||||
noremap <silent><script><buffer>
|
||||
\ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
|
||||
|
||||
|
||||
" Table mappings
|
||||
if g:vimwiki_table_auto_fmt
|
||||
inoremap <expr> <buffer> <CR> vimwiki_tbl#kbd_cr()
|
||||
inoremap <expr> <buffer> <Tab> vimwiki_tbl#kbd_tab()
|
||||
endif
|
||||
|
||||
nnoremap <buffer> gqq :VimwikiTableAlignQ<CR>
|
||||
nnoremap <buffer> gww :VimwikiTableAlignW<CR>
|
||||
|
||||
|
||||
" Text objects {{{
|
||||
omap <silent><buffer> ah :<C-U>call vimwiki#TO_header(0, 0)<CR>
|
||||
vmap <silent><buffer> ah :<C-U>call vimwiki#TO_header(0, 1)<CR>
|
||||
|
||||
omap <silent><buffer> ih :<C-U>call vimwiki#TO_header(1, 0)<CR>
|
||||
vmap <silent><buffer> ih :<C-U>call vimwiki#TO_header(1, 1)<CR>
|
||||
|
||||
nmap <silent><buffer> = :call vimwiki#AddHeaderLevel()<CR>
|
||||
nmap <silent><buffer> - :call vimwiki#RemoveHeaderLevel()<CR>
|
||||
|
||||
" }}}
|
||||
|
||||
" KEYBINDINGS }}}
|
||||
|
||||
" AUTOCOMMANDS {{{
|
||||
if VimwikiGet('auto_export')
|
||||
" Automatically generate HTML on page write.
|
||||
augroup vimwiki
|
||||
au BufWritePost <buffer> Vimwiki2HTML
|
||||
augroup END
|
||||
endif
|
||||
|
||||
" AUTOCOMMANDS }}}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user