├── README ├── plugin └── twitvim.vim └── doc └── twitvim.txt /README: -------------------------------------------------------------------------------- 1 | This is a mirror of http://www.vim.org/scripts/script.php?script_id=2204 2 | 3 | Introduction 4 | 5 | TwitVim is a Vim plugin that allows you to post to Twitter and view Twitter timelines. It is an enhancement of vimscript #2124 by Travis Jeffery. Credit goes to Travis for the original script concept and implementation. 6 | 7 | TwitVim supports most of the features of a typical Twitter client, including: 8 | 9 | - Friends, User, Direct Message, Mentions, and Favorites timelines 10 | - Twitter Search 11 | - Replying and retweeting 12 | - Hashtags (jump to search timeline) 13 | - In reply to (See which tweet an @-reply is for.) 14 | - Opening links in a browser 15 | - User profile display 16 | - Twitter List viewing and managing 17 | - Trending topics 18 | - Timeline filtering 19 | 20 | ***** 21 | 22 | Usage 23 | 24 | Plugin commands: 25 | 26 | - :PosttoTwitter - This command will prompt you for a message to send to Twitter. 27 | - :CPosttoTwitter - This command posts the current line in the current buffer to Twitter. 28 | - :BPosttoTwitter - This command posts the current buffer to Twitter. 29 | - :FriendsTwitter - View friends timeline. 30 | - :UserTwitter - View your timeline. 31 | - :MentionsTwitter - View @-mentions. 32 | - :PublicTwitter - View public timeline. 33 | - :DMTwitter - View direct messages. 34 | - :SearchTwitter - Use Twitter Search. 35 | 36 | Global mappings: 37 | 38 | - Alt-T - In Visual select mode, the Alt-T key posts the selected text to Twitter. Use this mapping if you compose your tweets in a separate scratch buffer. 39 | - Ctrl-T - Use this instead if the menu bar is enabled or if Alt-T is not available on your platform. 40 | 41 | Timeline buffer mappings: 42 | 43 | - Alt-R or r - Starts a @-reply. (in timeline buffer) 44 | - Alt-D or d - Starts a direct message. (in timeline buffer) 45 | 46 | Many more commands and mappings are available. See TwitVim's help documentation for full details. 47 | 48 | ***** 49 | 50 | License 51 | 52 | TwitVim is distributed under the same terms as Vim itself. See :help license. 53 | 54 | ***** 55 | 56 | Contact 57 | 58 | - @mortonfox (https://twitter.com/mortonfox) - The maintainer 59 | - @twitvim (https://twitter.com/twitvim) - TwitVim announcements 60 | 61 | -------------------------------------------------------------------------------- /plugin/twitvim.vim: -------------------------------------------------------------------------------- 1 | " ============================================================== 2 | " TwitVim - Post to Twitter from Vim 3 | " Based on Twitter Vim script by Travis Jeffery 4 | " 5 | " Version: 0.9.1 6 | " License: Vim license. See :help license 7 | " Language: Vim script 8 | " Maintainer: Po Shan Cheah 9 | " Created: March 28, 2008 10 | " Last updated: August 19, 2015 11 | " 12 | " GetLatestVimScripts: 2204 1 twitvim.vim 13 | " ============================================================== 14 | 15 | " Load this module only once. 16 | if exists('g:loaded_twitvim') 17 | finish 18 | endif 19 | let g:loaded_twitvim = '0.9.1 2015-08-19' 20 | 21 | " Check Vim version. 22 | if v:version < 703 23 | echohl ErrorMsg 24 | echomsg 'You need Vim 7.3 or later for this version of TwitVim' 25 | echohl None 26 | finish 27 | endif 28 | 29 | " Avoid side-effects from cpoptions setting. 30 | let s:save_cpo = &cpo 31 | set cpo&vim 32 | 33 | " For debugging. Reset Hmac method. 34 | if !exists(":TwitVimResetHmacMethod") 35 | command TwitVimResetHmacMethod :call twitvim#reset_hmac_method() 36 | endif 37 | 38 | " For debugging. Show current Hmac method. 39 | if !exists(":TwitVimShowHmacMethod") 40 | command TwitVimShowHmacMethod :call twitvim#show_hmac_method() 41 | endif 42 | 43 | " For debugging. Reset networking method. 44 | if !exists(":TwitVimResetMethod") 45 | command TwitVimResetMethod :call twitvim#reset_curl_method() 46 | endif 47 | 48 | " For debugging. Show current networking method. 49 | if !exists(":TwitVimShowMethod") 50 | command TwitVimShowMethod :call twitvim#show_curl_method() 51 | endif 52 | 53 | if !exists(":BackTwitter") 54 | command BackTwitter :call twitvim#back_buffer(0) 55 | endif 56 | if !exists(":ForwardTwitter") 57 | command ForwardTwitter :call twitvim#fwd_buffer(0) 58 | endif 59 | if !exists(":BackInfoTwitter") 60 | command BackInfoTwitter :call twitvim#back_buffer(1) 61 | endif 62 | if !exists(":ForwardInfoTwitter") 63 | command ForwardInfoTwitter :call twitvim#fwd_buffer(1) 64 | endif 65 | 66 | if !exists(":TwitVimShowBufstack") 67 | command TwitVimShowBufstack :call twitvim#show_bufstack(0) 68 | endif 69 | if !exists(":TwitVimShowInfoBufstack") 70 | command TwitVimShowInfoBufstack :call twitvim#show_bufstack(1) 71 | endif 72 | 73 | " For debugging. Show curbuffer variable. 74 | if !exists(":TwitVimShowCurbuffer") 75 | command TwitVimShowCurbuffer :call twitvim#show_bufvar(0) 76 | endif 77 | " For debugging. Show infobuffer variable. 78 | if !exists(":TwitVimShowInfobuffer") 79 | command TwitVimShowInfobuffer :call twitvim#show_bufvar(1) 80 | endif 81 | 82 | " Prompt user for tweet. 83 | if !exists(":PosttoTwitter") 84 | command PosttoTwitter :call twitvim#CmdLine_Twitter('', 0) 85 | endif 86 | 87 | nnoremenu Plugin.TwitVim.Post\ from\ cmdline :call twitvim#CmdLine_Twitter('', 0) 88 | 89 | " Post current line to Twitter. 90 | if !exists(":CPosttoTwitter") 91 | command CPosttoTwitter :call twitvim#post_twitter(getline('.'), 0) 92 | endif 93 | 94 | nnoremenu Plugin.TwitVim.Post\ current\ line :call twitvim#post_twitter(getline('.'), 0) 95 | 96 | " Post entire buffer to Twitter. 97 | if !exists(":BPosttoTwitter") 98 | command BPosttoTwitter :call twitvim#post_twitter(join(getline(1, "$")), 0) 99 | endif 100 | 101 | " Post visual selection to Twitter. 102 | noremap Visual y:call twitvim#post_twitter(@", 0) 103 | noremap