• Format JSON in Vim

    Occasionally I find myself needing to format a JSON document. There a couple tools online that can do it but it’s nicer do be able to do it right inside of Vim without having to leave. Here’s a simple command to do this (you’ll need Python installed).

    Just execute the following with the JSON document open.

    %!python -m json.tool

    Now if you’re like me you won’t remember this in an hour so you can add it to your .vimrc file as a custom command like so:

    command! FormatJSON %!python -m json.tool

    And there you go. Easy formatting of JSON documents.

  • Managing Terminal Jobs

    My terminal workflow usually involves multiple windows and tabs with a job running in each. Lately though I’ve been trying to use the capabilities that Bash provides to manage jobs and run them in the background.

    Here are some useful commands I’ve found.

    Command What It Does
    ctrl-z Suspend the current job
    jobs List the current jobs
    fg %[number] Resume a job in the foreground
    bg %[number] Resume a job in the background
    kill %[number] Stops a job
    %[name|number] Resume a job in the foreground
    disown %[number] Keep a job to running after terminal is closed
    nohup job & Run a job in the background

  • Be Productive, Eliminate Distractions

    I love to-do lists. And automation tools. And pretty much anything that claims to aid productivity. Perhaps it’s the programmer in me that is never satisfied with the status quo and loves to tinker but I’m always wanting to reorganize, automate, or find a better way to do something.

    However good intentioned though, I often waste a lot of time being “productive”. There are hundreds of ways to organize a to-do list and a million things you could automate in your daily workflows and I’m fairly certain I’ve tried 99% of them. Unfortunately, in the endless search to make things efficient and be productive, much time is wasted.

    Often more important than automating and organizing but frequently overlooked is eliminating distractions and doing one thing at a time (i.e, no multitasking). There are numerous articles and research that show how much multitasking and context switching are bad for your productivity.

    Between Twitter, chat messages, emails, Hacker News, and Facebook there is an endless supply of distractions that waste much more time than most things I might try to automate. All those things are good but without care they can easily become constant distractions that slow you way down.

    The takeaway? Be mindful of how much time you spend trying out new productivity tools or automating things and instead trim down the daily distractions so you can focus on that important tasks at hand and get them done.