I will show you how I’ve been using Vim for the last year. I used vim before for a long time, and then I switched to Sublime. However, after I saw how Josh was using his vim, I decided to try the same setup.

When you start working with vim you can either configure it by yourself or copy other's configuration. One time I already started my own configuration, but this time I tried to use another configuration. The good thing of using someone else's configuration is because you can see what people are using and how they are using it and copy the ideas, of course everything is open source. There is a huge number of vim plugins, sometimes it's hard to catch everything.

Here are Josh's dotfiles. He uses neovim, and it has some other configurations I will not talk about. In the file init.vim, there is all the necessary configuration. For the vim and terminal theme, we are using solarized, specifically solarized light.

Let's walk through the configuration.

We start by setting up our tabs size, in this case we are using a tab size of two spaces. Also, we can set up our leader key. In my case I like \\.

"""""""""""""" Plugins #plugins
call plug#begin()
"" Dash
Plug 'rizzatti/dash.vim'
""Vim Wiki
Plug 'vim-scripts/vimwiki'
let wiki = {}
let g:vimwikidir = $HOME . "/Dropbox/vimwiki"

Here there are some interesting plugins for Elixir, Elm…

We are using Plug to install the plugins.

Some plugins want configurations and we can see them here as well. Configurations and shortcuts for executing them.

Plugins in action

Let's see some of these plugins in action.

If I open vim and choose the directory it opens for me.

vim .

If I just use vim, it opens for me nvim, because I have an alias for vim to nvim. Let's open a project with it.

Vim has netrw for helping us manage the file system. I normally use it. There is also NERDTree for those who likes the file tree explorer.

Let's see how netrw is used. We are also using vinegar which adds some good functionalities to netrw. Here are the files from my project.

I can use shift + %, to create a file. File created. I can go back to the file list just using -. To create a directory I can use d, and it prompts to put the directory name. To move the files, I can use shift + r, and then I can set the new file destination.

This makes my life easy, and I don't need to have something like NERDTree.

Testing

Another interesting thing that makes my life easier is related to testing. Here I have some rspec tests, for ruby. I can only press leader + t in the line of the test and it executes only this test for me. If I execute it to the beginning of the file, it executes my whole test file. This makes life easier and I don't even need to leave my text editor.

Tabs and new views

Also, something I'm using is new windows or tabs. I can just execute a command, in my case control + n and vim opens a new window vertically for me, and then I just need to use control + c and it closes it.

Of course, all of these shortcuts can be changed according to your preferences. Here I have two tabs, and I can move between them easily.

Finding

To find files, I'm using FZF, which is a very fast fuzzy finder. So, I can find any file I want to see.

Summary

Using vim makes my life easier. The good thing is that it's totally configured to my needs. This can be bad too though because you can lose a lot of time setting things up. There is definitely a trade-off. Using someone else’s configuration was good because it helped me get started and showed me things I might have missed.

Resources

Franzé Jr

Software Engineer with experience working in multi-cultural teams, Franze wants to help people when he can, and he is passionate about programming and Computer Science. Founder of RemoteMeetup.com where he can meet people all over the World. When Franze is not coding, he is studying something about programming.

  1. Comments for vim at DailyDrip

You must login to comment

You May Also Like