I’m working on an Elixir app at the moment and really enjoying it, but some of my recent dabbling in the type-safe worlds of Elm and Crystal have left me desiring a bit more structure in my code. The app I’m building involves a multi-step data transformation and so I have a data structure to properly represent this process. But since Elixir is a dynamically typed language, you can’t, for example, have a non-nillable field in a struct. The Elixir/Erlang ecosystem does, however, have a type-checking syntax called Type Specs, along with a tool, Dialyzer,...
Blog Entries tagged "vim"
I had a ridiculous typo in a Git commit message recently, so I decided to explore spell checking in Vim. As it turns out, it’s extremely easy.
I only wanted it enabled for Git commit messages and markdown, so I added the following to my vimrc / init.vim:
" Spell-check Markdown files and Git Commit Messages autocmd FileType markdown setlocal spell autocmd FileType gitcommit setlocal spell
By doing this, it highlights potential misspellings in red underline. You can see a list of potential corrections by moving the cursor over the word in normal mode and...
Here’s a handy Vim command that I find myself searching for often. It could easily be made into a function in your vimrc.
" 4 spaces to 2 spaces %s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g " Tab to 2 spaces %s/\t/ /g
In order for testing to become part of your development workflow, it needs to become a habit. And like any habit, its biggest enemy is neglect. Too often I’ll be in a rush and not add tests to my code for a day, and that turns into a week and then a month, and suddenly I have an app where half of my codebase is untested and the other half has breaking tests. There are many things you can do to help keep this habit (hooking up a CI server immediately comes to mind), but an important one is to make running your tests as quick and easy as possible.
One way I do this is by making my ruby tests (either Rspec or Minitest) extremely easy to run while I’m using Vim (and Tmux). With one quick keystroke, I can run the current test file or individual test in a new Tmux pane.