Compare commits

..

No commits in common. "workman" and "master" have entirely different histories.

71 changed files with 28070 additions and 2166 deletions

View File

@ -1 +0,0 @@
setlocal expandtab

View File

@ -5,6 +5,3 @@ let g:rainbow_active = 1
let g:ScreenImpl = 'Tmux'
let g:sexp_enable_insert_mode_mappings = 0
" cljfmt
let g:clj_fmt_autosave = 0

View File

@ -1,48 +1,98 @@
setlocal ts=2 sw=2 expandtab
setlocal ts=2 sw=2 expandtab omnifunc=necoghc#omnifunc
" tags
call CmdAlias('hasktags', '!hasktags -c .<CR>')
"set background=light
"set guifont=Neep\ Medium\ Semi-Condensed\ 18
" from
" https://raw.githubusercontent.com/begriffs/haskell-vim-now/master/git-hscope
call CmdAlias('codex', 'call system("haskell-ctags")<CR><CR>call LoadHscope()<CR>')
call CmdAlias('Cc', 'Clap commits<CR>')
let g:haskell_classic_highlighting = 1
let g:ghcmod_hlint_options = ['--ignore=Eta reduce $']
syntax on
filetype plugin indent on
map <leader>ctg :codex<CR>
set tags=tags;/,codex.tags;/
call CmdAlias('hasktags', '!/home/jule/.cabal/bin/hasktags -c .<CR>')
" nnoremap <silent> <leader>cgd :cs find g <C-R>=expand("<cword>")<CR><CR>
nnoremap <silent> <C-\> :cs find c <C-R>=expand("<cword>")<CR><CR>
" set cscopeprg=do_at_stack_root\ hscope
set csre
set csto=1 " search codex tags first
set nocst
" set cscopequickfix=s-,c-,d-,i-,t-,e-,a-
let g:necoghc_enable_detailed_browse = 1
function! LoadHscope()
set nocscopeverbose " suppress 'duplicate connection' error
let hsf = findfile("hscope.out", ".;")
if filereadable(hsf)
exe "cs add " . hsf
elseif $HSCOPE_DB != ""
cs add $HSCOPE_DB
endif
set cscopeverbose
" ALE
let g:ale_linters = {'haskell':['ghc-mod', 'hdevtools'], 'c':['clang']}
" let g:ale_fixers = {
" \ 'go': ['gofmt', 'goimports'],
" \}
let g:ale_haskell_hdevtools_options = "-g '-Wall' -g '-Wno-orphans'"
" neco-ghc
let g:haskellmode_completion_ghc = 0
let g:necoghc_enable_detailed_browse = 1
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
let g:ycm_semantic_triggers = {'haskell' : ['.']}
function! HaskellDocCurrentWord()
let word = expand("<cword>")
exe "IDoc " . word
endfunction
" au BufEnter /*.hs call LoadHscope()
call deoplete#enable()
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" clear search
nmap <F2> :noh<CR>:GhcModTypeClear<CR>
imap <F2> <C-O>:noh<CR>:GhcModTypeClear<CR>
" unmap <F3>
" unmap <F4>
nmap <F6> :GhcModType<CR>
nmap <F8> :call HaskellDocCurrentWord()<CR><CR>
" vim-lsp
if executable('haskell-language-server-wrapper')
au User lsp_setup call lsp#register_server({
\ 'name': 'hls',
\ 'cmd': {server_info->['haskell-language-server-wrapper', '--lsp']},
\ 'allowlist': ['haskell'],
\ })
endif
nmap <silent> <F3> :silent update <bar> HsimportModule<CR>
nmap <silent> <F4> :silent update <bar> HsimportSymbol<CR>
" haskell-vim
" let g:haskell_enable_quantification = 1
" let g:haskell_enable_recursivedo = 1
" let g:haskell_enable_arrowsyntax = 1
" let g:haskell_enable_pattern_synonyms = 1
" let g:haskell_enable_typeroles = 1
" let g:haskell_indent_if = 3
" let g:haskell_indent_case = 5
" let g:haskell_indent_let = 4
" let g:haskell_indent_where = 6
" let g:haskell_indent_do = 3
" let g:haskell_indent_in = 1
" liquid-types
let g:vim_annotations_offset = '/.liquid/'
" autocmd BufWritePost *.hs call s:check_and_lint()
" function! s:check_and_lint()
" let l:path = expand('%:p')
" let l:qflist = ghcmod#make('check', l:path)
" call extend(l:qflist, ghcmod#make('lint', l:path))
" call setqflist(l:qflist)
" cwindow
" if empty(l:qflist)
" echo "No errors found"
" endif
" endfunction
" let g:deoplete#enable_at_startup = 1
" set hidden
" let g:LanguageClient_serverCommands = {
" \ 'haskell': ['hie', '--lsp', '-d', '-l', '/home/hasufell/lang-server.log'],
" \ }
" nnoremap <silent> K :call LanguageClient#textDocument_hover()<CR>
" nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
" autocmd VimEnter * LanguageClientStart

View File

@ -1,16 +0,0 @@
" let g:ale_linters = {'python':['mypy']}
" let g:ale_python_mypy_options = '--no-warn-incomplete-stub --ignore-missing-imports'
" let g:ale_python_pycodestyle_options = '--ignore=W391'
let g:neoformat_enabled_python = ['autopep8']
augroup fmt
autocmd!
autocmd BufWritePre * undojoin | Neoformat
augroup END
let g:jedi#completions_enabled = 0

View File

@ -1,3 +1,7 @@
let g:rustfmt_autosave = 0
let g:tagbar_ctags_bin = '/usr/bin/universal-ctags'
let g:rust_doc#define_map_K = 0
let g:rust_doc#downloaded_rust_doc_dir = '~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu'
@ -11,43 +15,21 @@ function! s:search_under_cursor(query) range
endfunction
" keys
nnoremap <buffer><silent><F7> :<C-u>call <SID>search_under_cursor(expand('<cword>'))<CR>
vnoremap <buffer><silent><F7> "gy:call <SID>search_under_cursor(getreg('g'))<CR>
nnoremap <buffer><silent><F6> :<C-u>call <SID>search_under_cursor(expand('<cword>'))<CR>
vnoremap <buffer><silent><F6> "gy:call <SID>search_under_cursor(getreg('g'))<CR>
" rusty-tags
autocmd BufRead *.rs :setlocal tags=./rusty-tags.vi;/
autocmd BufWritePost *.rs :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw!
let g:tagbar_ctags_bin = '/usr/bin/exuberant-ctags'
nnoremap <F3> :call LanguageClient_contextMenu()<CR>
nnoremap <silent> <F4> :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> <F7> :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> <F6> :call LanguageClient#textDocument_rename()<CR>
" nnoremap <F3> :call LanguageClient_contextMenu()<CR>
" nnoremap <silent> <F4> :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F6> :call LanguageClient#textDocument_hover()<CR>
" nnoremap <silent> <F8> :call LanguageClient#textDocument_rename()<CR>
" let g:LanguageClient_autoStart = 1
" let g:LanguageClient_serverCommands = {
" \ 'rust': ['rustup', 'run', 'nightly', 'rls'] }
" let g:LanguageClient_diagnosticsEnable = 0
" let g:ale_linters = {'rust': ['rls']}
" let g:ale_fixers = { 'rust': ['rustfmt'] }
" let g:ale_fix_on_save = 0
" let g:autofmt_autosave = 0
" deoplete
" call deoplete#custom#option('sources',{
" \ '_': ['buffer'],
" \ 'rust': ['ultisnips', 'buffer', 'file', 'LanguageClient']
" \ })
" inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" call deoplete#enable()
let g:LanguageClient_autoStart = 1
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/ra_lsp_server'],
\ }
\ 'rust': ['rustup', 'run', 'nightly', 'rls'] }
let g:ale_linters = {'rust': ['rls']}
let g:ale_fixers = { 'rust': ['rustfmt'] }
let g:autofmt_autosave = 0

View File

@ -1,8 +0,0 @@
if (expand("%:e") == "exheres-0")
finish
endif
if (expand("%:e") == "exlib")
finish
endif

View File

@ -1,18 +0,0 @@
nnoremap <leader>gd <C-]>
let g:tsuquyomi_disable_quickfix = 1
let g:ale_linters = {
\ 'typescript': ['tsserver'],
\}
call deoplete#custom#option('sources', {
\ 'typescript': ['ale', 'buffer', 'file', 'around'],
\})
call deoplete#custom#source('ale', 'rank', 999)
call deoplete#custom#source('ale', 'input_pattern', '[^. *\t]\.\w*')
" autocmd FileType typescript setlocal balloonexpr=tsuquyomi#balloonexpr()

View File

@ -1,2 +0,0 @@
let g:ale_linters = {'vim':['vint']}

View File

@ -1,54 +0,0 @@
if has('nvim') && !exists("g:vscode")
lua << EOF
vim.diagnostic.config({
virtual_text = false,
signs = true,
underline = true,
update_in_insert = false,
severity_sort = false,
})
vim.o.updatetime = 300
-- Show all diagnostics on current line in floating window
--vim.api.nvim_set_keymap(
-- 'n', '<Leader>d', ':lua vim.diagnostic.open_float()<CR>',
-- { noremap = true, silent = true }
--)
-- Go to next diagnostic (if there are multiple on the same line, only shows
-- one at a time in the floating window)
--vim.api.nvim_set_keymap(
-- 'n', '<Leader>n', ':lua vim.diagnostic.goto_next()<CR>',
-- { noremap = true, silent = true }
--)
-- Go to prev diagnostic (if there are multiple on the same line, only shows
-- one at a time in the floating window)
--vim.api.nvim_set_keymap(
-- 'n', '<Leader>p', ':lua vim.diagnostic.goto_prev()<CR>',
-- { noremap = true, silent = true }
--)
-- IMPORTANT!: this is only a showcase of how you can set default options!
require("telescope").setup {
extensions = {
file_browser = {
grouped = true,
theme = "ivy",
mappings = {
["i"] = {
-- your custom insert mode mappings
},
["n"] = {
-- your custom normal mode mappings
},
},
},
},
}
-- To get telescope-file-browser loaded and working with telescope,
-- you need to call load_extension, somewhere after setup function:
require("telescope").load_extension "file_browser"
EOF
endif

View File

@ -1,119 +0,0 @@
command! LogAutocmds call s:log_autocmds_toggle()
function! s:log_autocmds_toggle()
augroup LogAutocmd
autocmd!
augroup END
let l:date = strftime('%F', localtime())
let s:activate = get(s:, 'activate', 0) ? 0 : 1
if !s:activate
call s:log('Stopped autocmd log (' . l:date . ')')
return
endif
call s:log('Started autocmd log (' . l:date . ')')
augroup LogAutocmd
for l:au in s:aulist
silent execute 'autocmd' l:au '* call s:log(''' . l:au . ''')'
endfor
augroup END
endfunction
function! s:log(message)
silent execute '!echo "'
\ . strftime('%T', localtime()) . ' - ' . a:message . '"'
\ '>> /tmp/vim_log_autocommands'
endfunction
" These are deliberately left out due to side effects
" - SourceCmd
" - FileAppendCmd
" - FileWriteCmd
" - BufWriteCmd
" - FileReadCmd
" - BufReadCmd
" - FuncUndefined
let s:aulist = [
\ 'BufNewFile',
\ 'BufReadPre',
\ 'BufRead',
\ 'BufReadPost',
\ 'FileReadPre',
\ 'FileReadPost',
\ 'FilterReadPre',
\ 'FilterReadPost',
\ 'StdinReadPre',
\ 'StdinReadPost',
\ 'BufWrite',
\ 'BufWritePre',
\ 'BufWritePost',
\ 'FileWritePre',
\ 'FileWritePost',
\ 'FileAppendPre',
\ 'FileAppendPost',
\ 'FilterWritePre',
\ 'FilterWritePost',
\ 'BufAdd',
\ 'BufCreate',
\ 'BufDelete',
\ 'BufWipeout',
\ 'BufFilePre',
\ 'BufFilePost',
\ 'BufEnter',
\ 'BufLeave',
\ 'BufWinEnter',
\ 'BufWinLeave',
\ 'BufUnload',
\ 'BufHidden',
\ 'BufNew',
\ 'SwapExists',
\ 'FileType',
\ 'Syntax',
\ 'EncodingChanged',
\ 'TermChanged',
\ 'VimEnter',
\ 'GUIEnter',
\ 'GUIFailed',
\ 'TermResponse',
\ 'QuitPre',
\ 'VimLeavePre',
\ 'VimLeave',
\ 'FileChangedShell',
\ 'FileChangedShellPost',
\ 'FileChangedRO',
\ 'ShellCmdPost',
\ 'ShellFilterPost',
\ 'CmdUndefined',
\ 'SpellFileMissing',
\ 'SourcePre',
\ 'VimResized',
\ 'FocusGained',
\ 'FocusLost',
\ 'CursorHold',
\ 'CursorHoldI',
\ 'CursorMoved',
\ 'CursorMovedI',
\ 'WinEnter',
\ 'WinLeave',
\ 'TabEnter',
\ 'TabLeave',
\ 'CmdwinEnter',
\ 'CmdwinLeave',
\ 'InsertEnter',
\ 'InsertChange',
\ 'InsertLeave',
\ 'InsertCharPre',
\ 'TextChanged',
\ 'TextChangedI',
\ 'ColorScheme',
\ 'RemoteReply',
\ 'QuickFixCmdPre',
\ 'QuickFixCmdPost',
\ 'SessionLoadPost',
\ 'MenuPopup',
\ 'CompleteDone',
\ 'User',
\ ]

2504
autoload/plug.vim Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,551 +0,0 @@
" submode - Create your own submodes
" Version: 0.3.1
" Copyright (C) 2008-2014 kana <http://whileimautomaton.net/>
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be included
" in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
" }}}
" Concept "{{{1
"
" In the following pseudo code, :MAP means :map or :noremap, and it depends on
" user's specification.
"
" map {key-to-enter}
" \ <Plug>(submode-before-entering:{submode}:with:{key-to-enter})
" \<Plug>(submode-before-entering:{submode})
" \<Plug>(submode-enter:{submode})
"
" MAP <Plug>(submode-before-entering:{submode}:with:{key-to-enter})
" \ {anything}
" noremap <Plug>(submode-before-entering:{submode})
" \ {tweaking 'timeout' and others}
" map <Plug>(submode-enter:{submode})
" \ <Plug>(submode-before-action:{submode})
" \<Plug>(submode-prefix:{submode})
"
" map <Plug>(submode-prefix:{submode})
" \ <Plug>(submode-leave:{submode})
" map <Plug>(submode-prefix:{submode}){the first N keys in {lhs}}
" \ <Plug>(submode-leave:{submode})
" map <Plug>(submode-prefix:{submode}){lhs}
" \ <Plug>(submode-rhs:{submode}:for:{lhs})
" \<Plug>(submode-enter:{submode})
" MAP <Plug>(submode-rhs:{submode}:for:{lhs})
" \ {rhs}
" Variables "{{{1
if !exists('g:submode_always_show_submode')
let g:submode_always_show_submode = 0
endif
if !exists('g:submode_keep_leaving_key')
let g:submode_keep_leaving_key = 0
endif
if !exists('g:submode_keyseqs_to_leave')
let g:submode_keyseqs_to_leave = ['<Esc>']
endif
if !exists('g:submode_timeout')
let g:submode_timeout = &timeout
endif
if !exists('g:submode_timeoutlen')
let g:submode_timeoutlen = &timeoutlen
endif
"" See s:set_up_options() and s:restore_options().
"
" let s:original_showcmd = &showcmd
" let s:original_showmode = &showmode
" let s:original_timeout = &timeout
" let s:original_timeoutlen = &timeoutlen
" let s:original_ttimeout = &ttimeout
" let s:original_ttimeoutlen = &ttimeoutlen
if !exists('s:options_overridden_p')
let s:options_overridden_p = 0
endif
" A padding string to wipe out internal key mappings in 'showcmd' area. (gh-3)
"
" We use no-break spaces (U+00A0) or dots, depending of the current 'encoding'.
" Because
"
" * A normal space (U+0020) is rendered as "<20>" since Vim 7.4.116.
" * U+00A0 is rendered as an invisible glyph if 'encoding' is set to one of
" Unicode encodings. Otherwise "| " is rendered instead.
let s:STEALTH_TYPEAHEAD =
\ &g:encoding =~# '^u'
\ ? repeat("\<Char-0xa0>", 5)
\ : repeat('.', 10)
let s:current_submode = ''
" Interface "{{{1
" :SubmodeRestoreOptions "{{{2
command! -bar -nargs=0 SubmodeRestoreOptions call submode#restore_options()
function! submode#current() "{{{2
return s:current_submode
endfunction
function! submode#enter_with(submode, modes, options, lhs, ...) "{{{2
let rhs = 0 < a:0 ? a:1 : '<Nop>'
for mode in s:each_char(a:modes)
call s:define_entering_mapping(a:submode, mode, a:options, a:lhs, rhs)
endfor
return
endfunction
function! submode#leave_with(submode, modes, options, lhs) "{{{2
let options = substitute(a:modes, 'e', '', 'g') " <Nop> is not expression.
return submode#map(a:submode, a:modes, options . 'x', a:lhs, '<Nop>')
endfunction
function! submode#map(submode, modes, options, lhs, rhs) "{{{2
for mode in s:each_char(a:modes)
call s:define_submode_mapping(a:submode, mode, a:options, a:lhs, a:rhs)
endfor
return
endfunction
function! submode#restore_options() "{{{2
call s:restore_options()
return
endfunction
function! submode#unmap(submode, modes, options, lhs) "{{{2
for mode in s:each_char(a:modes)
call s:undefine_submode_mapping(a:submode, mode, a:options, a:lhs)
endfor
return
endfunction
" Core "{{{1
function! s:define_entering_mapping(submode, mode, options, lhs, rhs) "{{{2
execute s:map_command(a:mode, 'r')
\ s:map_options(s:filter_flags(a:options, 'bu'))
\ (a:lhs)
\ (s:named_key_before_entering_with(a:submode, a:lhs)
\ . s:named_key_before_entering(a:submode)
\ . s:named_key_enter(a:submode))
if !s:mapping_exists_p(s:named_key_enter(a:submode), a:mode)
" When the given submode is not defined yet - define the default key
" mappings to leave the submode.
for keyseq in g:submode_keyseqs_to_leave
call submode#leave_with(a:submode, a:mode, a:options, keyseq)
endfor
endif
execute s:map_command(a:mode, s:filter_flags(a:options, 'r'))
\ s:map_options(s:filter_flags(a:options, 'besu'))
\ s:named_key_before_entering_with(a:submode, a:lhs)
\ a:rhs
execute s:map_command(a:mode, '')
\ s:map_options('e')
\ s:named_key_before_entering(a:submode)
\ printf('<SID>on_entering_submode(%s)', string(a:submode))
execute s:map_command(a:mode, 'r')
\ s:map_options('')
\ s:named_key_enter(a:submode)
\ (s:named_key_before_action(a:submode)
\ . s:named_key_prefix(a:submode))
execute s:map_command(a:mode, '')
\ s:map_options('e')
\ s:named_key_before_action(a:submode)
\ printf('<SID>on_executing_action(%s)', string(a:submode))
execute s:map_command(a:mode, 'r')
\ s:map_options('')
\ s:named_key_prefix(a:submode)
\ s:named_key_leave(a:submode)
" NB: :map-<expr> cannot be used for s:on_leaving_submode(),
" because it uses some commands not allowed in :map-<expr>.
execute s:map_command(a:mode, '')
\ s:map_options('s')
\ s:named_key_leave(a:submode)
\ printf('%s<SID>on_leaving_submode(%s)<Return>',
\ a:mode =~# '[ic]' ? '<C-r>=' : '@=',
\ string(a:submode))
return
endfunction
function! s:define_submode_mapping(submode, mode, options, lhs, rhs) "{{{2
execute s:map_command(a:mode, 'r')
\ s:map_options(s:filter_flags(a:options, 'bu'))
\ (s:named_key_prefix(a:submode) . a:lhs)
\ (s:named_key_rhs(a:submode, a:lhs)
\ . (s:has_flag_p(a:options, 'x')
\ ? s:named_key_leave(a:submode)
\ : s:named_key_enter(a:submode)))
execute s:map_command(a:mode, s:filter_flags(a:options, 'r'))
\ s:map_options(s:filter_flags(a:options, 'besu'))
\ s:named_key_rhs(a:submode, a:lhs)
\ a:rhs
let keys = s:split_keys(a:lhs)
for n in range(1, len(keys) - 1)
let first_n_keys = join(keys[:-(n+1)], '')
silent! execute s:map_command(a:mode, 'r')
\ s:map_options(s:filter_flags(a:options, 'bu'))
\ (s:named_key_prefix(a:submode) . first_n_keys)
\ s:named_key_leave(a:submode)
endfor
return
endfunction
function! s:undefine_submode_mapping(submode, mode, options, lhs) "{{{2
execute s:map_command(a:mode, 'u')
\ s:map_options(s:filter_flags(a:options, 'b'))
\ s:named_key_rhs(a:submode, a:lhs)
let keys = s:split_keys(a:lhs)
for n in range(len(keys), 1, -1)
let first_n_keys = join(keys[:n-1], '')
execute s:map_command(a:mode, 'u')
\ s:map_options(s:filter_flags(a:options, 'b'))
\ s:named_key_prefix(a:submode) . first_n_keys
if s:longer_mapping_exists_p(s:named_key_prefix(a:submode), first_n_keys)
execute s:map_command(a:mode, 'r')
\ s:map_options(s:filter_flags(a:options, 'b'))
\ s:named_key_prefix(a:submode) . first_n_keys
\ s:named_key_leave(a:submode)
break
endif
endfor
return
endfunction
" Misc. "{{{1
function! s:each_char(s) "{{{2
return split(a:s, '.\zs')
endfunction
function! s:filter_flags(s, cs) "{{{2
return join(map(s:each_char(a:cs), 's:has_flag_p(a:s, v:val) ? v:val : ""'),
\ '')
endfunction
function! s:has_flag_p(s, c) "{{{2
return 0 <= stridx(a:s, a:c)
endfunction
function! s:insert_mode_p(mode) "{{{2
return a:mode =~# '^[iR]'
endfunction
function! s:longer_mapping_exists_p(submode, lhs) "{{{2
" FIXME: Implement the proper calculation.
" Note that mapcheck() can't be used for this purpose because it may
" act as s:shorter_mapping_exists_p() if there is such a mapping.
return !0
endfunction
function! s:map_command(mode, flags) "{{{2
if s:has_flag_p(a:flags, 'u')
return a:mode . 'unmap'
else
return a:mode . (s:has_flag_p(a:flags, 'r') ? 'map' : 'noremap')
endif
endfunction
function! s:map_options(options) "{{{2
let _ = {
\ 'b': '<buffer>',
\ 'e': '<expr>',
\ 's': '<silent>',
\ 'u': '<unique>',
\ }
return join(map(s:each_char(a:options), 'get(_, v:val, "")'))
endfunction
function! s:mapping_exists_p(keyseq, mode) "{{{2
return maparg(a:keyseq, a:mode) != ''
endfunction
function! s:may_override_showmode_p(mode) "{{{2
" Normal mode / Visual mode (& its variants) / Insert mode (& its variants)
return a:mode =~# "^[nvV\<C-v>sS\<C-s>]" || s:insert_mode_p(a:mode)
endfunction
function! s:named_key_before_action(submode) "{{{2
return printf('<Plug>(submode-before-action:%s)', a:submode)
endfunction
function! s:named_key_before_entering(submode) "{{{2
return printf('<Plug>(submode-before-entering:%s)', a:submode)
endfunction
function! s:named_key_before_entering_with(submode, lhs) "{{{2
return printf('<Plug>(submode-before-entering:%s:with:%s)', a:submode, a:lhs)
endfunction
function! s:named_key_enter(submode) "{{{2
return printf('<Plug>(submode-enter:%s)', a:submode)
endfunction
function! s:named_key_leave(submode) "{{{2
return printf('<Plug>(submode-leave:%s)', a:submode)
endfunction
function! s:named_key_prefix(submode) "{{{2
return printf('<Plug>(submode-prefix:%s)%s', a:submode, s:STEALTH_TYPEAHEAD)
endfunction
function! s:named_key_rhs(submode, lhs) "{{{2
return printf('<Plug>(submode-rhs:%s:for:%s)', a:submode, a:lhs)
endfunction
function! s:on_entering_submode(submode) "{{{2
call s:set_up_options(a:submode)
return ''
endfunction
function! s:on_executing_action(submode) "{{{2
if (s:original_showmode || g:submode_always_show_submode)
\ && s:may_override_showmode_p(mode())
echohl ModeMsg
echo '-- Submode:' a:submode '--'
echohl None
endif
return ''
endfunction
function! s:on_leaving_submode(submode) "{{{2
if (s:original_showmode || g:submode_always_show_submode)
\ && s:may_override_showmode_p(mode())
if s:insert_mode_p(mode())
let cursor_position = getpos('.')
endif
" BUGS: :redraw! doesn't redraw 'showmode'.
execute "normal! \<C-l>"
if s:insert_mode_p(mode())
call setpos('.', cursor_position)
endif
endif
if !g:submode_keep_leaving_key && getchar(1) isnot 0
" To completely ignore unbound key sequences in a submode,
" here we have to fetch and drop the last key in the key sequence.
call getchar()
endif
call s:restore_options()
return ''
endfunction
function! s:remove_flag(s, c) "{{{2
" Assumption: a:c is not a meta character.
return substitute(a:s, a:c, '', 'g')
endfunction
function! s:restore_options() "{{{2
if !s:options_overridden_p
return
endif
let s:options_overridden_p = 0
let &showcmd = s:original_showcmd
let &showmode = s:original_showmode
let &timeout = s:original_timeout
let &timeoutlen = s:original_timeoutlen
let &ttimeout = s:original_ttimeout
let &ttimeoutlen = s:original_ttimeoutlen
let s:current_submode = ''
return
endfunction
function! s:set_up_options(submode) "{{{2
if s:options_overridden_p
return
endif
let s:options_overridden_p = !0
let s:original_showcmd = &showcmd
let s:original_showmode = &showmode
let s:original_timeout = &timeout
let s:original_timeoutlen = &timeoutlen
let s:original_ttimeout = &ttimeout
let s:original_ttimeoutlen = &ttimeoutlen
" NB: 'showcmd' must be enabled to render the cursor properly.
" If 'showcmd' is disabled and the current submode message is rendered, the
" cursor is rendered at the end of the message, not the actual position in
" the current window. (gh-9)
set showcmd
set noshowmode
let &timeout = g:submode_timeout
let &ttimeout = s:original_timeout ? !0 : s:original_ttimeout
let &timeoutlen = g:submode_timeoutlen
let &ttimeoutlen = s:original_ttimeoutlen < 0
\ ? s:original_timeoutlen
\ : s:original_ttimeoutlen
let s:current_submode = a:submode
return
endfunction
function! s:split_keys(keyseq) "{{{2
" Assumption: Special keys such as <C-u> are escaped with < and >, i.e.,
" a:keyseq doesn't directly contain any escape sequences.
return split(a:keyseq, '\(<[^<>]\+>\|.\)\zs')
endfunction
" __END__ "{{{1
" vim: foldmethod=marker

View File

@ -1,4 +0,0 @@
snippet docsec
------------------------
--[ ${0:DOCUMENT SECTION} ]--
------------------------

View File

@ -1,2 +0,0 @@
snippet tc
\textcolor{${1:red}}{${0}}

View File

@ -1,106 +1,6 @@
nnoremap <SPACE> <Nop>
let g:mapleader = ' '
inoremap <C-u> <Esc>
nnoremap <C-,> :tabprevious<CR>
nnoremap <C-.> :tabnext<CR>
noremap <C-PageUp> gT
noremap <C-PageDown> gt
"
nnoremap <Leader>tk <C-w><C-]><C-w>T
" Quickly insert an empty new line without entering insert mode
nnoremap <Leader>o o<Esc>
nnoremap <Leader>O O<Esc>
" nnoremap <kPageUp> <PageUp>
" nnoremap <kPageDown> <PageDown>
" inoremap <kPageUp> <PageUp>
" inoremap <kPageDown> <PageDown>
" workman
noremap <C-K> <C-O>
noremap <Tab> <C-I>
noremap e j
noremap o k
noremap n h
noremap i l
vnoremap i l
noremap k n
noremap h e
noremap l o
noremap f u
noremap u i
noremap E J
noremap O K
noremap N H
noremap I L
noremap K N
noremap H E
noremap L O
noremap F U
noremap U I
noremap ge gj
noremap go gk
noremap gn gh
noremap gl go
noremap gk gn
noremap gh ge
noremap gE gJ
noremap gN gH
noremap gK gN
noremap gH gE
noremap gL gO
nnoremap <silent> <c-w>e :wincmd j<cr>
nnoremap <silent> <c-w>o :wincmd k<cr>
nnoremap <silent> <c-w>n :wincmd h<cr>
nnoremap <silent> <c-w>i :wincmd l<cr>
nnoremap <silent> <c-w>k :wincmd n<cr>
nnoremap <silent> <c-w>l :wincmd o<cr>
vnoremap <c-n> B
vnoremap <c-i> W
nnoremap <c-n> B
nnoremap <c-i> W
vnoremap <A-n> b
vnoremap <A-i> w
nnoremap <A-n> b
nnoremap <A-i> w
" nnoremap <c-n>i e
" get control-j back, so switch it with ctrl-n at qwerty position of j
" imap <c-n> <cr>
" cmap <c-n> <cr>
inoremap <c-j> <c-n>
cnoremap <c-j> <c-n>
" jump word in visual mode -- TODO
" In insert or command mode, move normally by using Ctrl
inoremap <C-n> <Left>
inoremap <C-e> <Down>
inoremap <C-o> <Up>
inoremap <C-i> <Right>
cnoremap <C-n> <Left>
cnoremap <C-e> <Down>
cnoremap <C-o> <Up>
cnoremap <C-i> <Right>
inoremap <C-A-n> <C-Left>
inoremap <C-A-i> <C-Right>
inoremap <C-A-e> <Esc>:+3<CR>i
inoremap <C-A-o> <Esc>:-3<CR>i
" easy config
nmap <S-F9> :e $HOME/.vimrc<CR>
nmap <S-F10> :so $HOME/.vimrc<CR>
@ -108,22 +8,15 @@ nmap <S-F10> :so $HOME/.vimrc<CR>
" Force saving files that require root permission
command! SUDOwrite :execute 'w !sudo tee > /dev/null %' | edit!
" TODO: C-S-o etc does not work
" Bubble single lines
nmap <silent> <C-S-Up> :m-2<CR>==
nmap <silent> <C-S-o> :m-2<CR>==
nmap <silent> <C-S-Down> :m+<CR>==
nmap <silent> <C-S-e> :m+<CR>==
imap <silent> <C-S-Up> <Esc>:m-2<CR>==gi
imap <silent> <C-S-o> <Esc>:m-2<CR>==gi
imap <silent> <C-S-Down> <Esc>:m+<CR>==gi
imap <silent> <C-S-e> <Esc>:m+<CR>==gi
" Bubble multiple lines
vmap <silent> <C-S-Up> :m-2<CR>gv=gv
vmap <silent> <C-S-o> :m-2<CR>gv=gv
vmap <silent> <C-S-Down> :m'>+<CR>gv=gv
vmap <silent> <C-S-e> :m'>+<CR>gv=gv
" Indent lines using <Left> and <Right>
vmap <C-S-Right> >gv
@ -144,9 +37,6 @@ noremap <leader>bd <Esc>:bd<CR>
noremap <leader>wc <Esc>:bd<CR>
noremap <leader>bo <Esc>:Bufonly<CR>
" close preview
nmap <leader>pc <Esc>:pc<CR>
" Remap window commands
" map <leader>ws <Esc>:wincmd s<CR>
" map <leader>wv <Esc>:wincmd v<CR>
@ -167,19 +57,10 @@ nmap <leader>pc <Esc>:pc<CR>
" map <C-h> <Esc>:wincmd h<CR>
" map <C-Right> <Esc>:wincmd l<CR>
" map <C-l> <Esc>:wincmd l<CR>
"
" nnoremap <silent> <A-o> :wincmd k<CR>
" nnoremap <silent> <A-e> :wincmd j<CR>
" nnoremap <silent> <A-n> :wincmd h<CR>
" nnoremap <silent> <A-i> :wincmd l<CR>
" inoremap <silent> <A-o> <Esc>:wincmd k<CR>
" inoremap <silent> <A-e> <Esc>:wincmd j<CR>
" inoremap <silent> <A-n> <Esc>:wincmd h<CR>
" inoremap <silent> <A-i> <Esc>:wincmd l<CR>
nnoremap <silent> <C-A-o> :wincmd k<CR>
nnoremap <silent> <C-A-e> :wincmd j<CR>
nnoremap <silent> <C-A-n> :wincmd h<CR>
nnoremap <silent> <C-A-i> :wincmd l<CR>
nnoremap <silent> <A-i> :wincmd K<CR>
nnoremap <silent> <A-k> :wincmd J<CR>
nnoremap <silent> <A-j> :wincmd H<CR>
nnoremap <silent> <A-l> :wincmd L<CR>
nnoremap <silent> <A-Up> :wincmd k<CR>
nnoremap <silent> <A-Down> :wincmd j<CR>
nnoremap <silent> <A-Left> :wincmd h<CR>
@ -188,23 +69,18 @@ inoremap <silent> <A-Up> <Esc>:wincmd k<CR>
inoremap <silent> <A-Down> <Esc>:wincmd j<CR>
inoremap <silent> <A-Left> <Esc>:wincmd h<CR>
inoremap <silent> <A-Right> <Esc>:wincmd l<CR>
nnoremap <silent> <C-A-Up> :wincmd K<CR>
nnoremap <silent> <C-A-Down> :wincmd J<CR>
nnoremap <silent> <C-A-Left> :wincmd H<CR>
nnoremap <silent> <C-A-Right> :wincmd L<CR>
inoremap <silent> <C-A-Up> <Esc>:wincmd K<CR>
inoremap <silent> <C-A-Down> <Esc>:wincmd J<CR>
inoremap <silent> <C-A-Left> <Esc>:wincmd H<CR>
inoremap <silent> <C-A-Right> <Esc>:wincmd L<CR>
" tags
nmap <S-F3> :exec("tjump ".expand("<cword>"))<CR>
nmap <S-F4> :split<CR>:exec("tjump ".expand("<cword>"))<CR>
" trigger NERDTree, Tagbar $ Co.
" nmap <leader>n <Esc>:NERDTreeToggle<CR>
" nmap <leader>t <Esc>:TagbarToggle<CR>
nmap <leader>n <Esc>:NERDTreeToggle<CR>
nmap <leader>t <Esc>:TagbarToggle<CR>
" nmap <leader>f "zyaw :exe ":Ack ".@z.""<CR>
nmap <C-f> :CtrlP<CR>
nmap <C-t> :CtrlPTag<CR>
nmap <C-b> :CtrlPBuffer<CR>
" grep word under cursor
nnoremap <silent><leader>f :lgr! "\b<C-R><C-W>\b"<CR>:cw<CR>
@ -216,69 +92,51 @@ inoremap <silent> <S-Insert> <ESC>:set paste<CR>"+p :set nopaste<CR>
nmap <silent> <S-F7> :setlocal spell! spelllang=en_us<CR>
" cursor jump
" nnoremap <A-Up> 3k
" inoremap <A-Up> <Esc>:-3<CR>i
" vnoremap <A-Up> 3k
" nnoremap <A-Down> 3j
" inoremap <A-Down> <Esc>:+3<CR>i
" vnoremap <A-Down> 3j
" nnoremap <C-Up> 6k
" inoremap <C-Up> <Esc>:-6<CR>i
" vnoremap <C-Up> 6k
" nnoremap <C-Down> 6j
" inoremap <C-Down> <Esc>:+6<CR>i
" vnoremap <C-Down> 6j
nnoremap <A-o> 3k
vnoremap <A-o> 3k
nnoremap <A-e> 3j
vnoremap <A-e> 3j
nnoremap <C-o> 6k
vnoremap <C-o> 6k
nnoremap <C-e> 6j
vnoremap <C-e> 6j
nnoremap <S-Up> 3k
inoremap <S-Up> <Esc>:-3<CR>i
vnoremap <S-Up> 3k
nnoremap <S-Down> 3j
inoremap <S-Down> <Esc>:+3<CR>i
vnoremap <S-Down> 3j
nnoremap <C-Up> 6k
inoremap <C-Up> <Esc>:-6<CR>i
vnoremap <C-Up> 6k
nnoremap <C-Down> 6j
inoremap <C-Down> <Esc>:+6<CR>i
vnoremap <C-Down> 6j
" scrolling
nnoremap <S-PageUp> 10<C-Y>
" inoremap <S-PageUp> <Esc>10<C-Y>i
inoremap <S-PageUp> <Esc>10<C-Y>i
vnoremap <S-PageUp> 10<C-Y>
nnoremap <S-PageDown> 10<C-E>
" inoremap <S-PageDown> <Esc>10<C-E>i
inoremap <S-PageDown> <Esc>10<C-E>i
vnoremap <S-PageDown> 10<C-E>
nnoremap <A-p> 10<C-Y>
" inoremap <A-p> <Esc>10<C-Y>i
vnoremap <A-p> 10<C-Y>
nnoremap <A-u> 10<C-E>
" inoremap <A-u> <Esc>10<C-E>i
vnoremap <A-u> 10<C-E>
nnoremap <C-p> <C-u>
" inoremap <C-p> <Esc><C-u>i
vnoremap <C-p> <C-u>
nnoremap <C-u> <C-d>
" inoremap <C-u> <Esc><C-d>i
vnoremap <C-u> <C-d>
" half scroll up and down
noremap <C-A-p> <C-b>
noremap <C-A-u> <C-f>
map <C-d> <Nop>
" F keys
" nmap <F2> :noh<CR>
" imap <F2> <C-O>:noh<CR>
nmap <F2> :noh<CR>
imap <F2> <C-O>:noh<CR>
nmap <F3> :YcmCompleter GoToDeclaration<CR>
nmap <F4> :YcmCompleter GoTo<CR>
nmap <C-F4> :YcmCompleter GoTo<CR>:wincmd o<CR>
noremap <F5> :FufBuffer<CR>
nmap <F7> :call ManCurrentWord()<CR><CR>
" nmap <F8> :call DevHelpCurrentWord()<CR><CR>
nmap <F8> :call DevHelpCurrentWord()<CR><CR>
nnoremap <silent> <F10> :call NERDComment("n", "Toggle")<cr>
vnoremap <silent> <F10> <ESC>:call NERDComment("v", "Toggle")<cr>
" nmap <F4> <C-]>
" plugins etc
noremap <C-F> :NERDTreeToggle<CR>
noremap <C-B> :TagbarToggle<CR>
inoremap <C-B> <C-O>:TagbarToggle<CR>
" remap visual block
nnoremap <S-C> <c-v>
nnoremap <S-B> <c-v>
" write
noremap <C-s> :w<CR>
inoremap <C-s> <Esc>:w<CR>
inoremap <C-s> <C-O>:w<CR>
" exit
noremap <C-q> :qa!<CR>
@ -292,161 +150,3 @@ inoremap <C-V> <C-O>:call Paste("i")<CR>
" select all
nnoremap <C-A> ggVG<CR>
inoremap <C-A> <C-O>:call Select()<CR>
nnoremap <leader>cd :cd %:p:h<CR>:pwd<CR>
nnoremap <Leader>cc :call ToggleQuickFix()<CR>
function! ToggleQuickFix()
if empty(filter(getwininfo(), 'v:val.quickfix'))
copen
else
cclose
endif
endfunction
function! ToggleLocList()
if empty(filter(getwininfo(), 'v:val.loclist'))
lopen
else
lclose
endif
endfunction
nnoremap <silent> <F3> :call ToggleQuickFix()<CR>
nnoremap <silent> <F4> :call ToggleLocList()<CR>
" PLUGINS
" NERDTree
if !exists('g:vscode')
" noremap <C-j> :Telescope file_browser<CR>
noremap <C-j> :NERDTreeToggle<CR>
" noremap <C-B> :TagbarToggle<CR>
inoremap <C-B> <C-O>:TagbarToggle<CR>
endif
" vista
nmap <F8> :Vista!!<CR>
" NERDComment
if !exists('g:vscode')
nnoremap <silent> <F10> :call NERDComment("n", "Toggle")<cr>
vnoremap <silent> <F10> <ESC>:call NERDComment("v", "Toggle")<cr>
endif
" YCM
if !exists('g:vscode')
nmap <C-F4> :YcmCompleter GoTo<CR>:wincmd o<CR>
endif
" vim-clap
if !exists('g:vscode')
if has('nvim')
nnoremap <leader>ag <cmd>lua require('telescope.builtin').live_grep({ default_text = vim.fn.expand("<cword>") })<cr>
nnoremap <silent> <leader>tg <cmd>lua require('telescope.builtin').tags({ default_text = vim.fn.expand("<cword>") })<cr>
nmap <silent> <C-f> :call ComIfGit('lua require("telescope.builtin").git_files()', 'lua require("telescope.builtin").find_files()')<CR>
nmap <F1> <cmd>lua require('telescope.builtin').tags()<cr>
nmap <C-b> <cmd>lua require('telescope.builtin').buffers()<cr>
nmap <C-d> <cmd>lua require('telescope.builtin').diagnostics()<cr>
nmap <C-l> <cmd>lua require('telescope.builtin').lsp_document_symbols()<cr>
nnoremap <leader>ls <cmd>lua require('telescope.builtin').lsp_document_symbols({ default_text = vim.fn.expand("<cword>") })<cr>
else
nnoremap <leader>ag :Clap grep ++query=<cword><CR>
nnoremap <leader>dg :Clap dumb_jump ++query=<cword><CR>
" nnoremap <silent> <leader>tg :Clap proj_tags ++query=<cword><CR>
nmap <silent> <C-f> :call ComIfGit('Clap gfiles', 'Clap files')<CR>
nmap <F1> :Clap tags<CR>
nmap <F2> :Clap proj_tags<CR>
nmap <C-b> :Clap buffers<CR>
nnoremap <silent> <leader>tb :Clap proj_tags ++query=<cword><CR>
endif
endif
" tags
nnoremap <silent> <leader>tg :tag <C-R>=expand("<cword>")<CR><CR>
nnoremap <silent> <leader>tp :ptag <C-R>=expand("<cword>")<CR><CR>
nnoremap <silent> <leader>ts :ts <C-R>=expand("<cword>")<CR><CR>
" gitgutter
if !exists('g:vscode')
nmap <leader>ggt <Esc>:GitGutterToggle<CR>
nmap <leader>nh <Plug>(GitGutterNextHunk)
nmap <leader>bh <Plug>(GitGutterPrevHunk)
" tig
" let g:tig_explorer_keymap_edit = '<C-x>'
" let g:tig_explorer_keymap_tabedit = '<C-t>'
" let g:tig_explorer_keymap_split = '<C-s>'
" let g:tig_explorer_keymap_vsplit = '<C-v>'
" nnoremap <Leader>T :TigOpenCurrentFile<CR>
" nnoremap <Leader>t :TigOpenProjectRootDir<CR>
" nnoremap <Leader>g :TigGrep<CR>
" nnoremap <Leader>r :TigGrepResume<CR>
" vnoremap <Leader>g y:TigGrep<Space><C-R>"<CR>
" nnoremap <Leader>cg :<C-u>:TigGrep<Space><C-R><C-W><CR>
" nnoremap <Leader>b :TigBlame<CR>
" ghcup
" nnoremap <Leader>ghc :GHCup<CR>
" git gutter
omap <leader>ic <Plug>(GitGutterTextObjectInnerPending)
omap <leader>ac <Plug>(GitGutterTextObjectOuterPending)
xmap <leader>ic <Plug>(GitGutterTextObjectInnerVisual)
xmap <leader>ac <Plug>(GitGutterTextObjectOuterVisual)
endif
" fastfold
nmap zuz <Plug>(FastFoldUpdate)
if exists('g:vscode')
nnoremap <silent> T :call VSCodeNotify('editor.action.showHover')<CR>
nnoremap <silent> gd :call VSCodeNotify('editor.action.revealDefinition')<CR>
else
if has('nvim')
nnoremap <silent> T :lua vim.lsp.buf.hover()<CR>
nnoremap <silent> gd :lua vim.lsp.buf.definition()<CR>
nnoremap <leader>la :lua vim.lsp.buf.code_action()<CR>
nnoremap <leader>rn :lua vim.lsp.buf.rename()<CR>
nnoremap <leader>ci :lua vim.lsp.buf.incoming_calls()<CR>
nnoremap <leader>co :lua vim.lsp.buf.outgoing_calls()<CR>
" Vim Script
nnoremap <leader>xx <cmd>TroubleToggle<cr>
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
nnoremap gR <cmd>TroubleToggle lsp_references<cr>
else
"LanguageClient-neovim
" Required for operations modifying multiple buffers like rename.
set hidden
nnoremap <leader>lc :call LanguageClient_contextMenu()<CR>
" Or map each action separately
nnoremap <silent> T :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
" nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
" nnoremap <leader>ld :call LanguageClient#textDocument_definition()<CR>
" nnoremap <leader>lr :call LanguageClient#textDocument_rename()<CR>
" nnoremap <leader>lf :call LanguageClient#textDocument_formatting()<CR>
" nnoremap <leader>lt :call LanguageClient#textDocument_typeDefinition()<CR>
" nnoremap <leader>lx :call LanguageClient#textDocument_references()<CR>
" nnoremap <leader>la :call LanguageClient_workspace_applyEdit()<CR>
" nnoremap <leader>lc :call LanguageClient#textDocument_completion()<CR>
" nnoremap <leader>lh :call LanguageClient#textDocument_hover()<CR>
nnoremap <leader>la :call LanguageClient#textDocument_codeAction()<CR>
nnoremap <leader>rn :call LanguageClient#textDocument_rename()<CR>
nnoremap <leader>ln <Plug>(lcn-diagnostics-next)
nnoremap <leader>lp <Plug>(lcn-diagnostics-prev)
endif
endif

View File

@ -1,848 +0,0 @@
[[plugins]]
repo = 'dstein64/nvim-scrollview'
hook_add = '''
lua require('scrollview').setup({ excluded_filetypes = {'nerdtree'}, current_only = true, winblend = 75, base = 'right', column = 1 })
'''
on_if = 'has("nvim") && !exists("g:vscode")'
lazy = false
[[plugins]]
repo = 'romgrk/fzy-lua-native'
[[plugins]]
repo = 'gelguy/wilder.nvim'
on_event = 'CmdlineEnter'
hook_post_source = '''
call wilder#setup({
\ 'modes': [':', '/', '?'],
\ 'enable_cmdline_enter': 0,
\ })
call wilder#set_option('noselect', 0)
call wilder#set_option('pipeline', [
\ wilder#branch(
\ wilder#python_file_finder_pipeline({
\ 'file_command': {_, arg -> stridx(arg, '.') != -1 ? ['fd', '-tf', '-H'] : ['fd', '-tf']},
\ 'dir_command': ['fd', '-td'],
\ 'filters': ['cpsm_filter'],
\ }),
\ wilder#substitute_pipeline({
\ 'pipeline': wilder#python_search_pipeline({
\ 'skip_cmdtype_check': 1,
\ 'pattern': wilder#python_fuzzy_pattern({
\ 'start_at_boundary': 0,
\ }),
\ }),
\ }),
\ wilder#cmdline_pipeline({
\ 'fuzzy': 2,
\ 'fuzzy_filter': has('nvim') ? wilder#lua_fzy_filter() : wilder#vim_fuzzy_filter(),
\ }),
\ [
\ wilder#check({_, x -> empty(x)}),
\ wilder#history(),
\ ],
\ wilder#python_search_pipeline({
\ 'pattern': wilder#python_fuzzy_pattern({
\ 'start_at_boundary': 0,
\ }),
\ }),
\ ),
\ ])
let s:highlighters = [
\ wilder#pcre2_highlighter(),
\ has('nvim') ? wilder#lua_fzy_highlighter() : wilder#cpsm_highlighter(),
\ ]
let s:popupmenu_renderer = wilder#popupmenu_renderer(wilder#popupmenu_border_theme({
\ 'border': 'rounded',
\ 'empty_message': wilder#popupmenu_empty_message_with_spinner(),
\ 'highlighter': s:highlighters,
\ 'left': [
\ ' ',
\ wilder#popupmenu_devicons(),
\ wilder#popupmenu_buffer_flags({
\ 'flags': ' a + ',
\ 'icons': {'+': '', 'a': '', 'h': ''},
\ }),
\ ],
\ 'right': [
\ ' ',
\ wilder#popupmenu_scrollbar(),
\ ],
\ }))
let s:wildmenu_renderer = wilder#wildmenu_renderer({
\ 'highlighter': s:highlighters,
\ 'separator': ' · ',
\ 'left': [' ', wilder#wildmenu_spinner(), ' '],
\ 'right': [' ', wilder#wildmenu_index()],
\ })
call wilder#set_option('renderer', wilder#renderer_mux({
\ ':': s:popupmenu_renderer,
\ '/': s:wildmenu_renderer,
\ 'substitute': s:wildmenu_renderer,
\ }))
'''
#[[plugins]]
#repo = 'dstein64/vim-startuptime'
[[plugins]]
repo = 'purescript-contrib/purescript-vim'
[[plugins]]
repo = 'PProvost/vim-ps1'
[[plugins]]
repo = 'nvim-lua/popup.nvim'
on_if = 'has("nvim")'
[[plugins]]
repo = 'nvim-lua/plenary.nvim'
on_if = 'has("nvim")'
[[plugins]]
repo = 'Twinside/vim-haskellFold'
hook_post_source = '''
call SetHaskellFolding()
'''
on_ft = ['haskell']
[[plugins]]
repo = 'kana/vim-submode'
hook_add = '''
" A message will appear in the message line when you're in a submode
" and stay there until the mode has exited.
let g:submode_always_show_submode = 1
let g:submode_keep_leaving_key = 1
let g:submode_timeout = 0
" We're taking over the default <C-w> setting. Don't worry we'll do
" our best to put back the default functionality.
call submode#enter_with('nav', 'n', '', '<C-ENTER>')
call submode#map('nav', 'n', 's', 'e', ':normal! 6j<cr>')
call submode#map('nav', 'n', 's', 'o', ':normal! 6k<cr>')
call submode#map('nav', 'n', 's', ',', '<Cmd>normal! <C-d><CR>')
call submode#map('nav', 'n', 's', '.', '<Cmd>normal! <C-u><CR>')
call submode#map('nav', 'n', 's', ']', '<Cmd>normal! <C-b><CR>')
call submode#map('nav', 'n', 's', '[', '<Cmd>normal! <C-f><CR>')
call submode#map('nav', 'n', '', 'n', 'B')
call submode#map('nav', 'n', '', 'i', 'W')
call submode#map('nav', 'n', 's', '<ENTER>', ':tabprevious<cr>')
call submode#map('nav', 'n', 's', '=', ':tabnext<cr>')
'''
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'jparise/vim-graphql'
[[plugins]]
repo = 'mileszs/ack.vim'
# [[plugins]]
# repo = 'vim-scripts/cmdalias.vim'
[[plugins]]
repo = 'easymotion/vim-easymotion'
hook_add = '''
'''
[[plugins]]
repo = 'Raimondi/delimitMate'
hook_add = '''
let g:delimitMate_matchpairs = "(:),[:],{:}"
let g:delimitMate_expand_cr = 1
let g:delimitMate_expand_space = 1
let g:delimitMate_autoclose = 1
'''
[[plugins]]
repo = 'vim-scripts/genindent.vim'
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'scrooloose/nerdcommenter'
hook_add = '''
let NERDSpaceDelims=1
let NERDCreateDefaultMappings=0
'''
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'scrooloose/nerdtree'
on_event = 'NERDTreeToggle'
hook_add = '''
let g:NERDTreeMapActivateNode = '<CR>'
let g:NERDTreeMapCustomOpen = ''
let g:NERDTreeMapOpenExpl = 'n'
let g:NERDTreeMapJumpNextSibling = ''
" let g:NERDTreeMapOpenSplit = ''
" use NERDTree instead of netrw
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
'''
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'Xuyuanp/nerdtree-git-plugin'
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'xolox/vim-easytags'
hook_add = '''
let g:easytags_async = 1
'''
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'xolox/vim-misc'
[[plugins]]
repo = 'nathanaelkane/vim-indent-guides'
[[plugins]]
repo = 'Shougo/vimproc.vim'
build = 'make'
[[plugins]]
repo = 'sjbach/lusty'
hook_add = '''
let g:LustyExplorerSuppressRubyWarning = 1
'''
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'nixprime/cpsm'
build = 'sh -c "PY3=ON ./install.sh"'
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'liuchengxu/vista.vim'
hook_add = '''
let g:vista#renderer#enable_icon = 0
let g:vista_ctags_cmd = {
\ 'haskell': 'hasktags -x -o - -c',
\ 'yaml': 'hasktags -x -o - -c',
\ }
'''
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'sbdchd/neoformat'
hook_add = '''
let g:neoformat_enabled_haskell = ['brittany']
let g:neoformat_enabled_typescript = ['prettier']
let g:neoformat_try_node_exe = 1
'''
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'AndrewRadev/bufferize.vim'
[[plugins]]
repo = 'vmchale/dhall-vim'
[[plugins]]
repo = 'Shougo/echodoc.vim'
hook_add = '''
" set cmdheight=2
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'signature'
'''
[[plugins]]
repo = 'tpope/vim-scriptease'
on_if = '!has("nvim")'
[[plugins]]
repo = 'Konfekt/FastFold'
hook_add = '''
let g:fastfold_savehook = 1
let g:fastfold_fold_command_suffixes = ['x','X','a','A','o','O','c','C']
let g:fastfold_fold_movement_commands = [']z', '[z', 'zj', 'zk']
let g:markdown_folding = 1
let g:tex_fold_enabled = 1
let g:vimsyn_folding = 'af'
let g:xml_syntax_folding = 1
let g:html_syntax_folding = 1
let g:javaScript_fold = 1
let g:sh_fold_enabled= 7
let g:ruby_fold = 1
let g:perl_fold = 1
let g:perl_fold_blocks = 1
let g:r_syntax_folding = 1
let g:rust_fold = 1
let g:haskell_fold = 1
'''
[[plugins]]
repo = 'editorconfig/editorconfig-vim'
hook_add = '''
" overwrite nonsense from editorconfig
let g:EditorConfig_max_line_indicator = 'none'
" let g:EditorConfig_preserve_formatoptions = 1
'''
[[plugins]]
repo = 'hasufell/ghcup.vim'
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'junegunn/vim-easy-align'
[[plugins]]
repo = 'dominikduda/vim_current_word'
hook_add = '''
let g:vim_current_word#highlight_current_word = 0
hi default link CurrentWordTwins CursorColumn
'''
#[[plugins]]
# repo = 'vim-airline/vim-airline'
#[[plugins]]
# repo = 'vim-airline/vim-airline-themes'
[[plugins]]
repo = 'mkitt/tabline.vim'
[[plugins]]
repo = 'kshenoy/vim-signature'
# finder
#[[plugins]]
#repo = 'liuchengxu/vim-clap'
#build = 'make'
#hook_add = '''
# autocmd Filetype clap_input inoremap <silent> <buffer> <kPageDown> <C-R>=clap#navigation#scroll('down')<CR>
# autocmd Filetype clap_input inoremap <silent> <buffer> <kPageUp> <C-R>=clap#navigation#scroll('up')<CR>
# autocmd Filetype clap_input nnoremap <silent> <buffer> <kPageDown> <C-R>=clap#navigation#scroll('down')<CR>
# autocmd Filetype clap_input nnoremap <silent> <buffer> <kPageUp> <C-R>=clap#navigation#scroll('up')<CR>
#
# let g:clap_popup_move_manager = {
# \ "\<kPageUp>": "\<PageUp>",
# \ "\<kPageDown>": "\<PageDown>",
# \ }
#
# let g:clap_layout = {'relative': 'editor', 'width': '95%', 'height': '33%', 'row': '33%', 'col': '5%'}
# let g:clap_use_pure_python = 1
#
# function! MultiClap(com, ...) abort
# let opts = map(copy(a:000), "printf('++query=%s', v:val)")
# execute 'Clap ' a:com join(opts, ' ')
# endfunction
#
# command! -nargs=* Rag call MultiClap('grep', <f-args>)
# command! -nargs=* Dag call MultiClap('dumb_jump', <f-args>)
#
# let g:clap_provider_generated_tags = {
# \ 'source': {-> Tags__source()},
# \ 'sink': {line -> Tags__sink(line)},
# \}
#
# function! Tags__source ()
# return flatten(map(tagfiles(), {_, file -> filter(readfile(file), 'stridx(v:val, "!_TAG") != 0')}))
# endfunc
#
# function! Tags__sink (line)
# " Let vim handle the tag
# execute 'tag' split(a:line, '\t')[0]
# endfunc
#
# cabbrev C Clap
# cabbrev c Clap
# cabbrev cp Clap proj_tags
#'''
#on_if = '!has("nvim") && !exists("g:vscode")'
# scm
[[plugins]]
repo = 'tpope/vim-fugitive'
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'tpope/vim-rhubarb'
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'tommcdo/vim-fubitive'
[[plugins]]
repo = 'airblade/vim-gitgutter'
hook_add = '''
" https://github.com/airblade/vim-gitgutter/issues/696
autocmd ColorScheme * highlight! link SignColumn LineNr
'''
on_if = '!exists("g:vscode")'
# local vimrc
[[plugins]]
repo = 'LucHermitte/lh-vim-lib'
[[plugins]]
repo = 'LucHermitte/local_vimrc'
# completion
#[[plugins]]
#repo = 'Valloric/YouCompleteMe'
#build = './install.py --clang-completer --go-completer --rust-completer --system-boost --system-libclang'
#on_ft = ['c', 'go', 'clojure']
#hook_add = '''
# youcompleteme
# let g:ycm_filetype_blacklist = {
# \ 'notes' : 1,
# \ 'markdown' : 1,
# \ 'text' : 1,
# \ 'java' : 1,
# \}
# let g:ycm_confirm_extra_conf = 0
# let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
# let g:ycm_collect_identifiers_from_tags_files = 1
# let g:ycm_seed_identifiers_with_syntax = 0
# " let g:ycm_always_populate_location_list = 1
# let g:ycm_autoclose_preview_window_after_completion = 1
# let g:ycm_key_invoke_completion = '<C-Space>'
# let g:ycm_key_list_select_completion = ['<TAB>']
# let g:ycm_key_list_previous_completion = ['<S-TAB>']
# " nnoremap <F4> :YcmCompleter GoToDefinition<CR>
# let g:ycm_server_log_level = 'error'
# let g:ycm_semantic_triggers = {'haskell' : ['. ', '$ ']}
# let g:ycm_goto_buffer_command = 'horizontal-split'
#'''
[[plugins]]
repo = 'Shougo/deoplete.nvim'
hook_add = '''
let g:deoplete#enable_at_startup = 1
autocmd FileType TelescopePrompt call deoplete#custom#buffer_option('auto_complete', v:false)
'''
on_if = '!exists("g:vscode")'
lazy = false
[[plugins]]
repo = 'Shougo/deoplete-lsp'
on_if = '!exists("g:vscode")'
lazy = false
[[plugins]]
repo = 'roxma/nvim-yarp'
on_if = '!has("nvim")'
[[plugins]]
repo = 'roxma/vim-hug-neovim-rpc'
on_if = '!has("nvim")'
# linting/compilation
[[plugins]]
repo = 'dense-analysis/ale'
# build = 'bash -c "cp -R ~/.vim/ale_linters ."'
hook_add = '''
let g:ale_enabled = 1
" let g:ale_haskell_hie_executable = $HOME . '/.ghcup/bin/haskell-language-server-wrapper'
" let g:ale_linters = {'haskell':['hie'], 'c':[]}
let g:ale_linters_explicit = 1
let g:ale_haskell_argon_error_level = 14
let g:ale_haskell_argon_warn_level = 10
let g:ale_haskell_argon_info_level = 6
'''
on_if = 'index(["sh", "vim"], &ft) >= 0 && !exists("g:vscode")'
# LSP
[[plugins]]
repo = 'autozimu/LanguageClient-neovim'
rev = 'dev'
build = 'bash ./install.sh'
hook_add = '''
" Required for operations modifying multiple buffers like rename.
set hidden
let g:LanguageClient_autoStart = 0
let g:LanguageClient_diagnosticsEnable = 1
let g:LanguageClient_diagnosticsList = "Quickfix"
let g:LanguageClient_diagnosticsDisplay = {
\ 1: {
\ "name": "Error",
\ "texthl": "ALEError",
\ "signText": "✖",
\ "signTexthl": "ALEErrorSign",
\ "virtualTexthl": "Error",
\ },
\ 2: {
\ "name": "Warning",
\ "texthl": "ALEWarning",
\ "signText": "⚠",
\ "signTexthl": "ALEWarningSign",
\ "virtualTexthl": "Virtual",
\ },
\ 3: {
\ "name": "Information",
\ "texthl": "ALEInfo",
\ "signText": "",
\ "signTexthl": "ALEInfoSign",
\ "virtualTexthl": "Virtual",
\ },
\ 4: {
\ "name": "Hint",
\ "texthl": "ALEInfo",
\ "signText": "➤",
\ "signTexthl": "ALEInfoSign",
\ "virtualTexthl": "Virtual",
\ },
\ }
" hi link ALEError Error
hi ALEError term=underline cterm=underline ctermfg=Red gui=undercurl guisp=Red
hi link ALEWarning Warning
hi Virtual cterm=italic ctermfg=10 gui=italic guifg=#4b5558
hi link ALEInfo SpellCap
let $LANGUAGECLIENT_DEBUG=1
let g:LanguageClient_loggingLevel='DEBUG'
let g:LanguageClient_virtualTextPrefix = ''
let g:LanguageClient_loggingFile = expand('~/LanguageClient.log')
let g:LanguageClient_serverStderr = expand('~/LanguageServer.log')
let g:LanguageClient_rootMarkers = {
\ 'haskell': ['cabal.project', '*.cabal', 'stack.yaml'],
\ 'elm': ['elm.json']
\ }
let g:LanguageClient_serverCommands = {
\ 'haskell': ['haskell-language-server-wrapper', '--lsp', '--logfile', $HOME.'/hls-server.log'],
\ 'purescript': ['~/.npm-modules/bin/purescript-language-server', '--stdio'],
\ 'elm': ['elm-language-server'],
\ 'typescript': ['typescript-language-server', '--stdio']
\ }
'''
on_if = '!has("nvim")'
#[[plugins]]
#repo = 'prabirshrestha/vim-lsp'
#hook_add = '''
# function! s:on_lsp_buffer_enabled() abort
# setlocal omnifunc=lsp#complete
# setlocal signcolumn=yes
# if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
# nmap <buffer> gd <plug>(lsp-definition)
# nmap <buffer> gr <plug>(lsp-references)
# " nmap <buffer> gi <plug>(lsp-implementation)
# " nmap <buffer> gt <plug>(lsp-type-definition)
# nmap <buffer> <leader>rn <plug>(lsp-rename)
# nmap <buffer> .g <Plug>(lsp-previous-diagnostic)
# nmap <buffer> ,g <Plug>(lsp-next-diagnostic)
# nmap <buffer> T <plug>(lsp-hover)
# nmap <buffer> <leader>la <plug>(lsp-code-action)
# nmap <buffer> <leader>sd <plug>(lsp-document-diagnostics)
#
# " refer to doc to add more commands
# endfunction
#
# augroup lsp_install
# au!
# " call s:on_lsp_buffer_enabled only for languages that has the server registered.
# autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
# augroup END
#
# let g:lsp_auto_enable = 0
#
# " command -nargs=0 LspStart call lsp#activate()
#'''
# snippets
#[[plugins]]
#repo = 'Shougo/neosnippet.vim'
#[[plugins]]
#repo = 'honza/vim-snippets'
# multi language
[[plugins]]
repo = 'luochen1990/rainbow'
hook_add = '''
let g:rainbow_conf = {
\ 'guifgs': ['#DC322F', 'royalblue3', 'darkorange3', 'seagreen3'],
\ 'ctermfgs': ['lightred', 'lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'],
\}
let g:rainbow_active = 1
'''
on_if = 'index(["clojure", "haskell", "python"], &ft) >= 0 && !exists("g:vscode")'
# haskell
[[plugins]]
repo = 'neovimhaskell/haskell-vim'
hook_add = '''
let g:haskell_classic_highlighting = 1
let g:haskell_indent_disable = 1
" let g:haskell_enable_quantification = 1
" let g:haskell_enable_recursivedo = 1
" let g:haskell_enable_arrowsyntax = 1
" let g:haskell_enable_pattern_synonyms = 1
" let g:haskell_enable_typeroles = 1
let g:haskell_indent_if = 0
let g:haskell_indent_case = 4
let g:haskell_indent_let = 4
let g:haskell_indent_where = 6
let g:haskell_indent_before_where = 2
let g:haskell_indent_after_bare_where = 2
let g:haskell_indent_do = 4
let g:haskell_indent_in = 0
let g:haskell_indent_guard = 4
" let g:haskell_disable_TH = 1
'''
on_if = 'index(["haskell", "cabal"], &ft) >= 0 && !exists("g:vscode")'
[[plugins]]
repo = 'Twinside/vim-hoogle'
hook_source = '''
nnoremap <leader>ho :Hoogle<CR>
nnoremap <leader>hc :HoogleClose<CR>
'''
on_if = 'index(["haskell"], &ft) >= 0 && !exists("g:vscode")'
[[plugins]]
repo = 'alx741/vim-stylishask'
hook_add = '''
let g:stylishask_on_save = 0
'''
on_if = 'index(["haskell"], &ft) >= 0 && !exists("g:vscode")'
[[plugins]]
repo = 'fatih/vim-go'
on_ft = ['go']
hook_post_source = 'GoInstallBinaries'
# rust
[[plugins]]
repo = 'rust-lang/rust.vim'
on_ft = ['rust']
# python
[[plugins]]
repo = 'python-mode/python-mode'
on_ft = ['python']
#[[plugins]]
# repo = 'zchee/deoplete-jedi'
# on_ft = ['python']
#[[plugins]]
# repo = 'davidhalter/jedi-vim'
# on_ft = ['python']
[[plugins]]
repo = 'manicmaniac/coconut.vim'
on_ft = ['python']
[[plugins]]
repo = 'alfredodeza/pytest.vim'
on_if = 'index(["python"], &ft) >= 0 && !exists("g:vscode")'
[[plugins]]
repo = 'idanarye/vim-vebugger'
on_if = 'index(["python"], &ft) >= 0 && !exists("g:vscode")'
# scala
[[plugins]]
repo = 'derekwyatt/vim-scala'
on_if = 'index(["scala"], &ft) >= 0 && !exists("g:vscode")'
# javascript
[[plugins]]
repo = 'pangloss/vim-javascript'
on_ft = ['typescript', 'javascript']
[[plugins]]
repo = 'MaxMEllon/vim-jsx-pretty'
on_ft = ['typescript', 'javascript']
# typescript
[[plugins]]
repo = 'leafgarland/typescript-vim'
on_ft = ['typescript', 'javascript']
#[[plugins]]
#repo = 'Quramy/tsuquyomi'
#on_ft = ['typescript', 'javascript']
[[plugins]]
repo = 'prettier/vim-prettier'
on_ft = ['typescript', 'javascript']
build = 'npm install'
# color and beauty
# [[plugins]]
# repo = 'tomasiser/vim-code-dark'
# [[plugins]]
# repo = 'romainl/Apprentice'
# [[plugins]]
# repo = 'chriskempson/base16-vim'
# [[plugins]]
# repo = 'fneu/breezy'
# [[plugins]]
# repo = 'romainl/Disciple'
# [[plugins]]
# repo = 'wimstefan/Lightning'
# [[plugins]]
# repo = 'NLKNguyen/papercolor-theme'
# [[plugins]]
# repo = 'flazz/vim-colorschemes'
[[plugins]]
repo = 'overcache/NeoSolarized'
hook_add = '''
let g:neosolarized_contrast = 'normal'
let g:neosolarized_visibility = 'normal'
let g:neosolarized_vertSplitBgTrans = 0
let g:neosolarized_bold = 1
let g:neosolarized_underline = 1
let g:neosolarized_italic = 1
set background=dark
colorscheme NeoSolarized
'''
# repo = 'reedes/vim-colors-pencil'
# [[plugins]]
# repo = 'whatyouhide/vim-gotham'
# [[plugins]]
# repo = 'noahfrederick/vim-hemisu'
# [[plugins]]
# repo = 'morhetz/gruvbox'
# toml
[[plugins]]
repo = 'https://github.com/cespare/vim-toml'
# unmanaged
[[plugins]]
name = 'L9'
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
rtp = 'L9'
[[plugins]]
name = 'ScrollColor'
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
rtp = 'ScrollColor'
[[plugins]]
name = 'bufonly'
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
rtp = 'bufonly'
on_if = '!exists("g:vscode")'
[[plugins]]
name = 'colorschemedgrade'
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
rtp = 'colorschemedegrade'
[[plugins]]
name = 'exheres-syntax'
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
rtp = 'exheres-syntax-20160115'
[[plugins]]
name = 'fontzoom'
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
rtp = 'fontzoom'
on_if = '!has("nvim")'
#[[plugins]]
#name = 'fuzzyfinder'
#repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
#rtp = 'fuzzyfinder'
#on_if = '!exists("g:vscode")'
[[plugins]]
name = 'log'
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
rtp = 'log'
on_if = '!exists("g:vscode")'
#[[plugins]]
#repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
#rtp = 'paredit'
#[[plugins]]
#repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
#rtp = 'tslime'
[[plugins]]
name = 'txtfmt'
repo = 'https://gogs.hasufell.de/hasufell/vim-unmanaged.git'
rtp = 'txtfmt'
on_if = '!exists("g:vscode")'
[[plugins]]
repo = 'williamboman/nvim-lsp-installer'
hook_add = '''
lua << EOF
require("nvim-lsp-installer").setup({
automatic_installation = false,
ui = {
icons = {
server_installed = "✓",
server_pending = "➜",
server_uninstalled = "✗"
}
}
})
EOF
'''
on_if = 'has("nvim") && !exists("g:vscode")'
lazy = true
depends = 'nvim-lspconfig'
[[plugins]]
repo = 'neovim/nvim-lspconfig'
hook_add = '''
" https://github.com/nvim-lua/diagnostic-nvim/issues/29#issuecomment-819344193
" https://github.com/neovim/neovim/issues/12389
function! Diagnostic_open()
if len(filter(nvim_tabpage_list_wins(0), {k,v->nvim_win_get_config(v).relative!=""})) <= 1
lua vim.diagnostic.open_float({focusable = false})
endif
endfunction
lua << EOF
local on_attach = function(client, bufnr)
vim.cmd('autocmd CursorHold * call Diagnostic_open()')
end
require('lspconfig').hls.setup{
cmd = { vim.fs.normalize('~/.ghcup/bin/haskell-language-server-wrapper'), '--lsp', '+RTS', '--nonmoving-gc', '-RTS' },
on_attach = on_attach,
settings = {
haskell = {
formattingProvider = "brittany",
plugin = {
["ghcide-hover-and-symbols"] = { globalOn = true },
["ghcide-code-actions-imports-exports"] = { globalOn = true },
["ghcide-code-actions-type-signatures"] = { globalOn = false },
["ghcide-code-actions-bindings"] = { globalOn = false },
["ghcide-code-actions-fill-holes"] = { globalOn = false },
["ghcide-completions"] = { globalOn = true },
["ghcide-type-lenses"] = { globalOn = false },
pragmas = { globalOn = false },
tactics = { globalOn = false },
rename = { globalOn = false },
retrie = { globalOn = false },
callHierarchy = { globalOn = true },
class = { globalOn = false },
haddockComments = { globalOn = true },
eval = { globalOn = false },
importLens = { globalOn = false },
qualifyImportNames = { globalOn = true },
refineImports = { globalOn = true },
moduleName = { globalOn = false },
hlint = { globalOn = true },
splice = { globalOn = false },
alternateNumberFormat = { globalOn = false },
selectionRange = { globalOn = false },
changeTypeSignature = { globalOn = false }
}
}
}
}
require('lspconfig').tsserver.setup{ on_attach = on_attach }
require('lspconfig').bashls.setup{ on_attach = on_attach }
require('lspconfig').jsonls.setup{ on_attach = on_attach }
require('lspconfig').vimls.setup{ on_attach = on_attach }
require('lspconfig').dockerls.setup{ on_attach = on_attach }
require('lspconfig').powershell_es.setup{ on_attach = on_attach, bundle_path = 'c:/w/PowerShellEditorServices', shell = 'pwsh' }
EOF
'''
on_if = 'has("nvim") && !exists("g:vscode")'
lazy = true
[[plugins]]
repo = 'kyazdani42/nvim-web-devicons'
on_if = 'has("nvim") && !exists("g:vscode")'
lazy = false
[[plugins]]
repo = 'folke/trouble.nvim'
hook_add = '''
lua << EOF
require("trouble").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
action_keys = { -- key mappings for actions in the trouble list
jump_close = {"t"}, -- jump to the diagnostic and close the list
}
}
EOF
'''
lazy = false
on_if = 'has("nvim") && !exists("g:vscode")'
[[plugins]]
repo = 'nvim-telescope/telescope-file-browser.nvim'
lazy = false
on_if = 'has("nvim") && !exists("g:vscode")'
[[plugins]]
repo = 'nvim-telescope/telescope.nvim'
lazy = false
on_if = 'has("nvim") && !exists("g:vscode")'
hook_add = '''
command! -nargs=* Rag :lua require('telescope.builtin').live_grep({ default_text = vim.fn.expand(<f-args>) })
'''
[[plugins]]
repo = 'ldelossa/litee.nvim'
lazy = false
hook_add = '''
lua << EOF
require("litee.lib").setup({})
EOF
'''
on_if = 'has("nvim") && !exists("g:vscode")'
[[plugins]]
repo = 'hasufell/litee-calltree.nvim'
lazy = false
hook_add = '''
lua << EOF
require("litee.calltree").setup({
map_resize_keys = false
})
EOF
'''
on_if = 'has("nvim") && !exists("g:vscode")'

View File

@ -0,0 +1,570 @@
"=============================================================================
" Copyright (c) 2009-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if exists('g:loaded_autoload_l9')
finish
endif
let g:loaded_autoload_l9 = 1
" }}}1
"=============================================================================
" COMPATIBILITY TEST {{{1
"
let s:L9_VERSION_CURRENT = 101
let s:L9_VERSION_PASSABLE = 101
" returns true if given version is compatible.
function l9#isCompatible(ver)
return
endfunction
let s:VERSION_FACTOR = str2float('0.01')
" returns false if the caller script should finish.
" a:vimVersion: if 0, don't check vim version
" a:l9Version: same rule as v:version
function l9#guardScriptLoading(path, vimVersion, l9Version, exprs)
let loadedVarName = 'g:loaded_' . substitute(a:path, '\W', '_', 'g')
if exists(loadedVarName)
return 0
elseif a:vimVersion > 0 && a:vimVersion > v:version
echoerr a:path . ' requires Vim version ' . string(a:vimVersion * s:VERSION_FACTOR)
return 0
elseif a:l9Version > 0 && (a:l9Version > s:L9_VERSION_CURRENT ||
\ a:l9Version < s:L9_VERSION_PASSABLE)
echoerr a:path . ' requires L9 library version ' . string(a:l9Version * s:VERSION_FACTOR)
return 0
endif
for expr in a:exprs
if !eval(expr)
echoerr a:path . ' requires: ' . expr
return 0
endif
endfor
let {loadedVarName} = 1
return 1
endfunction
"
function l9#getVersion()
return s:L9_VERSION_CURRENT
endfunction
" }}}1
"=============================================================================
" LIST {{{1
" Removes duplicates (unstable)
" This function doesn't change the list of argument.
function l9#unique(items)
let sorted = sort(a:items)
if len(sorted) < 2
return sorted
endif
let last = remove(sorted, 0)
let result = [last]
for item in sorted
if item != last
call add(result, item)
let last = item
endif
endfor
return result
endfunction
" Removes duplicates (stable)
" This function doesn't change the list of argument.
function l9#uniqueStably(items)
let result = []
for item in a:items
if count(result, item, &ignorecase) == 0
call add(result, item)
endif
endfor
return result
endfunction
" [ [0], [1,2], [3] ] -> [ 0, 1, 2, 3 ]
" This function doesn't change the list of argument.
function l9#concat(items)
let result = []
for l in a:items
let result += l
endfor
return result
endfunction
" [ [0,1,2], [3,4], [5,6,7,8] ] -> [ [0,3,5],[1,4,6] ]
" This function doesn't change the list of argument.
function l9#zip(items)
let result = []
for i in range(min(map(copy(a:items), 'len(v:val)')))
call add(result, map(copy(a:items), 'v:val[i]'))
endfor
return result
endfunction
" filter() with the maximum number of items
" This function doesn't change the list of argument.
function l9#filterWithLimit(items, expr, limit)
if a:limit <= 0
return filter(copy(a:items), a:expr)
endif
let result = []
let stride = a:limit * 3 / 2 " x1.5
for i in range(0, len(a:items) - 1, stride)
let result += filter(a:items[i : i + stride - 1], a:expr)
if len(result) >= a:limit
return remove(result, 0, a:limit - 1)
endif
endfor
return result
endfunction
" Removes if a:expr is evaluated as non-zero and returns removed items.
" This function change the list of argument.
function l9#removeIf(items, expr)
let removed = filter(copy(a:items), a:expr)
call filter(a:items, '!( ' . a:expr . ')')
return removed
endfunction
" }}}1
"=============================================================================
" NUMERIC {{{1
" }}}1
"=============================================================================
" STRING {{{1
" Snips a:str and add a:mask if the length of a:str is more than a:len
function l9#snipHead(str, len, mask)
if a:len >= len(a:str)
return a:str
elseif a:len <= len(a:mask)
return a:mask
endif
return a:mask . a:str[-a:len + len(a:mask):]
endfunction
" Snips a:str and add a:mask if the length of a:str is more than a:len
function l9#snipTail(str, len, mask)
if a:len >= len(a:str)
return a:str
elseif a:len <= len(a:mask)
return a:mask
endif
return a:str[:a:len - 1 - len(a:mask)] . a:mask
endfunction
" Snips a:str and add a:mask if the length of a:str is more than a:len
function l9#snipMid(str, len, mask)
if a:len >= len(a:str)
return a:str
elseif a:len <= len(a:mask)
return a:mask
endif
let len_head = (a:len - len(a:mask)) / 2
let len_tail = a:len - len(a:mask) - len_head
return (len_head > 0 ? a:str[: len_head - 1] : '') . a:mask .
\ (len_tail > 0 ? a:str[-len_tail :] : '')
endfunction
"
function l9#hash224(str)
let a = 0x00000800 " shift 11 bit (if unsigned)
let b = 0x001fffff " extract 11 bit (if unsigned)
let nHash = 7
let hashes = repeat([0], nHash)
for i in range(len(a:str))
let iHash = i % nHash
let hashes[iHash] = hashes[iHash] * a + hashes[iHash] / b
let hashes[iHash] += char2nr(a:str[i])
endfor
return join(map(hashes, 'printf("%08x", v:val)'), '')
endfunction
" wildcard -> regexp
function l9#convertWildcardToRegexp(expr)
let re = escape(a:expr, '\')
for [pat, sub] in [ [ '*', '\\.\\*' ], [ '?', '\\.' ], [ '[', '\\[' ], ]
let re = substitute(re, pat, sub, 'g')
endfor
return '\V' . re
endfunction
" }}}1
"=============================================================================
" LINES {{{1
" Removes from the line matching with a:begin first to the line matching with
" a:end next and returns removed lines.
" If matching range is not found, returns []
function l9#removeLinesBetween(lines, begin, end)
for i in range(len(a:lines) - 1)
if a:lines[i] =~ a:begin
break
endif
endfor
for j in range(i + 1, len(a:lines) - 1)
if a:lines[j] =~ a:end
let g:l0 += [a:lines[i : j]]
return remove(a:lines, i, j)
endif
endfor
return []
endfunction
" }}}1
"=============================================================================
" PATH {{{1
" returns the path separator charactor.
function l9#getPathSeparator()
return (!&shellslash && (has('win32') || has('win64')) ? '\' : '/')
endfunction
" [ 'a', 'b/', '/c' ] -> 'a/b/c'
function l9#concatPaths(paths)
let result = ''
for p in a:paths
if empty(p)
continue
elseif empty(result)
let result = p
else
let result = substitute(result, '[/\\]$', '', '') . l9#getPathSeparator()
\ . substitute(p, '^[/\\]', '', '')
endif
endfor
return result
endfunction
" path: '/a/b/c/d', dir: '/a/b' => 'c/d'
function l9#modifyPathRelativeToDir(path, dir)
let pathFull = fnamemodify(a:path, ':p')
let dirFull = fnamemodify(a:dir, ':p')
if len(pathFull) < len(dirFull) || pathFull[:len(dirFull) - 1] !=# dirFull
return pathFull
endif
return pathFull[len(dirFull):]
endfunction
" }}}1
"=============================================================================
" FILE {{{1
" Almost same as readfile().
function l9#readFile(...)
let args = copy(a:000)
let args[0] = expand(args[0])
try
return call('readfile', args)
catch
endtry
return []
endfunction
" Almost same as writefile().
function l9#writeFile(...)
let args = copy(a:000)
let args[1] = expand(args[1])
let dir = fnamemodify(args[1], ':h')
try
if !isdirectory(dir)
call mkdir(dir, 'p')
endif
return call('writefile', args)
catch
endtry
return -1 " -1 is error code.
endfunction
" }}}1
"=============================================================================
" BUFFER {{{1
" :wall/:wall! wrapper. Useful for writing readonly buffers.
function l9#writeAll()
try
silent update " NOTE: avoiding a problem with a buftype=acwrite buffer.
silent wall
catch /^Vim/ " E45, E505
if l9#inputHl('Question', v:exception . "\nWrite readonly files? (Y/N) : ", 'Y') ==? 'y'
redraw
:wall!
endif
endtry
endfunction
" Loads given files with :edit command
function l9#loadFilesToBuffers(files)
for file in filter(copy(a:files), '!bufloaded(v:val)')
execute 'edit ' . fnameescape(file)
if !exists('bufNrFirst')
let bufNrFirst = bufnr('%')
endif
endfor
if exists('bufNrFirst')
execute bufNrFirst . 'buffer'
endif
endfunction
" Deletes all buffers except given files with :bdelete command
function l9#deleteAllBuffersExcept(files)
let bufNrExcepts = map(copy(a:files), 'bufnr("^" . v:val . "$")')
for bufNr in filter(range(1, bufnr('$')), 'bufloaded(v:val)')
if count(bufNrExcepts, bufNr) == 0
execute bufNr . 'bdelete'
endif
endfor
endfunction
" }}}1
"=============================================================================
" WINDOW {{{1
" move current window to next tabpage.
function l9#shiftWinNextTabpage()
if tabpagenr('$') < 2
return
endif
let bufnr = bufnr('%')
tabnext
execute bufnr . 'sbuffer'
tabprevious
if winnr('$') > 1
close
tabnext
else
close " if tabpage is closed, next tabpage will become current
endif
endfunction
" move current window to previous tabpage.
function l9#shiftWinPrevTabpage()
if tabpagenr('$') < 2
return
endif
let bufnr = bufnr('%')
tabprevious
execute bufnr . 'sbuffer'
tabnext
close
tabprevious
endfunction
" move to a window containing specified buffer.
" returns 0 if the buffer is not found.
function l9#moveToBufferWindowInCurrentTabpage(bufNr)
if bufnr('%') == a:bufNr
return 1
elseif count(tabpagebuflist(), a:bufNr) == 0
return 0
endif
execute bufwinnr(a:bufNr) . 'wincmd w'
return 1
endfunction
" returns 0 if the buffer is not found.
function s:moveToOtherTabpageOpeningBuffer(bufNr)
for tabNr in range(1, tabpagenr('$'))
if tabNr != tabpagenr() && count(tabpagebuflist(tabNr), a:bufNr) > 0
execute 'tabnext ' . tabNr
return 1
endif
endfor
return 0
endfunction
" move to a window containing specified buffer.
" returns 0 if the buffer is not found.
function l9#moveToBufferWindowInOtherTabpage(bufNr)
if !s:moveToOtherTabpageOpeningBuffer(a:bufNr)
return 0
endif
return l9#moveToBufferWindowInCurrentTabpage(a:bufNr)
endfunction
" }}}1
"=============================================================================
" COMMAND LINE {{{1
" echo/echomsg with highlighting.
function l9#echoHl(hl, msg, prefix, addingHistory)
let echoCmd = (a:addingHistory ? 'echomsg' : 'echo')
execute "echohl " . a:hl
try
for l in (type(a:msg) == type([]) ? a:msg : split(a:msg, "\n"))
execute echoCmd . ' a:prefix . l'
endfor
finally
echohl None
endtry
endfunction
" input() with highlighting.
" This function can take list as {completion} argument.
function l9#inputHl(hl, ...)
execute "echohl " . a:hl
try
let args = copy(a:000)
if len(args) > 2 && type(args[2]) == type([])
let s:candidatesForInputHl = args[2]
let args[2] = 'custom,l9#completeForInputHl'
endif
let s = call('input', args)
unlet! s:candidatesForInputHl
finally
echohl None
endtry
redraw " needed to show following echo to next line.
return s
endfunction
" only called by l9#inputHl() for completion.
function l9#completeForInputHl(lead, line, pos)
return join(s:candidatesForInputHl, "\n")
endfunction
" }}}1
"=============================================================================
" VISUAL MODE {{{1
" returns last selected text in Visual mode.
function l9#getSelectedText()
let reg_ = [@", getregtype('"')]
let regA = [@a, getregtype('a')]
if mode() =~# "[vV\<C-v>]"
silent normal! "aygv
else
let pos = getpos('.')
silent normal! gv"ay
call setpos('.', pos)
endif
let text = @a
call setreg('"', reg_[0], reg_[1])
call setreg('a', regA[0], regA[1])
return text
endfunction
" }}}1
"=============================================================================
" EVAL {{{1
" loads given text as Vim script with :source command
function l9#loadScript(text)
let lines = (type(a:text) == type([]) ? a:text : split(a:text, "\n"))
let fname = tempname()
call writefile(lines, fname)
source `=fname`
call delete(fname)
endfunction
" }}}1
"=============================================================================
" VARIABLES {{{1
"
function l9#defineVariableDefault(name, default)
if !exists(a:name)
let {a:name} = a:default
endif
endfunction
" }}}1
"=============================================================================
" GREP {{{1
" Execute :vimgrep and opens the quickfix window if matches are found.
"
" a:pattern: search pattern. If ommitted, last search pattern (@/) is used.
" a:files: List of files
function l9#grepFiles(pattern, files)
let target = join(map(a:files, 'escape(v:val, " ")'), ' ')
let pattern = (a:pattern[0] ==# '/' ? a:pattern[1:] : a:pattern)
let pattern = (empty(pattern) ? @/ : pattern)
try
execute printf('vimgrep/%s/j %s', pattern, target)
catch /^Vim/
call setqflist([])
endtry
call l9#quickfix#sort()
call l9#quickfix#openIfNotEmpty(1, 0)
endfunction
" Execute :vimgrep for buffers using l9#grepFiles()
" See also: :L9GrepBuffer :L9GrepBufferAll
function l9#grepBuffers(pattern, bufNrs)
let files = map(filter(a:bufNrs, 'bufloaded(v:val)'), 'bufname(v:val)')
call l9#grepFiles(a:pattern, files)
endfunction
" }}}1
"=============================================================================
" SIGN {{{1
" Highlights lines using :sign define and :sign place.
"
" a:linehl, a:text, a:texthl: See |signs|. Ignored if empty string.
" a:locations: List of [{buffer number}, {line number}] for highlighting
function l9#placeSign(linehl, text, texthl, locations)
let argLinehl = (empty(a:linehl) ? '' : 'linehl=' . a:linehl)
let argText = (empty(a:text) ? '' : 'text=' . a:text)
let argTexthl = (empty(a:texthl) ? '' : 'texthl=' . a:texthl)
let name = 'l9--' . a:linehl . '--' . a:text . '--' . a:texthl
execute printf('sign define %s linehl=%s text=%s texthl=%s',
\ name, a:linehl, a:text, a:texthl)
for [bufNr, lnum] in a:locations
execute printf('sign place 1 line=%d name=%s buffer=%d', lnum, name, bufNr)
endfor
endfunction
" }}}1
"=============================================================================
" NOTIFY EXTERNALLY {{{1
" Notify a message using an external program.
" Currently supports Balloonly, Screen, and Tmux.
function l9#notifyExternally(msg)
return l9#notifyBalloonly(a:msg)
\ || l9#notifyScreen(a:msg)
\ || l9#notifyTmux(a:msg)
endfunction
"
function l9#notifyBalloonly(msg)
if !(has('win32') || has('win64')) || !executable(g:l9_balloonly)
return 0
endif
execute 'silent !start ' . shellescape(g:l9_balloonly) . ' 4000 "l9" ' . shellescape(a:msg)
return 1
endfunction
"
function l9#notifyScreen(msg)
if !has('unix') || has('gui_running') || $WINDOW !~ '\d' || !executable('screen')
return 0
endif
call system('screen -X wall ' . shellescape('l9: ' . a:msg))
return 1
endfunction
"
function l9#notifyTmux(msg)
if !has('unix') || has('gui_running') || empty($TMUX) || !executable('tmux')
return 0
endif
call system('tmux display-message ' . shellescape('l9: ' . a:msg))
return 1
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,92 @@
#!/usr/bin/env python
from __future__ import with_statement
import vim
import os
import subprocess
import threading
import Queue
class Asyncer:
def __init__(self):
self._workers = {}
def execute(self, var_key, var_command, var_cwd, var_input, var_appends):
key = vim.eval(var_key)
command = vim.eval(var_command)
cwd = vim.eval(var_cwd)
input = vim.eval(var_input)
appends = vim.eval(var_appends)
if key not in self._workers:
self._workers[key] = Worker()
self._workers[key].start()
self._workers[key].put(Executor(command, cwd, input, appends))
def print_output(self, var_key):
key = vim.eval(var_key)
if key not in self._workers:
return
for l in self._workers[key].copy_outputs():
print l,
def print_worker_keys(self):
for k in self._workers.keys():
print k
def print_active_worker_keys(self):
for k in self._workers.keys():
print k
class Worker(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self._queue = Queue.Queue()
self._lines = []
self._lock = threading.Lock()
def run(self):
while True:
self._queue.get().execute(self)
self._queue.task_done()
def put(self, executor):
self._queue.put(executor)
def clear_outputs(self):
with self._lock:
self._lines = []
def record_output(self, line):
with self._lock:
self._lines.append(line)
def copy_outputs(self):
with self._lock:
return self._lines[:]
class Executor:
def __init__(self, command, cwd, input, appends):
self._command = command
self._cwd = cwd
self._input = input
self._appends = appends
def execute(self, worker):
if not self._appends:
worker.clear_outputs()
os.chdir(self._cwd)
p = subprocess.Popen(self._command, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
p.stdin.write(self._input)
line = p.stdout.readline()
while line:
worker.record_output(line)
line = p.stdout.readline()

View File

@ -0,0 +1,67 @@
"=============================================================================
" Copyright (C) 2009-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, ['has("python")'])
finish
endif
" }}}1
"=============================================================================
" ASYNC EXECUTE {{{1
"
function s:checkKey(key)
if a:key =~ '\n' || a:key !~ '\S'
throw "Asyncer: Invalid key: " . a:key
endif
endfunction
"
function l9#async#execute(key, cmd, cwd, input, appends)
call s:checkKey(a:key)
python asyncer.execute('a:key', 'a:cmd', 'a:cwd', 'a:input', 'a:appends')
endfunction
"
function l9#async#read(key)
call s:checkKey(a:key)
redir => result
silent python asyncer.print_output('a:key')
redir END
" NOTE: "\n" is somehow inserted by redir.
return (result[0] ==# "\n" ? result[1:] : result)
endfunction
"
function l9#async#listWorkers()
redir => result
silent python asyncer.print_worker_keys()
redir END
return split(result, "\n")
endfunction
"
function l9#async#listActiveWorkers()
redir => result
silent python asyncer.print_active_worker_keys()
redir END
return split(result, "\n")
endfunction
" }}}1
"=============================================================================
" INITIALIZATION {{{1
let s:ASYNC_PY_PATH = fnamemodify(expand('<sfile>:p:h'), ':p') . 'async.py'
pyfile `=s:ASYNC_PY_PATH`
python asyncer = Asyncer()
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,107 @@
"=============================================================================
" Copyright (C) 2009-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" QUICKFIX {{{1
" Returns non-zero if quickfix window is opened.
function l9#quickfix#isWindowOpened()
return count(map(range(1, winnr('$')), 'getwinvar(v:val, "&buftype")'), 'quickfix') > 0
endfunction
" Opens quickfix window if quickfix is not empty, and echo the number of errors.
"
" a:onlyRecognized: if non-zero, opens only if quickfix has recognized errors.
" a:holdCursor: if non-zero, the cursor won't move to quickfix window.
function l9#quickfix#openIfNotEmpty(onlyRecognized, holdCursor)
let numErrors = len(filter(getqflist(), 'v:val.valid'))
let numOthers = len(getqflist()) - numErrors
if numErrors > 0 || (!a:onlyRecognized && numOthers > 0)
copen
if a:holdCursor
wincmd p
endif
else
cclose
endif
redraw
if numOthers > 0
echo printf('Quickfix: %d(+%d)', numErrors, numOthers)
else
echo printf('Quickfix: %d', numErrors)
endif
endfunction
" Toggles Quickfix window
function l9#quickfix#toggleWindow()
if l9#quickfix#isWindowOpened()
cclose
else
call l9#quickfix#openIfNotEmpty(0, 0)
endif
endfunction
" Creates quickfix list form given lines and opens the quickfix window if
" errors exists.
"
" a:lines:
" a:jump: if non-zero, jump to the first error.
function l9#quickfix#setMakeResult(lines)
cexpr a:lines
call l9#quickfix#openIfNotEmpty(0, 1)
endfunction
" Compares quickfix entries for sorting.
function l9#quickfix#compareEntries(e0, e1)
if a:e0.bufnr != a:e1.bufnr
let i0 = bufname(a:e0.bufnr)
let i1 = bufname(a:e1.bufnr)
elseif a:e0.lnum != a:e1.lnum
let i0 = a:e0.lnum
let i1 = a:e1.lnum
elseif a:e0.col != a:e1.col
let i0 = a:e0.col
let i1 = a:e1.col
else
return 0
endif
return (i0 > i1 ? +1 : -1)
endfunction
" Sorts quickfix
function l9#quickfix#sort()
call setqflist(sort(getqflist(), 'l9#quickfix#compareEntries'), 'r')
endfunction
" Highlights Quickfix lines by :sign.
" Inspired by errormarker plugin.
"
" You can customize the highlighting via L9ErrorLine and L9WarningLine
" highlight groups.
function l9#quickfix#placeSign()
let warnings = []
let errors = []
for e in filter(getqflist(), 'v:val.valid')
let warning = (e.type ==? 'w' || e.text =~? '^\s*warning:')
call add((warning ? warnings : errors), [e.bufnr, e.lnum])
endfor
sign unplace *
call l9#placeSign('L9WarningLine', '>>', '', warnings)
call l9#placeSign('L9ErrorLine', '>>', '', errors)
endfunction
highlight default L9ErrorLine ctermfg=white ctermbg=52 guibg=#5F0000
highlight default L9WarningLine ctermfg=white ctermbg=17 guibg=#00005F
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,112 @@
"=============================================================================
" Copyright (C) 2009-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" TEMPORARY BUFFER {{{1
" each key is a buffer name.
let s:dataMap = {}
"
function s:onBufDelete(bufname)
if exists('s:dataMap[a:bufname].listener.onClose')
call s:dataMap[a:bufname].listener.onClose(s:dataMap[a:bufname].written)
endif
if bufnr('%') == s:dataMap[a:bufname].bufNr && winnr('#') != 0
" if winnr('#') returns 0, "wincmd p" causes ringing the bell.
wincmd p
endif
endfunction
"
function s:onBufWriteCmd(bufname)
if !exists('s:dataMap[a:bufname].listener.onWrite') ||
\ s:dataMap[a:bufname].listener.onWrite(getline(1, '$'))
setlocal nomodified
let s:dataMap[a:bufname].written = 1
call l9#tempbuffer#close(a:bufname)
else
endif
endfunction
" a:bufname:
" a:height: Window height. If 0, default height is used.
" If less than 0, the window becomes full-screen.
" a:listener:
" a:listener.onClose(written)
function l9#tempbuffer#openScratch(bufname, filetype, lines, topleft, vertical, height, listener)
let openCmdPrefix = (a:topleft ? 'topleft ' : '')
\ . (a:vertical ? 'vertical ' : '')
\ . (a:height > 0 ? a:height : '')
if !exists('s:dataMap[a:bufname]') || !bufexists(s:dataMap[a:bufname].bufNr)
execute openCmdPrefix . 'new'
else
call l9#tempbuffer#close(a:bufname)
execute openCmdPrefix . 'split'
execute 'silent ' . s:dataMap[a:bufname].bufNr . 'buffer'
endif
if a:height < 0
only
endif
setlocal buflisted noswapfile bufhidden=delete modifiable noreadonly buftype=nofile
let &l:filetype = a:filetype
silent file `=a:bufname`
call setline(1, a:lines)
setlocal nomodified
augroup L9TempBuffer
autocmd! * <buffer>
execute printf('autocmd BufDelete <buffer> call s:onBufDelete (%s)', string(a:bufname))
execute printf('autocmd BufWriteCmd <buffer> nested call s:onBufWriteCmd(%s)', string(a:bufname))
augroup END
let s:dataMap[a:bufname] = {
\ 'bufNr': bufnr('%'),
\ 'written': 0,
\ 'listener': a:listener,
\ }
endfunction
"
function l9#tempbuffer#openReadOnly(bufname, filetype, lines, topleft, vertical, height, listener)
call l9#tempbuffer#openScratch(a:bufname, a:filetype, a:lines, a:topleft, a:vertical, a:height, a:listener)
setlocal nomodifiable readonly
endfunction
" a:listener:
" a:listener.onClose(written)
" a:listener.onWrite(lines)
function l9#tempbuffer#openWritable(bufname, filetype, lines, topleft, vertical, height, listener)
call l9#tempbuffer#openScratch(a:bufname, a:filetype, a:lines, a:topleft, a:vertical, a:height, a:listener)
setlocal buftype=acwrite
endfunction
" makes specified temp buffer current.
function l9#tempbuffer#moveTo(bufname)
return l9#moveToBufferWindowInCurrentTabpage(s:dataMap[a:bufname].bufNr) ||
\ l9#moveToBufferWindowInOtherTabpage(s:dataMap[a:bufname].bufNr)
endfunction
"
function l9#tempbuffer#close(bufname)
if !l9#tempbuffer#isOpen(a:bufname)
return
endif
execute printf('%dbdelete!', s:dataMap[a:bufname].bufNr)
endfunction
"
function l9#tempbuffer#isOpen(bufname)
return exists('s:dataMap[a:bufname]') && bufloaded(s:dataMap[a:bufname].bufNr)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,60 @@
"=============================================================================
" Copyright (C) 2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" TEMPORARY VARIABLES {{{1
"
let s:origMap = {}
" set temporary variables
function l9#tempvariables#set(group, name, value)
if !exists('s:origMap[a:group]')
let s:origMap[a:group] = {}
endif
if !exists('s:origMap[a:group][a:name]')
let s:origMap[a:group][a:name] = eval(a:name)
endif
execute 'let ' . a:name . ' = a:value'
endfunction
" set temporary variables
function l9#tempvariables#setList(group, variables)
for [name, value] in a:variables
call l9#tempvariables#set(a:group, name, value)
unlet value " to avoid E706
endfor
endfunction
" get temporary variables
function l9#tempvariables#getList(group)
if !exists('s:origMap[a:group]')
return []
endif
return map(keys(s:origMap[a:group]), '[v:val, eval(v:val)]')
endfunction
" restore original variables and clean up.
function l9#tempvariables#end(group)
if !exists('s:origMap[a:group]')
return
endif
for [name, value] in items(s:origMap[a:group])
execute 'let ' . name . ' = value'
unlet value " to avoid E706
endfor
unlet s:origMap[a:group]
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,55 @@
*l9.txt* Vimスクリプトライブラリ
Copyright (c) 2009-2010 Takeshi NISHIDA
l9 *l9*
概要 |l9-introduction|
インストール |l9-installation|
使い方 |l9-usage|
CHANGELOG |l9-changelog|
あばうと |l9-about|
==============================================================================
概要 *l9-introduction*
l9はVimスクリプトの関数やコマンドを提供するライブラリです。
==============================================================================
インストール *l9-installation*
ZIPファイルをランタイムディレクトリに展開します。
以下のようにファイルが配置されるはずです。
>
<your runtime directory>/plugin/l9.vim
<your runtime directory>/doc/l9.txt
...
<
もしランタイムディレクトリが多数のプラグインでごちゃごちゃになるのが嫌なら、各
プラグインを個別のディレクトリに配置し、そのディレクトリのパスを 'runtimepath'
に追加してください。アンインストールも楽になります。
その後、ヘルプを有効にするためにタグファイルを更新してください。詳しくは
|add-local-help|を参照してください。
==============================================================================
使い方 *l9-usage*
ソースコードを参照してください。
==============================================================================
あばうと *l9-about* *l9-contact* *l9-author*
作者: Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com>
ライセンス: MIT Licence
URL: http://www.vim.org/scripts/script.php?script_id=3252
http://bitbucket.org/ns9tks/vim-l9/
バグや要望など ~
こちらへどうぞ: http://bitbucket.org/ns9tks/vim-l9/issues/
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,73 @@
*l9.txt* Vim-script library
Copyright (c) 2009-2010 Takeshi NISHIDA
l9 *l9*
INTRODUCTION |l9-introduction|
INSTALLATION |l9-installation|
USAGE |l9-usage|
CHANGELOG |l9-changelog|
ABOUT |l9-about|
==============================================================================
INTRODUCTION *l9-introduction*
l9 is a Vim-script library, which provides some utility functions and commands
for programming in Vim.
==============================================================================
INSTALLATION *l9-installation*
Put all files into your runtime directory. If you have the zip file, extract
it to your runtime directory.
You should place the files as follows:
>
<your runtime directory>/plugin/l9.vim
<your runtime directory>/doc/l9.txt
...
<
If you are disgusted to make your runtime directory confused with a lot of
plugins, put each of the plugins into a directory individually and just add
the directory path to 'runtimepath'. It's easy to uninstall the plugin.
Then update your help tags files to enable fuzzyfinder help. See
|add-local-help| for details.
==============================================================================
USAGE *l9-usage*
See source code.
==============================================================================
CHANGELOG *l9-changelog*
1.1:
- Added l9#zip()
- Added l9#tempvariables#getList()
- Changed l9#guardScriptLoading()
- Removed l9#tempvariables#swap()
1.0.1:
- Fixed a bug that floating point numbers weren't evaluated correctly and
caused errors on some non-English locales.
1.0:
- First release.
==============================================================================
ABOUT *l9-about* *l9-contact* *l9-author*
Author: Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com>
Licence: MIT Licence
URL: http://www.vim.org/scripts/script.php?script_id=3252
http://bitbucket.org/ns9tks/vim-l9/
Bugs/Issues/Suggestions/Improvements ~
Please submit to http://bitbucket.org/ns9tks/vim-l9/issues/ .
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,9 @@
l9 l9.txt /*l9*
l9-about l9.txt /*l9-about*
l9-author l9.txt /*l9-author*
l9-changelog l9.txt /*l9-changelog*
l9-contact l9.txt /*l9-contact*
l9-installation l9.txt /*l9-installation*
l9-introduction l9.txt /*l9-introduction*
l9-usage l9.txt /*l9-usage*
l9.txt l9.txt /*l9.txt*

View File

@ -0,0 +1,9 @@
!_TAG_FILE_ENCODING utf-8 //
l9 l9.jax /*l9*
l9-about l9.jax /*l9-about*
l9-author l9.jax /*l9-author*
l9-contact l9.jax /*l9-contact*
l9-installation l9.jax /*l9-installation*
l9-introduction l9.jax /*l9-introduction*
l9-usage l9.jax /*l9-usage*
l9.txt l9.jax /*l9.txt*

View File

@ -0,0 +1,108 @@
"=============================================================================
" Copyright (C) 2009-2010 Takeshi NISHIDA
"
" GetLatestVimScripts: 3252 1 :AutoInstall: L9
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 0, [])
finish
endif
" }}}1
"=============================================================================
" OPTIONS: {{{1
call l9#defineVariableDefault('g:l9_balloonly', 'balloonly.exe')
" }}}1
"=============================================================================
" ASSERTION: {{{1
" This command has effect only if $L9_DEBUG is non-zero.
" Used as follows:
" L9Assert a:i > 0
" This command can't interpret script-local variables directly.
" NG: L9Assert s:a == 1
" OK: execute 'L9Assert ' . s:a . ' == 1'
"
if $L9_DEBUG
command -nargs=* L9Assert call eval((<args>) ? 0 : s:handleFailedAssersion(<q-args>))
function s:handleFailedAssersion(expr)
echoerr '[L9Assert] Assersion failure: ' . a:expr
if input('[L9Assert] Continue? (Y/N) ', 'Y') !=? 'Y'
throw 'L9Assert ' . a:expr
endif
endfunction
else
command -nargs=* L9Assert :
endif
" }}}1
"=============================================================================
" TIMER: {{{1
" These commands have effect only if $L9_TIMER is non-zero.
" Used as follows:
" L9Timer foo
" ... (1)
" L9Timer bar
" ... (2)
" L9TimerStop
" ...
" L9TimerDump <- shows each elapsed time of (1) and (2)
"
if $L9_TIMER
command -nargs=1 L9Timer call s:timerBegin(<q-args>)
command -nargs=0 L9TimerStop call s:timerStop()
command -nargs=0 L9TimerDump call s:timerDump()
let s:timerData = []
let s:timerTagMaxLen = 0
function s:timerBegin(tag)
L9TimerStop
let s:timerCurrent = {'tag': strftime('%c ') . a:tag . ' ', 'time': reltime()}
let s:timerTagMaxLen = max([len(s:timerCurrent.tag), s:timerTagMaxLen])
endfunction
function s:timerStop()
if !exists('s:timerCurrent')
return
endif
let s:timerCurrent.time = reltimestr(reltime(s:timerCurrent.time))
call add(s:timerData, s:timerCurrent)
unlet s:timerCurrent
endfunction
function s:timerDump()
L9TimerStop
let lines = map(s:timerData, 'v:val.tag . repeat(" ", s:timerTagMaxLen - len(v:val.tag)) . v:val.time')
call l9#tempbuffer#openReadOnly('[l9-timer]', '', lines, 0, 0, 0, {})
let s:timerData = []
let s:timerTagMaxLen = 0
endfunction
else
command -nargs=1 L9Timer :
command -nargs=0 L9TimerStop :
command -nargs=0 L9TimerDump :
endif
" }}}1
"=============================================================================
" GREP BUFFER: {{{1
" Grep for current buffer by l9#grepBuffers()
" Used as :L9GrepBuffer/pattern
command -nargs=? L9GrepBuffer call l9#grepBuffers(<q-args>, [bufnr('%')])
" Grep for all buffers by l9#grepBuffers()
" Used as :L9GrepBufferAll/pattern
command -nargs=? L9GrepBufferAll call l9#grepBuffers(<q-args>, range(1, bufnr('$')))
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,457 @@
" ScrollColors.vim - Colorsheme Scroller, Chooser, and Browser
"
" Author and maintainer: Yakov Lerner <iler_ml@fastmail.fm>
" Last Change: 2006-07-18
"
" SYNOPSIS:
" This is colorscheme Scroller/Chooser/Browser.
" With this plugin, you walk through installed
" colorschemes using arrow keys.
"
" SHORT USAGE DESCRIPTION:
" Drop ScrollColors.vim into your plugin directory.
" Type :SCROLL
" Use arrow keys to walk through colorschemes, ? for help, Esc to exit.
"
" DETAILED DESCRIPTION:
" 1. source ScrollColors.vim " or drop ScrollColors.vim into
" " your ~/.vim/plugins directory
" 2. Type :SCROLL
" 3. Use arrows to scroll thgough colorschemes.
" 4. When done, press Esc to exit. You will be prompted
" wether to
"
" You can download 140 colorschemes pack from:
" http://www.vim.org/scripts/script.php?script_id=625
" Having 140 installed colorschemes is in no way prerequisite for
" ScrollColors. But with ScrollColors you can preview 140 colorschemes
" in couple of minutes.
"
" CUSTOM KEY MAPPINGS:
" You can map two keys of your choice to NextColor and PrevColor actions.
" Choose pair of shortcut keys (for example <F2> and <f3>, or \n and \p)
" and map them as follows:
" map <silent><F3> :NEXTCOLOR<cr>
" map <silent><F2> :PREVCOLOR<cr>
if exists("g:scroll_colors") | finish | endif
let g:scroll_colors = 1
command! COLORSCROLL :call s:ColorScroller()
command! SCROLLCOLOR :call s:ColorScroller()
command! NEXTCOLOR :call s:NextColorscheme()
command! PREVCOLOR :call s:PrevColorscheme()
" Example of convenience mappings:
"map <silent><F3> :NEXTCOLOR<cr>
"map <silent><F2> :PREVCOLOR<cr>
"map <silent><F4> :SCROLLCOLOR<cr>
function! s:ScrollerHelp()
echo " "
echohl Title
echo "Color Scroller Help:"
echo "--------------------"
echohl NONE
echo "Arrows - change colorscheme"
echo "Esc,q,Enter - exit"
echo "h,j,k,l - change colorscheme"
echo "0,g - go to first colorscheme"
echo "$,G - go to last colorscheme"
echo "L - list colorschemes"
echo "PgUp,PgDown - jump by 10 colorschemes"
echo "# - go to colorscheme by index (1-N)"
echo "R - refresh colorscheme list"
echo "? - this help text"
echohl MoreMsg
echo "Press any key to continue"
echohl NONE
call getchar()
endfu
function! s:Align(s, width)
if strlen(a:s) >= a:width
return a:s." "
else
let pad=" "
let res=a:s
while strlen(res) < a:width
let chunk = (a:width - strlen(res) > strlen(pad) ? strlen(pad) : a:width - strlen(res))
let res = res . strpart(pad,0,chunk)
endw
return res
endif
endfu
function! s:ListColors()
echo " "
let list=s:GetColorschemesList()
let width=18
let pos=0
while list != ''
let str=substitute(list,"\n.*","","")
let list=substitute(list,"[^\n]*\n", "", "")
let aligned = s:Align(str, width)
if( pos+strlen(aligned)+1 >= &columns)
echo " "
let pos=0
endif
echon aligned
let pos = pos + strlen(aligned)
endw
echo "Press any key to continue"
call getchar()
endfu
function! s:CurrentColor()
return exists("g:colors_name") ? g:colors_name : ""
endfu
function! s:SetColor(name)
exe "color ".a:name
" if we do not assign a:colors_name, then
" bad things happen if file colors/name.vim conmtains wrong assignment inside.
" Wrong assignment inside happens when file was copied but
" assignment inside not fixed.
" Such wrong assignment cause up erratic switches unless
" we do our own assignment to g:colors_name
let g:colors_name=a:name
endfu
function! s:JumpByIndex(list,total)
let ans = input("Enter colorscheme number (1-".a:total.") : ")
let index = (ans<=0? 1 : 1+(ans-1)%a:total )
let name = s:EntryByIndex(a:list, index )
call s:SetColor(name)
endfu
function! s:JumpByIndex2(list,total, index)
let mod = (a:index <= 0? 1 : 1+(a:index-1)%a:total )
let name = s:EntryByIndex(a:list, mod )
call s:SetColor(name)
endfu
function! s:ExitDialog(old, action)
let ans = 0
if a:old == s:CurrentColor()
let ans=1
elseif a:action == ''
let ans = confirm("Keep this colorscheme ?", "&Yes\n&No\n&Cancel")
elseif action == 'keep'
ans = 1
elseif action == 'revert'
ans = 2
endif
if ans == 1 || ans==0
" exit, keep colorscheme
let msg = (a:old == s:CurrentColor() ? '' : "(original: '".a:old."')")
call s:FinalEcho( msg )
elseif ans == 2
" exit, revert colorscheme
call s:SetColor(a:old)
call s:FinalEcho('original color restored')
elseif ans == 3
" do not exit, continue browsing
return -1
endif
endfu
function! s:ColorScroller()
let old = s:CurrentColor()
let list = s:GetColorschemesList()
let total = s:CountEntries(list)
let loop=0
if line("$") == 1 && getline(1) == "" && bufnr('$')==1
" if buffer is empty, open something
echo "We will open sample text with syntax highlighting."
echo "Watch for the guiding prompt in the bottom line."
echo "When the text will open, use Arrow keys to switch colorschemes, ? for help."
echo " "
echo "Press any key to continue"
call getchar()
:e $VIMRUNTIME/syntax/abc.vim
:setlocal ro
syntax on
redraw
endif
if !exists("g:syntax_on")
syntax on
redraw
endif
while 1
redraw
let index = s:FindIndex(list, s:CurrentColor())
echo "["
echohl Search
echon s:CurrentColor()
echohl NONE
if loop == 0
echon "] ColorScroller: "
echohl MoreMsg | echon "Arrows" | echohl NONE | echon "-next/prev; "
echohl MoreMsg | echon "Esc" | echohl NONE | echon "-exit; "
echohl MoreMsg | echon "?" | echohl NONE | echon "-help > "
else
echon "] "
echon " " . index . "/" . total . " "
echon s:Align("", 12-strlen(s:CurrentColor()))
echon "> ColorScroll > "
echon "Arrows,Esc,? > "
endif
let key = getchar()
let c = nr2char(key)
if key == "\<Left>" || key == "\<Up>" || c ==# 'h' || c ==# 'j'
call s:PrevSilent()
elseif key == "\<Down>" || key == "\<Right>" || c ==# 'l' || c==# 'k' || c==# ' '
call s:NextSilent()
elseif c==# 'g' || c=='0' || c=='1'
call s:SetColor( s:GetFirstColors() )
elseif c=='$' || c==# 'G'
call s:SetColor( s:GetLastColors() )
elseif c ==# 'L'
" command 'L' list colors
call s:ListColors()
elseif c=='Z' || c=='z' || key == 13 || c=='q' || c=='Q' || c==':' || key == 27
if s:ExitDialog(old, '') != -1
break
endif
elseif key == 12 " c=="\<C-L>"
redraw
elseif c == '#'
call s:JumpByIndex(list,total)
elseif key == "\<PageDown>"
call s:JumpByIndex2(list,total, (index-10>=1 ? index-10 : index-10+total))
elseif key == "\<PageUp>"
call s:JumpByIndex2(list,total, index+10)
elseif c == '?'
call s:ScrollerHelp()
elseif c == 'R'
call s:RefreshColorschemesList()
echo "Colorscheme list refreshed. Press any key to continue."
call getchar()
else
call s:ScrollerHelp()
endif
let loop = loop + 1
endw
endfu
" Get 1-based index of 'entry' in \n-separated 'list'
function! s:FindIndex(list,entry)
" we assume entry has no special chars or we could escape() it
let str = substitute("\n" . a:list . "\n", "\n" . a:entry . "\n.*$", "", "")
return 1 + s:CountEntries(str)
endfu
" Get list element by 1-based index
function! s:EntryByIndex(list,index)
let k=1
let tail=a:list
while tail != '' && k < a:index
let tail=substitute(tail, "^[^\n]*\n", "", "")
let k = k + 1
endw
let tail = substitute(tail, "\n.*$", "", "")
return tail
endfu
function! s:MakeWellFormedList(list)
" make sure last \n is present
let str=a:list."\n"
" make sure leading \n are not present
let str=substitute(str, "^\n*", "", "")
" make sure entries are separated by exactly one \n
let str=substitute(str, "\n\\+", "\n", "g")
return str
endfu
function! s:CountEntries(list)
let str = s:MakeWellFormedList(a:list)
let str=substitute(str, "[^\n]\\+\n", ".", "g")
return strlen(str)
endfu
function! s:RemoveDuplicates(list)
let sep = "\n"
let res = s:MakeWellFormedList(a:list . "\n")
let beg = 0
while beg < strlen(res)
let end = matchend(res, sep, beg)
let str1 = strpart( res, beg, end - beg)
let res = strpart(res,0,end) . substitute("\n".strpart(res,end), "\n".str1,"\n","g")
let res = substitute(res, "\n\\+", "\n", "g")
let beg = end
endw
return res
endfu
if v:version >= 700
" s:SortVar(): sort components of string @var separated
" by delimiter @sep, and returns the sorted string.
" For example, s:SortVar("c\nb\na", "\n") returns "a\nb\nc\n"
function! s:SortVar(list, sep)
let list = split( a:list, a:sep )
let sorted = sort(list)
let result = join( sorted, "\n" )
return result . "\n"
endfun
endif
if v:version < 700
" s:SortVar(): sort components of string @var separated
" by delimiter @sep, and returns the sorted string.
" For example, s:SortVar("c\nb\na", "\n") returns "a\nb\nc\n"
function! s:SortVar(list, sep)
let res=s:MakeWellFormedList(a:list . "\n")
while 1
let disorder=0
let index1=0
let len=strlen(res)
while 1
let index2=matchend(res, a:sep, index1)
if index2 == -1 || index2>=len
break
endif
let index3=matchend(res, a:sep, index2)
if index3 == -1
let index3=len
endif
let str1=strpart(res, index1, index2-index1)
let str2=strpart(res, index2, index3-index2)
if str1 > str2
let disorder=1
" swap str1 and str2 in res
let res=strpart(res,0,index1).str2.str1.strpart(res,index3)
let index1=index1 + strlen(str2)
else
let index1=index1 + strlen(str1)
endif
endw
if !disorder
break
endif
endw
return res
endfu
endif " v:version < 700
let s:list = ""
function! s:GetColorschemesList()
if s:list == ""
let s:list = s:RefreshColorschemesList()
endif
return s:list
endfunction
function! s:RefreshColorschemesList()
let x=globpath(&rtp, "colors/*.vim")
let y=substitute(x."\n","\\(^\\|\n\\)[^\n]*[/\\\\]", "\n", "g")
let z=substitute(y,"\\.vim\n", "\n", "g")
let sorted = s:SortVar(z, "\n")
let s:list = s:RemoveDuplicates(sorted)
return s:list
endfun
function! s:GetFirstColors()
let list=s:GetColorschemesList()
let trim=substitute(list, "^\n\\+", "", "")
return substitute(trim, "\n.*", "", "")
endfu
function! s:GetLastColors()
let list=s:GetColorschemesList()
let trim=substitute(list, "\n\\+$", "", "")
return substitute(trim, "^.*\n", "", "")
endfu
function! s:FinalEcho(suffix)
let list = s:GetColorschemesList()
let total = s:CountEntries(list)
let index = s:FindIndex(list, s:CurrentColor())
redraw
echon "["
echohl Search
echon s:CurrentColor()
echohl NONE
echon "] colorscheme #".index ." of " . total.". "
echon a:suffix
endfu
function! s:GetNextColor(color)
let list=s:GetColorschemesList()
if ("\n".list) =~ ("\n".s:CurrentColor()."\n")
let next=substitute("\n".list."\n", ".*\n".a:color."\n", "", "")
let next = substitute(next, "\n.*", "", "")
return next=='' ? s:GetFirstColors() : next
else
return s:GetFirstColors()
endif
endfu
function! s:GetPrevColor(color)
let list=s:GetColorschemesList()
if ("\n".list) =~ ("\n".a:color."\n")
let prev=substitute("\n".list."\n", "\n".a:color."\n.*", "", "")
let prev=substitute(prev, "^.*\n", "", "")
return prev=='' ? s:GetLastColors() : prev
else
return s:GetLastColors()
endif
endfu
function! s:NextSilent()
let old = s:CurrentColor()
let next = s:GetNextColor(s:CurrentColor())
call s:SetColor( next )
endfu
function! s:PrevSilent()
let old = s:CurrentColor()
let prev = s:GetPrevColor(s:CurrentColor())
call s:SetColor( prev )
endfu
function! s:NextColorscheme()
let old = s:CurrentColor()
let next = s:GetNextColor(s:CurrentColor())
call s:SetColor( next )
redraw
call s:FinalEcho('previous: '.old)
endfun
function! s:PrevColorscheme()
let old = s:CurrentColor()
let prev = s:GetPrevColor(s:CurrentColor())
call s:SetColor( prev )
redraw
call s:FinalEcho('previous: '.old)
endfun
command! CN :call s:NextColorscheme()
command! CP :call s:PrevColorscheme()
map \n :CN<cr>
map \p :CP<cr>
map \c :echo g:colors_name<cr>
" 2006-07-18 fixed bug with Align() -> s:Align() (affected L command)
" 2006-07-18 added colorlist cache (s:list)
" 2006-07-18 added R key to refresh colorlist
" 2006-07-19 for vim7, sort using builtin sort() (bubblesort is slow)

View File

@ -0,0 +1,69 @@
" BufOnly.vim - Delete all the buffers except the current/named buffer.
"
" Copyright November 2003 by Christian J. Robinson <infynity@onewest.net>
"
" Distributed under the terms of the Vim license. See ":help license".
"
" Usage:
"
" :Bonly / :BOnly / :Bufonly / :BufOnly [buffer]
"
" Without any arguments the current buffer is kept. With an argument the
" buffer name/number supplied is kept.
command! -nargs=? -complete=buffer -bang Bonly
\ :call BufOnly('<args>', '<bang>')
command! -nargs=? -complete=buffer -bang BOnly
\ :call BufOnly('<args>', '<bang>')
command! -nargs=? -complete=buffer -bang Bufonly
\ :call BufOnly('<args>', '<bang>')
command! -nargs=? -complete=buffer -bang BufOnly
\ :call BufOnly('<args>', '<bang>')
function! BufOnly(buffer, bang)
if a:buffer == ''
" No buffer provided, use the current buffer.
let buffer = bufnr('%')
elseif (a:buffer + 0) > 0
" A buffer number was provided.
let buffer = bufnr(a:buffer + 0)
else
" A buffer name was provided.
let buffer = bufnr(a:buffer)
endif
if buffer == -1
echohl ErrorMsg
echomsg "No matching buffer for" a:buffer
echohl None
return
endif
let last_buffer = bufnr('$')
let delete_count = 0
let n = 1
while n <= last_buffer
if n != buffer && buflisted(n)
if a:bang == '' && getbufvar(n, '&modified')
echohl ErrorMsg
echomsg 'No write since last change for buffer'
\ n '(add ! to override)'
echohl None
else
silent exe 'bdel' . a:bang . ' ' . n
if ! buflisted(n)
let delete_count = delete_count+1
endif
endif
endif
let n = n+1
endwhile
if delete_count == 1
echomsg delete_count "buffer deleted"
elseif delete_count > 1
echomsg delete_count "buffers deleted"
endif
endfunction

View File

@ -0,0 +1,764 @@
function! colorschemedegradelib#RGB()
let rv = {}
let rv["snow"] = "#FFFAFA"
let rv["ghost_white"] = "#F8F8FF"
let rv["ghostwhite"] = "#F8F8FF"
let rv["white_smoke"] = "#F5F5F5"
let rv["whitesmoke"] = "#F5F5F5"
let rv["gainsboro"] = "#DCDCDC"
let rv["floral_white"] = "#FFFAF0"
let rv["floralwhite"] = "#FFFAF0"
let rv["old_lace"] = "#FDF5E6"
let rv["oldlace"] = "#FDF5E6"
let rv["linen"] = "#FAF0E6"
let rv["antique_white"] = "#FAEBD7"
let rv["antiquewhite"] = "#FAEBD7"
let rv["papaya_whip"] = "#FFEFD5"
let rv["papayawhip"] = "#FFEFD5"
let rv["blanched_almond"] = "#FFEBCD"
let rv["blanchedalmond"] = "#FFEBCD"
let rv["bisque"] = "#FFE4C4"
let rv["peach_puff"] = "#FFDAB9"
let rv["peachpuff"] = "#FFDAB9"
let rv["navajo_white"] = "#FFDEAD"
let rv["navajowhite"] = "#FFDEAD"
let rv["moccasin"] = "#FFE4B5"
let rv["cornsilk"] = "#FFF8DC"
let rv["ivory"] = "#FFFFF0"
let rv["lemon_chiffon"] = "#FFFACD"
let rv["lemonchiffon"] = "#FFFACD"
let rv["seashell"] = "#FFF5EE"
let rv["honeydew"] = "#F0FFF0"
let rv["mint_cream"] = "#F5FFFA"
let rv["mintcream"] = "#F5FFFA"
let rv["azure"] = "#F0FFFF"
let rv["alice_blue"] = "#F0F8FF"
let rv["aliceblue"] = "#F0F8FF"
let rv["lavender"] = "#E6E6FA"
let rv["lavender_blush"] = "#FFF0F5"
let rv["lavenderblush"] = "#FFF0F5"
let rv["misty_rose"] = "#FFE4E1"
let rv["mistyrose"] = "#FFE4E1"
let rv["white"] = "#FFFFFF"
let rv["black"] = "#000000"
let rv["dark_slate_gray"] = "#2F4F4F"
let rv["darkslategray"] = "#2F4F4F"
let rv["dark_slate_grey"] = "#2F4F4F"
let rv["darkslategrey"] = "#2F4F4F"
let rv["dim_gray"] = "#696969"
let rv["dimgray"] = "#696969"
let rv["dim_grey"] = "#696969"
let rv["dimgrey"] = "#696969"
let rv["slate_gray"] = "#708090"
let rv["slategray"] = "#708090"
let rv["slate_grey"] = "#708090"
let rv["slategrey"] = "#708090"
let rv["light_slate_gray"] = "#778899"
let rv["lightslategray"] = "#778899"
let rv["light_slate_grey"] = "#778899"
let rv["lightslategrey"] = "#778899"
let rv["gray"] = "#BEBEBE"
let rv["grey"] = "#BEBEBE"
let rv["light_grey"] = "#D3D3D3"
let rv["lightgrey"] = "#D3D3D3"
let rv["light_gray"] = "#D3D3D3"
let rv["lightgray"] = "#D3D3D3"
let rv["midnight_blue"] = "#191970"
let rv["midnightblue"] = "#191970"
let rv["navy"] = "#000080"
let rv["navy_blue"] = "#000080"
let rv["navyblue"] = "#000080"
let rv["cornflower_blue"] = "#6495ED"
let rv["cornflowerblue"] = "#6495ED"
let rv["dark_slate_blue"] = "#483D8B"
let rv["darkslateblue"] = "#483D8B"
let rv["slate_blue"] = "#6A5ACD"
let rv["slateblue"] = "#6A5ACD"
let rv["medium_slate_blue"] = "#7B68EE"
let rv["mediumslateblue"] = "#7B68EE"
let rv["light_slate_blue"] = "#8470FF"
let rv["lightslateblue"] = "#8470FF"
let rv["medium_blue"] = "#0000CD"
let rv["mediumblue"] = "#0000CD"
let rv["royal_blue"] = "#4169E1"
let rv["royalblue"] = "#4169E1"
let rv["blue"] = "#0000FF"
let rv["dodger_blue"] = "#1E90FF"
let rv["dodgerblue"] = "#1E90FF"
let rv["deep_sky_blue"] = "#00BFFF"
let rv["deepskyblue"] = "#00BFFF"
let rv["sky_blue"] = "#87CEEB"
let rv["skyblue"] = "#87CEEB"
let rv["light_sky_blue"] = "#87CEFA"
let rv["lightskyblue"] = "#87CEFA"
let rv["steel_blue"] = "#4682B4"
let rv["steelblue"] = "#4682B4"
let rv["light_steel_blue"] = "#B0C4DE"
let rv["lightsteelblue"] = "#B0C4DE"
let rv["light_blue"] = "#ADD8E6"
let rv["lightblue"] = "#ADD8E6"
let rv["powder_blue"] = "#B0E0E6"
let rv["powderblue"] = "#B0E0E6"
let rv["pale_turquoise"] = "#AFEEEE"
let rv["paleturquoise"] = "#AFEEEE"
let rv["dark_turquoise"] = "#00CED1"
let rv["darkturquoise"] = "#00CED1"
let rv["medium_turquoise"] = "#48D1CC"
let rv["mediumturquoise"] = "#48D1CC"
let rv["turquoise"] = "#40E0D0"
let rv["cyan"] = "#00FFFF"
let rv["light_cyan"] = "#E0FFFF"
let rv["lightcyan"] = "#E0FFFF"
let rv["cadet_blue"] = "#5F9EA0"
let rv["cadetblue"] = "#5F9EA0"
let rv["medium_aquamarine"] = "#66CDAA"
let rv["mediumaquamarine"] = "#66CDAA"
let rv["aquamarine"] = "#7FFFD4"
let rv["dark_green"] = "#006400"
let rv["darkgreen"] = "#006400"
let rv["dark_olive_green"] = "#556B2F"
let rv["darkolivegreen"] = "#556B2F"
let rv["dark_sea_green"] = "#8FBC8F"
let rv["darkseagreen"] = "#8FBC8F"
let rv["sea_green"] = "#2E8B57"
let rv["seagreen"] = "#2E8B57"
let rv["medium_sea_green"] = "#3CB371"
let rv["mediumseagreen"] = "#3CB371"
let rv["light_sea_green"] = "#20B2AA"
let rv["lightseagreen"] = "#20B2AA"
let rv["pale_green"] = "#98FB98"
let rv["palegreen"] = "#98FB98"
let rv["spring_green"] = "#00FF7F"
let rv["springgreen"] = "#00FF7F"
let rv["lawn_green"] = "#7CFC00"
let rv["lawngreen"] = "#7CFC00"
let rv["green"] = "#00FF00"
let rv["chartreuse"] = "#7FFF00"
let rv["medium_spring_green"] = "#00FA9A"
let rv["mediumspringgreen"] = "#00FA9A"
let rv["green_yellow"] = "#ADFF2F"
let rv["greenyellow"] = "#ADFF2F"
let rv["lime_green"] = "#32CD32"
let rv["limegreen"] = "#32CD32"
let rv["yellow_green"] = "#9ACD32"
let rv["yellowgreen"] = "#9ACD32"
let rv["forest_green"] = "#228B22"
let rv["forestgreen"] = "#228B22"
let rv["olive_drab"] = "#6B8E23"
let rv["olivedrab"] = "#6B8E23"
let rv["dark_khaki"] = "#BDB76B"
let rv["darkkhaki"] = "#BDB76B"
let rv["khaki"] = "#F0E68C"
let rv["pale_goldenrod"] = "#EEE8AA"
let rv["palegoldenrod"] = "#EEE8AA"
let rv["light_goldenrod_yellow"] = "#FAFAD2"
let rv["lightgoldenrodyellow"] = "#FAFAD2"
let rv["light_yellow"] = "#FFFFE0"
let rv["lightyellow"] = "#FFFFE0"
let rv["yellow"] = "#FFFF00"
let rv["gold"] = "#FFD700"
let rv["light_goldenrod"] = "#EEDD82"
let rv["lightgoldenrod"] = "#EEDD82"
let rv["goldenrod"] = "#DAA520"
let rv["dark_goldenrod"] = "#B8860B"
let rv["darkgoldenrod"] = "#B8860B"
let rv["rosy_brown"] = "#BC8F8F"
let rv["rosybrown"] = "#BC8F8F"
let rv["indian_red"] = "#CD5C5C"
let rv["indianred"] = "#CD5C5C"
let rv["saddle_brown"] = "#8B4513"
let rv["saddlebrown"] = "#8B4513"
let rv["sienna"] = "#A0522D"
let rv["peru"] = "#CD853F"
let rv["burlywood"] = "#DEB887"
let rv["beige"] = "#F5F5DC"
let rv["wheat"] = "#F5DEB3"
let rv["sandy_brown"] = "#F4A460"
let rv["sandybrown"] = "#F4A460"
let rv["tan"] = "#D2B48C"
let rv["chocolate"] = "#D2691E"
let rv["firebrick"] = "#B22222"
let rv["brown"] = "#A52A2A"
let rv["dark_salmon"] = "#E9967A"
let rv["darksalmon"] = "#E9967A"
let rv["salmon"] = "#FA8072"
let rv["light_salmon"] = "#FFA07A"
let rv["lightsalmon"] = "#FFA07A"
let rv["orange"] = "#FFA500"
let rv["dark_orange"] = "#FF8C00"
let rv["darkorange"] = "#FF8C00"
let rv["coral"] = "#FF7F50"
let rv["light_coral"] = "#F08080"
let rv["lightcoral"] = "#F08080"
let rv["tomato"] = "#FF6347"
let rv["orange_red"] = "#FF4500"
let rv["orangered"] = "#FF4500"
let rv["red"] = "#FF0000"
let rv["hot_pink"] = "#FF69B4"
let rv["hotpink"] = "#FF69B4"
let rv["deep_pink"] = "#FF1493"
let rv["deeppink"] = "#FF1493"
let rv["pink"] = "#FFC0CB"
let rv["light_pink"] = "#FFB6C1"
let rv["lightpink"] = "#FFB6C1"
let rv["pale_violet_red"] = "#DB7093"
let rv["palevioletred"] = "#DB7093"
let rv["maroon"] = "#B03060"
let rv["medium_violet_red"] = "#C71585"
let rv["mediumvioletred"] = "#C71585"
let rv["violet_red"] = "#D02090"
let rv["violetred"] = "#D02090"
let rv["magenta"] = "#FF00FF"
let rv["violet"] = "#EE82EE"
let rv["plum"] = "#DDA0DD"
let rv["orchid"] = "#DA70D6"
let rv["medium_orchid"] = "#BA55D3"
let rv["mediumorchid"] = "#BA55D3"
let rv["dark_orchid"] = "#9932CC"
let rv["darkorchid"] = "#9932CC"
let rv["dark_violet"] = "#9400D3"
let rv["darkviolet"] = "#9400D3"
let rv["blue_violet"] = "#8A2BE2"
let rv["blueviolet"] = "#8A2BE2"
let rv["purple"] = "#A020F0"
let rv["medium_purple"] = "#9370DB"
let rv["mediumpurple"] = "#9370DB"
let rv["thistle"] = "#D8BFD8"
let rv["snow1"] = "#FFFAFA"
let rv["snow2"] = "#EEE9E9"
let rv["snow3"] = "#CDC9C9"
let rv["snow4"] = "#8B8989"
let rv["seashell1"] = "#FFF5EE"
let rv["seashell2"] = "#EEE5DE"
let rv["seashell3"] = "#CDC5BF"
let rv["seashell4"] = "#8B8682"
let rv["antiquewhite1"] = "#FFEFDB"
let rv["antiquewhite2"] = "#EEDFCC"
let rv["antiquewhite3"] = "#CDC0B0"
let rv["antiquewhite4"] = "#8B8378"
let rv["bisque1"] = "#FFE4C4"
let rv["bisque2"] = "#EED5B7"
let rv["bisque3"] = "#CDB79E"
let rv["bisque4"] = "#8B7D6B"
let rv["peachpuff1"] = "#FFDAB9"
let rv["peachpuff2"] = "#EECBAD"
let rv["peachpuff3"] = "#CDAF95"
let rv["peachpuff4"] = "#8B7765"
let rv["navajowhite1"] = "#FFDEAD"
let rv["navajowhite2"] = "#EECFA1"
let rv["navajowhite3"] = "#CDB38B"
let rv["navajowhite4"] = "#8B795E"
let rv["lemonchiffon1"] = "#FFFACD"
let rv["lemonchiffon2"] = "#EEE9BF"
let rv["lemonchiffon3"] = "#CDC9A5"
let rv["lemonchiffon4"] = "#8B8970"
let rv["cornsilk1"] = "#FFF8DC"
let rv["cornsilk2"] = "#EEE8CD"
let rv["cornsilk3"] = "#CDC8B1"
let rv["cornsilk4"] = "#8B8878"
let rv["ivory1"] = "#FFFFF0"
let rv["ivory2"] = "#EEEEE0"
let rv["ivory3"] = "#CDCDC1"
let rv["ivory4"] = "#8B8B83"
let rv["honeydew1"] = "#F0FFF0"
let rv["honeydew2"] = "#E0EEE0"
let rv["honeydew3"] = "#C1CDC1"
let rv["honeydew4"] = "#838B83"
let rv["lavenderblush1"] = "#FFF0F5"
let rv["lavenderblush2"] = "#EEE0E5"
let rv["lavenderblush3"] = "#CDC1C5"
let rv["lavenderblush4"] = "#8B8386"
let rv["mistyrose1"] = "#FFE4E1"
let rv["mistyrose2"] = "#EED5D2"
let rv["mistyrose3"] = "#CDB7B5"
let rv["mistyrose4"] = "#8B7D7B"
let rv["azure1"] = "#F0FFFF"
let rv["azure2"] = "#E0EEEE"
let rv["azure3"] = "#C1CDCD"
let rv["azure4"] = "#838B8B"
let rv["slateblue1"] = "#836FFF"
let rv["slateblue2"] = "#7A67EE"
let rv["slateblue3"] = "#6959CD"
let rv["slateblue4"] = "#473C8B"
let rv["royalblue1"] = "#4876FF"
let rv["royalblue2"] = "#436EEE"
let rv["royalblue3"] = "#3A5FCD"
let rv["royalblue4"] = "#27408B"
let rv["blue1"] = "#0000FF"
let rv["blue2"] = "#0000EE"
let rv["blue3"] = "#0000CD"
let rv["blue4"] = "#00008B"
let rv["dodgerblue1"] = "#1E90FF"
let rv["dodgerblue2"] = "#1C86EE"
let rv["dodgerblue3"] = "#1874CD"
let rv["dodgerblue4"] = "#104E8B"
let rv["steelblue1"] = "#63B8FF"
let rv["steelblue2"] = "#5CACEE"
let rv["steelblue3"] = "#4F94CD"
let rv["steelblue4"] = "#36648B"
let rv["deepskyblue1"] = "#00BFFF"
let rv["deepskyblue2"] = "#00B2EE"
let rv["deepskyblue3"] = "#009ACD"
let rv["deepskyblue4"] = "#00688B"
let rv["skyblue1"] = "#87CEFF"
let rv["skyblue2"] = "#7EC0EE"
let rv["skyblue3"] = "#6CA6CD"
let rv["skyblue4"] = "#4A708B"
let rv["lightskyblue1"] = "#B0E2FF"
let rv["lightskyblue2"] = "#A4D3EE"
let rv["lightskyblue3"] = "#8DB6CD"
let rv["lightskyblue4"] = "#607B8B"
let rv["slategray1"] = "#C6E2FF"
let rv["slategray2"] = "#B9D3EE"
let rv["slategray3"] = "#9FB6CD"
let rv["slategray4"] = "#6C7B8B"
let rv["lightsteelblue1"] = "#CAE1FF"
let rv["lightsteelblue2"] = "#BCD2EE"
let rv["lightsteelblue3"] = "#A2B5CD"
let rv["lightsteelblue4"] = "#6E7B8B"
let rv["lightblue1"] = "#BFEFFF"
let rv["lightblue2"] = "#B2DFEE"
let rv["lightblue3"] = "#9AC0CD"
let rv["lightblue4"] = "#68838B"
let rv["lightcyan1"] = "#E0FFFF"
let rv["lightcyan2"] = "#D1EEEE"
let rv["lightcyan3"] = "#B4CDCD"
let rv["lightcyan4"] = "#7A8B8B"
let rv["paleturquoise1"] = "#BBFFFF"
let rv["paleturquoise2"] = "#AEEEEE"
let rv["paleturquoise3"] = "#96CDCD"
let rv["paleturquoise4"] = "#668B8B"
let rv["cadetblue1"] = "#98F5FF"
let rv["cadetblue2"] = "#8EE5EE"
let rv["cadetblue3"] = "#7AC5CD"
let rv["cadetblue4"] = "#53868B"
let rv["turquoise1"] = "#00F5FF"
let rv["turquoise2"] = "#00E5EE"
let rv["turquoise3"] = "#00C5CD"
let rv["turquoise4"] = "#00868B"
let rv["cyan1"] = "#00FFFF"
let rv["cyan2"] = "#00EEEE"
let rv["cyan3"] = "#00CDCD"
let rv["cyan4"] = "#008B8B"
let rv["darkslategray1"] = "#97FFFF"
let rv["darkslategray2"] = "#8DEEEE"
let rv["darkslategray3"] = "#79CDCD"
let rv["darkslategray4"] = "#528B8B"
let rv["aquamarine1"] = "#7FFFD4"
let rv["aquamarine2"] = "#76EEC6"
let rv["aquamarine3"] = "#66CDAA"
let rv["aquamarine4"] = "#458B74"
let rv["darkseagreen1"] = "#C1FFC1"
let rv["darkseagreen2"] = "#B4EEB4"
let rv["darkseagreen3"] = "#9BCD9B"
let rv["darkseagreen4"] = "#698B69"
let rv["seagreen1"] = "#54FF9F"
let rv["seagreen2"] = "#4EEE94"
let rv["seagreen3"] = "#43CD80"
let rv["seagreen4"] = "#2E8B57"
let rv["palegreen1"] = "#9AFF9A"
let rv["palegreen2"] = "#90EE90"
let rv["palegreen3"] = "#7CCD7C"
let rv["palegreen4"] = "#548B54"
let rv["springgreen1"] = "#00FF7F"
let rv["springgreen2"] = "#00EE76"
let rv["springgreen3"] = "#00CD66"
let rv["springgreen4"] = "#008B45"
let rv["green1"] = "#00FF00"
let rv["green2"] = "#00EE00"
let rv["green3"] = "#00CD00"
let rv["green4"] = "#008B00"
let rv["chartreuse1"] = "#7FFF00"
let rv["chartreuse2"] = "#76EE00"
let rv["chartreuse3"] = "#66CD00"
let rv["chartreuse4"] = "#458B00"
let rv["olivedrab1"] = "#C0FF3E"
let rv["olivedrab2"] = "#B3EE3A"
let rv["olivedrab3"] = "#9ACD32"
let rv["olivedrab4"] = "#698B22"
let rv["darkolivegreen1"] = "#CAFF70"
let rv["darkolivegreen2"] = "#BCEE68"
let rv["darkolivegreen3"] = "#A2CD5A"
let rv["darkolivegreen4"] = "#6E8B3D"
let rv["khaki1"] = "#FFF68F"
let rv["khaki2"] = "#EEE685"
let rv["khaki3"] = "#CDC673"
let rv["khaki4"] = "#8B864E"
let rv["lightgoldenrod1"] = "#FFEC8B"
let rv["lightgoldenrod2"] = "#EEDC82"
let rv["lightgoldenrod3"] = "#CDBE70"
let rv["lightgoldenrod4"] = "#8B814C"
let rv["lightyellow1"] = "#FFFFE0"
let rv["lightyellow2"] = "#EEEED1"
let rv["lightyellow3"] = "#CDCDB4"
let rv["lightyellow4"] = "#8B8B7A"
let rv["yellow1"] = "#FFFF00"
let rv["yellow2"] = "#EEEE00"
let rv["yellow3"] = "#CDCD00"
let rv["yellow4"] = "#8B8B00"
let rv["gold1"] = "#FFD700"
let rv["gold2"] = "#EEC900"
let rv["gold3"] = "#CDAD00"
let rv["gold4"] = "#8B7500"
let rv["goldenrod1"] = "#FFC125"
let rv["goldenrod2"] = "#EEB422"
let rv["goldenrod3"] = "#CD9B1D"
let rv["goldenrod4"] = "#8B6914"
let rv["darkgoldenrod1"] = "#FFB90F"
let rv["darkgoldenrod2"] = "#EEAD0E"
let rv["darkgoldenrod3"] = "#CD950C"
let rv["darkgoldenrod4"] = "#8B6508"
let rv["rosybrown1"] = "#FFC1C1"
let rv["rosybrown2"] = "#EEB4B4"
let rv["rosybrown3"] = "#CD9B9B"
let rv["rosybrown4"] = "#8B6969"
let rv["indianred1"] = "#FF6A6A"
let rv["indianred2"] = "#EE6363"
let rv["indianred3"] = "#CD5555"
let rv["indianred4"] = "#8B3A3A"
let rv["sienna1"] = "#FF8247"
let rv["sienna2"] = "#EE7942"
let rv["sienna3"] = "#CD6839"
let rv["sienna4"] = "#8B4726"
let rv["burlywood1"] = "#FFD39B"
let rv["burlywood2"] = "#EEC591"
let rv["burlywood3"] = "#CDAA7D"
let rv["burlywood4"] = "#8B7355"
let rv["wheat1"] = "#FFE7BA"
let rv["wheat2"] = "#EED8AE"
let rv["wheat3"] = "#CDBA96"
let rv["wheat4"] = "#8B7E66"
let rv["tan1"] = "#FFA54F"
let rv["tan2"] = "#EE9A49"
let rv["tan3"] = "#CD853F"
let rv["tan4"] = "#8B5A2B"
let rv["chocolate1"] = "#FF7F24"
let rv["chocolate2"] = "#EE7621"
let rv["chocolate3"] = "#CD661D"
let rv["chocolate4"] = "#8B4513"
let rv["firebrick1"] = "#FF3030"
let rv["firebrick2"] = "#EE2C2C"
let rv["firebrick3"] = "#CD2626"
let rv["firebrick4"] = "#8B1A1A"
let rv["brown1"] = "#FF4040"
let rv["brown2"] = "#EE3B3B"
let rv["brown3"] = "#CD3333"
let rv["brown4"] = "#8B2323"
let rv["salmon1"] = "#FF8C69"
let rv["salmon2"] = "#EE8262"
let rv["salmon3"] = "#CD7054"
let rv["salmon4"] = "#8B4C39"
let rv["lightsalmon1"] = "#FFA07A"
let rv["lightsalmon2"] = "#EE9572"
let rv["lightsalmon3"] = "#CD8162"
let rv["lightsalmon4"] = "#8B5742"
let rv["orange1"] = "#FFA500"
let rv["orange2"] = "#EE9A00"
let rv["orange3"] = "#CD8500"
let rv["orange4"] = "#8B5A00"
let rv["darkorange1"] = "#FF7F00"
let rv["darkorange2"] = "#EE7600"
let rv["darkorange3"] = "#CD6600"
let rv["darkorange4"] = "#8B4500"
let rv["coral1"] = "#FF7256"
let rv["coral2"] = "#EE6A50"
let rv["coral3"] = "#CD5B45"
let rv["coral4"] = "#8B3E2F"
let rv["tomato1"] = "#FF6347"
let rv["tomato2"] = "#EE5C42"
let rv["tomato3"] = "#CD4F39"
let rv["tomato4"] = "#8B3626"
let rv["orangered1"] = "#FF4500"
let rv["orangered2"] = "#EE4000"
let rv["orangered3"] = "#CD3700"
let rv["orangered4"] = "#8B2500"
let rv["red1"] = "#FF0000"
let rv["red2"] = "#EE0000"
let rv["red3"] = "#CD0000"
let rv["red4"] = "#8B0000"
let rv["deeppink1"] = "#FF1493"
let rv["deeppink2"] = "#EE1289"
let rv["deeppink3"] = "#CD1076"
let rv["deeppink4"] = "#8B0A50"
let rv["hotpink1"] = "#FF6EB4"
let rv["hotpink2"] = "#EE6AA7"
let rv["hotpink3"] = "#CD6090"
let rv["hotpink4"] = "#8B3A62"
let rv["pink1"] = "#FFB5C5"
let rv["pink2"] = "#EEA9B8"
let rv["pink3"] = "#CD919E"
let rv["pink4"] = "#8B636C"
let rv["lightpink1"] = "#FFAEB9"
let rv["lightpink2"] = "#EEA2AD"
let rv["lightpink3"] = "#CD8C95"
let rv["lightpink4"] = "#8B5F65"
let rv["palevioletred1"] = "#FF82AB"
let rv["palevioletred2"] = "#EE799F"
let rv["palevioletred3"] = "#CD6889"
let rv["palevioletred4"] = "#8B475D"
let rv["maroon1"] = "#FF34B3"
let rv["maroon2"] = "#EE30A7"
let rv["maroon3"] = "#CD2990"
let rv["maroon4"] = "#8B1C62"
let rv["violetred1"] = "#FF3E96"
let rv["violetred2"] = "#EE3A8C"
let rv["violetred3"] = "#CD3278"
let rv["violetred4"] = "#8B2252"
let rv["magenta1"] = "#FF00FF"
let rv["magenta2"] = "#EE00EE"
let rv["magenta3"] = "#CD00CD"
let rv["magenta4"] = "#8B008B"
let rv["orchid1"] = "#FF83FA"
let rv["orchid2"] = "#EE7AE9"
let rv["orchid3"] = "#CD69C9"
let rv["orchid4"] = "#8B4789"
let rv["plum1"] = "#FFBBFF"
let rv["plum2"] = "#EEAEEE"
let rv["plum3"] = "#CD96CD"
let rv["plum4"] = "#8B668B"
let rv["mediumorchid1"] = "#E066FF"
let rv["mediumorchid2"] = "#D15FEE"
let rv["mediumorchid3"] = "#B452CD"
let rv["mediumorchid4"] = "#7A378B"
let rv["darkorchid1"] = "#BF3EFF"
let rv["darkorchid2"] = "#B23AEE"
let rv["darkorchid3"] = "#9A32CD"
let rv["darkorchid4"] = "#68228B"
let rv["purple1"] = "#9B30FF"
let rv["purple2"] = "#912CEE"
let rv["purple3"] = "#7D26CD"
let rv["purple4"] = "#551A8B"
let rv["mediumpurple1"] = "#AB82FF"
let rv["mediumpurple2"] = "#9F79EE"
let rv["mediumpurple3"] = "#8968CD"
let rv["mediumpurple4"] = "#5D478B"
let rv["thistle1"] = "#FFE1FF"
let rv["thistle2"] = "#EED2EE"
let rv["thistle3"] = "#CDB5CD"
let rv["thistle4"] = "#8B7B8B"
let rv["gray0"] = "#000000"
let rv["grey0"] = "#000000"
let rv["gray1"] = "#030303"
let rv["grey1"] = "#030303"
let rv["gray2"] = "#050505"
let rv["grey2"] = "#050505"
let rv["gray3"] = "#080808"
let rv["grey3"] = "#080808"
let rv["gray4"] = "#0A0A0A"
let rv["grey4"] = "#0A0A0A"
let rv["gray5"] = "#0D0D0D"
let rv["grey5"] = "#0D0D0D"
let rv["gray6"] = "#0F0F0F"
let rv["grey6"] = "#0F0F0F"
let rv["gray7"] = "#121212"
let rv["grey7"] = "#121212"
let rv["gray8"] = "#141414"
let rv["grey8"] = "#141414"
let rv["gray9"] = "#171717"
let rv["grey9"] = "#171717"
let rv["gray10"] = "#1A1A1A"
let rv["grey10"] = "#1A1A1A"
let rv["gray11"] = "#1C1C1C"
let rv["grey11"] = "#1C1C1C"
let rv["gray12"] = "#1F1F1F"
let rv["grey12"] = "#1F1F1F"
let rv["gray13"] = "#212121"
let rv["grey13"] = "#212121"
let rv["gray14"] = "#242424"
let rv["grey14"] = "#242424"
let rv["gray15"] = "#262626"
let rv["grey15"] = "#262626"
let rv["gray16"] = "#292929"
let rv["grey16"] = "#292929"
let rv["gray17"] = "#2B2B2B"
let rv["grey17"] = "#2B2B2B"
let rv["gray18"] = "#2E2E2E"
let rv["grey18"] = "#2E2E2E"
let rv["gray19"] = "#303030"
let rv["grey19"] = "#303030"
let rv["gray20"] = "#333333"
let rv["grey20"] = "#333333"
let rv["gray21"] = "#363636"
let rv["grey21"] = "#363636"
let rv["gray22"] = "#383838"
let rv["grey22"] = "#383838"
let rv["gray23"] = "#3B3B3B"
let rv["grey23"] = "#3B3B3B"
let rv["gray24"] = "#3D3D3D"
let rv["grey24"] = "#3D3D3D"
let rv["gray25"] = "#404040"
let rv["grey25"] = "#404040"
let rv["gray26"] = "#424242"
let rv["grey26"] = "#424242"
let rv["gray27"] = "#454545"
let rv["grey27"] = "#454545"
let rv["gray28"] = "#474747"
let rv["grey28"] = "#474747"
let rv["gray29"] = "#4A4A4A"
let rv["grey29"] = "#4A4A4A"
let rv["gray30"] = "#4D4D4D"
let rv["grey30"] = "#4D4D4D"
let rv["gray31"] = "#4F4F4F"
let rv["grey31"] = "#4F4F4F"
let rv["gray32"] = "#525252"
let rv["grey32"] = "#525252"
let rv["gray33"] = "#545454"
let rv["grey33"] = "#545454"
let rv["gray34"] = "#575757"
let rv["grey34"] = "#575757"
let rv["gray35"] = "#595959"
let rv["grey35"] = "#595959"
let rv["gray36"] = "#5C5C5C"
let rv["grey36"] = "#5C5C5C"
let rv["gray37"] = "#5E5E5E"
let rv["grey37"] = "#5E5E5E"
let rv["gray38"] = "#616161"
let rv["grey38"] = "#616161"
let rv["gray39"] = "#636363"
let rv["grey39"] = "#636363"
let rv["gray40"] = "#666666"
let rv["grey40"] = "#666666"
let rv["gray41"] = "#696969"
let rv["grey41"] = "#696969"
let rv["gray42"] = "#6B6B6B"
let rv["grey42"] = "#6B6B6B"
let rv["gray43"] = "#6E6E6E"
let rv["grey43"] = "#6E6E6E"
let rv["gray44"] = "#707070"
let rv["grey44"] = "#707070"
let rv["gray45"] = "#737373"
let rv["grey45"] = "#737373"
let rv["gray46"] = "#757575"
let rv["grey46"] = "#757575"
let rv["gray47"] = "#787878"
let rv["grey47"] = "#787878"
let rv["gray48"] = "#7A7A7A"
let rv["grey48"] = "#7A7A7A"
let rv["gray49"] = "#7D7D7D"
let rv["grey49"] = "#7D7D7D"
let rv["gray50"] = "#7F7F7F"
let rv["grey50"] = "#7F7F7F"
let rv["gray51"] = "#828282"
let rv["grey51"] = "#828282"
let rv["gray52"] = "#858585"
let rv["grey52"] = "#858585"
let rv["gray53"] = "#878787"
let rv["grey53"] = "#878787"
let rv["gray54"] = "#8A8A8A"
let rv["grey54"] = "#8A8A8A"
let rv["gray55"] = "#8C8C8C"
let rv["grey55"] = "#8C8C8C"
let rv["gray56"] = "#8F8F8F"
let rv["grey56"] = "#8F8F8F"
let rv["gray57"] = "#919191"
let rv["grey57"] = "#919191"
let rv["gray58"] = "#949494"
let rv["grey58"] = "#949494"
let rv["gray59"] = "#969696"
let rv["grey59"] = "#969696"
let rv["gray60"] = "#999999"
let rv["grey60"] = "#999999"
let rv["gray61"] = "#9C9C9C"
let rv["grey61"] = "#9C9C9C"
let rv["gray62"] = "#9E9E9E"
let rv["grey62"] = "#9E9E9E"
let rv["gray63"] = "#A1A1A1"
let rv["grey63"] = "#A1A1A1"
let rv["gray64"] = "#A3A3A3"
let rv["grey64"] = "#A3A3A3"
let rv["gray65"] = "#A6A6A6"
let rv["grey65"] = "#A6A6A6"
let rv["gray66"] = "#A8A8A8"
let rv["grey66"] = "#A8A8A8"
let rv["gray67"] = "#ABABAB"
let rv["grey67"] = "#ABABAB"
let rv["gray68"] = "#ADADAD"
let rv["grey68"] = "#ADADAD"
let rv["gray69"] = "#B0B0B0"
let rv["grey69"] = "#B0B0B0"
let rv["gray70"] = "#B3B3B3"
let rv["grey70"] = "#B3B3B3"
let rv["gray71"] = "#B5B5B5"
let rv["grey71"] = "#B5B5B5"
let rv["gray72"] = "#B8B8B8"
let rv["grey72"] = "#B8B8B8"
let rv["gray73"] = "#BABABA"
let rv["grey73"] = "#BABABA"
let rv["gray74"] = "#BDBDBD"
let rv["grey74"] = "#BDBDBD"
let rv["gray75"] = "#BFBFBF"
let rv["grey75"] = "#BFBFBF"
let rv["gray76"] = "#C2C2C2"
let rv["grey76"] = "#C2C2C2"
let rv["gray77"] = "#C4C4C4"
let rv["grey77"] = "#C4C4C4"
let rv["gray78"] = "#C7C7C7"
let rv["grey78"] = "#C7C7C7"
let rv["gray79"] = "#C9C9C9"
let rv["grey79"] = "#C9C9C9"
let rv["gray80"] = "#CCCCCC"
let rv["grey80"] = "#CCCCCC"
let rv["gray81"] = "#CFCFCF"
let rv["grey81"] = "#CFCFCF"
let rv["gray82"] = "#D1D1D1"
let rv["grey82"] = "#D1D1D1"
let rv["gray83"] = "#D4D4D4"
let rv["grey83"] = "#D4D4D4"
let rv["gray84"] = "#D6D6D6"
let rv["grey84"] = "#D6D6D6"
let rv["gray85"] = "#D9D9D9"
let rv["grey85"] = "#D9D9D9"
let rv["gray86"] = "#DBDBDB"
let rv["grey86"] = "#DBDBDB"
let rv["gray87"] = "#DEDEDE"
let rv["grey87"] = "#DEDEDE"
let rv["gray88"] = "#E0E0E0"
let rv["grey88"] = "#E0E0E0"
let rv["gray89"] = "#E3E3E3"
let rv["grey89"] = "#E3E3E3"
let rv["gray90"] = "#E5E5E5"
let rv["grey90"] = "#E5E5E5"
let rv["gray91"] = "#E8E8E8"
let rv["grey91"] = "#E8E8E8"
let rv["gray92"] = "#EBEBEB"
let rv["grey92"] = "#EBEBEB"
let rv["gray93"] = "#EDEDED"
let rv["grey93"] = "#EDEDED"
let rv["gray94"] = "#F0F0F0"
let rv["grey94"] = "#F0F0F0"
let rv["gray95"] = "#F2F2F2"
let rv["grey95"] = "#F2F2F2"
let rv["gray96"] = "#F5F5F5"
let rv["grey96"] = "#F5F5F5"
let rv["gray97"] = "#F7F7F7"
let rv["grey97"] = "#F7F7F7"
let rv["gray98"] = "#FAFAFA"
let rv["grey98"] = "#FAFAFA"
let rv["gray99"] = "#FCFCFC"
let rv["grey99"] = "#FCFCFC"
let rv["gray100"] = "#FFFFFF"
let rv["grey100"] = "#FFFFFF"
let rv["dark_grey"] = "#A9A9A9"
let rv["darkgrey"] = "#A9A9A9"
let rv["dark_gray"] = "#A9A9A9"
let rv["darkgray"] = "#A9A9A9"
let rv["dark_blue"] = "#00008B"
let rv["darkblue"] = "#00008B"
let rv["dark_cyan"] = "#008B8B"
let rv["darkcyan"] = "#008B8B"
let rv["dark_magenta"] = "#8B008B"
let rv["darkmagenta"] = "#8B008B"
let rv["dark_red"] = "#8B0000"
let rv["darkred"] = "#8B0000"
let rv["light_green"] = "#90EE90"
let rv["lightgreen"] = "#90EE90"
let rv["darkyellow"] = "#BBBB00"
let rv["dark_yellow"] = "#BBBB00"
let rv["lightred"] = "#FFA0A0"
let rv["light_red"] = "#FFA0A0"
let rv["lightmagenta"] = "#F0A0F0"
let rv["light_magenta"] = "#F0A0F0"
return rv
endfunction

View File

@ -0,0 +1,416 @@
" ColorschemeDegrade: Degrade gvim colorschemes to be suitable for a terminal
" Maintainer: Matthew Wozniski (mjw@drexel.edu)
" Date: Sun, 21 Oct 2007 21:04:33 -0400
" Version: 0.2
" History: TODO(History Link)
" Installation: Drop this script into ~/.vim/plugin.
" Whenever you change colorschemes using the :colorscheme command, this script
" will be executed. If you're running in 256 color terminal or an 88 color
" terminal, as reported by the command ":echo &t_Co" it will take the colors
" that the scheme specified for use in the gui and use an approximation
" algorithm to try to gracefully degrade them to the closest color available.
" If you are running in a gui or if t_Co is reported as less than 88 colors,
" no changes are made.
" Abort if running in vi-compatible mode or the user doesn't want or need us.
if &cp || has("gui_running") || ! has("gui") || exists('g:colorschemedegrade_loaded')
if &cp && &verbose
echomsg "Not loading ColorschemeDegrade in compatible mode."
endif
if has('gui_running') && &verbose
echomsg "Not loading ColorschemeDegrade in gui mode."
endif
if ! has('gui') && &verbose
echomsg "Unfortunately, ColorschemeDegrade needs gui support. Not loading."
endif
finish
endif
" A local copy of rgb.txt must be included, since I can't count on it being in
" a standard location. But, we won't load it unless we need it.
let s:rgb = {}
let g:colorschemedegrade_loaded = 1
let s:savecpo = &cpo
set cpo&vim
" Script-local variables {{{1
" Script-local variables defining the rgb vals on a 256-color cube {{{2
" Every possible 256-color cube color is made up of 3 rgb values, all out of
" this table.
let s:vals_greys_256 = [ 0, 8, 18, 28, 38,
\ 48, 58, 68, 78, 88,
\ 95, 98, 108, 118, 128,
\ 135, 138, 148, 158, 168,
\ 175, 178, 188, 198, 208,
\ 215, 218, 228, 238, 255 ]
" Many of those colors can only be used for a grey (r == g == b). This subset
" can be mix-and-matched.
let s:vals_color_256 = [ 0, 95, 135, 175, 215, 255 ]
" This table holds the midpoints between each of the possible grey values, as
" well as one extra element higher than all, to be used in the approximation
" algorithm.
let s:mids_greys_256 = [ 4, 13, 23, 33, 43,
\ 53, 63, 73, 83, 91,
\ 96, 103, 113, 123, 131,
\ 136, 143, 153, 163, 171,
\ 176, 183, 193, 203, 211,
\ 216, 223, 233, 246, 256 ]
" This table is the same, only for the non-grey midpoints.
let s:mids_color_256 = [ 48, 115, 155, 195, 235, 256 ]
" Script-local variables defining the rgb vals on a 88-color cube {{{2
" Every possible 88-color cube color is made up of 3 rgb values, all out of
" this table.
let s:vals_greys_88 = [ 0, 46, 92, 115, 139, 162,
\ 185, 205, 208, 231, 255 ]
" Many of those colors can only be used for a grey (r == g == b). This subset
" can be mix-and-matched.
let s:vals_color_88 = [ 0, 139, 205, 255 ]
" This table holds the midpoints between each of the possible grey values, as
" well as one extra element higher than all, to be used in the approximation
" algorithm.
let s:mids_greys_88 = [ 23, 69, 103, 127, 150, 173,
\ 195, 206, 219, 243, 256 ]
" This table is the same, only for the non-grey midpoints.
let s:mids_color_88 = [ 69, 172, 230, 256 ]
" Function definitions {{{1
" Given 3 hex strings rr, gg, bb, return the closest color cube number.
function! s:FindClosestCode(h1,h2,h3)
let d1 = str2nr(a:h1, 16)
let d2 = str2nr(a:h2, 16)
let d3 = str2nr(a:h3, 16)
let r = s:FindClosest(d1, s:vals_greys_{&t_Co}, s:mids_greys_{&t_Co})
let g = s:FindClosest(d2, s:vals_greys_{&t_Co}, s:mids_greys_{&t_Co})
let b = s:FindClosest(d3, s:vals_greys_{&t_Co}, s:mids_greys_{&t_Co})
if(r == g && g == b)
return s:GreyComponentTo{&t_Co}Cube(r)
else
let r = s:FindClosest(d1, s:vals_color_{&t_Co}, s:mids_color_{&t_Co})
let g = s:FindClosest(d2, s:vals_color_{&t_Co}, s:mids_color_{&t_Co})
let b = s:FindClosest(d3, s:vals_color_{&t_Co}, s:mids_color_{&t_Co})
return s:RGBComponentsTo{&t_Co}Cube(r, g, b)
endif
endfunction
" Given a number, an array of elements, and an array of midpts, find the index
" of the least midpt that the number is strictly less than, and return the
" corresponding element.
function! s:FindClosest(num, elems, midpts)
for i in range(len(a:elems))
if ( a:num < a:midpts[i] )
return a:elems[i]
endif
endfor
endfunction
" Expects a decimal value 'x' between 0 and 255, inclusive
" Returns a 256-color colorcube number for the color at RGB=x,x,x
function! s:GreyComponentTo256Cube(num)
if(a:num % 10 == 8)
return 232 + (a:num - 8) / 10
else
" Not in the greyscale ramp, so we can use our normal processing
return s:RGBComponentsTo256Cube(a:num, a:num, a:num)
endif
endfunction
" Expects a decimal value 'x' between 0 and 255, inclusive
" Returns an 88-color colorcube number for the color at RGB=x,x,x
function! s:GreyComponentTo88Cube(num)
if a:num == 46
return 80
elseif a:num == 92
return 81
elseif a:num == 115
return 82
elseif a:num == 139
return 83
elseif a:num == 162
return 84
elseif a:num == 185
return 85
elseif a:num == 208
return 86
elseif a:num == 231
return 87
else
" Not in the greyscale ramp, so we can use our normal processing
return s:RGBComponentsTo88Cube(a:num, a:num, a:num)
endif
endfunction
" Expects 3 decimal values 'r', 'g', and 'b', each between 0 and 255 inclusive.
" Returns a 256-color colorcube number for the color at RGB=r,g,b.
" Will not use the greyscale ramp.
function! s:RGBComponentsTo256Cube(r,g,b)
let rc = index(s:vals_color_256, a:r)
let gc = index(s:vals_color_256, a:g)
let bc = index(s:vals_color_256, a:b)
return (rc * 36 + gc * 6 + bc + 16)
endfunction
" Expects 3 decimal values 'r', 'g', and 'b', each between 0 and 255 inclusive.
" Returns a 88-color colorcube number for the color at RGB=r,g,b.
" Will not use the greyscale ramp.
function! s:RGBComponentsTo88Cube(r,g,b)
let rc = index(s:vals_color_88, a:r)
let gc = index(s:vals_color_88, a:g)
let bc = index(s:vals_color_88, a:b)
return (rc * 16 + gc * 4 + bc + 16)
endfunction
" Check if the provided value is found in "g:colorschemedegrade_ignore", which
" may either be a list or a comma or space separated string. If the variable
" "g:colorschemedegrade_ignore" is not present, the default is "bold italic"
function! s:ignoring(attr)
if !exists("g:colorschemedegrade_ignore")
let ignore = [ 'bold', 'italic' ]
elseif type(g:colorschemedegrade_ignore) == type("")
let ignore = split(g:colorschemedegrade_ignore, '[ ,]')
elseif type(g:colorschemedegrade_ignore) == type([])
let ignore = g:colorschemedegrade_ignore
else
return 0
endif
return index(ignore, a:attr) != -1
endfunction
" Sets some settings, calls s:ColorschemeDegradeImpl to handle actually
" degrading the colorscheme, then restores the settings. This wrapper
" should make sure that we don't accidentally recurse, and that settings are
" restored properly even if something throws.
function! s:ColorschemeDegrade()
if g:colors_name =~ ".*-rgb"
return
endif
let saveei = &ei
set ei+=ColorScheme
if exists("g:colors_name")
let colors_name = g:colors_name
unlet g:colors_name
endif
let savelz = &lz
set lz
let rv = -1
try
let rv = s:ColorschemeDegradeImpl()
catch
let ex = v:exception
endtry
let &lz = savelz
if exists("colors_name")
let g:colors_name = colors_name
endif
let &ei = saveei
if exists("ex")
echoerr 'ColorschemeDegrade failed: ' . substitute(ex, '.\{-}:', '', '')
endif
return rv
endfunction
" For every highlight group, sets the cterm values to the best approximation
" of the gui values possible given the value of &t_Co.
function! s:ColorschemeDegradeImpl()
if has('gui_running') || (&t_Co != 256 && &t_Co != 88)
return
endif
let g:highlights = ""
redir => g:highlights
" Normal must be set 1st for ctermfg=bg, etc, and resetting it doesn't hurt
silent highlight Normal
silent highlight
redir END
let hilines = split(g:highlights, '\n')
" hilines[0] is Normal. If that doesn't use gui colors, we should probably
" just give up. That way we don't muck up an already 256/88 color scheme.
if hilines[0] !~ 'gui[fb]g'
if &verbose
echomsg "Not degrading colorscheme; doesn't set Normal group gui colors"
endif
return
endif
call filter(hilines, 'v:val !~ "links to" && v:val !~ "cleared"')
let i = 0
let end = len(hilines)
while i < end
let line = hilines[i]
let i += 1
while i < end && hilines[i] !~ '\<xxx\>'
let line .= hilines[i]
let i += 1
endwhile
let line = substitute(line, '\<st\(art\|op\)=.\{-}\S\@!', '', 'g')
let line = substitute(line, '\<c\=term.\{-}=.\{-}\S\@!', '', 'g')
let line = substitute(line, '\<xxx\>', '', '')
let line = substitute(line, '\<gui', 'cterm', 'g')
let line = substitute(line, '\s\+', ' ', 'g')
let items = split(line, '\%(\s\zecterm\|font\)\|=')
let higrp = items[0]
if len(items) % 2 != 1
echoerr "I cannot understand the highlight group "
\ . string(items) . ' at line ' . hilines[i]
endif
" Start clean
exe 'hi ' . higrp . ' term=NONE cterm=NONE ctermbg=NONE ctermfg=NONE'
for j in range((len(items)-1)/2)
" TODO Can we handle 16 color terminals? Probably, if we're in an xterm.
let var = items[2*j+1]
let val = items[2*j+2]
if var == 'ctermsp'
if exists('g:colorschemedegrade_sp_is_bg') && g:colorschemedegrade_sp_is_bg
let var = 'ctermbg'
else
let var = 'ctermfg'
endif
endif
if var == 'cterm'
if s:ignoring('bold')
let val = substitute(val, 'bold', '', '')
endif
if s:ignoring('underline')
let val = substitute(val, 'underline', '', '')
endif
if s:ignoring('undercurl')
let val = substitute(val, 'undercurl', '', '')
endif
if s:ignoring('reverse') || s:ignoring('inverse')
let val = substitute(val, '\%(re\|in\)verse', '', '')
endif
if s:ignoring('italic')
let val = substitute(val, 'italic', '', '')
endif
if s:ignoring('standout')
let val = substitute(val, 'standout', '', '')
endif
let val = substitute(val, '\(^,*\|,*$\)', '', '')
let val = substitute(val, ',\+', ',', 'g')
let val = substitute(val, '^,*$', 'NONE', '')
exe 'hi ' . higrp . ' ' . var . '=' . val
elseif var =~ 'cterm[fb]g'
if val =~ '[FBfb]g'
let val = tolower(val)
if var =~ val
let val = "NONE"
endif
"echomsg 'higrp=' . higrp . ' var=' . var . ' val=' . val
exe 'hi ' . higrp . ' ' . var . '=' . val
continue
elseif val !~ '^#'
try
" We do need our cooked rgb.txt
if s:rgb == {}
let s:rgb = colorschemedegradelib#RGB()
endif
let val = s:rgb[tolower(substitute(val, ' ', '_', 'g'))]
catch
echomsg "Cannot translate color \"" . val . "\""
continue
endtry
endif
if v:termresponse =~ '>8[35];'
\ && exists('g:colorschemedegrade_changecube')
\ && g:colorschemedegrade_changecube
if !exists("s:lastcubepos")
let s:lastcubepos="15"
let s:colors = {}
endif
let tisave = &t_ti
let tesave = &t_te
set t_ti= t_te=
if has_key(s:colors, tolower(val))
let nr = s:colors[tolower(val)]
else
let s:lastcubepos = s:lastcubepos + 1
if s:lastcubepos >= &t_Co
let s:lastcubepos = 16
endif
let nr = s:lastcubepos
let s:colors[tolower(val)] = nr
if $STY == ""
exe 'sil !echo -n -e "\\033]4;' . nr . ';\' . val . '\\a"'
else
exe 'sil !echo -n -e "\\033P\\033]4;' . nr . ';\' . val . '\\a\\033\\\\"'
endif
endif
let &t_ti = tisave
let &t_te = tesave
exe 'hi' higrp var.'='.nr
else
let r = val[1] . val[2]
let g = val[3] . val[4]
let b = val[5] . val[6]
exe 'hi ' . higrp . ' ' . var . '=' . s:FindClosestCode(r, g, b)
endif
endif
endfor
endwhile
if exists("s:lastcubepos")
unlet s:lastcubepos
endif
endfunction
augroup ColorSchemeDegrade
au!
au ColorScheme * call s:ColorschemeDegrade()
augroup END
autocmd TermResponse * if exists("g:colors_name")
\ | exe "colorscheme" g:colors_name
\ | call s:ColorschemeDegrade()
\ | endif
if exists("g:colors_name")
" Don't do anything unless :colorscheme has already been called
call s:ColorschemeDegrade()
endif
let &cpo = s:savecpo
unlet s:savecpo
" vim:set sw=2 sts=2 fdm=marker:

View File

@ -0,0 +1,105 @@
*fontzoom.txt* The fontsize controller in gVim.
Version: 0.1.1
Modified: thinca <thinca+vim@gmail.com>
License: Creative Commons Attribution 2.1 Japan License
<http://creativecommons.org/licenses/by/2.1/jp/deed.en>
==============================================================================
CONTENTS *fontzoom-contents*
INTRODUCTION |fontzoom-introduction|
INTERFACE |fontzoom-interface|
KEY MAPPINGS |fontzoom-key-mappings|
COMMANDS |fontzoom-commands|
SETTINGS |fontzoom-settings|
LIMITATION |fontzoom-limitation|
CHANGELOG |fontzoom-changelog|
==============================================================================
INTRODUCTION *fontzoom-introduction*
*fontzoom* is a Vim plugin to control gui fontsize. You can change fontsize
with + and - keys(when default setting). You can also use the [count].
This plugin remember 'guifont', 'lines', and 'columns' when you change
fontsize first. And tries to keep the size of the window as much as possible.
==============================================================================
INTERFACE *fontzoom-interface*
------------------------------------------------------------------------------
KEY MAPPINGS *fontzoom-key-mappings*
<Plug>(fontzoom-learger) *<Plug>(fontzoom-learger)*
Fontsize is made large [count] point.
<Plug>(fontzoom-smaller) *<Plug>(fontzoom-smaller)*
Fontsize is made small [count] point.
*g:fontzoom_no_default_key_mappings*
The following key mappings will be also available unless
g:fontzoom_no_default_key_mappings is defined:
{lhs} {rhs}
-------- -----------------------------
+ <Plug>(fontzoom-larger)
- <Plug>(fontzoom-smaller)
<C-ScrollWheelUp> <Plug>(fontzoom-larger)
<C-ScrollWheelDown> <Plug>(fontzoom-smaller)
------------------------------------------------------------------------------
COMMANDS *fontzoom-commands*
:Fontzoom *:Fontzoom*
Show fontsize in current.
:Fontzoom +[N]
Fontsize is made large [N] point.
:Fontzoom -[N]
Fontsize is made small [N] point.
:Fontzoom [N]
Fontsize is changed into [N] points.
:Fontzoom!
Fontsize is changed into initial size. All arguments
are ignored.
==============================================================================
SETTINGS *fontzoom-settings*
g:fontzoom_pattern *g:fontzoom_pattern*
Pick out the Fontsize from font name. The pattern
must match to the Fontsize. |/\zs| and |/\ze| are
convenient.
==============================================================================
LIMITATION *fontzoom-limitation*
- 'guifont' should contain fontsize that matches to |g:fontzoom_pattern|.
==============================================================================
CHANGELOG *fontzoom-changelog*
0.1.1 2011-02-24
- Added default key mappings.
- <C-ScrollWheelUp> and <C-ScrollWheelDown>.
0.1.0 2009-12-25
- Initial version.
==============================================================================
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl

View File

@ -0,0 +1,15 @@
:Fontzoom fontzoom.txt /*:Fontzoom*
<Plug>(fontzoom-learger) fontzoom.txt /*<Plug>(fontzoom-learger)*
<Plug>(fontzoom-smaller) fontzoom.txt /*<Plug>(fontzoom-smaller)*
fontzoom fontzoom.txt /*fontzoom*
fontzoom-changelog fontzoom.txt /*fontzoom-changelog*
fontzoom-commands fontzoom.txt /*fontzoom-commands*
fontzoom-contents fontzoom.txt /*fontzoom-contents*
fontzoom-interface fontzoom.txt /*fontzoom-interface*
fontzoom-introduction fontzoom.txt /*fontzoom-introduction*
fontzoom-key-mappings fontzoom.txt /*fontzoom-key-mappings*
fontzoom-limitation fontzoom.txt /*fontzoom-limitation*
fontzoom-settings fontzoom.txt /*fontzoom-settings*
fontzoom.txt fontzoom.txt /*fontzoom.txt*
g:fontzoom_no_default_key_mappings fontzoom.txt /*g:fontzoom_no_default_key_mappings*
g:fontzoom_pattern fontzoom.txt /*g:fontzoom_pattern*

View File

@ -0,0 +1,75 @@
" The fontsize controller in gVim.
" Version: 0.1.1
" Author : thinca <thinca+vim@gmail.com>
" License: Creative Commons Attribution 2.1 Japan License
" <http://creativecommons.org/licenses/by/2.1/jp/deed.en>
if exists('g:loaded_fontzoom') || !has('gui_running')
finish
endif
let g:loaded_fontzoom = 1
let s:save_cpo = &cpo
set cpo&vim
function! s:fontzoom(size, reset)
if a:reset
if exists('s:keep') " Reset font size.
let [&guifont, &lines, &columns] = s:keep
unlet! s:keep
endif
elseif a:size == ''
echo matchstr(&guifont, g:fontzoom_pattern)
else
let size = (a:size =~ '^[+-]' ? 'submatch(0)' : '') . a:size
if !exists('s:keep')
let s:keep = [&guifont, &lines, &columns]
endif
let &guifont = join(map(split(&guifont, '\\\@<!,'),
\ printf('substitute(v:val, %s, %s, "g")',
\ string(g:fontzoom_pattern),
\ string('\=max([1,' . size . '])'))), ',')
" Keep window size if possible.
let [&lines, &columns] = s:keep[1:]
endif
endfunction
if !exists('g:fontzoom_pattern')
" TODO: X11 is not tested because I do not have the environment.
let g:fontzoom_pattern =
\ has('win32') || has('win64') ||
\ has('mac') || has('macunix') ? ':h\zs\d\+':
\ has('gui_gtk') ? '\s\+\zs\d\+$':
\ has('X11') ? '\v%([^-]*-){6}\zs\d+\ze%(-[^-]*){7}':
\ '*Unknown system*'
endif
" Commands.
command! -narg=? -bang -bar Fontzoom call s:fontzoom(<q-args>, <bang>0)
" Key mappings.
nnoremap <silent> <Plug>(fontzoom-larger)
\ :<C-u>Fontzoom +<C-r>=v:count1<CR><CR>
nnoremap <silent> <Plug>(fontzoom-smaller)
\ :<C-u>Fontzoom -<C-r>=v:count1<CR><CR>
inoremap <silent> <Plug>(fontzoom-larger)
\ <C-O>:<C-u>Fontzoom +<C-r>=v:count1<CR><CR>
inoremap <silent> <Plug>(fontzoom-smaller)
\ <C-O>:<C-u>Fontzoom -<C-r>=v:count1<CR><CR>
if !exists('g:fontzoom_no_default_key_mappings')
\ || !g:fontzoom_no_default_key_mappings
silent! nmap <unique> <silent> + <Plug>(fontzoom-larger)
silent! nmap <unique> <silent> - <Plug>(fontzoom-smaller)
silent! nmap <unique> <silent> <C-ScrollWheelUp> <Plug>(fontzoom-larger)
silent! nmap <unique> <silent> <C-ScrollWheelDown> <Plug>(fontzoom-smaller)
silent! imap <unique> <silent> <C-ScrollWheelUp> <Plug>(fontzoom-larger)
silent! imap <unique> <silent> <C-ScrollWheelDown> <Plug>(fontzoom-smaller)
endif
let &cpo = s:save_cpo
unlet s:save_cpo

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
"=============================================================================
" Copyright (c) 2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#bookmarkdir#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#bookmarkdir#getSwitchOrder()
return g:fuf_bookmarkdir_switchOrder
endfunction
"
function fuf#bookmarkdir#getEditableDataNames()
return ['items']
endfunction
"
function fuf#bookmarkdir#renewCache()
endfunction
"
function fuf#bookmarkdir#requiresOnCommandPre()
return 0
endfunction
"
function fuf#bookmarkdir#onInit()
call fuf#defineLaunchCommand('FufBookmarkDir', s:MODE_NAME, '""', [])
command! -bang -narg=? FufBookmarkDirAdd call s:bookmark(<q-args>)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_DELETE = -1
"
function s:bookmark(word)
let item = {
\ 'time' : localtime(),
\ }
let item.path = l9#inputHl('Question', '[fuf] Directory to bookmark:',
\ fnamemodify(getcwd(), ':p:~'), 'dir')
if item.path !~ '\S'
call fuf#echoWarning('Canceled')
return
endif
let item.word = l9#inputHl('Question', '[fuf] Bookmark as:',
\ fnamemodify(getcwd(), ':p:~'))
if item.word !~ '\S'
call fuf#echoWarning('Canceled')
return
endif
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
call insert(items, item)
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
endfunction
"
function s:findItem(items, word)
for item in a:items
if item.word ==# a:word
return item
endif
endfor
return {}
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_bookmarkdir_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
if a:mode ==# s:OPEN_TYPE_DELETE
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
call filter(items, 'v:val.word !=# a:word')
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
let self.reservedMode = self.getModeName()
return
else
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word)
if !empty(item)
execute ':cd ' . fnameescape(item.path)
endif
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
call fuf#defineKeyMappingInHandler(g:fuf_bookmarkdir_keyDelete,
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))')
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,199 @@
"=============================================================================
" Copyright (c) 2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#bookmarkfile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#bookmarkfile#getSwitchOrder()
return g:fuf_bookmarkfile_switchOrder
endfunction
"
function fuf#bookmarkfile#getEditableDataNames()
return ['items']
endfunction
"
function fuf#bookmarkfile#renewCache()
endfunction
"
function fuf#bookmarkfile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#bookmarkfile#onInit()
call fuf#defineLaunchCommand('FufBookmarkFile', s:MODE_NAME, '""', [])
command! -bang -narg=? FufBookmarkFileAdd call s:bookmarkHere(<q-args>)
command! -bang -narg=0 -range FufBookmarkFileAddAsSelectedText call s:bookmarkHere(l9#getSelectedText())
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_DELETE = -1
" opens a:path and jumps to the line matching to a:pattern from a:lnum within
" a:range. if not found, jumps to a:lnum.
function s:jumpToBookmark(path, mode, pattern, lnum)
call fuf#openFile(a:path, a:mode, g:fuf_reuseWindow)
call cursor(s:getMatchingLineNumber(getline(1, '$'), a:pattern, a:lnum), 0)
normal! zvzz
endfunction
"
function s:getMatchingLineNumber(lines, pattern, lnumBegin)
let l = min([a:lnumBegin, len(a:lines)])
for [l0, l1] in map(range(0, g:fuf_bookmarkfile_searchRange),
\ '[l + v:val, l - v:val]')
if l0 <= len(a:lines) && a:lines[l0 - 1] =~# a:pattern
return l0
elseif l1 >= 0 && a:lines[l1 - 1] =~# a:pattern
return l1
endif
endfor
return l
endfunction
"
function s:getLinePattern(lnum)
return '\C\V\^' . escape(getline(a:lnum), '\') . '\$'
endfunction
"
function s:bookmarkHere(word)
if !empty(&buftype) || expand('%') !~ '\S'
call fuf#echoWarning('Can''t bookmark this buffer.')
return
endif
let item = {
\ 'word' : (a:word =~# '\S' ? substitute(a:word, '\n', ' ', 'g')
\ : pathshorten(expand('%:p:~')) . '|' . line('.') . '| ' . getline('.')),
\ 'path' : expand('%:p'),
\ 'lnum' : line('.'),
\ 'pattern' : s:getLinePattern(line('.')),
\ 'time' : localtime(),
\ }
let item.word = l9#inputHl('Question', '[fuf] Bookmark as:', item.word)
if item.word !~ '\S'
call fuf#echoWarning('Canceled')
return
endif
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
call insert(items, item)
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
endfunction
"
function s:findItem(items, word)
for item in a:items
if item.word ==# a:word
return item
endif
endfor
return {}
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_bookmarkfile_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word)
let lines = fuf#getFileLines(item.path)
if empty(lines)
return []
endif
let index = s:getMatchingLineNumber(lines, item.pattern, item.lnum) - 1
return fuf#makePreviewLinesAround(
\ lines, [index], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
if a:mode ==# s:OPEN_TYPE_DELETE
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
call filter(items, 'v:val.word !=# a:word')
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
let self.reservedMode = self.getModeName()
return
else
let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word)
if !empty(item)
call s:jumpToBookmark(item.path, a:mode, item.pattern, item.lnum)
endif
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
call fuf#defineKeyMappingInHandler(g:fuf_bookmarkfile_keyDelete,
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))')
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,189 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#buffer#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#buffer#getSwitchOrder()
return g:fuf_buffer_switchOrder
endfunction
"
function fuf#buffer#getEditableDataNames()
return []
endfunction
"
function fuf#buffer#renewCache()
endfunction
"
function fuf#buffer#requiresOnCommandPre()
return 0
endfunction
"
function fuf#buffer#onInit()
call fuf#defineLaunchCommand('FufBuffer', s:MODE_NAME, '""', [])
augroup fuf#buffer
autocmd!
autocmd BufEnter * call s:updateBufTimes()
autocmd BufWritePost * call s:updateBufTimes()
augroup END
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_DELETE = -1
let s:bufTimes = {}
"
function s:updateBufTimes()
let s:bufTimes[bufnr('%')] = localtime()
endfunction
"
function s:makeItem(nr)
let fname = (empty(bufname(a:nr))
\ ? '[No Name]'
\ : fnamemodify(bufname(a:nr), ':p:~:.'))
let time = (exists('s:bufTimes[a:nr]') ? s:bufTimes[a:nr] : 0)
let item = fuf#makePathItem(fname, strftime(g:fuf_timeFormat, time), 0)
let item.index = a:nr
let item.bufNr = a:nr
let item.time = time
let item.abbrPrefix = s:getBufIndicator(a:nr) . ' '
return item
endfunction
"
function s:getBufIndicator(bufNr)
if !getbufvar(a:bufNr, '&modifiable')
return '[-]'
elseif getbufvar(a:bufNr, '&modified')
return '[+]'
elseif getbufvar(a:bufNr, '&readonly')
return '[R]'
else
return ' '
endif
endfunction
"
function s:compareTimeDescending(i1, i2)
return a:i1.time == a:i2.time ? 0 : a:i1.time > a:i2.time ? -1 : +1
endfunction
"
function s:findItem(items, word)
for item in a:items
if item.word ==# a:word
return item
endif
endfor
return {}
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_buffer_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let item = s:findItem(self.items, a:word)
if empty(item)
return []
endif
return fuf#makePreviewLinesForFile(item.bufNr, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
" not use bufnr(a:word) in order to handle unnamed buffer
let item = s:findItem(self.items, a:word)
if empty(item)
" do nothing
elseif a:mode ==# s:OPEN_TYPE_DELETE
execute item.bufNr . 'bdelete'
let self.reservedMode = self.getModeName()
else
call fuf#openBuffer(item.bufNr, a:mode, g:fuf_reuseWindow)
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
call fuf#defineKeyMappingInHandler(g:fuf_buffer_keyDelete,
\ 'onCr(' . s:OPEN_TYPE_DELETE . ')')
let self.items = range(1, bufnr('$'))
call filter(self.items, 'buflisted(v:val) && v:val != self.bufNrPrev && v:val != bufnr("%")')
call map(self.items, 's:makeItem(v:val)')
if g:fuf_buffer_mruOrder
call sort(self.items, 's:compareTimeDescending')
call fuf#mapToSetSerialIndex(self.items, 1)
endif
let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,300 @@
"=============================================================================
" Copyright (c) 2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#buffertag#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#buffertag#getSwitchOrder()
return g:fuf_buffertag_switchOrder
endfunction
"
function fuf#buffertag#getEditableDataNames()
return []
endfunction
"
function fuf#buffertag#renewCache()
let s:tagItemsCache = {}
let s:tagDataCache = {}
endfunction
"
function fuf#buffertag#requiresOnCommandPre()
return 0
endfunction
"
function fuf#buffertag#onInit()
call fuf#defineLaunchCommand('FufBufferTag', s:MODE_NAME, '""',
\ [['g:fuf_buffertag_forAll', 0]])
call fuf#defineLaunchCommand('FufBufferTagAll', s:MODE_NAME, '""',
\ [['g:fuf_buffertag_forAll', 1]])
call fuf#defineLaunchCommand('FufBufferTagWithCursorWord', s:MODE_NAME,
\ 'expand(''<cword>'')', [['g:fuf_buffertag_forAll', 0]])
call fuf#defineLaunchCommand('FufBufferTagAllWithCursorWord', s:MODE_NAME,
\ 'expand(''<cword>'')', [['g:fuf_buffertag_forAll', 1]])
call fuf#defineLaunchCommand('FufBufferTagWithSelectedText', s:MODE_NAME,
\ 'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 0]])
call fuf#defineLaunchCommand('FufBufferTagAllWithSelectedText', s:MODE_NAME,
\ 'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 1]])
call l9#defineVariableDefault('g:fuf_buffertag_forAll', 0) " private option
" the following settings originate from taglist.vim
call l9#defineVariableDefault('g:fuf_buffertag__asm' , '--language-force=asm --asm-types=dlmt')
call l9#defineVariableDefault('g:fuf_buffertag__aspperl' , '--language-force=asp --asp-types=fsv')
call l9#defineVariableDefault('g:fuf_buffertag__aspvbs' , '--language-force=asp --asp-types=fsv')
call l9#defineVariableDefault('g:fuf_buffertag__awk' , '--language-force=awk --awk-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__beta' , '--language-force=beta --beta-types=fsv')
call l9#defineVariableDefault('g:fuf_buffertag__c' , '--language-force=c --c-types=dgsutvf')
call l9#defineVariableDefault('g:fuf_buffertag__cpp' , '--language-force=c++ --c++-types=nvdtcgsuf')
call l9#defineVariableDefault('g:fuf_buffertag__cs' , '--language-force=c# --c#-types=dtncEgsipm')
call l9#defineVariableDefault('g:fuf_buffertag__cobol' , '--language-force=cobol --cobol-types=dfgpPs')
call l9#defineVariableDefault('g:fuf_buffertag__eiffel' , '--language-force=eiffel --eiffel-types=cf')
call l9#defineVariableDefault('g:fuf_buffertag__erlang' , '--language-force=erlang --erlang-types=drmf')
call l9#defineVariableDefault('g:fuf_buffertag__expect' , '--language-force=tcl --tcl-types=cfp')
call l9#defineVariableDefault('g:fuf_buffertag__fortran' , '--language-force=fortran --fortran-types=pbceiklmntvfs')
call l9#defineVariableDefault('g:fuf_buffertag__html' , '--language-force=html --html-types=af')
call l9#defineVariableDefault('g:fuf_buffertag__java' , '--language-force=java --java-types=pcifm')
call l9#defineVariableDefault('g:fuf_buffertag__javascript', '--language-force=javascript --javascript-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__lisp' , '--language-force=lisp --lisp-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__lua' , '--language-force=lua --lua-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__make' , '--language-force=make --make-types=m')
call l9#defineVariableDefault('g:fuf_buffertag__pascal' , '--language-force=pascal --pascal-types=fp')
call l9#defineVariableDefault('g:fuf_buffertag__perl' , '--language-force=perl --perl-types=clps')
call l9#defineVariableDefault('g:fuf_buffertag__php' , '--language-force=php --php-types=cdvf')
call l9#defineVariableDefault('g:fuf_buffertag__python' , '--language-force=python --python-types=cmf')
call l9#defineVariableDefault('g:fuf_buffertag__rexx' , '--language-force=rexx --rexx-types=s')
call l9#defineVariableDefault('g:fuf_buffertag__ruby' , '--language-force=ruby --ruby-types=cfFm')
call l9#defineVariableDefault('g:fuf_buffertag__scheme' , '--language-force=scheme --scheme-types=sf')
call l9#defineVariableDefault('g:fuf_buffertag__sh' , '--language-force=sh --sh-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__csh' , '--language-force=sh --sh-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__zsh' , '--language-force=sh --sh-types=f')
call l9#defineVariableDefault('g:fuf_buffertag__slang' , '--language-force=slang --slang-types=nf')
call l9#defineVariableDefault('g:fuf_buffertag__sml' , '--language-force=sml --sml-types=ecsrtvf')
call l9#defineVariableDefault('g:fuf_buffertag__sql' , '--language-force=sql --sql-types=cFPrstTvfp')
call l9#defineVariableDefault('g:fuf_buffertag__tcl' , '--language-force=tcl --tcl-types=cfmp')
call l9#defineVariableDefault('g:fuf_buffertag__vera' , '--language-force=vera --vera-types=cdefgmpPtTvx')
call l9#defineVariableDefault('g:fuf_buffertag__verilog' , '--language-force=verilog --verilog-types=mcPertwpvf')
call l9#defineVariableDefault('g:fuf_buffertag__vim' , '--language-force=vim --vim-types=avf')
call l9#defineVariableDefault('g:fuf_buffertag__yacc' , '--language-force=yacc --yacc-types=l')
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:parseTagLine(line)
" tag W:\Win32\SRC7\NCSIM\NCVW32\CUBEFACE.H /^#define CUBEFACE_H$/;" macro line:4
let fields = matchlist(a:line, '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline\:(\d+)')
if empty(fields)
return {}
endif
return {
\ 'tag' : fields[1],
\ 'fname' : fields[2],
\ 'pattern': fields[3],
\ 'kind' : fields[4],
\ 'lnum' : str2nr(fields[5]),
\ }
endfunction
"
let s:TEMP_VARIABLES_GROUP = expand('<sfile>:p')
"
function s:getFileType(bufNr)
let ft = getbufvar(a:bufNr, '&filetype')
if !empty(ft) || bufloaded(a:bufNr)
return ft
endif
let ft = getbufvar(a:bufNr, 'fuf_buffertag_filetype')
if !empty(ft)
return ft
endif
call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&eventignore', 'FileType')
call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&filetype', &filetype)
" from taglist.vim
execute 'doautocmd filetypedetect BufRead ' . bufname(a:bufNr)
let ft = &filetype
call l9#tempvariables#end(s:TEMP_VARIABLES_GROUP)
call setbufvar(a:bufNr, 'fuf_buffertag_filetype', ft)
return ft
endfunction
"
function s:makeCtagsCmd(bufNr)
let ft = s:getFileType(a:bufNr)
if !exists('g:fuf_buffertag__{ft}')
return ''
endif
"
let cmd = join([g:fuf_buffertag_ctagsPath,
\ '-f - --sort=no --excmd=pattern --fields=nKs',
\ g:fuf_buffertag__{ft},
\ shellescape(fnamemodify(bufname(a:bufNr), ':p'))])
return cmd
endfunction
"
function s:getTagItems(bufNr)
let cmd = s:makeCtagsCmd(a:bufNr)
if empty(cmd)
return []
elseif !exists('s:tagItemsCache[cmd]') ||
\ s:tagItemsCache[cmd].time < getftime(expand(bufname(a:bufNr)))
let items = split(system(cmd), "\n")
if v:shell_error
call fuf#echoError([cmd] + items)
throw "Command error"
endif
call map(items, 's:parseTagLine(v:val)')
call filter(items, '!empty(v:val)')
let s:tagItemsCache[cmd] = {
\ 'time' : localtime(),
\ 'items' : items,
\ }
endif
return s:tagItemsCache[cmd].items
endfunction
"
function s:makeItem(tag, itemMap)
let menu = fnamemodify(a:itemMap[a:tag][0].fname, ':t')
\ . ' [' . a:itemMap[a:tag][0].kind . ']'
if len(a:itemMap[a:tag]) > 1
let menu .= ' (' . len(a:itemMap[a:tag]) . ')'
endif
let item = fuf#makeNonPathItem(a:tag, menu)
return item
endfunction
"
function s:getTagData(bufNrs)
let key = join([0] + sort(copy(a:bufNrs)), "\n")
let bufNames = map(copy(a:bufNrs), 'bufname(v:val)')
if !exists('s:tagDataCache[key]') ||
\ fuf#countModifiedFiles(bufNames, s:tagDataCache[key].time) > 0
let itemMap = {}
for item in l9#concat(map(copy(a:bufNrs), 's:getTagItems(v:val)'))
if !exists('itemMap[item.tag]')
let itemMap[item.tag] = []
endif
call add(itemMap[item.tag], item)
endfor
let items = sort(keys(itemMap))
call map(items, 's:makeItem(v:val, itemMap)')
call fuf#mapToSetSerialIndex(items, 1)
call map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
let s:tagDataCache[key] = {
\ 'time' : localtime(),
\ 'itemMap': itemMap,
\ 'items' : items,
\ }
endif
return [s:tagDataCache[key].items, s:tagDataCache[key].itemMap]
endfunction
"
function s:jumpToTag(item, mode)
call fuf#openFile(a:item.fname, a:mode, g:fuf_reuseWindow)
call cursor(a:item.lnum, 1)
normal! zvzz
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_buffertag_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
if !exists('self.itemMap[a:word][0]')
call fuf#echoError('Definition not found:' . a:word)
return
elseif len(self.itemMap[a:word]) == 1
let i = 0
else
let list = map(fuf#mapToSetSerialIndex(copy(self.itemMap[a:word]), 1),
\ 'printf(" %2d: %s|%d| [%s] %s",v:val.index, fnamemodify(v:val.fname, ":~:."), v:val.lnum, v:val.kind, v:val.pattern)')
let i = inputlist(['Select a definition of "' . a:word . '":'] + list) - 1
endif
if 0 <= i && i < len(self.itemMap[a:word])
call s:jumpToTag(self.itemMap[a:word][i], a:mode)
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
if g:fuf_buffertag_forAll
let bufNrs = filter(range(1, bufnr('$')), 'buflisted(v:val)')
else
let bufNrs = [self.bufNrPrev]
endif
let [self.items, self.itemMap] = s:getTagData(bufNrs)
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,137 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#callbackfile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#callbackfile#getSwitchOrder()
return -1
endfunction
"
function fuf#callbackfile#getEditableDataNames()
return []
endfunction
"
function fuf#callbackfile#renewCache()
let s:cache = {}
endfunction
"
function fuf#callbackfile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#callbackfile#onInit()
endfunction
"
function fuf#callbackfile#launch(initialPattern, partialMatching, prompt, exclude, listener)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:exclude = a:exclude
let s:listener = a:listener
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:enumItems(dir)
let key = getcwd() . g:fuf_ignoreCase . s:exclude . "\n" . a:dir
if !exists('s:cache[key]')
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, s:exclude)
if isdirectory(a:dir)
call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0))
endif
call fuf#mapToSetSerialIndex(s:cache[key], 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
endif
return s:cache[key]
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return a:enteredPattern =~# '[^/\\]$'
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
let items = copy(s:enumItems(fuf#splitPath(a:patternPrimary).head))
return filter(items, 'bufnr("^" . v:val.word . "$") != self.bufNrPrev')
endfunction
"
function s:handler.onOpen(word, mode)
call s:listener.onComplete(a:word, a:mode)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
if !a:opened && exists('s:listener.onAbort()')
call s:listener.onAbort()
endif
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,139 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#callbackitem#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#callbackitem#getSwitchOrder()
return -1
endfunction
"
function fuf#callbackitem#getEditableDataNames()
return []
endfunction
"
function fuf#callbackitem#renewCache()
endfunction
"
function fuf#callbackitem#requiresOnCommandPre()
return 0
endfunction
"
function fuf#callbackitem#onInit()
endfunction
"
function fuf#callbackitem#launch(initialPattern, partialMatching, prompt, listener, items, forPath)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:listener = a:listener
let s:forPath = a:forPath
let s:items = copy(a:items)
if s:forPath
call map(s:items, 'fuf#makePathItem(v:val, "", 1)')
call fuf#mapToSetSerialIndex(s:items, 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items)
else
call map(s:items, 'fuf#makeNonPathItem(v:val, "")')
call fuf#mapToSetSerialIndex(s:items, 1)
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endif
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
if s:forPath
return g:fuf_previewHeight
endif
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
let parser = (s:forPath
\ ? 's:interpretPrimaryPatternForPath'
\ : 's:interpretPrimaryPatternForNonPath')
return fuf#makePatternSet(a:patternBase, parser, self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
if s:forPath
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endif
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:items
endfunction
"
function s:handler.onOpen(word, mode)
call s:listener.onComplete(a:word, a:mode)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
if !a:opened && exists('s:listener.onAbort()')
call s:listener.onAbort()
endif
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,172 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#changelist#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#changelist#getSwitchOrder()
return g:fuf_changelist_switchOrder
endfunction
"
function fuf#changelist#getEditableDataNames()
return []
endfunction
"
function fuf#changelist#renewCache()
endfunction
"
function fuf#changelist#requiresOnCommandPre()
return 0
endfunction
"
function fuf#changelist#onInit()
call fuf#defineLaunchCommand('FufChangeList', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getChangesLines()
redir => result
:silent changes
redir END
return split(result, "\n")
endfunction
"
function s:parseChangesLine(line)
" return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$')
let elements = matchlist(a:line, '\v^(.)\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$')
if empty(elements)
return {}
endif
return {
\ 'prefix': elements[1],
\ 'count' : elements[2],
\ 'lnum' : elements[3],
\ 'text' : printf('|%d:%d|%s', elements[3], elements[4], elements[5]),
\ }
endfunction
"
function s:makeItem(line)
let parsed = s:parseChangesLine(a:line)
if empty(parsed)
return {}
endif
let item = fuf#makeNonPathItem(parsed.text, '')
let item.abbrPrefix = parsed.prefix
let item.lnum = parsed.lnum
return item
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_changelist_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(self.items), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(self.bufNrPrev)
return fuf#makePreviewLinesAround(
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#prejump(a:mode)
let older = 0
for line in reverse(s:getChangesLines())
if stridx(line, '>') == 0
let older = 1
endif
let parsed = s:parseChangesLine(line)
if !empty(parsed) && parsed.text ==# a:word
if parsed.count != 0
execute 'normal! ' . parsed.count . (older ? 'g;' : 'g,') . 'zvzz'
endif
break
endif
endfor
endfunction
"
function s:handler.onModeEnterPre()
let self.items = s:getChangesLines()
endfunction
"
function s:handler.onModeEnterPost()
call map(self.items, 's:makeItem(v:val)')
call filter(self.items, '!empty(v:val)')
call reverse(self.items)
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,199 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#coveragefile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#coveragefile#getSwitchOrder()
return g:fuf_coveragefile_switchOrder
endfunction
"
function fuf#coveragefile#getEditableDataNames()
return ['coverages']
endfunction
"
function fuf#coveragefile#renewCache()
let s:cache = {}
endfunction
"
function fuf#coveragefile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#coveragefile#onInit()
call fuf#defineLaunchCommand('FufCoverageFile', s:MODE_NAME, '""', [])
call l9#defineVariableDefault('g:fuf_coveragefile_name', '') " private option
command! -bang -narg=0 FufCoverageFileRegister call s:registerCoverage()
command! -bang -narg=? FufCoverageFileChange call s:changeCoverage(<q-args>)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:enumItems()
let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_coveragefile_exclude,
\ g:fuf_coveragefile_globPatterns], "\n")
if !exists('s:cache[key]')
let s:cache[key] = l9#concat(map(copy(g:fuf_coveragefile_globPatterns),
\ 'fuf#glob(v:val)'))
call filter(s:cache[key], 'filereadable(v:val)') " filter out directories
call map(s:cache[key], 'fuf#makePathItem(fnamemodify(v:val, ":~:."), "", 0)')
if len(g:fuf_coveragefile_exclude)
call filter(s:cache[key], 'v:val.word !~ g:fuf_coveragefile_exclude')
endif
call fuf#mapToSetSerialIndex(s:cache[key], 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
endif
return s:cache[key]
endfunction
"
function s:registerCoverage()
let patterns = []
while 1
let pattern = l9#inputHl('Question', '[fuf] Glob pattern for coverage (<Esc> and end):',
\ '', 'file')
if pattern !~ '\S'
break
endif
call add(patterns, pattern)
endwhile
if empty(patterns)
call fuf#echoWarning('Canceled')
return
endif
echo '[fuf] patterns: ' . string(patterns)
let name = l9#inputHl('Question', '[fuf] Coverage name:')
if name !~ '\S'
call fuf#echoWarning('Canceled')
return
endif
let coverages = fuf#loadDataFile(s:MODE_NAME, 'coverages')
call insert(coverages, {'name': name, 'patterns': patterns})
call fuf#saveDataFile(s:MODE_NAME, 'coverages', coverages)
endfunction
"
function s:createChangeCoverageListener()
let listener = {}
function listener.onComplete(name, method)
call s:changeCoverage(a:name)
endfunction
return listener
endfunction
"
function s:changeCoverage(name)
let coverages = fuf#loadDataFile(s:MODE_NAME, 'coverages')
if a:name !~ '\S'
let names = map(copy(coverages), 'v:val.name')
call fuf#callbackitem#launch('', 0, '>Coverage>', s:createChangeCoverageListener(), names, 0)
return
else
let name = a:name
endif
call filter(coverages, 'v:val.name ==# name')
if empty(coverages)
call fuf#echoError('Coverage not found: ' . name)
return
endif
call fuf#setOneTimeVariables(
\ ['g:fuf_coveragefile_globPatterns', coverages[0].patterns],
\ ['g:fuf_coveragefile_name' , a:name]
\ )
FufCoverageFile
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
let nameString = (empty(g:fuf_coveragefile_name) ? ''
\ : '[' . g:fuf_coveragefile_name . ']')
return fuf#formatPrompt(g:fuf_coveragefile_prompt, self.partialMatching,
\ nameString)
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':~:.')
let self.items = copy(s:enumItems())
call filter(self.items, 'v:val.word !=# bufNamePrev')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,132 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#dir#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#dir#getSwitchOrder()
return g:fuf_dir_switchOrder
endfunction
"
function fuf#dir#getEditableDataNames()
return []
endfunction
"
function fuf#dir#renewCache()
let s:cache = {}
endfunction
"
function fuf#dir#requiresOnCommandPre()
return 0
endfunction
"
function fuf#dir#onInit()
call fuf#defineLaunchCommand('FufDir' , s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufDirWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', [])
call fuf#defineLaunchCommand('FufDirWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:enumItems(dir)
let key = getcwd() . g:fuf_ignoreCase . g:fuf_dir_exclude . "\n" . a:dir
if !exists('s:cache[key]')
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_dir_exclude)
call filter(s:cache[key], 'v:val.word =~# ''[/\\]$''')
if isdirectory(a:dir)
call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0))
endif
call fuf#mapToSetSerialIndex(s:cache[key], 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
endif
return s:cache[key]
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_dir_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return a:enteredPattern =~# '[^/\\]$'
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesAround(
\ fuf#glob(fnamemodify(a:word, ':p') . '*'),
\ [], a:count, self.getPreviewHeight())
return
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:enumItems(fuf#splitPath(a:patternPrimary).head)
endfunction
"
function s:handler.onOpen(word, mode)
execute ':cd ' . fnameescape(a:word)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,139 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#file#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#file#getSwitchOrder()
return g:fuf_file_switchOrder
endfunction
"
function fuf#file#getEditableDataNames()
return []
endfunction
"
function fuf#file#renewCache()
let s:cache = {}
endfunction
"
function fuf#file#requiresOnCommandPre()
return 0
endfunction
"
function fuf#file#onInit()
call fuf#defineLaunchCommand('FufFile' , s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufFileWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', [])
call fuf#defineLaunchCommand('FufFileWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:enumItems(dir)
let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_file_exclude, a:dir], "\n")
if !exists('s:cache[key]')
let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_file_exclude)
call fuf#mapToSetSerialIndex(s:cache[key], 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key])
endif
return s:cache[key]
endfunction
"
function s:enumNonCurrentItems(dir, bufNrPrev, cache)
let key = a:dir . 'AVOIDING EMPTY KEY'
if !exists('a:cache[key]')
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
let bufNamePrev = bufname(a:bufNrPrev)
let a:cache[key] =
\ filter(copy(s:enumItems(a:dir)), 'v:val.word !=# bufNamePrev')
endif
return a:cache[key]
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_file_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return a:enteredPattern =~# '[^/\\]$'
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:enumNonCurrentItems(
\ fuf#splitPath(a:patternPrimary).head, self.bufNrPrev, self.cache)
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let self.cache = {}
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,123 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#givencmd#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#givencmd#getSwitchOrder()
return -1
endfunction
"
function fuf#givencmd#getEditableDataNames()
return []
endfunction
"
function fuf#givencmd#renewCache()
endfunction
"
function fuf#givencmd#requiresOnCommandPre()
return 0
endfunction
"
function fuf#givencmd#onInit()
endfunction
"
function fuf#givencmd#launch(initialPattern, partialMatching, prompt, items)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:items = copy(a:items)
call map(s:items, 'fuf#makeNonPathItem(v:val, "")')
call fuf#mapToSetSerialIndex(s:items, 1)
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:items
endfunction
"
function s:handler.onOpen(word, mode)
if a:word[0] =~# '[:/?]'
call histadd(a:word[0], a:word[1:])
endif
call feedkeys(a:word . "\<CR>", 'n')
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,123 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#givendir#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#givendir#getSwitchOrder()
return -1
endfunction
"
function fuf#givendir#getEditableDataNames()
return []
endfunction
"
function fuf#givendir#renewCache()
endfunction
"
function fuf#givendir#requiresOnCommandPre()
return 0
endfunction
"
function fuf#givendir#onInit()
endfunction
"
function fuf#givendir#launch(initialPattern, partialMatching, prompt, items)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:items = map(copy(a:items), 'substitute(v:val, ''[/\\]\?$'', "", "")')
let s:items = map(s:items, 'fuf#makePathItem(v:val, "", 0)')
call fuf#mapToSetSerialIndex(s:items, 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items)
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesAround(
\ fuf#glob(fnamemodify(a:word, ':p') . '*'),
\ [], a:count, self.getPreviewHeight())
return
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:items
endfunction
"
function s:handler.onOpen(word, mode)
execute ':cd ' . fnameescape(a:word)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,121 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#givenfile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#givenfile#getSwitchOrder()
return -1
endfunction
"
function fuf#givenfile#getEditableDataNames()
return []
endfunction
"
function fuf#givenfile#renewCache()
endfunction
"
function fuf#givenfile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#givenfile#onInit()
endfunction
"
function fuf#givenfile#launch(initialPattern, partialMatching, prompt, items)
let s:prompt = (empty(a:prompt) ? '>' : a:prompt)
let s:items = map(copy(a:items), 'fuf#makePathItem(v:val, "", 0)')
call fuf#mapToSetSerialIndex(s:items, 1)
call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching)
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(s:prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,198 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#help#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#help#getSwitchOrder()
return g:fuf_help_switchOrder
endfunction
"
function fuf#help#getEditableDataNames()
return []
endfunction
"
function fuf#help#renewCache()
let s:cache = {}
endfunction
"
function fuf#help#requiresOnCommandPre()
return 0
endfunction
"
function fuf#help#onInit()
call fuf#defineLaunchCommand('FufHelp' , s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufHelpWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getCurrentHelpTagFiles()
let prefix = 'doc' . l9#getPathSeparator()
let tagFiles = split(globpath(&runtimepath, prefix . 'tags' ), "\n")
\ + split(globpath(&runtimepath, prefix . 'tags-??'), "\n")
return sort(map(tagFiles, 'fnamemodify(v:val, ":p")'))
endfunction
"
function s:parseHelpTagEntry(line, tagFile)
let elements = split(a:line, "\t")
if len(elements) != 3 || elements[0][0] ==# '!'
return {}
endif
let suffix = matchstr(a:tagFile, '-\zs..$')
if empty(suffix)
let suffix = '@en'
else
let suffix = '@' . suffix
endif
let dir = fnamemodify(a:tagFile, ':h') . l9#getPathSeparator()
return {
\ 'word' : elements[0] . suffix,
\ 'path' : dir . elements[1],
\ 'pattern': elements[2][1:],
\ }
endfunction
"
function s:getHelpTagEntries(tagFile)
let names = map(l9#readFile(a:tagFile), 's:parseHelpTagEntry(v:val, a:tagFile)')
return filter(names, '!empty(v:val)')
endfunction
"
function s:parseHelpTagFiles(tagFiles, key)
let cacheName = 'cache-' . l9#hash224(a:key)
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName)
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0
return fuf#loadDataFile(s:MODE_NAME, cacheName)
endif
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getHelpTagEntries(v:val)')))
let items = map(items, 'extend(v:val, fuf#makeNonPathItem(v:val.word, ""))')
call fuf#mapToSetSerialIndex(items, 1)
let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
return items
endfunction
"
function s:enumHelpTags(tagFiles)
if !len(a:tagFiles)
return []
endif
let key = join([g:fuf_ignoreCase] + a:tagFiles, "\n")
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time)
let s:cache[key] = {
\ 'time' : localtime(),
\ 'items' : s:parseHelpTagFiles(a:tagFiles, key)
\ }
endif
return s:cache[key].items
endfunction
"
function s:getMatchingIndex(lines, pattern)
if empty(a:pattern)
return -1
endif
for i in range(len(a:lines))
if stridx(a:lines[i], a:pattern) >= 0
return i
endif
endfor
return -1
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_help_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(s:enumHelpTags(self.tagFiles)), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(items[0].path)
let index = s:getMatchingIndex(lines, items[0].pattern)
return [items[0].path . ':'] + fuf#makePreviewLinesAround(
\ lines, (index < 0 ? [] : [index]), a:count, self.getPreviewHeight() - 1)
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:enumHelpTags(self.tagFiles)
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openHelp(a:word, a:mode)
endfunction
"
function s:handler.onModeEnterPre()
let self.tagFiles = s:getCurrentHelpTagFiles()
endfunction
"
function s:handler.onModeEnterPost()
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,182 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#jumplist#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#jumplist#getSwitchOrder()
return g:fuf_jumplist_switchOrder
endfunction
"
function fuf#jumplist#getEditableDataNames()
return []
endfunction
"
function fuf#jumplist#renewCache()
endfunction
"
function fuf#jumplist#requiresOnCommandPre()
return 0
endfunction
"
function fuf#jumplist#onInit()
call fuf#defineLaunchCommand('FufJumpList', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getJumpsLines()
redir => result
:silent jumps
redir END
return split(result, "\n")
endfunction
"
function s:parseJumpsLine(line, bufnrPrev)
"return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$')
let elements = matchlist(a:line, '\v^(.)\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$')
if empty(elements)
return {}
endif
let linePrevBuffer = join(getbufline(a:bufnrPrev, elements[3]))
if stridx(linePrevBuffer, elements[5]) >= 0
let fname = bufname(a:bufnrPrev)
let text = elements[5]
else
let fname = elements[5]
let text = join(getbufline('^' . elements[5] . '$', elements[3]))
endif
return {
\ 'prefix': elements[1],
\ 'count' : elements[2],
\ 'lnum' : elements[3],
\ 'fname' : fname,
\ 'text' : printf('%s|%d:%d|%s', fname, elements[3], elements[4], text),
\ }
endfunction
"
function s:makeItem(line, bufnrPrev)
let parsed = s:parseJumpsLine(a:line, a:bufnrPrev)
if empty(parsed)
return {}
endif
let item = fuf#makeNonPathItem(parsed.text, '')
let item.abbrPrefix = parsed.prefix
let item.lnum = parsed.lnum
let item.fname = parsed.fname
return item
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_jumplist_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(self.items), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(items[0].fname)
return fuf#makePreviewLinesAround(
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#prejump(a:mode)
let older = 0
for line in reverse(s:getJumpsLines())
if stridx(line, '>') == 0
let older = 1
endif
let parsed = s:parseJumpsLine(line, self.bufNrPrev)
if !empty(parsed) && parsed.text ==# a:word
if parsed.count != 0
execute 'normal! ' . parsed.count . (older ? "\<C-o>" : "\<C-i>") . 'zvzz'
endif
break
endif
endfor
endfunction
"
function s:handler.onModeEnterPre()
let self.items = s:getJumpsLines()
endfunction
"
function s:handler.onModeEnterPost()
call map(self.items, 's:makeItem(v:val, self.bufNrPrev)')
call filter(self.items, '!empty(v:val)')
call reverse(self.items)
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,135 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#line#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#line#getSwitchOrder()
return g:fuf_line_switchOrder
endfunction
"
function fuf#line#getEditableDataNames()
return []
endfunction
"
function fuf#line#renewCache()
endfunction
"
function fuf#line#requiresOnCommandPre()
return 0
endfunction
"
function fuf#line#onInit()
call fuf#defineLaunchCommand('FufLine', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_DELETE = -1
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_line_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(self.items), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(self.bufNrPrev)
return fuf#makePreviewLinesAround(
\ lines, [items[0].index - 1], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#prejump(a:mode)
call filter(self.items, 'v:val.word ==# a:word')
if empty(self.items)
return
execute 'cc ' . self.items[0].index
endif
call cursor(self.items[0].index, 0)
normal! zvzz
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let tab = repeat(' ', getbufvar(self.bufNrPrev, '&tabstop'))
let self.items = getbufline(self.bufNrPrev, 1, '$')
let lnumFormat = '%' . len(string(len(self.items) + 1)) . 'd|'
for i in range(len(self.items))
let self.items[i] = printf(lnumFormat, i + 1)
\ . substitute(self.items[i], "\t", tab, 'g')
endfor
call map(self.items, 'fuf#makeNonPathItem(v:val, "")')
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 0)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,134 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#mrucmd#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#mrucmd#getSwitchOrder()
return g:fuf_mrucmd_switchOrder
endfunction
"
function fuf#mrucmd#getEditableDataNames()
return ['items']
endfunction
"
function fuf#mrucmd#renewCache()
endfunction
"
function fuf#mrucmd#requiresOnCommandPre()
return 1
endfunction
"
function fuf#mrucmd#onInit()
call fuf#defineLaunchCommand('FufMruCmd', s:MODE_NAME, '""', [])
endfunction
"
function fuf#mrucmd#onCommandPre(cmd)
if getcmdtype() =~# '^[:/?]'
call s:updateInfo(a:cmd)
endif
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:updateInfo(cmd)
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
let items = fuf#updateMruList(
\ items, { 'word' : a:cmd, 'time' : localtime() },
\ g:fuf_mrucmd_maxItem, g:fuf_mrucmd_exclude)
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_mrucmd_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return 0
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return []
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call s:updateInfo(a:word)
call histadd(a:word[0], a:word[1:])
call feedkeys(a:word . "\<CR>", 'n')
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))')
call fuf#mapToSetSerialIndex(self.items, 1)
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,234 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#mrufile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#mrufile#getSwitchOrder()
return g:fuf_mrufile_switchOrder
endfunction
"
function fuf#mrufile#getEditableDataNames()
return ['items', 'itemdirs']
endfunction
"
function fuf#mrufile#renewCache()
let s:cache = {}
let s:aroundCache = {}
endfunction
"
function fuf#mrufile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#mrufile#onInit()
call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufMruFileInCwd', s:MODE_NAME,
\ '""', [['g:fuf_mrufile_underCwd', 1]])
call l9#defineVariableDefault('g:fuf_mrufile_underCwd', 0) " private option
call l9#defineVariableDefault('g:fuf_mrufile_searchAroundLevel', -1) " private option
augroup fuf#mrufile
autocmd!
autocmd BufEnter * call s:updateData()
autocmd BufWritePost * call s:updateData()
augroup END
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
let s:OPEN_TYPE_EXPAND = -1
"
function s:updateData()
if !empty(&buftype) || !filereadable(expand('%'))
return
endif
let items = fuf#loadDataFile(s:MODE_NAME, 'items')
let items = fuf#updateMruList(
\ items, { 'word' : expand('%:p'), 'time' : localtime() },
\ g:fuf_mrufile_maxItem, g:fuf_mrufile_exclude)
call fuf#saveDataFile(s:MODE_NAME, 'items', items)
call s:removeItemFromCache(expand('%:p'))
let itemDirs = fuf#loadDataFile(s:MODE_NAME, 'itemdirs')
let itemDirs = fuf#updateMruList(
\ itemDirs, { 'word' : expand('%:p:h') },
\ g:fuf_mrufile_maxItemDir, g:fuf_mrufile_exclude)
call fuf#saveDataFile(s:MODE_NAME, 'itemdirs', itemDirs)
endfunction
"
function s:removeItemFromCache(word)
for items in values(s:cache)
if exists('items[a:word]')
unlet items[a:word]
endif
endfor
endfunction
" returns empty value if invalid item
function s:formatItemUsingCache(item)
if a:item.word !~ '\S'
return {}
endif
if !exists('s:cache[a:item.word]')
if filereadable(a:item.word)
let s:cache[a:item.word] = fuf#makePathItem(
\ fnamemodify(a:item.word, ':p:~'), strftime(g:fuf_timeFormat, a:item.time), 0)
else
let s:cache[a:item.word] = {}
endif
endif
return s:cache[a:item.word]
endfunction
"
function s:expandSearchDir(dir, level)
let dirs = [a:dir]
let dirPrev = a:dir
for i in range(a:level)
let dirPrev = l9#concatPaths([dirPrev, '*'])
call add(dirs, dirPrev)
endfor
let dirPrev = a:dir
for i in range(a:level)
let dirPrevPrev = dirPrev
let dirPrev = fnamemodify(dirPrev, ':h')
if dirPrevPrev ==# dirPrev
break
endif
call add(dirs, dirPrev)
endfor
return dirs
endfunction
"
function s:listAroundFiles(dir)
if !exists('s:aroundCache[a:dir]')
let s:aroundCache[a:dir] = [a:dir] +
\ fuf#glob(l9#concatPaths([a:dir, '*' ])) +
\ fuf#glob(l9#concatPaths([a:dir, '.*']))
call filter(s:aroundCache[a:dir], 'filereadable(v:val)')
call map(s:aroundCache[a:dir], 'fuf#makePathItem(fnamemodify(v:val, ":~"), "", 0)')
if len(g:fuf_mrufile_exclude)
call filter(s:aroundCache[a:dir], 'v:val.word !~ g:fuf_mrufile_exclude')
endif
endif
return s:aroundCache[a:dir]
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
let cwdString = (g:fuf_mrufile_underCwd ? '[CWD]' : '')
let levelString = (g:fuf_mrufile_searchAroundLevel < 0 ? ''
\ : '[Around:' . g:fuf_mrufile_searchAroundLevel . ']')
return fuf#formatPrompt(g:fuf_mrufile_prompt, self.partialMatching, cwdString . levelString)
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
if a:mode ==# s:OPEN_TYPE_EXPAND
let nextLevel = (self.searchAroundLevel < 0 ? 0 : self.searchAroundLevel + 1)
call fuf#setOneTimeVariables(['g:fuf_mrufile_searchAroundLevel', nextLevel])
let self.reservedMode = self.getModeName()
return
else
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let self.searchAroundLevel = g:fuf_mrufile_searchAroundLevel
call fuf#defineKeyMappingInHandler(g:fuf_mrufile_keyExpand,
\ 'onCr(' . s:OPEN_TYPE_EXPAND . ')')
if self.searchAroundLevel < 0
let self.items = fuf#loadDataFile(s:MODE_NAME, 'items')
call map(self.items, 's:formatItemUsingCache(v:val)')
else
let self.items = fuf#loadDataFile(s:MODE_NAME, 'itemdirs')
call map(self.items, 's:expandSearchDir(v:val.word, g:fuf_mrufile_searchAroundLevel)')
let self.items = l9#concat(self.items)
let self.items = l9#unique(self.items)
call map(self.items, 's:listAroundFiles(v:val)')
let self.items = l9#concat(self.items)
endif
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~')
call filter(self.items, '!empty(v:val) && v:val.word !=# bufNamePrev')
if g:fuf_mrufile_underCwd
let cwd = fnamemodify(getcwd(), ':p:~')
call filter(self.items, 'stridx(v:val.word, cwd) == 0')
endif
call fuf#mapToSetSerialIndex(self.items, 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(self.items)
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,154 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#quickfix#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#quickfix#getSwitchOrder()
return g:fuf_quickfix_switchOrder
endfunction
"
function fuf#quickfix#getEditableDataNames()
return []
endfunction
"
function fuf#quickfix#renewCache()
endfunction
"
function fuf#quickfix#requiresOnCommandPre()
return 0
endfunction
"
function fuf#quickfix#onInit()
call fuf#defineLaunchCommand('FufQuickfix', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getJumpsLines()
redir => result
:silent jumps
redir END
return split(result, "\n")
endfunction
"
function s:parseJumpsLine(line)
return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$')
endfunction
"
function s:makeItem(qfItem)
if !a:qfItem.valid
return {}
endif
let item = fuf#makeNonPathItem(
\ printf('%s|%d:%d|%s', bufname(a:qfItem.bufnr), a:qfItem.lnum,
\ a:qfItem.col, matchstr(a:qfItem.text, '\s*\zs.*\S'))
\ , '')
let item.bufnr = a:qfItem.bufnr
let item.lnum = a:qfItem.lnum
return item
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_quickfix_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
let items = filter(copy(self.items), 'v:val.word ==# a:word')
if empty(items)
return []
endif
let lines = fuf#getFileLines(items[0].bufnr)
return fuf#makePreviewLinesAround(
\ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#prejump(a:mode)
call filter(self.items, 'v:val.word ==# a:word')
if !empty(self.items)
execute 'cc ' . self.items[0].index
endif
endfunction
"
function s:handler.onModeEnterPre()
endfunction
"
function s:handler.onModeEnterPost()
let self.items = getqflist()
call map(self.items, 's:makeItem(v:val)')
call fuf#mapToSetSerialIndex(self.items, 1)
call filter(self.items, 'exists("v:val.word")')
call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,178 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#tag#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#tag#getSwitchOrder()
return g:fuf_tag_switchOrder
endfunction
"
function fuf#tag#getEditableDataNames()
return []
endfunction
"
function fuf#tag#renewCache()
let s:cache = {}
endfunction
"
function fuf#tag#requiresOnCommandPre()
return 0
endfunction
"
function fuf#tag#onInit()
call fuf#defineLaunchCommand('FufTag' , s:MODE_NAME, '""', [])
call fuf#defineLaunchCommand('FufTagWithCursorWord', s:MODE_NAME, 'expand(''<cword>'')', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getTagNames(tagFile)
let names = map(l9#readFile(a:tagFile), 'matchstr(v:val, ''^[^!\t][^\t]*'')')
return filter(names, 'v:val =~# ''\S''')
endfunction
"
function s:parseTagFiles(tagFiles, key)
let cacheName = 'cache-' . l9#hash224(a:key)
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName)
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0
return fuf#loadDataFile(s:MODE_NAME, cacheName)
endif
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTagNames(v:val)')))
let items = map(items, 'fuf#makeNonPathItem(v:val, "")')
call fuf#mapToSetSerialIndex(items, 1)
let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)')
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
return items
endfunction
"
function s:enumTags(tagFiles)
if !len(a:tagFiles)
return []
endif
let key = join([g:fuf_ignoreCase] + a:tagFiles, "\n")
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time)
let s:cache[key] = {
\ 'time' : localtime(),
\ 'items' : s:parseTagFiles(a:tagFiles, key)
\ }
endif
return s:cache[key].items
endfunction
"
function s:getMatchingIndex(lines, cmd)
if a:cmd !~# '\D'
return str2nr(a:cmd)
endif
let pattern = matchstr(a:cmd, '^\/\^\zs.*\ze\$\/$')
if empty(pattern)
return -1
endif
for i in range(len(a:lines))
if a:lines[i] ==# pattern
return i
endif
endfor
return -1
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_tag_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath',
\ self.partialMatching)
endfunction
" 'cmd' is '/^hoge hoge$/' or line number
function s:handler.makePreviewLines(word, count)
let tags = taglist('^' . a:word . '$')
if empty(tags)
return []
endif
let i = a:count % len(tags)
let title = printf('(%d/%d) %s', i + 1, len(tags), tags[i].filename)
let lines = fuf#getFileLines(tags[i].filename)
let index = s:getMatchingIndex(lines, tags[i].cmd)
return [title] + fuf#makePreviewLinesAround(
\ lines, (index < 0 ? [] : [index]), 0, self.getPreviewHeight() - 1)
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return s:enumTags(self.tagFiles)
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openTag(a:word, a:mode)
endfunction
"
function s:handler.onModeEnterPre()
let self.tagFiles = fuf#getCurrentTagFiles()
endfunction
"
function s:handler.onModeEnterPost()
let &l:tags = join(self.tagFiles, ',')
endfunction
"
function s:handler.onModeLeavePost(opened)
let &l:tags = ''
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,159 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
"=============================================================================
" LOAD GUARD {{{1
if !l9#guardScriptLoading(expand('<sfile>:p'), 0, 0, [])
finish
endif
" }}}1
"=============================================================================
" GLOBAL FUNCTIONS {{{1
"
function fuf#taggedfile#createHandler(base)
return a:base.concretize(copy(s:handler))
endfunction
"
function fuf#taggedfile#getSwitchOrder()
return g:fuf_taggedfile_switchOrder
endfunction
"
function fuf#taggedfile#getEditableDataNames()
return []
endfunction
"
function fuf#taggedfile#renewCache()
let s:cache = {}
endfunction
"
function fuf#taggedfile#requiresOnCommandPre()
return 0
endfunction
"
function fuf#taggedfile#onInit()
call fuf#defineLaunchCommand('FufTaggedFile', s:MODE_NAME, '""', [])
endfunction
" }}}1
"=============================================================================
" LOCAL FUNCTIONS/VARIABLES {{{1
let s:MODE_NAME = expand('<sfile>:t:r')
"
function s:getTaggedFileList(tagfile)
execute 'cd ' . fnamemodify(a:tagfile, ':h')
let result = map(l9#readFile(a:tagfile), 'matchstr(v:val, ''^[^!\t][^\t]*\t\zs[^\t]\+'')')
call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":p")')
cd -
call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":~:.")')
return filter(result, 'v:val =~# ''[^/\\ ]$''')
endfunction
"
function s:parseTagFiles(tagFiles, key)
let cacheName = 'cache-' . l9#hash224(a:key)
let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName)
if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0
return fuf#loadDataFile(s:MODE_NAME, cacheName)
endif
let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTaggedFileList(v:val)')))
call map(items, 'fuf#makePathItem(v:val, "", 0)')
call fuf#mapToSetSerialIndex(items, 1)
call fuf#mapToSetAbbrWithSnippedWordAsPath(items)
call fuf#saveDataFile(s:MODE_NAME, cacheName, items)
return items
endfunction
"
function s:enumTaggedFiles(tagFiles)
if !len(a:tagFiles)
return []
endif
let key = join([getcwd(), g:fuf_ignoreCase] + a:tagFiles, "\n")
if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time)
let s:cache[key] = {
\ 'time' : localtime(),
\ 'items' : s:parseTagFiles(a:tagFiles, key)
\ }
endif
return s:cache[key].items
endfunction
" }}}1
"=============================================================================
" s:handler {{{1
let s:handler = {}
"
function s:handler.getModeName()
return s:MODE_NAME
endfunction
"
function s:handler.getPrompt()
return fuf#formatPrompt(g:fuf_taggedfile_prompt, self.partialMatching, '')
endfunction
"
function s:handler.getPreviewHeight()
return g:fuf_previewHeight
endfunction
"
function s:handler.isOpenable(enteredPattern)
return 1
endfunction
"
function s:handler.makePatternSet(patternBase)
return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath',
\ self.partialMatching)
endfunction
"
function s:handler.makePreviewLines(word, count)
return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight())
endfunction
"
function s:handler.getCompleteItems(patternPrimary)
return self.items
endfunction
"
function s:handler.onOpen(word, mode)
call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow)
endfunction
"
function s:handler.onModeEnterPre()
let self.tagFiles = fuf#getCurrentTagFiles()
endfunction
"
function s:handler.onModeEnterPost()
" NOTE: Comparing filenames is faster than bufnr('^' . fname . '$')
let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~:.')
" NOTE: Don't do this in onModeEnterPre()
" because that should return in a short time.
let self.items = copy(s:enumTaggedFiles(self.tagFiles))
call filter(self.items, 'v:val.word !=# bufNamePrev')
endfunction
"
function s:handler.onModeLeavePost(opened)
endfunction
" }}}1
"=============================================================================
" vim: set fdm=marker:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,176 @@
:FufBookmarkDir fuf.txt /*:FufBookmarkDir*
:FufBookmarkDirAdd fuf.txt /*:FufBookmarkDirAdd*
:FufBookmarkFile fuf.txt /*:FufBookmarkFile*
:FufBookmarkFileAdd fuf.txt /*:FufBookmarkFileAdd*
:FufBookmarkFileAddAsSelectedText fuf.txt /*:FufBookmarkFileAddAsSelectedText*
:FufBuffer fuf.txt /*:FufBuffer*
:FufBufferTag fuf.txt /*:FufBufferTag*
:FufBufferTagAll fuf.txt /*:FufBufferTagAll*
:FufBufferTagAllWithCursorWord fuf.txt /*:FufBufferTagAllWithCursorWord*
:FufBufferTagAllWithSelectedText fuf.txt /*:FufBufferTagAllWithSelectedText*
:FufBufferTagWithCursorWord fuf.txt /*:FufBufferTagWithCursorWord*
:FufBufferTagWithSelectedText fuf.txt /*:FufBufferTagWithSelectedText*
:FufChangeList fuf.txt /*:FufChangeList*
:FufCoverageFile fuf.txt /*:FufCoverageFile*
:FufCoverageFileChange fuf.txt /*:FufCoverageFileChange*
:FufCoverageFileRegister fuf.txt /*:FufCoverageFileRegister*
:FufDir fuf.txt /*:FufDir*
:FufDirWithCurrentBufferDir fuf.txt /*:FufDirWithCurrentBufferDir*
:FufDirWithFullCwd fuf.txt /*:FufDirWithFullCwd*
:FufEditDataFile fuf.txt /*:FufEditDataFile*
:FufFile fuf.txt /*:FufFile*
:FufFileWithCurrentBufferDir fuf.txt /*:FufFileWithCurrentBufferDir*
:FufFileWithFullCwd fuf.txt /*:FufFileWithFullCwd*
:FufHelp fuf.txt /*:FufHelp*
:FufJumpList fuf.txt /*:FufJumpList*
:FufLine fuf.txt /*:FufLine*
:FufMruCmd fuf.txt /*:FufMruCmd*
:FufMruFile fuf.txt /*:FufMruFile*
:FufMruFileInCwd fuf.txt /*:FufMruFileInCwd*
:FufQuickfix fuf.txt /*:FufQuickfix*
:FufRenewCache fuf.txt /*:FufRenewCache*
:FufTag fuf.txt /*:FufTag*
:FufTagWithCursorWord fuf.txt /*:FufTagWithCursorWord*
:FufTaggedFile fuf.txt /*:FufTaggedFile*
abc fuf.txt /*abc*
fuf fuf.txt /*fuf*
fuf#setOneTimeVariables() fuf.txt /*fuf#setOneTimeVariables()*
fuf-abbreviation fuf.txt /*fuf-abbreviation*
fuf-about fuf.txt /*fuf-about*
fuf-author fuf.txt /*fuf-author*
fuf-bookmarkdir-mode fuf.txt /*fuf-bookmarkdir-mode*
fuf-bookmarkfile-mode fuf.txt /*fuf-bookmarkfile-mode*
fuf-buffer-mode fuf.txt /*fuf-buffer-mode*
fuf-buffertag-mode fuf.txt /*fuf-buffertag-mode*
fuf-cache fuf.txt /*fuf-cache*
fuf-callbackfile-mode fuf.txt /*fuf-callbackfile-mode*
fuf-callbackitem-mode fuf.txt /*fuf-callbackitem-mode*
fuf-changelist-mode fuf.txt /*fuf-changelist-mode*
fuf-changelog fuf.txt /*fuf-changelog*
fuf-commands fuf.txt /*fuf-commands*
fuf-contact fuf.txt /*fuf-contact*
fuf-coveragefile-mode fuf.txt /*fuf-coveragefile-mode*
fuf-data-file fuf.txt /*fuf-data-file*
fuf-detailed-topics fuf.txt /*fuf-detailed-topics*
fuf-dir-mode fuf.txt /*fuf-dir-mode*
fuf-dot-sequence fuf.txt /*fuf-dot-sequence*
fuf-file-mode fuf.txt /*fuf-file-mode*
fuf-givencmd-mode fuf.txt /*fuf-givencmd-mode*
fuf-givendir-mode fuf.txt /*fuf-givendir-mode*
fuf-givenfile-mode fuf.txt /*fuf-givenfile-mode*
fuf-help-mode fuf.txt /*fuf-help-mode*
fuf-hiding-menu fuf.txt /*fuf-hiding-menu*
fuf-how-to-add-mode fuf.txt /*fuf-how-to-add-mode*
fuf-installation fuf.txt /*fuf-installation*
fuf-introduction fuf.txt /*fuf-introduction*
fuf-jumplist-mode fuf.txt /*fuf-jumplist-mode*
fuf-line-mode fuf.txt /*fuf-line-mode*
fuf-migemo fuf.txt /*fuf-migemo*
fuf-modes fuf.txt /*fuf-modes*
fuf-mrucmd-mode fuf.txt /*fuf-mrucmd-mode*
fuf-mrufile-mode fuf.txt /*fuf-mrufile-mode*
fuf-multiple-search fuf.txt /*fuf-multiple-search*
fuf-options fuf.txt /*fuf-options*
fuf-options-for-all-modes fuf.txt /*fuf-options-for-all-modes*
fuf-options-for-bookmarkdir-mode fuf.txt /*fuf-options-for-bookmarkdir-mode*
fuf-options-for-bookmarkfile-mode fuf.txt /*fuf-options-for-bookmarkfile-mode*
fuf-options-for-buffer-mode fuf.txt /*fuf-options-for-buffer-mode*
fuf-options-for-buffertag-mode fuf.txt /*fuf-options-for-buffertag-mode*
fuf-options-for-changelist-mode fuf.txt /*fuf-options-for-changelist-mode*
fuf-options-for-coveragefile-mode fuf.txt /*fuf-options-for-coveragefile-mode*
fuf-options-for-dir-mode fuf.txt /*fuf-options-for-dir-mode*
fuf-options-for-file-mode fuf.txt /*fuf-options-for-file-mode*
fuf-options-for-help-mode fuf.txt /*fuf-options-for-help-mode*
fuf-options-for-jumplist-mode fuf.txt /*fuf-options-for-jumplist-mode*
fuf-options-for-line-mode fuf.txt /*fuf-options-for-line-mode*
fuf-options-for-mrucmd-mode fuf.txt /*fuf-options-for-mrucmd-mode*
fuf-options-for-mrufile-mode fuf.txt /*fuf-options-for-mrufile-mode*
fuf-options-for-quickfix-mode fuf.txt /*fuf-options-for-quickfix-mode*
fuf-options-for-tag-mode fuf.txt /*fuf-options-for-tag-mode*
fuf-options-for-taggedfile-mode fuf.txt /*fuf-options-for-taggedfile-mode*
fuf-quickfix-mode fuf.txt /*fuf-quickfix-mode*
fuf-reusing-window fuf.txt /*fuf-reusing-window*
fuf-search-patterns fuf.txt /*fuf-search-patterns*
fuf-setting-one-time-option fuf.txt /*fuf-setting-one-time-option*
fuf-sorting-of-completion-items fuf.txt /*fuf-sorting-of-completion-items*
fuf-tag-mode fuf.txt /*fuf-tag-mode*
fuf-taggedfile-mode fuf.txt /*fuf-taggedfile-mode*
fuf-thanks fuf.txt /*fuf-thanks*
fuf-usage fuf.txt /*fuf-usage*
fuf-vimrc-example fuf.txt /*fuf-vimrc-example*
fuf.txt fuf.txt /*fuf.txt*
fuzzyfinder fuf.txt /*fuzzyfinder*
g:fuf_abbrevMap fuf.txt /*g:fuf_abbrevMap*
g:fuf_autoPreview fuf.txt /*g:fuf_autoPreview*
g:fuf_bookmarkdir_keyDelete fuf.txt /*g:fuf_bookmarkdir_keyDelete*
g:fuf_bookmarkdir_prompt fuf.txt /*g:fuf_bookmarkdir_prompt*
g:fuf_bookmarkdir_switchOrder fuf.txt /*g:fuf_bookmarkdir_switchOrder*
g:fuf_bookmarkfile_keyDelete fuf.txt /*g:fuf_bookmarkfile_keyDelete*
g:fuf_bookmarkfile_prompt fuf.txt /*g:fuf_bookmarkfile_prompt*
g:fuf_bookmarkfile_searchRange fuf.txt /*g:fuf_bookmarkfile_searchRange*
g:fuf_bookmarkfile_switchOrder fuf.txt /*g:fuf_bookmarkfile_switchOrder*
g:fuf_buffer_keyDelete fuf.txt /*g:fuf_buffer_keyDelete*
g:fuf_buffer_mruOrder fuf.txt /*g:fuf_buffer_mruOrder*
g:fuf_buffer_prompt fuf.txt /*g:fuf_buffer_prompt*
g:fuf_buffer_switchOrder fuf.txt /*g:fuf_buffer_switchOrder*
g:fuf_buffertag_ctagsPath fuf.txt /*g:fuf_buffertag_ctagsPath*
g:fuf_buffertag_prompt fuf.txt /*g:fuf_buffertag_prompt*
g:fuf_buffertag_switchOrder fuf.txt /*g:fuf_buffertag_switchOrder*
g:fuf_changelist_prompt fuf.txt /*g:fuf_changelist_prompt*
g:fuf_changelist_switchOrder fuf.txt /*g:fuf_changelist_switchOrder*
g:fuf_coveragefile_exclude fuf.txt /*g:fuf_coveragefile_exclude*
g:fuf_coveragefile_globPatterns fuf.txt /*g:fuf_coveragefile_globPatterns*
g:fuf_coveragefile_prompt fuf.txt /*g:fuf_coveragefile_prompt*
g:fuf_coveragefile_switchOrder fuf.txt /*g:fuf_coveragefile_switchOrder*
g:fuf_dataDir fuf.txt /*g:fuf_dataDir*
g:fuf_dir_exclude fuf.txt /*g:fuf_dir_exclude*
g:fuf_dir_prompt fuf.txt /*g:fuf_dir_prompt*
g:fuf_dir_switchOrder fuf.txt /*g:fuf_dir_switchOrder*
g:fuf_enumeratingLimit fuf.txt /*g:fuf_enumeratingLimit*
g:fuf_file_exclude fuf.txt /*g:fuf_file_exclude*
g:fuf_file_prompt fuf.txt /*g:fuf_file_prompt*
g:fuf_file_switchOrder fuf.txt /*g:fuf_file_switchOrder*
g:fuf_fuzzyRefining fuf.txt /*g:fuf_fuzzyRefining*
g:fuf_help_prompt fuf.txt /*g:fuf_help_prompt*
g:fuf_help_switchOrder fuf.txt /*g:fuf_help_switchOrder*
g:fuf_ignoreCase fuf.txt /*g:fuf_ignoreCase*
g:fuf_jumplist_prompt fuf.txt /*g:fuf_jumplist_prompt*
g:fuf_jumplist_switchOrder fuf.txt /*g:fuf_jumplist_switchOrder*
g:fuf_keyNextMode fuf.txt /*g:fuf_keyNextMode*
g:fuf_keyNextPattern fuf.txt /*g:fuf_keyNextPattern*
g:fuf_keyOpen fuf.txt /*g:fuf_keyOpen*
g:fuf_keyOpenSplit fuf.txt /*g:fuf_keyOpenSplit*
g:fuf_keyOpenTabpage fuf.txt /*g:fuf_keyOpenTabpage*
g:fuf_keyOpenVsplit fuf.txt /*g:fuf_keyOpenVsplit*
g:fuf_keyPrevMode fuf.txt /*g:fuf_keyPrevMode*
g:fuf_keyPrevPattern fuf.txt /*g:fuf_keyPrevPattern*
g:fuf_keyPreview fuf.txt /*g:fuf_keyPreview*
g:fuf_keySwitchMatching fuf.txt /*g:fuf_keySwitchMatching*
g:fuf_learningLimit fuf.txt /*g:fuf_learningLimit*
g:fuf_line_prompt fuf.txt /*g:fuf_line_prompt*
g:fuf_line_switchOrder fuf.txt /*g:fuf_line_switchOrder*
g:fuf_maxMenuWidth fuf.txt /*g:fuf_maxMenuWidth*
g:fuf_modesDisable fuf.txt /*g:fuf_modesDisable*
g:fuf_mrucmd_exclude fuf.txt /*g:fuf_mrucmd_exclude*
g:fuf_mrucmd_maxItem fuf.txt /*g:fuf_mrucmd_maxItem*
g:fuf_mrucmd_prompt fuf.txt /*g:fuf_mrucmd_prompt*
g:fuf_mrucmd_switchOrder fuf.txt /*g:fuf_mrucmd_switchOrder*
g:fuf_mrufile_exclude fuf.txt /*g:fuf_mrufile_exclude*
g:fuf_mrufile_keyExpand fuf.txt /*g:fuf_mrufile_keyExpand*
g:fuf_mrufile_maxItem fuf.txt /*g:fuf_mrufile_maxItem*
g:fuf_mrufile_maxItemDir fuf.txt /*g:fuf_mrufile_maxItemDir*
g:fuf_mrufile_prompt fuf.txt /*g:fuf_mrufile_prompt*
g:fuf_mrufile_switchOrder fuf.txt /*g:fuf_mrufile_switchOrder*
g:fuf_patternSeparator fuf.txt /*g:fuf_patternSeparator*
g:fuf_previewHeight fuf.txt /*g:fuf_previewHeight*
g:fuf_promptHighlight fuf.txt /*g:fuf_promptHighlight*
g:fuf_quickfix_prompt fuf.txt /*g:fuf_quickfix_prompt*
g:fuf_quickfix_switchOrder fuf.txt /*g:fuf_quickfix_switchOrder*
g:fuf_reuseWindow fuf.txt /*g:fuf_reuseWindow*
g:fuf_splitPathMatching fuf.txt /*g:fuf_splitPathMatching*
g:fuf_tag_prompt fuf.txt /*g:fuf_tag_prompt*
g:fuf_tag_switchOrder fuf.txt /*g:fuf_tag_switchOrder*
g:fuf_taggedfile_prompt fuf.txt /*g:fuf_taggedfile_prompt*
g:fuf_taggedfile_switchOrder fuf.txt /*g:fuf_taggedfile_switchOrder*
g:fuf_timeFormat fuf.txt /*g:fuf_timeFormat*
g:fuf_useMigemo fuf.txt /*g:fuf_useMigemo*

View File

@ -0,0 +1,174 @@
!_TAG_FILE_ENCODING utf-8 //
:FufBookmarkDir fuf.jax /*:FufBookmarkDir*
:FufBookmarkDirAdd fuf.jax /*:FufBookmarkDirAdd*
:FufBookmarkFile fuf.jax /*:FufBookmarkFile*
:FufBookmarkFileAdd fuf.jax /*:FufBookmarkFileAdd*
:FufBookmarkFileAddAsSelectedText fuf.jax /*:FufBookmarkFileAddAsSelectedText*
:FufBuffer fuf.jax /*:FufBuffer*
:FufBufferTag fuf.jax /*:FufBufferTag*
:FufBufferTagAll fuf.jax /*:FufBufferTagAll*
:FufBufferTagAllWithCursorWord fuf.jax /*:FufBufferTagAllWithCursorWord*
:FufBufferTagAllWithSelectedText fuf.jax /*:FufBufferTagAllWithSelectedText*
:FufBufferTagWithCursorWord fuf.jax /*:FufBufferTagWithCursorWord*
:FufBufferTagWithSelectedText fuf.jax /*:FufBufferTagWithSelectedText*
:FufChangeList fuf.jax /*:FufChangeList*
:FufCoverageFileChange fuf.jax /*:FufCoverageFileChange*
:FufCoverageFileRegister fuf.jax /*:FufCoverageFileRegister*
:FufDir fuf.jax /*:FufDir*
:FufDirWithCurrentBufferDir fuf.jax /*:FufDirWithCurrentBufferDir*
:FufDirWithFullCwd fuf.jax /*:FufDirWithFullCwd*
:FufEditDataFile fuf.jax /*:FufEditDataFile*
:FufFile fuf.jax /*:FufFile*
:FufFileWithCurrentBufferDir fuf.jax /*:FufFileWithCurrentBufferDir*
:FufFileWithFullCwd fuf.jax /*:FufFileWithFullCwd*
:FufHelp fuf.jax /*:FufHelp*
:FufJumpList fuf.jax /*:FufJumpList*
:FufLine fuf.jax /*:FufLine*
:FufMruCmd fuf.jax /*:FufMruCmd*
:FufMruFile fuf.jax /*:FufMruFile*
:FufMruFileInCwd fuf.jax /*:FufMruFileInCwd*
:FufQuickfix fuf.jax /*:FufQuickfix*
:FufRenewCache fuf.jax /*:FufRenewCache*
:FufTag fuf.jax /*:FufTag*
:FufTagWithCursorWord fuf.jax /*:FufTagWithCursorWord*
:FufTaggedFile fuf.jax /*:FufTaggedFile*
abc fuf.jax /*abc*
fuf fuf.jax /*fuf*
fuf#setOneTimeVariables() fuf.jax /*fuf#setOneTimeVariables()*
fuf-abbreviation fuf.jax /*fuf-abbreviation*
fuf-about fuf.jax /*fuf-about*
fuf-author fuf.jax /*fuf-author*
fuf-bookmarkdir-mode fuf.jax /*fuf-bookmarkdir-mode*
fuf-bookmarkfile-mode fuf.jax /*fuf-bookmarkfile-mode*
fuf-buffer-mode fuf.jax /*fuf-buffer-mode*
fuf-buffertag-mode fuf.jax /*fuf-buffertag-mode*
fuf-cache fuf.jax /*fuf-cache*
fuf-callbackfile-mode fuf.jax /*fuf-callbackfile-mode*
fuf-callbackitem-mode fuf.jax /*fuf-callbackitem-mode*
fuf-changelist-mode fuf.jax /*fuf-changelist-mode*
fuf-commands fuf.jax /*fuf-commands*
fuf-contact fuf.jax /*fuf-contact*
fuf-coveragefile-mode fuf.jax /*fuf-coveragefile-mode*
fuf-data-file fuf.jax /*fuf-data-file*
fuf-detailed-topics fuf.jax /*fuf-detailed-topics*
fuf-dir-mode fuf.jax /*fuf-dir-mode*
fuf-dot-sequence fuf.jax /*fuf-dot-sequence*
fuf-file-mode fuf.jax /*fuf-file-mode*
fuf-givencmd-mode fuf.jax /*fuf-givencmd-mode*
fuf-givendir-mode fuf.jax /*fuf-givendir-mode*
fuf-givenfile-mode fuf.jax /*fuf-givenfile-mode*
fuf-help-mode fuf.jax /*fuf-help-mode*
fuf-hiding-menu fuf.jax /*fuf-hiding-menu*
fuf-how-to-add-mode fuf.jax /*fuf-how-to-add-mode*
fuf-installation fuf.jax /*fuf-installation*
fuf-introduction fuf.jax /*fuf-introduction*
fuf-jumplist-mode fuf.jax /*fuf-jumplist-mode*
fuf-line-mode fuf.jax /*fuf-line-mode*
fuf-migemo fuf.jax /*fuf-migemo*
fuf-modes fuf.jax /*fuf-modes*
fuf-mrucmd-mode fuf.jax /*fuf-mrucmd-mode*
fuf-mrufile-mode fuf.jax /*fuf-mrufile-mode*
fuf-multiple-search fuf.jax /*fuf-multiple-search*
fuf-options fuf.jax /*fuf-options*
fuf-options-for-all-modes fuf.jax /*fuf-options-for-all-modes*
fuf-options-for-bookmarkdir-mode fuf.jax /*fuf-options-for-bookmarkdir-mode*
fuf-options-for-bookmarkfile-mode fuf.jax /*fuf-options-for-bookmarkfile-mode*
fuf-options-for-buffer-mode fuf.jax /*fuf-options-for-buffer-mode*
fuf-options-for-buffertag-mode fuf.jax /*fuf-options-for-buffertag-mode*
fuf-options-for-changelist-mode fuf.jax /*fuf-options-for-changelist-mode*
fuf-options-for-coveragefile-mode fuf.jax /*fuf-options-for-coveragefile-mode*
fuf-options-for-dir-mode fuf.jax /*fuf-options-for-dir-mode*
fuf-options-for-file-mode fuf.jax /*fuf-options-for-file-mode*
fuf-options-for-help-mode fuf.jax /*fuf-options-for-help-mode*
fuf-options-for-jumplist-mode fuf.jax /*fuf-options-for-jumplist-mode*
fuf-options-for-line-mode fuf.jax /*fuf-options-for-line-mode*
fuf-options-for-mrucmd-mode fuf.jax /*fuf-options-for-mrucmd-mode*
fuf-options-for-mrufile-mode fuf.jax /*fuf-options-for-mrufile-mode*
fuf-options-for-quickfix-mode fuf.jax /*fuf-options-for-quickfix-mode*
fuf-options-for-tag-mode fuf.jax /*fuf-options-for-tag-mode*
fuf-options-for-taggedfile-mode fuf.jax /*fuf-options-for-taggedfile-mode*
fuf-quickfix-mode fuf.jax /*fuf-quickfix-mode*
fuf-reusing-window fuf.jax /*fuf-reusing-window*
fuf-search-patterns fuf.jax /*fuf-search-patterns*
fuf-setting-one-time-option fuf.jax /*fuf-setting-one-time-option*
fuf-sorting-of-completion-items fuf.jax /*fuf-sorting-of-completion-items*
fuf-tag-mode fuf.jax /*fuf-tag-mode*
fuf-taggedfile-mode fuf.jax /*fuf-taggedfile-mode*
fuf-usage fuf.jax /*fuf-usage*
fuf-vimrc-example fuf.jax /*fuf-vimrc-example*
fuf.jax fuf.jax /*fuf.jax*
fuzzyfinder fuf.jax /*fuzzyfinder*
g:fuf_abbrevMap fuf.jax /*g:fuf_abbrevMap*
g:fuf_autoPreview fuf.jax /*g:fuf_autoPreview*
g:fuf_bookmarkdir_keyDelete fuf.jax /*g:fuf_bookmarkdir_keyDelete*
g:fuf_bookmarkdir_prompt fuf.jax /*g:fuf_bookmarkdir_prompt*
g:fuf_bookmarkdir_switchOrder fuf.jax /*g:fuf_bookmarkdir_switchOrder*
g:fuf_bookmarkfile_keyDelete fuf.jax /*g:fuf_bookmarkfile_keyDelete*
g:fuf_bookmarkfile_prompt fuf.jax /*g:fuf_bookmarkfile_prompt*
g:fuf_bookmarkfile_searchRange fuf.jax /*g:fuf_bookmarkfile_searchRange*
g:fuf_bookmarkfile_switchOrder fuf.jax /*g:fuf_bookmarkfile_switchOrder*
g:fuf_buffer_keyDelete fuf.jax /*g:fuf_buffer_keyDelete*
g:fuf_buffer_mruOrder fuf.jax /*g:fuf_buffer_mruOrder*
g:fuf_buffer_prompt fuf.jax /*g:fuf_buffer_prompt*
g:fuf_buffer_switchOrder fuf.jax /*g:fuf_buffer_switchOrder*
g:fuf_buffertag_ctagsPath fuf.jax /*g:fuf_buffertag_ctagsPath*
g:fuf_buffertag_prompt fuf.jax /*g:fuf_buffertag_prompt*
g:fuf_buffertag_switchOrder fuf.jax /*g:fuf_buffertag_switchOrder*
g:fuf_changelist_prompt fuf.jax /*g:fuf_changelist_prompt*
g:fuf_changelist_switchOrder fuf.jax /*g:fuf_changelist_switchOrder*
g:fuf_coveragefile_exclude fuf.jax /*g:fuf_coveragefile_exclude*
g:fuf_coveragefile_globPatterns fuf.jax /*g:fuf_coveragefile_globPatterns*
g:fuf_coveragefile_prompt fuf.jax /*g:fuf_coveragefile_prompt*
g:fuf_coveragefile_switchOrder fuf.jax /*g:fuf_coveragefile_switchOrder*
g:fuf_dataDir fuf.jax /*g:fuf_dataDir*
g:fuf_dir_exclude fuf.jax /*g:fuf_dir_exclude*
g:fuf_dir_prompt fuf.jax /*g:fuf_dir_prompt*
g:fuf_dir_switchOrder fuf.jax /*g:fuf_dir_switchOrder*
g:fuf_enumeratingLimit fuf.jax /*g:fuf_enumeratingLimit*
g:fuf_file_exclude fuf.jax /*g:fuf_file_exclude*
g:fuf_file_prompt fuf.jax /*g:fuf_file_prompt*
g:fuf_file_switchOrder fuf.jax /*g:fuf_file_switchOrder*
g:fuf_fuzzyRefining fuf.jax /*g:fuf_fuzzyRefining*
g:fuf_help_prompt fuf.jax /*g:fuf_help_prompt*
g:fuf_help_switchOrder fuf.jax /*g:fuf_help_switchOrder*
g:fuf_ignoreCase fuf.jax /*g:fuf_ignoreCase*
g:fuf_jumplist_prompt fuf.jax /*g:fuf_jumplist_prompt*
g:fuf_jumplist_switchOrder fuf.jax /*g:fuf_jumplist_switchOrder*
g:fuf_keyNextMode fuf.jax /*g:fuf_keyNextMode*
g:fuf_keyNextPattern fuf.jax /*g:fuf_keyNextPattern*
g:fuf_keyOpen fuf.jax /*g:fuf_keyOpen*
g:fuf_keyOpenSplit fuf.jax /*g:fuf_keyOpenSplit*
g:fuf_keyOpenTabpage fuf.jax /*g:fuf_keyOpenTabpage*
g:fuf_keyOpenVsplit fuf.jax /*g:fuf_keyOpenVsplit*
g:fuf_keyPrevMode fuf.jax /*g:fuf_keyPrevMode*
g:fuf_keyPrevPattern fuf.jax /*g:fuf_keyPrevPattern*
g:fuf_keyPreview fuf.jax /*g:fuf_keyPreview*
g:fuf_keySwitchMatching fuf.jax /*g:fuf_keySwitchMatching*
g:fuf_learningLimit fuf.jax /*g:fuf_learningLimit*
g:fuf_line_prompt fuf.jax /*g:fuf_line_prompt*
g:fuf_line_switchOrder fuf.jax /*g:fuf_line_switchOrder*
g:fuf_maxMenuWidth fuf.jax /*g:fuf_maxMenuWidth*
g:fuf_modesDisable fuf.jax /*g:fuf_modesDisable*
g:fuf_mrucmd_exclude fuf.jax /*g:fuf_mrucmd_exclude*
g:fuf_mrucmd_maxItem fuf.jax /*g:fuf_mrucmd_maxItem*
g:fuf_mrucmd_prompt fuf.jax /*g:fuf_mrucmd_prompt*
g:fuf_mrucmd_switchOrder fuf.jax /*g:fuf_mrucmd_switchOrder*
g:fuf_mrufile_exclude fuf.jax /*g:fuf_mrufile_exclude*
g:fuf_mrufile_keyExpand fuf.jax /*g:fuf_mrufile_keyExpand*
g:fuf_mrufile_maxItem fuf.jax /*g:fuf_mrufile_maxItem*
g:fuf_mrufile_maxItemDir fuf.jax /*g:fuf_mrufile_maxItemDir*
g:fuf_mrufile_prompt fuf.jax /*g:fuf_mrufile_prompt*
g:fuf_mrufile_switchOrder fuf.jax /*g:fuf_mrufile_switchOrder*
g:fuf_patternSeparator fuf.jax /*g:fuf_patternSeparator*
g:fuf_previewHeight fuf.jax /*g:fuf_previewHeight*
g:fuf_promptHighlight fuf.jax /*g:fuf_promptHighlight*
g:fuf_quickfix_prompt fuf.jax /*g:fuf_quickfix_prompt*
g:fuf_quickfix_switchOrder fuf.jax /*g:fuf_quickfix_switchOrder*
g:fuf_reuseWindow fuf.jax /*g:fuf_reuseWindow*
g:fuf_splitPathMatching fuf.jax /*g:fuf_splitPathMatching*
g:fuf_tag_prompt fuf.jax /*g:fuf_tag_prompt*
g:fuf_tag_switchOrder fuf.jax /*g:fuf_tag_switchOrder*
g:fuf_taggedfile_prompt fuf.jax /*g:fuf_taggedfile_prompt*
g:fuf_taggedfile_switchOrder fuf.jax /*g:fuf_taggedfile_switchOrder*
g:fuf_timeFormat fuf.jax /*g:fuf_timeFormat*
g:fuf_useMigemo fuf.jax /*g:fuf_useMigemo*

View File

@ -0,0 +1,158 @@
"=============================================================================
" Copyright (c) 2007-2010 Takeshi NISHIDA
"
" GetLatestVimScripts: 1984 1 :AutoInstall: FuzzyFinder
"=============================================================================
" LOAD GUARD {{{1
try
if !l9#guardScriptLoading(expand('<sfile>:p'), 702, 101, [])
finish
endif
catch /E117/
echoerr '***** L9 library must be installed! *****'
finish
endtry
" }}}1
"=============================================================================
" LOCAL FUNCTIONS {{{1
"
function s:initialize()
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_modesDisable' , [ 'mrufile', 'mrucmd', ])
call l9#defineVariableDefault('g:fuf_keyOpen' , '<CR>')
call l9#defineVariableDefault('g:fuf_keyOpenSplit' , '<C-j>')
call l9#defineVariableDefault('g:fuf_keyOpenVsplit' , '<C-k>')
call l9#defineVariableDefault('g:fuf_keyOpenTabpage' , '<C-l>')
call l9#defineVariableDefault('g:fuf_keyPreview' , '<C-@>')
call l9#defineVariableDefault('g:fuf_keyNextMode' , '<C-t>')
call l9#defineVariableDefault('g:fuf_keyPrevMode' , '<C-y>')
call l9#defineVariableDefault('g:fuf_keyPrevPattern' , '<C-s>')
call l9#defineVariableDefault('g:fuf_keyNextPattern' , '<C-_>')
call l9#defineVariableDefault('g:fuf_keySwitchMatching', '<C-\><C-\>')
call l9#defineVariableDefault('g:fuf_dataDir' , '~/.vim-fuf-data')
call l9#defineVariableDefault('g:fuf_abbrevMap' , {})
call l9#defineVariableDefault('g:fuf_patternSeparator' , ';')
call l9#defineVariableDefault('g:fuf_promptHighlight' , 'Question')
call l9#defineVariableDefault('g:fuf_ignoreCase' , 1)
call l9#defineVariableDefault('g:fuf_splitPathMatching', 1)
call l9#defineVariableDefault('g:fuf_fuzzyRefining' , 0)
call l9#defineVariableDefault('g:fuf_smartBs' , 1)
call l9#defineVariableDefault('g:fuf_reuseWindow' , 1)
call l9#defineVariableDefault('g:fuf_timeFormat' , '(%Y-%m-%d %H:%M:%S)')
call l9#defineVariableDefault('g:fuf_learningLimit' , 100)
call l9#defineVariableDefault('g:fuf_enumeratingLimit' , 50)
call l9#defineVariableDefault('g:fuf_maxMenuWidth' , 78)
call l9#defineVariableDefault('g:fuf_previewHeight' , 0)
call l9#defineVariableDefault('g:fuf_autoPreview' , 0)
call l9#defineVariableDefault('g:fuf_useMigemo' , 0)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_buffer_prompt' , '>Buffer[]>')
call l9#defineVariableDefault('g:fuf_buffer_switchOrder', 10)
call l9#defineVariableDefault('g:fuf_buffer_mruOrder' , 1)
call l9#defineVariableDefault('g:fuf_buffer_keyDelete' , '<C-]>')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_file_prompt' , '>File[]>')
call l9#defineVariableDefault('g:fuf_file_switchOrder', 20)
call l9#defineVariableDefault('g:fuf_file_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_coveragefile_prompt' , '>CoverageFile[]>')
call l9#defineVariableDefault('g:fuf_coveragefile_switchOrder', 30)
call l9#defineVariableDefault('g:fuf_coveragefile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])')
call l9#defineVariableDefault('g:fuf_coveragefile_globPatterns', ['**/.*', '**/*'])
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_dir_prompt' , '>Dir[]>')
call l9#defineVariableDefault('g:fuf_dir_switchOrder', 40)
call l9#defineVariableDefault('g:fuf_dir_exclude' , '\v(^|[/\\])\.(hg|git|bzr)($|[/\\])')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_mrufile_prompt' , '>MRU-File[]>')
call l9#defineVariableDefault('g:fuf_mrufile_switchOrder', 50)
call l9#defineVariableDefault('g:fuf_mrufile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|^(\/\/|\\\\|\/mnt\/|\/media\/)')
call l9#defineVariableDefault('g:fuf_mrufile_maxItem' , 200)
call l9#defineVariableDefault('g:fuf_mrufile_maxItemDir' , 50)
call l9#defineVariableDefault('g:fuf_mrufile_keyExpand' , '<C-]>')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_mrucmd_prompt' , '>MRU-Cmd[]>')
call l9#defineVariableDefault('g:fuf_mrucmd_switchOrder', 60)
call l9#defineVariableDefault('g:fuf_mrucmd_exclude' , '^$')
call l9#defineVariableDefault('g:fuf_mrucmd_maxItem' , 200)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_bookmarkfile_prompt' , '>Bookmark-File[]>')
call l9#defineVariableDefault('g:fuf_bookmarkfile_switchOrder', 70)
call l9#defineVariableDefault('g:fuf_bookmarkfile_searchRange', 400)
call l9#defineVariableDefault('g:fuf_bookmarkfile_keyDelete' , '<C-]>')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_bookmarkdir_prompt' , '>Bookmark-Dir[]>')
call l9#defineVariableDefault('g:fuf_bookmarkdir_switchOrder', 80)
call l9#defineVariableDefault('g:fuf_bookmarkdir_keyDelete' , '<C-]>')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_tag_prompt' , '>Tag[]>')
call l9#defineVariableDefault('g:fuf_tag_switchOrder', 90)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_buffertag_prompt' , '>Buffer-Tag[]>')
call l9#defineVariableDefault('g:fuf_buffertag_switchOrder', 100)
call l9#defineVariableDefault('g:fuf_buffertag_ctagsPath' , 'ctags')
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_taggedfile_prompt' , '>Tagged-File[]>')
call l9#defineVariableDefault('g:fuf_taggedfile_switchOrder', 110)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_jumplist_prompt' , '>Jump-List[]>')
call l9#defineVariableDefault('g:fuf_jumplist_switchOrder', 120)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_changelist_prompt' , '>Change-List[]>')
call l9#defineVariableDefault('g:fuf_changelist_switchOrder', 130)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_quickfix_prompt' , '>Quickfix[]>')
call l9#defineVariableDefault('g:fuf_quickfix_switchOrder', 140)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_line_prompt' , '>Line[]>')
call l9#defineVariableDefault('g:fuf_line_switchOrder', 150)
"---------------------------------------------------------------------------
call l9#defineVariableDefault('g:fuf_help_prompt' , '>Help[]>')
call l9#defineVariableDefault('g:fuf_help_switchOrder', 160)
"---------------------------------------------------------------------------
command! -bang -narg=0 FufEditDataFile call fuf#editDataFile()
command! -bang -narg=0 FufRenewCache call s:renewCachesOfAllModes()
"---------------------------------------------------------------------------
call fuf#addMode('buffer')
call fuf#addMode('file')
call fuf#addMode('coveragefile')
call fuf#addMode('dir')
call fuf#addMode('mrufile')
call fuf#addMode('mrucmd')
call fuf#addMode('bookmarkfile')
call fuf#addMode('bookmarkdir')
call fuf#addMode('tag')
call fuf#addMode('buffertag')
call fuf#addMode('taggedfile')
call fuf#addMode('jumplist')
call fuf#addMode('changelist')
call fuf#addMode('quickfix')
call fuf#addMode('line')
call fuf#addMode('help')
call fuf#addMode('givenfile')
call fuf#addMode('givendir')
call fuf#addMode('givencmd')
call fuf#addMode('callbackfile')
call fuf#addMode('callbackitem')
"---------------------------------------------------------------------------
endfunction
"
function s:renewCachesOfAllModes()
for m in fuf#getModeNames()
call fuf#{m}#renewCache()
endfor
endfunction
" }}}1
"=============================================================================
" INITIALIZATION {{{1
call s:initialize()
" }}}1
"=============================================================================
" vim: set fdm=marker:

View File

@ -0,0 +1,73 @@
" Vim syntax file
" Language: build logs
" Maintainer: Julian Ospald
" Latest Revision: 30 May 2012
if exists("b:current_syntax")
finish
endif
" flags
syn match CFLAGS " -g"
syn match CFLAGS " -[a-zA-Z][a-zA-Z0-9_\-\,\=\.\/]\+"
syn match CPPFLAGS " -D[a-zA-Z0-9_\-\,\=\.\/\"]\+"
syn match LINK " -l[a-zA-Z0-9_\-\,\=\.\/]\+"
syn match LDFLAGS " -L[a-zA-Z0-9_\-\,\=\.\/]\+"
syn match LDFLAGS " -Wl,[a-zA-Z0-9_\-\,\=\.\/]\+"
syn match LDFLAGS " -shared"
syn match LDFLAGS " -static"
syn match LDFLAGS " -static[a-zA-Z0-9_\-\,\=\.\/]\+"
syn match LDFLAGS " -rdynamic"
syn match INCS " -I[a-zA-Z0-9_\-\,\=\.\/]\+"
" files
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.c"
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.cc"
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.cxx"
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.cpp"
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.h"
syn match SOURCE " [a-zA-Z0-9_\-\,\=\.\/]\+\.hpp"
syn match OBJECTS " [a-zA-Z0-9_\-\,\=\.\/]\+\.o"
syn match LIBS " [a-zA-Z0-9_\,\=\.\/]\+\.a"
syn match LIBS " [a-zA-Z0-9_\,\=\.\/]\+\.so"
syn match LIBS " [a-zA-Z0-9_\,\=\.\/]\+\.so[\.0-9]\+"
syn match TARGETS " -o [a-zA-Z0-9_\-\,\=\.\/]\+"
" messages
syn match cMLogMissing "[\./a-zA-Z0-9_]\+\.[a-zA-Z_]\+: No such .*$"
syn match cMLogMissing "[\./a-zA-Z0-9_]\+\.[a-zA-Z_]\+: Datei oder Verzeichnis nicht gefunden"
syn match cMLogMissing "undefined reference to .*$"
syn match cMLogMissing "Keine Regel vorhanden.*$"
syn match cMLogCurDir "Entering directory .*$"
" syn match cMLogCurDir "cd [a-zA-Z0-9_\-\,\=\.\/]\+"
syn match cMLogWarn "\<[wW]arn[iu]ng.*$"
syn match cMLogErr "[Ee]rror.*$"
syn match cMLogErr "No such .*$"
" disrespected toolchain
syn match toolchain "\V\C\<\(-\)\@<!ar\>"
syn match toolchain "\V\C\<\(-\)\@<!ranlib\>"
syn match toolchain "\V\C\<\(-\)\@<!cc\>"
syn match toolchain "\V\C\<\(-\)\@<!gcc\>"
syn match toolchain "\V\C\<\(-\)\@<!c\>\+++"
syn match toolchain "\V\C\<\(-\)\@<!g\>\+++"
hi cMLogWarn guifg=Red
hi cMLogErr guifg=Red term=underline cterm=underline gui=underline
hi cMLogCurDir guifg=Blue
hi cMLogMissing guifg=Red
hi toolchain guifg=Red
hi CFLAGS guifg=Green
hi CPPFLAGS guifg=DarkGreen
hi LINK guifg=Yellow
hi LDFLAGS guifg=Orange
hi INCS guifg=DarkViolet
hi TARGETS guifg=Brown
hi LIBS guifg=Brown
hi OBJECTS guifg=Black
hi SOURCE guifg=Grey
let b:current_syntax = "log"

View File

@ -0,0 +1,461 @@
*paredit.txt* Paredit Last Change: 13 Dec 2016
Paredit Mode for Vim *paredit* *slimv-paredit*
Version 0.9.13
The paredit.vim plugin performs structured editing of s-expressions used in
the Lisp, Clojure, Scheme programming languages. It may come as part of Slimv
but it is also distributed separately as a standalone plugin.
|paredit-mode| Paredit mode
|paredit-keys| Paredit keybindings
|paredit-options| Paredit options
===============================================================================
PAREDIT MODE *paredit-mode*
Paredit mode is a special editing mode that keeps all matched characters
(parentheses, square and curly braces, double quotes) balanced, i.e. all opening
characters have a matching closing character. Most text entering and erasing
commands try to maintain the balanced state, so no single matched character is
added or deleted, they are entered or removed in pairs.
The function takes care of strings and comments, so no parenthesis and square
bracket balancing is performed inside a string or comment.
Please note that [] and {} pairs are not balanced for Lisp filetypes, only
for Clojure and Scheme.
The idea is taken from the paredit mode of Emacs, but not all paredit.el
editing functions are implemented or behave exactly the same way as they do
in Emacs.
When you enter a '(' then a matching ')' is automatically inserted.
If needed, spaces before and/or after the '()' pair are added.
When you press ')' in insert mode then there's no need to insert a closing
parenthesis mark (it is already there), so the cursor is simply advanced past
the next closing parenthesis (then the next outer closing parenthesis, etc.).
The result of this is however that when entering text with paredit mode
you can use the same keystrokes as without paredit mode and you get the same
result. Of course you can choose to not enter the closing parenthesis (as
required without paredit mode), because it is already there.
When you are trying to delete a ')' alone then it is not possible, the cursor
is simply moved inside the list, where all regular characters can be deleted.
When the list is finally empty: '()', then the deletion of the opening '('
makes both parentheses erased at once, so the balanced state is maintained.
All the above holds for [...] and "..." character pairs.
When you are deleting multiple characters at once, e.g. deleting a whole line,
or deleting till the end of the line, etc, then the deletion logic of a single
character is iterated. This means that the whole line or the characters till
the end of the line, etc are not necessarily deleted all. Depending on the
number of open/close parentheses, square or curly braces, double quotes some
of them might be kept in order to maintain the balanced state.
For example if you press D in Normal mode to delete till the end of line
between the a and b parameters of the following Clojure function definition:
(defn myfunc [a b c] (+ a b c))
^--- press D here
then the closing ] as well as the last closing ) will not be deleted, because
in the list you have an ( and a [ to be matched, so the result will be:
(defn myfunc [a])
If you are deleting multiple lines, then the above process is performed for
all lines involved. If a line was not completely cleared, then it is joined
with the next line and the process continues.
Of course not all Vim commands are compatible with the paredit mode (e.g.
you can yank and paste unbalanced code snippet, or comment out an asymmetrical
part of the code), and there is also the possibility to edit the source code
with paredit mode switched off or with another editor to make it unbalanced.
When paredit mode detects that the underlying code is not balanced, then the
paredit functionality is suspended until the top level form balance is fixed.
As soon as all parens are matched, the paredit mode is automatically resumed.
Paredit needs "syntax on" to identify the syntax elements of the underlying
code, so if syntax is switched off, then paredit will not be suspended inside
comments or strings.
Slurpage and Barfage known from Emacs is also possible but in a different
fashion: you don't move the symbols but move the opening or closing parenthesis
over the symbol or a sub-list. This way you can move any symbol or sub-list
into or out of the current list. It is not possible to move the parenthesis
over its pair, so for example if you move the opening parenthesis to the right,
then it will stop at the matched closing parenthesis.
Paredit mode is set by default for .lisp, .cl, .clj, cljs, .scm and .rkt files,
but it is possible to switch it off by putting the following statement in the
.vimrc file:
let g:paredit_mode = 0
You can enable paredit mode for other file types as well. Here is how to set
it for Arc files in your .vimrc (assuming you have a filetype 'arc' defined):
au FileType arc call PareditInitBuffer()
Paredit is part of Slimv, but it is also distributed separately as a standalone
plugin. If you indend to use the SWANK client and/or Slimv's indentation and
syntax functions, then please install the Slimv plugin. Otherwise you may want
to install the Paredit plugin thus omitting other unnecessary files.
===============================================================================
PAREDIT KEYBINDINGS *paredit-keys*
Here follows a list of paredit keybindings:
Insert Mode:
( Inserts '()' and moves the cursor inside. Also adds leading
or trailing spaces when needed.
Inserts '(' when inside comment or string.
) Moves the cursor to the next closing parenthesis mark of
the current list. When pressed again then moves to the next
outer closing parenthesis, etc, until the closing of the
top level form is reached.
Inserts ')' when inside comment or string.
If |g:paredit_electric_return| is on then it also re-gathers
electric returns when appropriate.
[ Inserts '[]' and moves the cursor inside. Also adds leading
or trailing spaces when needed.
Inserts '[' when inside comment or string.
] Moves the cursor to the next closing square bracket of the
current list. When pressed again then moves to the next
outer closing square bracket, etc, until the closing of the
top level form is reached.
Inserts ']' when inside comment or string.
If |g:paredit_electric_return| is on then it also re-gathers
electric returns when appropriate.
{ Inserts '{}' and moves the cursor inside. Also adds leading
or trailing spaces when needed.
Inserts '{' when inside comment or string.
} Moves the cursor to the next closing curly brace of the
current list. When pressed again then moves to the next
outer closing curly brace, etc, until the closing of the
top level form is reached.
Inserts '}' when inside comment or string.
If |g:paredit_electric_return| is on then it also re-gathers
electric returns when appropriate.
" When outside of string, inserts '""' and moves the cursor
inside. When inside string then moves to the closing '"'.
Inserts '"' when inside comment. Also insert '"' when inside
string and preceded by a '\'.
<BS> When about to delete a (, ), [, ], or " and there are other
characters inside, then just skip it to the left. When
about to delete the opening part of the matched character
with nothing inside, then the whole empty list is removed.
<Del> When about to delete a (, ), [, ], or " and there are other
characters inside, then just skip it to the right. When
about to delete the closing part of the matched character
with nothing inside, then the whole empty list is removed.
<Enter> If |g:paredit_electric_return| is on then insert an
"electric return", i.e. create an empty line by inserting
two newline characters.
Normal Mode:
( Finds opening '(' of the current list. Can be pressed
repeatedly until the opening of the top level form reached.
) Finds closing ')' of the current list. Can be pressed
repeatedly until the closing of the top level form reached.
[[ Go to the start of current/previous defun.
]] Go to the start of next defun.
<Leader>< If standing on a delimiter (parenthesis or square bracket)
then moves it to the left by slurping or barfing the
s-expression to the left, depending on the direction of the
delimiter:
Pressing '<' when standing on a ')' makes the s-expression
to the left of the ')' going out of the current list.
Pressing '<' when standing on a '(' makes the s-expression
to the left of the '(' coming into the current list.
For example pressing <Leader>< at position marked with |:
(aaa bbb|) ---> (aaa|) bbb
aaa |(bbb) ---> |(aaa bbb)
<Leader>> If standing on a delimiter (parenthesis or square bracket)
then moves it to the right by slurping or barfing the
s-expression to the right, depending on the direction of the
delimiter:
Pressing '>' when standing on a '(' makes the s-expression
to the right of the '(' going out of the current list.
Pressing '>' when standing on a ')' makes the s-expression
to the right of the ')' coming into the current list.
For example pressing <Leader>< at position marked with |:
(aaa|) bbb ---> (aaa bbb|)
|(aaa bbb) ---> aaa |(bbb)
<Leader>J Join two subsequent lists or strings. The first one must end
before the cursor, the second one must start after the
cursor position.
For example pressing <Leader>J at position marked with |:
(aaa)| (bbb) ---> (aaa |bbb)
"aaa"| "bbb" ---> "aaa |bbb"
<Leader>O Split ("Open") current list or string at the cursor position.
Opposite of Join. Key O is selected because for the original
Vim mapping J and O are also kind of opposites.
For example pressing <Leader>O at position marked with |:
(aaa |bbb) ---> (aaa) |(bbb)
"aaa|bbb" ---> "aaa" |"bbb"
<Leader>W Wrap the current symbol in a pair of parentheses. The cursor
<Leader>w( is then positioned on the opening parenthesis, as wrapping
is usually done because one wants to call a function with
the symbol as parameter, so by pressing "a" one can enter
the function name right after the newly inserted "(".
For example pressing <Leader>W at position marked with |:
(aaa b|bb ccc) ---> (aaa |(bbb) ccc)
<Leader>w[ Wrap the current symbol in a pair of square brackets,
similarly to <Leader>W.
For example pressing <Leader>w[ at position marked with |:
(aaa b|bb ccc) ---> (aaa |[bbb] ccc)
<Leader>w{ Wrap the current symbol in a pair of curly braces,
similarly to <Leader>W.
For example pressing <Leader>w{ at position marked with |:
(aaa b|bb ccc) ---> (aaa |{bbb} ccc)
<Leader>w" Wrap the current symbol in a pair of double quotes,
similarly to <Leader>W.
For example pressing <Leader>w" at position marked with |:
(aaa b|bb ccc) ---> (aaa "bbb|" ccc)
<Leader>S Splice the current list into the containing list, i.e.
remove the opening and closing parens. Opposite of wrap.
For example pressing <Leader>S at position marked with |:
(aaa (b|bb ccc) ddd) ---> (aaa |bbb ccc ddd)
<Leader><Up> Splice the current list into the containing list by deleting
everything backward from the cursor position up to the
opening paren.
For example pressing <Leader><Up> at position marked with |:
(aaa (bbb |ccc) ddd) ---> (aaa |ccc ddd)
<Leader><Down> Splice the current list into the containing list by deleting
everything forward from the cursor position up to the
closing paren.
For example pressing <Leader><Down> at position marked with |:
(aaa (bbb| ccc) ddd) ---> (aaa |bbb ddd)
<Leader>I Raise the current symbol, i.e. replace the current list with
the current symbol by deleting everything else (except the
symbol) in the list, including the enclosing pair of parens.
For example pressing <Leader>I at position marked with |:
(aaa (b|bb ccc) ddd) ---> (aaa |bbb ddd)
x or <Del> When about to delete a (, ), [, ], or " and there are other
characters inside, then just skip it to the right. When
about to delete the closing part of the matched character
with nothing inside, then the whole empty list is removed.
When preceded by a <count> value then delete this many
characters.
X When about to delete a (, ), [, ], or " and there are other
characters inside, then just skip it to the left. When
about to delete the opening part of the matched character
with nothing inside, then the whole empty list is removed.
D Keep deleting characters towards the end of line,
maintaining the balanced state, i.e. keep the number of
opening and closing parens the same.
C Same as 'D' but go to insert mode at the end.
s Same as 'x' but go to insert mode at the end.
dd Delete whole line by keeping the balanced state, i.e.
keep the number of opening and closing parens the same.
When preceded by a <count> value then delete this many
lines.
cc Same as 'dd' but go to insert mode at the end.
d{motion} Delete text till {motion}. Keeps text balanced, so if the
surrounded text contains unpaired matched characters then
they are not removed.
c{motion} Delete text till {motion} and start insert mode. Keeps text
balanced just like d{motion}.
p Put the text after the cursor with all unbalanced matched
characters removed.
P Put the text before the cursor with all unbalanced matched
characters removed.
Visual Mode:
( Finds opening '(' of the current list and selects the whole
list. Can be pressed repeatedly until the top level form
selected.
) Finds closing ')' of the current list and selects the whole
list. Can be pressed repeatedly until the top level form
selected.
d Delete the current visual selection. Keeps text balanced,
x so the the selection contains unpaired matched characters
<Del> then they are not removed.
c Delete the current visual selection and start insert mode.
Keeps text balanced just like the 'd' command.
<Leader>W Wrap the current visual selection in a pair of parentheses.
<Leader>w( The visual selection is kept.
<Leader>w[ Wrap the current visual selection in a pair of square
brackets. The visual selection is kept.
<Leader>w{ Wrap the current visual selection in a pair of curly braces.
The visual selection is kept.
<Leader>w" Wrap the current visual selection in a pair of double
quotes. The visual selection is kept.
Please note that if variable |g:paredit_shortmaps| is nonzero then the
following normal mode mappings don't get a <Leader> prefix, they are mapped
to existing (but infrequently used) Vim functions and instead the original Vim
functions are mapped with the <Leader> prefix:
<, >, J, O, W, S
Vim has many built-in mappings for manipulating s-expressions. Here follows a
list of useful commands, these are not defined by paredit.vim, they are
available even when paredit mode is switched off.
% Find the matching pair of the parenthesis the cursor is
standing on.
d% Delete till the matching parenthesis. Normally it is used
when the cursor is standing on a parenthesis (works with
square or curly braces as well). If not standing on a
parenthesis then deletes left till the first opening paren,
so this command may also be used to delete an s-expression
that is right before the cursor.
daw Delete a word. Can be used to delete a list element, the
cursor may be placed anywhere in the element.
da( Delete the innermost s-expression. The cursor may be placed
anywhere inside the s-expression.
di( Same as da( but does not delete the enclosing parens.
Davide Taviani made a cheetsheet for Paredit, which can be accessed here:
https://github.com/StudyFlow/paredit.vim-cheatsheet
===============================================================================
PAREDIT OPTIONS *paredit-options*
|g:paredit_disable_clojure| If defined, paredit is disabled for clojure files.
|g:paredit_disable_hy| If defined, paredit is disabled for hy files.
|g:paredit_disable_lisp| If defined, paredit is disabled for lisp files.
|g:paredit_disable_scheme| If defined, paredit is disabled for scheme files.
|g:paredit_disable_shen| If defined, paredit is disabled for shen files.
|g:paredit_electric_return| If nonzero, electric return feature is enabled.
|g:paredit_smartjump| If nonzero, '(' and ')' also target square brackets
and curly braces when editing Clojure or Scheme.
|g:paredit_leader| Custom <Leader> setting for Paredit.
|g:paredit_matchlines| Number of lines to look backward and forward
when checking if the current form is balanced.
|g:paredit_mode| If nonzero, paredit mode is switched on.
|g:paredit_shortmaps| If nonzero, paredit is remapping some one-letter
Vim commands that are not frequently used.
*g:paredit_disable_clojure*
*g:paredit_disable_lisp*
*g:paredit_disable_scheme*
*g:paredit_disable_shen*
If defined then paredit is disabled for the given file type. Useful to use
a different plugin for a specific file type, but keep using paredit for the
others.
*g:paredit_electric_return*
If nonzero then "electric return" feature is enabled. This means that when an
<Enter> is pressed before a closing paren in insert mode, paredit will actually
insert two newlines creating an empty line. The extra newline is consumed at
pressing the next closing paren. This feature allows linewise editing of the
subform entered in the next (empty) line.
In other words <Enter> "opens" parenthetical expressions while editing, ')'
"closes" them.
Please note that electric return is disabled for the REPL buffer if Slimv
option |g:slimv_repl_simple_eval| is nonzero. In this case <Enter> is used
to send the command line to the swank server for evaluation.
Please find a video demonstration of the electric return feature here:
http://img8.imageshack.us/img8/9479/openparen.gif
*g:paredit_smartjump*
If nonzero, this option changes the behavior of '(' and ')' in normal and visual
modes when editing Clojure or Scheme. Rather than jumping to nearest open or close
parenthesis, instead the cursor will jump to the nearest '(', '[', or '{' if
you press '(', and it will jump to the nearest ')', ']', or '}' if you press
')'. This option makes it much easier to navigate nested Clojure data
structures. It does nothing if the filetype is not clojure or Scheme.
*g:paredit_leader*
This option allows a custom <Leader> setting for the Paredit keybindings.
By default it has the same value as |mapleader|. If neither g:paredit_leader
nor mapleader are defined then the default <Leader> is "," in Paredit.
Example:
let g:paredit_leader = '\'
If this is set in the .vimrc then Wrap will be mapped to \W instead of ,W.
There is a separate |g:slimv_leader| option for the general Slimv keybindings.
*g:paredit_matchlines*
Number of lines to look backward and forward when checking if the current
top level form is balanced in paredit mode. Default is 100.
*g:paredit_mode*
If nonzero then paredit mode is switched on, i.e. the plugin tries to keep the
balanced state of parens. This is the default behaviour.
*g:paredit_shortmaps*
If nonzero, paredit is remapping some one-letter normal mode Vim commands that
are not frequently used. These are <, >, J, O, W, S. The original function of
these maps then can be reached via <Leader> (which is the "," character
by default in Paredit).
Otherwise these paredit functions can be reached via <Leader> maintaining the
original functions of these keys.
===============================================================================
vim:tw=80:et:wrap:ft=help:norl:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,58 @@
function! Send_to_Tmux(text)
if !exists("b:tmux_sessionname") || !exists("b:tmux_windowname")
if exists("g:tmux_sessionname") && exists("g:tmux_windowname")
let b:tmux_sessionname = g:tmux_sessionname
let b:tmux_windowname = g:tmux_windowname
if exists("g:tmux_panenumber")
let b:tmux_panenumber = g:tmux_panenumber
end
else
call Tmux_Vars()
end
end
let target = b:tmux_sessionname . ":" . b:tmux_windowname
if exists("b:tmux_panenumber")
let target .= "." . b:tmux_panenumber
end
call system("tmux set-buffer -t " . b:tmux_sessionname . " '" . substitute(a:text, "'", "'\\\\''", 'g') . "'" )
call system("tmux paste-buffer -t " . target)
endfunction
function! Tmux_Session_Names(A,L,P)
return system("tmux list-sessions | sed -e 's/:.*$//'")
endfunction
function! Tmux_Window_Names(A,L,P)
return system("tmux list-windows -t" . b:tmux_sessionname . ' | grep -e "^\w:" | sed -e "s/ \[[0-9x]*\]$//"')
endfunction
function! Tmux_Pane_Numbers(A,L,P)
return system("tmux list-panes -t " . b:tmux_sessionname . ":" . b:tmux_windowname . " | sed -e 's/:.*$//'")
endfunction
function! Tmux_Vars()
let b:tmux_sessionname = input("session name: ", "", "custom,Tmux_Session_Names")
let b:tmux_windowname = substitute(input("window name: ", "", "custom,Tmux_Window_Names"), ":.*$" , '', 'g')
if system("tmux list-panes -t " . b:tmux_sessionname . ":" . b:tmux_windowname . " | wc -l") > 1
let b:tmux_panenumber = input("pane number: ", "", "custom,Tmux_Pane_Numbers")
end
if !exists("g:tmux_sessionname") || !exists("g:tmux_windowname")
let g:tmux_sessionname = b:tmux_sessionname
let g:tmux_windowname = b:tmux_windowname
if exists("b:tmux_panenumber")
let g:tmux_panenumber = b:tmux_panenumber
end
end
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
vmap <C-c><C-c> "ry :call Send_to_Tmux(@r)<CR>
nmap <C-c><C-c> vip<C-c><C-c>
nmap <C-c>v :call Tmux_Vars()<CR>

View File

@ -0,0 +1,248 @@
'short'/'long'-formats txtfmt.txt /*'short'\/'long'-formats*
<C-\><C-\> txtfmt.txt /*<C-\\><C-\\>*
[a txtfmt.txt /*[a*
[ba txtfmt.txt /*[ba*
[bc txtfmt.txt /*[bc*
[bf txtfmt.txt /*[bf*
[bk txtfmt.txt /*[bk*
[c txtfmt.txt /*[c*
[ea txtfmt.txt /*[ea*
[ec txtfmt.txt /*[ec*
[ef txtfmt.txt /*[ef*
[ek txtfmt.txt /*[ek*
[f txtfmt.txt /*[f*
[k txtfmt.txt /*[k*
[ta txtfmt.txt /*[ta*
[tba txtfmt.txt /*[tba*
[tbc txtfmt.txt /*[tbc*
[tbf txtfmt.txt /*[tbf*
[tbk txtfmt.txt /*[tbk*
[tc txtfmt.txt /*[tc*
[tea txtfmt.txt /*[tea*
[tec txtfmt.txt /*[tec*
[tef txtfmt.txt /*[tef*
[tek txtfmt.txt /*[tek*
[tf txtfmt.txt /*[tf*
[tk txtfmt.txt /*[tk*
\A txtfmt.txt /*\\A*
\I txtfmt.txt /*\\I*
\O txtfmt.txt /*\\O*
\a txtfmt.txt /*\\a*
\ga txtfmt.txt /*\\ga*
\i txtfmt.txt /*\\i*
\o txtfmt.txt /*\\o*
\s txtfmt.txt /*\\s*
\vA txtfmt.txt /*\\vA*
\vI txtfmt.txt /*\\vI*
\vO txtfmt.txt /*\\vO*
\va txtfmt.txt /*\\va*
\vi txtfmt.txt /*\\vi*
\vo txtfmt.txt /*\\vo*
\vs txtfmt.txt /*\\vs*
]a txtfmt.txt /*]a*
]ba txtfmt.txt /*]ba*
]bc txtfmt.txt /*]bc*
]bf txtfmt.txt /*]bf*
]bk txtfmt.txt /*]bk*
]c txtfmt.txt /*]c*
]ea txtfmt.txt /*]ea*
]ec txtfmt.txt /*]ec*
]ef txtfmt.txt /*]ef*
]ek txtfmt.txt /*]ek*
]f txtfmt.txt /*]f*
]k txtfmt.txt /*]k*
]ta txtfmt.txt /*]ta*
]tba txtfmt.txt /*]tba*
]tbc txtfmt.txt /*]tbc*
]tbf txtfmt.txt /*]tbf*
]tbk txtfmt.txt /*]tbk*
]tc txtfmt.txt /*]tc*
]tea txtfmt.txt /*]tea*
]tec txtfmt.txt /*]tec*
]tef txtfmt.txt /*]tef*
]tek txtfmt.txt /*]tek*
]tf txtfmt.txt /*]tf*
]tk txtfmt.txt /*]tk*
indent_patch.txt txtfmt.txt /*indent_patch.txt*
txtfmt txtfmt.txt /*txtfmt*
txtfmt-'bcm' txtfmt.txt /*txtfmt-'bcm'*
txtfmt-'bgcolormask' txtfmt.txt /*txtfmt-'bgcolormask'*
txtfmt-'cncl' txtfmt.txt /*txtfmt-'cncl'*
txtfmt-'cocu' txtfmt.txt /*txtfmt-'cocu'*
txtfmt-'conceal' txtfmt.txt /*txtfmt-'conceal'*
txtfmt-'concealcursor' txtfmt.txt /*txtfmt-'concealcursor'*
txtfmt-'esc' txtfmt.txt /*txtfmt-'esc'*
txtfmt-'escape' txtfmt.txt /*txtfmt-'escape'*
txtfmt-'fcm' txtfmt.txt /*txtfmt-'fcm'*
txtfmt-'fgcolormask' txtfmt.txt /*txtfmt-'fgcolormask'*
txtfmt-'nested' txtfmt.txt /*txtfmt-'nested'*
txtfmt-'nst' txtfmt.txt /*txtfmt-'nst'*
txtfmt-'pack' txtfmt.txt /*txtfmt-'pack'*
txtfmt-'pck' txtfmt.txt /*txtfmt-'pck'*
txtfmt-'rng' txtfmt.txt /*txtfmt-'rng'*
txtfmt-'sync' txtfmt.txt /*txtfmt-'sync'*
txtfmt-'tokrange' txtfmt.txt /*txtfmt-'tokrange'*
txtfmt-'tokrange'-expr txtfmt.txt /*txtfmt-'tokrange'-expr*
txtfmt-'uc' txtfmt.txt /*txtfmt-'uc'*
txtfmt-'undercurl' txtfmt.txt /*txtfmt-'undercurl'*
txtfmt-:GetTokInfo txtfmt.txt /*txtfmt-:GetTokInfo*
txtfmt-:MakeTestPage txtfmt.txt /*txtfmt-:MakeTestPage*
txtfmt-:MoveStartTok txtfmt.txt /*txtfmt-:MoveStartTok*
txtfmt-:Refresh txtfmt.txt /*txtfmt-:Refresh*
txtfmt-:ShowTokenMap txtfmt.txt /*txtfmt-:ShowTokenMap*
txtfmt-GetTokInfo() txtfmt.txt /*txtfmt-GetTokInfo()*
txtfmt-GetTokStr() txtfmt.txt /*txtfmt-GetTokStr()*
txtfmt-bck-till-any-beg-tok txtfmt.txt /*txtfmt-bck-till-any-beg-tok*
txtfmt-bck-till-any-end-tok txtfmt.txt /*txtfmt-bck-till-any-end-tok*
txtfmt-bck-till-any-tok txtfmt.txt /*txtfmt-bck-till-any-tok*
txtfmt-bck-till-bgc-beg-tok txtfmt.txt /*txtfmt-bck-till-bgc-beg-tok*
txtfmt-bck-till-bgc-end-tok txtfmt.txt /*txtfmt-bck-till-bgc-end-tok*
txtfmt-bck-till-bgc-tok txtfmt.txt /*txtfmt-bck-till-bgc-tok*
txtfmt-bck-till-clr-beg-tok txtfmt.txt /*txtfmt-bck-till-clr-beg-tok*
txtfmt-bck-till-clr-end-tok txtfmt.txt /*txtfmt-bck-till-clr-end-tok*
txtfmt-bck-till-clr-tok txtfmt.txt /*txtfmt-bck-till-clr-tok*
txtfmt-bck-till-fmt-beg-tok txtfmt.txt /*txtfmt-bck-till-fmt-beg-tok*
txtfmt-bck-till-fmt-end-tok txtfmt.txt /*txtfmt-bck-till-fmt-end-tok*
txtfmt-bck-till-fmt-tok txtfmt.txt /*txtfmt-bck-till-fmt-tok*
txtfmt-bck-to-any-beg-tok txtfmt.txt /*txtfmt-bck-to-any-beg-tok*
txtfmt-bck-to-any-end-tok txtfmt.txt /*txtfmt-bck-to-any-end-tok*
txtfmt-bck-to-any-tok txtfmt.txt /*txtfmt-bck-to-any-tok*
txtfmt-bck-to-bgc-beg-tok txtfmt.txt /*txtfmt-bck-to-bgc-beg-tok*
txtfmt-bck-to-bgc-end-tok txtfmt.txt /*txtfmt-bck-to-bgc-end-tok*
txtfmt-bck-to-bgc-tok txtfmt.txt /*txtfmt-bck-to-bgc-tok*
txtfmt-bck-to-clr-beg-tok txtfmt.txt /*txtfmt-bck-to-clr-beg-tok*
txtfmt-bck-to-clr-end-tok txtfmt.txt /*txtfmt-bck-to-clr-end-tok*
txtfmt-bck-to-clr-tok txtfmt.txt /*txtfmt-bck-to-clr-tok*
txtfmt-bck-to-fmt-beg-tok txtfmt.txt /*txtfmt-bck-to-fmt-beg-tok*
txtfmt-bck-to-fmt-end-tok txtfmt.txt /*txtfmt-bck-to-fmt-end-tok*
txtfmt-bck-to-fmt-tok txtfmt.txt /*txtfmt-bck-to-fmt-tok*
txtfmt-buflocal-user-map txtfmt.txt /*txtfmt-buflocal-user-map*
txtfmt-choosing-token-range txtfmt.txt /*txtfmt-choosing-token-range*
txtfmt-clr-spec txtfmt.txt /*txtfmt-clr-spec*
txtfmt-color-config txtfmt.txt /*txtfmt-color-config*
txtfmt-color-defaults txtfmt.txt /*txtfmt-color-defaults*
txtfmt-colorschemes txtfmt.txt /*txtfmt-colorschemes*
txtfmt-combining txtfmt.txt /*txtfmt-combining*
txtfmt-conceal-backwards-compatibility txtfmt.txt /*txtfmt-conceal-backwards-compatibility*
txtfmt-conceal-history txtfmt.txt /*txtfmt-conceal-history*
txtfmt-conceal-notes txtfmt.txt /*txtfmt-conceal-notes*
txtfmt-configuration txtfmt.txt /*txtfmt-configuration*
txtfmt-contents txtfmt.txt /*txtfmt-contents*
txtfmt-create-tok-str txtfmt.txt /*txtfmt-create-tok-str*
txtfmt-cterm-default-background txtfmt.txt /*txtfmt-cterm-default-background*
txtfmt-cterm-ignore-issue txtfmt.txt /*txtfmt-cterm-ignore-issue*
txtfmt-cterm-ignore-workaround txtfmt.txt /*txtfmt-cterm-ignore-workaround*
txtfmt-cterm-pitfalls txtfmt.txt /*txtfmt-cterm-pitfalls*
txtfmt-cterm-term-issue txtfmt.txt /*txtfmt-cterm-term-issue*
txtfmt-default-tokrange txtfmt.txt /*txtfmt-default-tokrange*
txtfmt-dist-files txtfmt.txt /*txtfmt-dist-files*
txtfmt-encoding txtfmt.txt /*txtfmt-encoding*
txtfmt-filetype txtfmt.txt /*txtfmt-filetype*
txtfmt-fmt-clr-spec-list txtfmt.txt /*txtfmt-fmt-clr-spec-list*
txtfmt-fmt-spec txtfmt.txt /*txtfmt-fmt-spec*
txtfmt-formats txtfmt.txt /*txtfmt-formats*
txtfmt-fwd-till-any-beg-tok txtfmt.txt /*txtfmt-fwd-till-any-beg-tok*
txtfmt-fwd-till-any-end-tok txtfmt.txt /*txtfmt-fwd-till-any-end-tok*
txtfmt-fwd-till-any-tok txtfmt.txt /*txtfmt-fwd-till-any-tok*
txtfmt-fwd-till-bgc-beg-tok txtfmt.txt /*txtfmt-fwd-till-bgc-beg-tok*
txtfmt-fwd-till-bgc-end-tok txtfmt.txt /*txtfmt-fwd-till-bgc-end-tok*
txtfmt-fwd-till-bgc-tok txtfmt.txt /*txtfmt-fwd-till-bgc-tok*
txtfmt-fwd-till-clr-beg-tok txtfmt.txt /*txtfmt-fwd-till-clr-beg-tok*
txtfmt-fwd-till-clr-end-tok txtfmt.txt /*txtfmt-fwd-till-clr-end-tok*
txtfmt-fwd-till-clr-tok txtfmt.txt /*txtfmt-fwd-till-clr-tok*
txtfmt-fwd-till-fmt-beg-tok txtfmt.txt /*txtfmt-fwd-till-fmt-beg-tok*
txtfmt-fwd-till-fmt-end-tok txtfmt.txt /*txtfmt-fwd-till-fmt-end-tok*
txtfmt-fwd-till-fmt-tok txtfmt.txt /*txtfmt-fwd-till-fmt-tok*
txtfmt-fwd-to-any-beg-tok txtfmt.txt /*txtfmt-fwd-to-any-beg-tok*
txtfmt-fwd-to-any-end-tok txtfmt.txt /*txtfmt-fwd-to-any-end-tok*
txtfmt-fwd-to-any-tok txtfmt.txt /*txtfmt-fwd-to-any-tok*
txtfmt-fwd-to-bgc-beg-tok txtfmt.txt /*txtfmt-fwd-to-bgc-beg-tok*
txtfmt-fwd-to-bgc-end-tok txtfmt.txt /*txtfmt-fwd-to-bgc-end-tok*
txtfmt-fwd-to-bgc-tok txtfmt.txt /*txtfmt-fwd-to-bgc-tok*
txtfmt-fwd-to-clr-beg-tok txtfmt.txt /*txtfmt-fwd-to-clr-beg-tok*
txtfmt-fwd-to-clr-end-tok txtfmt.txt /*txtfmt-fwd-to-clr-end-tok*
txtfmt-fwd-to-clr-tok txtfmt.txt /*txtfmt-fwd-to-clr-tok*
txtfmt-fwd-to-fmt-beg-tok txtfmt.txt /*txtfmt-fwd-to-fmt-beg-tok*
txtfmt-fwd-to-fmt-end-tok txtfmt.txt /*txtfmt-fwd-to-fmt-end-tok*
txtfmt-fwd-to-fmt-tok txtfmt.txt /*txtfmt-fwd-to-fmt-tok*
txtfmt-get-tok-info txtfmt.txt /*txtfmt-get-tok-info*
txtfmt-gnome-terminal-issue txtfmt.txt /*txtfmt-gnome-terminal-issue*
txtfmt-gnome-terminal-issue-workaround txtfmt.txt /*txtfmt-gnome-terminal-issue-workaround*
txtfmt-hl-color-names txtfmt.txt /*txtfmt-hl-color-names*
txtfmt-ins-tok txtfmt.txt /*txtfmt-ins-tok*
txtfmt-ins-tok-A txtfmt.txt /*txtfmt-ins-tok-A*
txtfmt-ins-tok-CTRL-\_CTRL-\ txtfmt.txt /*txtfmt-ins-tok-CTRL-\\_CTRL-\\*
txtfmt-ins-tok-I txtfmt.txt /*txtfmt-ins-tok-I*
txtfmt-ins-tok-O txtfmt.txt /*txtfmt-ins-tok-O*
txtfmt-ins-tok-a txtfmt.txt /*txtfmt-ins-tok-a*
txtfmt-ins-tok-i txtfmt.txt /*txtfmt-ins-tok-i*
txtfmt-ins-tok-map-list txtfmt.txt /*txtfmt-ins-tok-map-list*
txtfmt-ins-tok-maps txtfmt.txt /*txtfmt-ins-tok-maps*
txtfmt-ins-tok-o txtfmt.txt /*txtfmt-ins-tok-o*
txtfmt-ins-tok-s txtfmt.txt /*txtfmt-ins-tok-s*
txtfmt-ins-tok-vA txtfmt.txt /*txtfmt-ins-tok-vA*
txtfmt-ins-tok-vI txtfmt.txt /*txtfmt-ins-tok-vI*
txtfmt-ins-tok-vO txtfmt.txt /*txtfmt-ins-tok-vO*
txtfmt-ins-tok-va txtfmt.txt /*txtfmt-ins-tok-va*
txtfmt-ins-tok-vi txtfmt.txt /*txtfmt-ins-tok-vi*
txtfmt-ins-tok-vo txtfmt.txt /*txtfmt-ins-tok-vo*
txtfmt-ins-tok-vs txtfmt.txt /*txtfmt-ins-tok-vs*
txtfmt-installation txtfmt.txt /*txtfmt-installation*
txtfmt-jump-to-tok txtfmt.txt /*txtfmt-jump-to-tok*
txtfmt-jump-to-tok-maps txtfmt.txt /*txtfmt-jump-to-tok-maps*
txtfmt-loading txtfmt.txt /*txtfmt-loading*
txtfmt-map-config txtfmt.txt /*txtfmt-map-config*
txtfmt-map-conflict txtfmt.txt /*txtfmt-map-conflict*
txtfmt-modeline txtfmt.txt /*txtfmt-modeline*
txtfmt-modeline-fmt txtfmt.txt /*txtfmt-modeline-fmt*
txtfmt-motivation txtfmt.txt /*txtfmt-motivation*
txtfmt-move-tok-range txtfmt.txt /*txtfmt-move-tok-range*
txtfmt-multibyte-syntax-bug txtfmt.txt /*txtfmt-multibyte-syntax-bug*
txtfmt-nesting txtfmt.txt /*txtfmt-nesting*
txtfmt-nesting-c-example txtfmt.txt /*txtfmt-nesting-c-example*
txtfmt-nesting-notes-example txtfmt.txt /*txtfmt-nesting-notes-example*
txtfmt-nesting-tvo-example txtfmt.txt /*txtfmt-nesting-tvo-example*
txtfmt-opt-list txtfmt.txt /*txtfmt-opt-list*
txtfmt-opt-names txtfmt.txt /*txtfmt-opt-names*
txtfmt-opt-num-fmt txtfmt.txt /*txtfmt-opt-num-fmt*
txtfmt-opt-refresh txtfmt.txt /*txtfmt-opt-refresh*
txtfmt-opt-types txtfmt.txt /*txtfmt-opt-types*
txtfmt-options txtfmt.txt /*txtfmt-options*
txtfmt-overview txtfmt.txt /*txtfmt-overview*
txtfmt-performance-considerations txtfmt.txt /*txtfmt-performance-considerations*
txtfmt-private-use-area txtfmt.txt /*txtfmt-private-use-area*
txtfmt-problematic-ranges txtfmt.txt /*txtfmt-problematic-ranges*
txtfmt-query-tok-type txtfmt.txt /*txtfmt-query-tok-type*
txtfmt-start-token txtfmt.txt /*txtfmt-start-token*
txtfmt-starttok txtfmt.txt /*txtfmt-starttok*
txtfmt-syn-rgn-count-table txtfmt.txt /*txtfmt-syn-rgn-count-table*
txtfmt-test-cur-settings txtfmt.txt /*txtfmt-test-cur-settings*
txtfmt-tok-descriptor txtfmt.txt /*txtfmt-tok-descriptor*
txtfmt-upgrading-to-extended-long-formats txtfmt.txt /*txtfmt-upgrading-to-extended-long-formats*
txtfmt-upgrading-tokrange txtfmt.txt /*txtfmt-upgrading-tokrange*
txtfmt-user-interface txtfmt.txt /*txtfmt-user-interface*
txtfmt-user-map-examples txtfmt.txt /*txtfmt-user-map-examples*
txtfmt-user-map-expansion txtfmt.txt /*txtfmt-user-map-expansion*
txtfmt-user-map-fmt txtfmt.txt /*txtfmt-user-map-fmt*
txtfmt-user-maps txtfmt.txt /*txtfmt-user-maps*
txtfmt-view-tok-map txtfmt.txt /*txtfmt-view-tok-map*
txtfmt-viewing-old-files-without-conceal txtfmt.txt /*txtfmt-viewing-old-files-without-conceal*
txtfmt.txt txtfmt.txt /*txtfmt.txt*
txtfmtAllowxl txtfmt.txt /*txtfmtAllowxl*
txtfmtBgcolormask txtfmt.txt /*txtfmtBgcolormask*
txtfmtBgcolor{} txtfmt.txt /*txtfmtBgcolor{}*
txtfmtColor{} txtfmt.txt /*txtfmtColor{}*
txtfmtConceal txtfmt.txt /*txtfmtConceal*
txtfmtConcealcursor txtfmt.txt /*txtfmtConcealcursor*
txtfmtEscape txtfmt.txt /*txtfmtEscape*
txtfmtFgcolormask txtfmt.txt /*txtfmtFgcolormask*
txtfmtJumptoinactive txtfmt.txt /*txtfmtJumptoinactive*
txtfmtMapwarn txtfmt.txt /*txtfmtMapwarn*
txtfmtModelines txtfmt.txt /*txtfmtModelines*
txtfmtNested txtfmt.txt /*txtfmtNested*
txtfmtPack txtfmt.txt /*txtfmtPack*
txtfmtSync txtfmt.txt /*txtfmtSync*
txtfmtTokrange txtfmt.txt /*txtfmtTokrange*
txtfmtUndercurl txtfmt.txt /*txtfmtUndercurl*
txtfmtUsermaplimit txtfmt.txt /*txtfmtUsermaplimit*
txtfmtUsermap{} txtfmt.txt /*txtfmtUsermap{}*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

392
vimrc
View File

@ -1,58 +1,183 @@
" ===== hasufell's vimrc ))))
" no ATTENTION messages when swap file is already found
set shortmess+=A
let g:pymode_python = 'python3'
let g:python_host_prog = '/usr/bin/python2'
let g:python3_host_prog = '/usr/bin/python3'
" plugin stuff
filetype plugin on
filetype indent on
set backspace=indent,eol,start " backspace through everything in insert mode
set cmdheight=1
" Section pathogen
" let g:pathogen_disabled = []
" call add(g:pathogen_disabled, 'syntastic')
" call pathogen#infect()
" if has("gui_running")
" autocmd GUIEnter * set vb t_vb=
" endif
set belloff=all
set wildmenu
" set wildmode=longest,list,full
" vim-plug settings (Plugin declaration)
call plug#begin('~/.vim/plugged')
" plugins
if &compatible
set nocompatible " Be iMproved
endif
Plug 'mileszs/ack.vim'
Plug 'romainl/Apprentice'
Plug 'chriskempson/base16-vim'
Plug 'fneu/breezy'
Plug 'vim-scripts/cmdalias.vim'
Plug 'Raimondi/delimitMate'
Plug 'romainl/Disciple'
Plug 'vim-scripts/genindent.vim'
Plug 'sjl/gundo.vim'
Plug 'idris-hackers/idris-vim'
Plug 'wimstefan/Lightning'
Plug 'vim-scripts/LustyJuggler'
Plug 'yegappan/mru'
Plug 'scrooloose/nerdcommenter'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'NLKNguyen/papercolor-theme'
Plug 'powerline/powerline', {
\ 'branch': 'develop',
\ 'do': 'python setup.py install --user',
\ 'rtp': 'powerline/bindings/vim',
\ }
Plug 'vim-scripts/promela.vim'
Plug 'AndrewRadev/simple_bookmarks.vim'
Plug 'Keithbsmiley/swift.vim'
Plug 'majutsushi/tagbar'
Plug 'ternjs/tern_for_vim'
Plug 'flazz/vim-colorschemes'
Plug 'reedes/vim-colors-pencil'
Plug 'altercation/vim-colors-solarized'
Plug 'xolox/vim-easytags'
Plug 'tpope/vim-fugitive'
Plug 'whatyouhide/vim-gotham'
Plug 'noahfrederick/vim-hemisu'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'xolox/vim-misc'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'tpope/vim-rhubarb'
" Required:
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim
" local_vimrc
Plug 'LucHermitte/lh-vim-lib'
Plug 'LucHermitte/local_vimrc'
let s:toml = $HOME . '/.vim/plugins.toml'
let g:dein#lazy_rplugins = v:false
" Required:
if dein#load_state($HOME . '/.cache/dein')
call dein#begin($HOME . '/.cache/dein', [$HOME . '/.vim/vimrc', $HOME . '/.vim/plugins.toml'])
call dein#add('wsdjeg/dein-ui.vim')
call dein#load_toml(s:toml)
" LSP
" setting this per-language breaks "let g:LanguageClient_autoStart = 1",
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" (Optional) Multi-entry selection UI.
" Plug 'junegunn/fzf', { 'for': 'haskell' }
" autocomplet
" Plug 'Shougo/deoplete.nvim', { 'for': 'haskell' }
" Plug 'roxma/nvim-yarp', { 'for': 'haskell' }
" Plug 'roxma/vim-hug-neovim-rpc', { 'for': 'haskell' }
" Let dein manage dein
" Required:
call dein#add($HOME . '/.cache/dein/repos/github.com/Shougo/dein.vim')
" linting/compilation
Plug 'w0rp/ale'
" Required:
call dein#end()
call dein#save_state()
endif
filetype plugin indent on
" completion
Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clang-completer --go-completer --rust-completer --system-boost --system-libclang',
\ 'for': ['haskell', 'c', 'python', 'sh', 'go', 'clojure', 'rust'],
\ }
" ===== further plugin initialization and default config =====
" haskell
Plug 'eagletmt/ghcmod-vim', { 'for': 'haskell' }
Plug 'eagletmt/neco-ghc', { 'for': 'haskell' }
Plug 'lukerandall/haskellmode-vim', { 'for': 'haskell' }
Plug 'raichoo/haskell-vim', { 'for': 'haskell' }
Plug 'ucsd-progsys/liquid-types.vim', { 'for': 'haskell' }
Plug 'bitc/lushtags', {
\ 'do': 'bash -c \"cabal clean && cabal sandbox delete && cabal sandbox init && cabal install && cp .cabal-sandbox/bin/lushtags ~/.cabal/bin/lushtags\"',
\ 'for': 'haskell',
\ }
" Plug 'timmytofu/vim-cabal-context', { 'for': 'haskell' }
Plug 'itchyny/vim-haskell-indent', { 'for': 'haskell' }
Plug 'dan-t/vim-hsimport', { 'for': 'haskell' }
" clojure
" Plug '~/.vim/unmanaged-vim-plug/paredit', { 'for': 'clojure' }
" Plug '~/.vim/unmanaged-vim-plug/tslime', { 'for': 'clojure' }
Plug 'guns/vim-slamhound', {'for': 'clojure'}
Plug 'guns/vim-sexp', {'for': 'clojure'}
Plug 'tpope/vim-sexp-mappings-for-regular-people', {'for': 'clojure'}
Plug 'kovisoft/paredit', {'for': 'clojure'}
Plug 'tpope/vim-salve', { 'for': 'clojure' }
Plug 'tpope/vim-projectionist', { 'for': 'clojure' }
Plug 'tpope/vim-dispatch', { 'for': 'clojure' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
Plug 'luochen1990/rainbow', { 'for': 'clojure' }
Plug 'typedclojure/vim-typedclojure', {'for': 'clojure'}
" go
Plug 'garyburd/go-explorer', { 'for': 'go' }
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries', 'for': 'go' }
" rust
Plug 'rhysd/rust-doc.vim', { 'for': 'rust' }
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
" javascript
Plug 'moll/vim-node', { 'for': 'javascript' }
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
" python
Plug 'icedwater/vimpython', { 'for': 'python' }
" scala
Plug 'derekwyatt/vim-scala', { 'for': 'scala' }
" unmanaged
Plug '~/.vim/unmanaged-vim-plug/bufonly'
Plug '~/.vim/unmanaged-vim-plug/colorschemedegrade'
Plug '~/.vim/unmanaged-vim-plug/fontzoom'
Plug '~/.vim/unmanaged-vim-plug/fuzzyfinder'
Plug '~/.vim/unmanaged-vim-plug/L9'
Plug '~/.vim/unmanaged-vim-plug/log'
Plug '~/.vim/unmanaged-vim-plug/ScrollColor'
Plug '~/.vim/unmanaged-vim-plug/txtfmt'
" Initialize plugin system
call plug#end()
" ===== further plugin initialization =====
so ~/.vim/plugged/cmdalias.vim/plugin/cmdalias.vim
so ~/.vim/autoload/log-autocmds.vim
" lustyexplorer
set hidden
"powerline
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
set laststatus=2
" lj
let g:LustyJugglerSuppressRubyWarning = 1
" global settings
set foldmethod=syntax "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i useset directory=~/.vimtmp
set mouse=a
set autoread
set number
set encoding=utf8
set guifont=Monospace\ 14
set clipboard=unnamedplus
set textwidth=0
set tabstop=4
set shiftwidth=4
set directory=~/.vimtmp
set modeline
set modelines=1
let g:nickID = "hasufell"
" haskellmode, needs to load early
let g:haddock_browser='/usr/bin/firefox'
let g:haddock_browser_callformat='%s file://%s >/dev/null 2>&1 &'
" ==== conque ====
@ -66,67 +191,10 @@ call CmdAlias('hotkeys', 'tabnew ~/.vim/hotkeys')
call CmdAlias('TC', 'call ToggleComment()<CR>')
call CmdAlias('TF', 'call ToggleFoldText()<CR>')
call CmdAlias('ctags', '!/usr/bin/ctags -R --langmap=c:.c.h --c++-kinds=+p --c-kinds=+p+x --fields=+i+a+S+t+l+m+n --extra=+q .<CR>')
call CmdAlias('Nf', 'Neoformat')
call CmdAlias('NF', 'Neoformat')
call CmdAlias('nf', 'Neoformat')
call CmdAlias('LS', 'LanguageClientStart')
call CmdAlias('LspLog', 'lua vim.cmd("e"..vim.lsp.get_log_path())<CR>')
" cabbrev git Git
" global settings
if has('gui_running')
set guioptions -=T
" disable gvim tab
set guioptions-=e
set winaltkeys=no
set guiheadroom=0
else
set termguicolors
endif
set foldmethod=syntax "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i useset directory=~/.vimtmp
set mouse=a
set autoread
set number
set encoding=utf8
set guifont=Hack\ Nerd\ Font\ Mono\ 16
set clipboard=unnamedplus
set textwidth=0
set tabstop=4
set shiftwidth=4
set directory=~/.vimtmp
set modeline
set modelines=1
set autoindent
set laststatus=2
let g:nickID = 'hasufell'
" don't yank to buffer on deletion
" vnoremap d "_d
" nnoremap d "_d
vnoremap x "_x
nnoremap x "_x
" Syntax
syntax on
" pane navigation
" Use ctrl-[hjkl] to select the active split!
let g:C_Ctrl_j = 'off'
let g:BASH_Ctrl_j = 'off'
try
lang en_US
catch
endtry
" ===========================
" Disable annoying auto line break
@ -136,7 +204,7 @@ fu! DisableBr()
set nolist " list disables linebreak
set textwidth=0
set wrapmargin=0
set formatoptions-=t
set fo-=t
endfu
" Disable line breaks for all file types
@ -145,15 +213,15 @@ au BufNewFile,BufRead *.* call DisableBr()
" ==========copy/paste===========
function! Paste(mode)
if a:mode == 'v'
if a:mode == "v"
normal gv
normal "_d
normal "+gP
normal l
elseif a:mode == 'i'
elseif a:mode == "i"
set virtualedit=all
normal `^"+gP
let &virtualedit = ''
let &virtualedit = ""
endif
endfunction
@ -162,11 +230,66 @@ endfunction
function! Select()
set virtualedit=all
normal `^ggVG
let &virtualedit = ''
let &virtualedit = ""
endfunction
" =======================
" don't yank to buffer on deletion
" vnoremap d "_d
" nnoremap d "_d
vnoremap x "_x
nnoremap x "_x
" Syntax
syntax enable
" ==== delimitMate ====
let g:delimitMate_matchpairs = "(:),[:],{:}"
let g:delimitMate_expand_cr = 1
let g:delimitMate_expand_space = 1
let g:delimitMate_autoclose = 1
" pane navigation
" Use ctrl-[hjkl] to select the active split!
let g:C_Ctrl_j = 'off'
let g:BASH_Ctrl_j = 'off'
" ==========colors===========
"set t_Co=256
"let g:solarized_termcolors=256
if has('gui_running')
set background=dark
colorscheme solarized
else
set background=dark
colorscheme solarized
" colorscheme dante
endif
" ===========================
" Solarized stuff
" let g:solarized_termtrans=0
" let g:solarized_degrade=0
" let g:solarized_bold=1
" let g:solarized_underline=1
" let g:solarized_italic=1
" let g:solarized_termcolors=16
" let g:solarized_contrast="normal"
let g:solarized_visibility="high"
" let g:solarized_diffmode="normal"
" let g:solarized_hitrail=0
let g:solarized_menu=1
try
lang en_US
catch
endtry
" ====== traling whitespace =====
fun! ShowTrailingWhitespace(pattern)
@ -205,21 +328,44 @@ fun! StripTrailingWhitespaces()
call cursor(l, c)
endfun
function! ComIfGit(com1, com2)
silent! !git rev-parse --is-inside-work-tree
if v:shell_error == 0
execute a:com1
else
execute a:com2
endif
endfunction
" ===========================
" LSP
let g:LanguageClient_autoStart = 0
" youcompleteme
let g:ycm_filetype_blacklist = {
\ 'notes' : 1,
\ 'markdown' : 1,
\ 'text' : 1,
\ 'java' : 1,
\}
let g:ycm_confirm_extra_conf = 0
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_seed_identifiers_with_syntax = 0
" let g:ycm_always_populate_location_list = 1
let g:ycm_autoclose_preview_window_after_completion = 1
let g:ycm_key_invoke_completion = '<C-Space>'
let g:ycm_key_list_select_completion = ['<TAB>']
let g:ycm_key_list_previous_completion = ['<S-TAB>']
" nnoremap <F4> :YcmCompleter GoToDefinition<CR>
let g:ycm_server_log_level = 'error'
let g:ycm_semantic_triggers = {'haskell' : ['. ', '$ ']}
let g:ycm_goto_buffer_command = 'horizontal-split'
" commenting
let NERDSpaceDelims=1
let NERDCreateDefaultMappings=0
" comment hiding
func! IsComment( lnum )
return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1),'name') =~? 'comment'
return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1),"name") =~? 'comment'
endfun
@ -260,29 +406,13 @@ endfunction
" vim macro to jump to devhelp topics.
""""""""""""""""""""""""""""""
function! DevHelpCurrentWord()
let word = expand('<cword>')
exe '!devhelp -s ' . word . ' &'
let word = expand("<cword>")
exe "!devhelp -s " . word . " &"
endfunction
function! ManCurrentWord()
let word = expand('<cword>')
exe '!man 3 ' . word
let word = expand("<cword>")
exe "!man 3 " . word
endfunction
""""""""""""""""""""""""""""""
" Close preview after typing
""""""""""""""""""""""""""""""
autocmd WinEnter * call ClosePreviewWindow()
function ClosePreviewWindow()
if getwinvar(winnr("#"), "&pvw") == 1
pclose
endif
endfunction
set title
autocmd BufEnter * set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:h\")})%)%(\ %a%)
" vim:foldmethod=marker:foldlevel=0