Get the highlights in your inbox every week.
Use Vim to manage your task list and access Reddit and Twitter | Opensource.com
Use Vim to manage your task list and access Reddit and Twitter
Handle your to-do list and get social from the text editor in the seventeenth in our series on 20 ways to be more productive with open source in 2020.
Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using.
Doing (almost) all the things with Vim, part 2
In yesterday's article, you started reading mail and checking your calendars with Vim. Today, you're going to do even more. First, you'll take care of your task tracking, and then you'll get social, directly in the Vim text editor.
Track your to-do's in Vim with todo.txt-vim
Editing a text-based to-do file with Vim is a natural fit, and the todo.txt-vim package makes it even easier. Start by installing the todo.txt-vim package:
git clone https://github.com/freitass/todo.txt-vim ~/.vim/bundle/todo.txt-vim
Todo.txt-vim automatically recognizes files ending in todo.txt and done.txt as todo.txt files. It adds key bindings specific to the todo.txt format. You can mark things "done" with \x, set them to the current date with \d, and change the priority with \a, \b, and \c. You can bump the priorities up (\k) or down (\j) and sort (\s) based on project (\s+), context (\s@), or date (\sd). And when you are finished, you can close and save the file like normal.
Read Reddit in Vim with vim-reddit
git clone https://github.com/DougBeney/vim-reddit.git ~/.vim/bundle/vim-reddit
Now type :Reddit and the Reddit frontpage will load. You can load a specific subreddit with :Reddit name. Once the article list is onscreen, navigate with the arrow keys or scroll with the mouse. Pressing o will open the article in Vim (unless it is a media post, in which case it opens a browser), and pressing c brings up the comments. If you want to go right to the page, press O instead of o. Going back a screen is as easy as u. And when you are done with Reddit, type :bd. The only drawback is vim-reddit cannot log in or post new stories or comments. Then again, sometimes that is a good thing.
Tweet from Vim with twitvim
And last, we have twitvim, a Vim package for reading and posting to Twitter. This one takes a bit more to set up. Start by installing twitvim from GitHub:
git clone https://github.com/twitvim/twitvim.git ~/.vim/bundle/twitvim
Now you need to edit the .vimrc file and set some options. These help the plugin know which libraries it can use to talk to Twitter. Run vim --version and see what languages have a + next to them—those languages are supported by your copy of Vim.
Since mine says +perl -python +python3, I know I can enable Perl and Python 3, but not Python 2 (python).
" TwitVim Settings
let twitvim_enable_perl = 1
" let twitvim_enable_python = 1
let twitvim_enable_python3 = 1
Now you can start up Vim and log into Twitter by running :SetLoginTwitter, which launches a browser window asking you to authorize VimTwit as an application with access to your account. Once you enterthe supplied PIN into Vim, you're good to go.
Twitvim's commands are not as simple as in the other packages. To load up the timeline of your friends and followers, type in :FriendsTwitter. To list your mentions and replies, use :MentionsTwitter. Posting a new tweet is :PosttoTwitter <Your message>. You can scroll through the list and reply to a specific tweet by typing \r, and you can start a direct message with someone using \d.
And there you have it; you're doing (almost) all the things in Vim!