This is the second round of random mini level-ups I had in programming over the last couple of weeks. I wrote the first post of this kind last month1 and have already piled up enough small lessons for part 2:

  • Git: You can keep a folder but not its content in Git: Add the following .gitignore file into the folder
    *
    !.gitignore
    

    I found this in a directory2 that Laravel uses for caching.

  • Vim: To start a new line after the current one I currently use A↵. From normal mode, A moves me to the end of the current line and into insert mode where then inserts the newline. I discovered that there is a single key for exactly this move: o.

  • Git: Instead of manually deleting untracked files one more time, I decided to search for a command to do it. Turns out that this is built into Git already: git clean command deletes untracked files from the working tree. It has a couple of options, most importantly git clean -n to not delete anything but only show what it would do.

  • Vim: Search results with / are available even after doing other things like moving around and editing. Simply press n to jump to next occurence and cycle through them.

  • Functional Programming: The term pointfree style describes programming functions without mentioning their arguments directly, but composing them from other functions. I learned this while writing my first post about Haskell3.

  • Command line: On OSX the command pbcopy can copy file contents to the clipboard. If I want to paste content from a file somewhere, I use pbcopy < path/to/myfile and then simply paste it with ⌘ + v. Found here4.