Created
March 9, 2011 17:24
-
-
Save tyru/862586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" lingr.vim {{{ | |
" from thinca's .vimrc {{{ | |
" http://soralabo.net/s/vrcb/s/thinca | |
if !exists('g:lingr') | |
call rtputil#remove('\<lingr-vim\>') | |
endif | |
if 0 | |
" Update GNU screen tab name. | |
augroup vimrc-plugin-lingr | |
autocmd! | |
autocmd User plugin-lingr-* call s:lingr_event( | |
\ matchstr(expand('<amatch>'), 'plugin-lingr-\zs\w*')) | |
autocmd FileType lingr-* call s:init_lingr(expand('<amatch>')) | |
augroup END | |
function! s:lingr_ctrl_l() "{{{ | |
call lingr#mark_as_read_current_room() | |
call s:screen_auto_window_name() | |
redraw! | |
endfunction "}}} | |
function! s:init_lingr(ft) "{{{ | |
if exists('s:screen_is_running') | |
nnoremap <buffer><silent> <C-l> :<C-u>call <SID>lingr_ctrl_l()<CR> | |
let b:window_name = 'lingr' | |
endif | |
endfunction "}}} | |
function! s:lingr_event(event) "{{{ | |
if a:event ==# 'message' && s:screen_is_running | |
execute printf('WindowName %s(%d)', 'lingr', lingr#unread_count()) | |
endif | |
endfunction "}}} | |
endif " Update GNU screen tab name. | |
" }}} | |
MyAutocmd FileType lingr-messages | |
\ call s:lingr_messages_mappings() | |
function! s:lingr_messages_mappings() "{{{ | |
nmap <buffer> o <Plug>(lingr-messages-show-say-buffer) | |
nnoremap <buffer> <C-g><C-n> gt | |
nnoremap <buffer> <C-g><C-p> gT | |
endfunction "}}} | |
MyAutocmd FileType lingr-say | |
\ call s:lingr_say_mappings() | |
function! s:lingr_say_mappings() "{{{ | |
nmap <buffer> <CR> <SID>(lingr-say-say) | |
endfunction "}}} | |
nnoremap <silent> <SID>(lingr-say-say) :<C-u>call <SID>lingr_say_say()<CR> | |
function! s:lingr_say_say() "{{{ | |
let all_lines = getline(1, '$') | |
let blank_line = '^\s*$' | |
call filter(all_lines, 'v:val =~# blank_line') | |
if empty(all_lines) " has blank line(s). | |
let doit = 1 | |
else | |
let doit = input('lingr-say buffer has one or more blank lines. say it?[y/n]:') =~? '^y\%[es]' | |
endif | |
if doit | |
execute "normal \<Plug>(lingr-say-say)" | |
endif | |
endfunction "}}} | |
let g:lingr_vim_additional_rooms = [ | |
\ 'tyru', | |
\ 'vim', | |
\ 'emacs', | |
\ 'editor', | |
\ 'vim_users_en', | |
\ 'vimperator', | |
\ 'filer', | |
\ 'completion', | |
\ 'shell', | |
\ 'git', | |
\ 'termtter', | |
\ 'lingr', | |
\ 'ruby', | |
\ 'few', | |
\ 'gc', | |
\ 'scala', | |
\ 'lowlevel', | |
\ 'lingr_vim', | |
\ 'vimjolts', | |
\] | |
let g:lingr_vim_rooms_buffer_height = len(g:lingr_vim_additional_rooms) + 3 | |
let g:lingr_vim_count_unread_at_current_room = 1 | |
" }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment