My development environment

Saturday, December 31, 2022

This post is about my preferred development environment tooling. I prefer working in the terminal, so much of my tooling is organized around this building block. I will not be comparing this setup to any other setup. I am not writing this to convince others to start using this setup. I would simply like to document the tooling that I like to use. If you would like to reach out to me to learn more about this setup, please feel free to reach out in my public-inbox.

The reason that I like using vim is because it is in the terminal. It also runs quickly and doesn't involve opening a gui application. I can keep multiple processes of vim (for different codebases) running for extended periods of time without any crashes (with tmux). Another reason is that I can use vim anywhere and have the same experience, i.e. on a raspberry pi or a company server. I also feel a sense of focus and freedom from distraction when working in vim. What I hope to convey in this post is that despite the appearance of vim as being a low-level, minimalist tool, is that it can be a capable, and modern development environment.

The essential tools in my development environment are code completion, introspection, a go-to definition functionality, an ability to run arbitrary commands, an ability to search for text throughout a codebase, an ability to view and traverse directory structures, an ability to search for files by name, and an ability to manage git. Of course I expect my development environment to support these features across multiple programming languages.

In regards to support of multiple programming languages, the tooling has improved considerably in the last few years since the widespread adoption of the "language server protocol" (LSP). This has vastly improved my experience using vim as my primary code editor. In particular, since I discovered the "conquer of code" vim extension (coc.nvim) my ability to stay within vim has greatly improved. It is this extension that provides most of the essential functionality I need for multiple languages. In particular I have been using these extensions:

These extensions provide me with a set of commands, keystrokes and behaviors that are consistent across projects in any of these languages. This addresses my needs for code completion, introspection and go-to definition in a language independent way. It is the LSP that enables this. You can also use any custom language server protocol, i.e. here is a way that you can add the terraform-ls to coc.vim.

In order to achieve advanced file search and text search within files, I rely on the fzf.vim extension. This adds two invaluable tools. When I hit the "ctrl+p" key combo, I am provided with a fuzzy search dialogue to search for particular files in my projects. When I use the ":Rg" command I am given a fuzzy search dialogue for utilizing ripgrep to search for text throughout a codebase (and allows for navigation to search results). In order to visualize and traverse a project directories structure I make use of vim's built-in file-explorer (netrw), i.e. :Explore. These tools combined with the go-to definition functionality give me multiple effective ways of navigating a codebase. As a side-note, in order to run arbitrary commands from vim I make use of the built-in method to call commands (note the !), i.e. :!ls -l.

Lastly I appreciate being able to have some git tooling in my vim environment. For that I make use of vim-fugitive. It allows me to open a window where I can manage git. This window allows me to view changes. It allows me to view diffs for those changes. It allows me to stage and commit changes. It allows me view history, and open up diff's for particular commits. In short, it's a powerful tool that's pretty straightforward to make use of.

Vim provides a comfortable environment for me to work in, and it provides me a small bit of joy when I am writing code. My hope is that no matter what type of code I am working on, I can continue to use this environment. And I am feeling pretty confident that this can be the case given the improvements I have seen over the last few years, and the active development happening amongst the vim community (including neovim too!). I'm appreciative for the hard work that the community puts into this tooling.

I hope that you too have an environment that you are comfortable working in, and maybe you too have some small bit of joy from having fun writing code and if not, well I just hope you find joy in some other part of your life. Take care, and happy new year!