cis3296s23 / applebaum-software-design-section-704-projects-spring-23

Project Proposals for Prof. Applebaum Section 704
0 stars 1 forks source link

hoot.nvim - Liam Mackay #9

Open ruuffian opened 1 year ago

ruuffian commented 1 year ago
# hoot.nvim

Repo

Keywords

Section 704, Lua, Vim, NeoVim, vim-plug, REST API, Twitter API, Plugin, terminal, Linux

Project Abstract

hoot.vim is a NeoVim plugin that will allow users to view, send, like, and retweet straight from a NeoVim terminal. The plugin would use different file buffers to display a user’s timeline, share tweets, and allow likes/retweets. The Twitter API is crucial in this process- it is the main point-of-entry for the plugin. Ideally, a user will not have to interact with the Twitter API beyond setting their username and token.

High Level Requirement

hoot.vim aims to be an easy-to-use Twitter wrapper that only requires a basic knowledge of NeoVim and how to sign up for Twitter Apps. Thanks to NeoVim's built in documentation command :h, if a user knows how to access :h they can read the entire documentation for the plugin. Thus, it is important for the documentation to be clear and concise.

Conceptual Design

The plugin will be written entirely in Lua. There will be a few parts- the most important of which would be integration with popular plugin managers such as pathogen or vim-plug. The plugin will also need some way to interact with the Twitter API. Luckily, a ‘helper plugin’ exists in the form of webapi-vim. Worst case scenario, Lua has an http API that can also be used. Finally, the plugin will have to be compliant with the Twitter API itself- that means no spam, no lengthy tweets, and also some way to secure a user’s account details rather than storing them plaintext.

Background

A Twitter wrapper in vim is not an entirely original idea- it came only after looking through the examples listed in webapi-vim. Upon further research, there have been various attempts at a Twitter client in Vim over the years. Unfortunately, these are either 8+ years out of date, written in vimscript for Vim rather than NeoVim, or written entirely in Python3 instead of Lua (a much faster scripting language). As well as this, none of these plugins are particularly user-friendly; they require a decent understanding of Vim and knowing that you need to register for Twitter Apps in order to access the API. Thus, hoot.nvim (name subject to change) will be the first of its kind as a 100% Lua Twitter ‘client’, and also aim to be usable by those who may be newer to Vim.

Required Resources

Desire to learn Lua, knowledge of git, interest in learning Vim/Neovim/Vim-Flavored text editors, desire to learn about REST APIs, interest in learning how to setup a workspace based around Vim/NeoVim. No resources are "required" for this project since Vim and NeoVim run on every single distro of Linux that exists, however some kind of Lua language server will be helpful (or somewhere to write Lua that has good syntax highlighting, code completion etc).

Proof of concept

The following images are from the main inspiration of this project, Twitter.nvim:

Twitter.vim

As you can see, this plugin displays tweets separated by a “---“ and allows a user to scroll/search/interact with the feed with regular vim motions. Not shown here is the ability to send tweets that are made up of the current text buffer with a : command.

Here is an example of a basic “Hello World” plugin written in a few minutes. The best part of this is that integration with plugin managers is basically done, as the repo is a *.nvim name so they should handle installing it easily. Plug “ruuffian/hoot.nvim” should work for vim-plug.

Command Resulting Output

Slide

hoot.vim