lingr.vim: Lingr client for Vim
Python Vim script
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
autoload
doc
plugin
syntax
.gitignore
README.mkd

README.mkd

lingr.vim: Lingr client for Vim

Now this plugin is little unstable. Please use this at your own risk.

今のところ ちょっと不安定 なので,自己責任でご利用ください

Be careful. Don't use this plugin in X11 environment because it crashes Vim!

注意.X11環境では使わないでください.Vimがクラッシュします!

Requirement

This plugin is tested with Vim 7.2, but maybe works with Vim 7.0 or 7.1.

This plugin needs +python (Python 2.6 only)

Install

Of couse, your machine needs to be connected to web.

Example ways of installing Vim with +python feature

Install Lingr-Vim

  • Put files in your vim runtime directory.
    • If you use Windows, the runtime directory may be ~\_vimfiles, otherwise that may be ~/.vim

Usage

  • Launch with :LingrLaunch
    • Set user name to g:lingr_vim_user and password to g:lingr_vim_password to automatic login
    • Use :LingrLaunch! to force interactive login
  • Select rooms with <Enter> in lingr-rooms buffer at left above
  • lingr-members buffer at left below shows members of selected room
  • lingr-messages buffer at right side shows messages
    • Press <Enter> on [Read more from archives] at top of the buffer to get more archives
    • Press <Enter> on URLs to open it on browser
    • Press s to show a buffer for say
      • Press <Enter> in Normal Mode to say with the buffer contents
      • Press <Esc> in Normal Mode to close the buffer
  • Press o in lingr-rooms and lingr-members to open corresponding pages in Lingr on browser
  • Other commands in lingr-messages
    • Press <C-n> or <C-p> to go around rooms
    • Press { or } to junp to delimiters that are inserted between past logs
    • Use Q{motion} to quote messages in Normal Mode
    • Press Q to quote messages in Visual Mode
  • Mouse operations are also supported
    • Left click works as same as <Enter>
    • Left double click works as same as o
  • Logout with :LingrExit

簡単な使い方

  • :LingrLaunchで起動します
    • g:lingr_vim_userにユーザ名,g:lingr_vim_passwordにパスワードを設定すると自動的にログインできます
    • :LingrLaunch!を使うと強制的にユーザ名とパスワードを聞きます
  • 左上のlingr-roomsでは<Enter>で部屋を選択できます
  • 左下のlingr-membersには選択中の部屋のメンバーが表示されます
  • 右のlingr-messagesでメッセージを閲覧できます
    • 一番上の[Read more from archives]上で<Enter>を押すと過去ログを遡れます
    • URL上で<Enter>を押すとブラウザで開けます
    • sで発言用のバッファが表示されます
      • ノーマルモードで<Enter>を押すとバッファの内容が発言されます
      • ノーマルモードで<Esc>でバッファを閉じます
  • lingr-roomsとlingr-messagesではoを押すとLingrの該当ページをブラウザで開けます
  • lingr-messagesのその他のコマンド
    • <C-n><C-p>で部屋を巡回できます
    • {}で過去ログ取得時に挿入される区切りにジャンプできます
    • ノーマルモードではQ{motion}でメッセージを引用できます
    • ビジュアルモードではQでメッセージを引用できます
  • マウスでも一応操作できます
    • <Enter>でできることは左クリックでもできます
    • oでできることは左ダブルクリックでもできます
  • :LingrExitでログアウトできます

Options

g:lingr_vim_sidebar_width
Width of the sidebar.
Default is 25.
g:lingr_vim_rooms_buffer_height
Height of lingr-rooms buffer.
Default is 10.
g:lingr_vim_say_buffer_height
Height of lingr-say buffer.
Default is 3.
g:lingr_vim_remain_height_to_auto_scroll
If remain height is less than this value, auto scroll is performed when Lingr-Vim receives some messages.
Default is 5.
g:lingr_vim_time_format
Time format for messages. Please see C language strftime() reference to customize this value.
Default is '%c'.
g:lingr_vim_command_to_open_url
Command to open url in browsers. Default value is set for each OSs. For example, "open %s" is set for Mac OS X. %s is replaced to specified URL

Custom event

plugin-lingr-connected
Dispatched when Lingr-Vim connects to Lingr
plugin-lingr-message
Dispatched when Lingr-Vim receives new message
plugin-lingr-presence
Dispatched when someone changes her/his presence
plugin-lingr-unread
Dispatched when unread count is changed
plugin-lingr-connected
Dispatched when some errors occur

API

lingr#launch(use_setting)
Same as :LingrLaunch
lingr#exit()
Same as :LingrExit
lingr#say(text)
Say a:text to the current room
lingr#open_url(url)
Open a:url in browser with using g:lingr_vim_command_to_open_url
lingr#unread_count()
Return count of unread messages or -1 if Lingr-Vim has not been launched. You may want to use this in 'statusline' or 'tabline'
lingr#status()
Return current status of Lingr-Vim: connected/offline/waiting for reconnect...
lingr#current_room()
Return the name of current room
lingr#member_count()
Return the number of members in the current room
lingr#online_member_count()
Return the number of online members in the current room
lingr#offline_member_count()
Return the number of offline members in the current room
lingr#get_last_message()
Return the dictionary of last message
The dictionary member is nickname and text
You may want to use this with plugin-lingr-message event
lingr#get_last_member()
Return the dictionary of last member who changes her/his presence
The dictionary member is name, username and presence
You may want to use this with plugin-lingr-member event
lingr#quote_operator(motion_wiseness)
This is the function for quote operator (default is Q)

Customize example

Using Growl on Mac OS X

function! s:growl(title, message)
    execute printf('silent !growlnotify -t %s -m %s', shellescape(a:title, 1), shellescape(a:message, 1))
endfunction

augroup lingr-vim
    autocmd!
    autocmd User plugin-lingr-message
    \   let s:temp = lingr#get_last_message()
    \|  if !empty(s:temp)
    \|      call s:growl(s:temp.nickname, s:temp.text)
    \|  endif
    \|  unlet s:temp

    autocmd User plugin-lingr-presence
    \   let s:temp = lingr#get_last_member()
    \|  if !empty(s:temp)
    \|      call s:growl(s:temp.name, (s:temp.presence ? 'online' : 'offline'))
    \|  endif
    \|  unlet s:temp
augroup END

Licence

The 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.

日本語参考訳
http://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_license