How I

Kassio Borges

Developer

São Paulo, Brazil

Who are you and what do you use Vim for?

Hello there, I’m Kassio Borges. I’m a Brazilian Developer, currently working mainly with Ruby and Rails at Plataformatec. So I do use vim and neovim for coding, noting and draft ideas. I’ve been using vim for almost a decade, at the beginning I used it more for work on text files on servers, nowadays I use it for almost every text editing I have to do.

Introduce us to your Vim config.

First of all, I’d like to tell I care about my vim’s configurations a lot, however I also love to try new configurations, so my config files change a lot. My vim repo, on github, has more than a thousand commits, and it exists only for 4 years.

Some configs change a lot on my files: key mappings and plugins loading. I’m always trying new plugins, and also trying to live without some plugins. Today, I’m using 26 plugins on my configs, some of them only for neovim.

I have one config that I’d love to be default in vim, I use ! to search the current word/selection without move the cursor. This is awesome to look around where the current word/selection is being used, also to help with replacing. It’s very common for me to use :s//new-word/g just after a !. This way, before the replacement, I’ll see what’s changing on the file.

Besides that, there are some plugins that I use a lot:

I tried a lot of statusline plugins, but I didn’t like anyone so I use a fancy statusline that I configured by myself.

Currently I’m using ocean-next colors, on iTerm2 an neovim/vim. It’s very nice on neovim with $NVIM_TUI_ENABLE_TRUE_COLOR enabled.

I already used as leader key \ and ,, but nowadays I’m using <space>. It makes a lot of sense for me to use the biggest key on the keyboard as the leader one.

Some people already asked my about how to organize vim configs. I like to organize my configs as personal plugins. I have on my vimrc/init.vim only sets and some little vim boot configs. All external plugins’s configurations are on my /plugins folder. All my custom functions are in /autoload. This made my setup easier to maintain and faster to load, because vim doesn’t load my functions on boot.

What have been the most useful resources for you to learn Vim?

I read almost all :help. I learned a lot reading the source code from the plugins I use most, like vim-ruby. Vim-casts and Pratical Vim are also a good place to learn how to improve the vim skills. I love learn more about regexp and replace techniques, because refactoring large code bases are hard and this can help a lot. Also, I like to learn about all the news, so I try to follow every new feature/concept on vim/neovim.

What’s the most recent thing you’ve learned about Vim?

I fell in love with vim few years ago, but it was missing some features. Neovim brought some of the missing to the table. I just learned that vim 8.0 is back to the track, bringing channels and a native plugin manager and I’m really excited about these new features.

How did you get started writing Vim plugins?

I guess my first plugin as the vim-session_manager. Writing plugin, for me, it’s not a vim thing, I’m always trying to get all I can from my tools. With vim, one way to do this is writing plugins. After writing vim-session_manager, I was more comfortable with vim script, so I started write a lot of custom functions, and other little plugins.

Tell us the story behind your plugin neoterm.

Before neovim I used to use vim+tmux. I had a plugin to send commands to tmux. But I wasn’t satisfied with that. I’d like something more IDEish. So when neovim brought :terminal to the table I saw the opportunity to run tests and other commands without leave vim, and that was awesome. I’m currently without many time to work on neoterm, but I’d like to improve its tests’ statusline feedback. Today it’s done by pattern match, I’d like to improve it to use the test command status instead, this way we’d have a more reliable test status on neovim’s statusline.

Are you involved in a local Vim community?

I went, recently, to the first vim meetup on São Paulo and talked about neovim and vim configurations organization. I really enjoy help people to use better vim/neovim, and I intend to do this again when possible.

Share a snippet of Vim script you’ve written and talk about what it does.

function! preserve#preserve(command)
  setlocal lazyredraw
  let l:search=@/

  let last_view = winsaveview()
  execute a:command
  call winrestview(last_view)

  let @/=l:search
  redraw
  setlocal nolazyredraw
endfunction

This is a snippet that I copied the idea from I don’t know where (I think is vim wiki). I use this function on many keymappings, and other functions. What it does is very simple, it runs the given command without move the cursor or the current window view. I use this, for instance, in the ! mapping that I mentioned before.