Hacker News new | ask | show | jobs
by wilkskyes 2705 days ago
My advice would be to learn and master vim.

When I began programming, I was forced to use vim and hated it, I didn't understand why someone would use such an "old school" text editor to write programs. I abandoned it and moved on to typical IDEs. As a young programmer, it's difficult to see the value.

But many years later I discovered the power of vim came from customizing it to my exact preferences, and mastering all the shortcuts and its grammar. After a year's worth of effort, I began coding at the speed of thought, and programming has been much more enjoyable ever since, as time moves on I only get faster and faster. It's like cooking with a really sharp knife vs a dull one.

2 comments

This somewhat depends on the technology you're using as well though. Writing Java in vim is a pain in the ass in comparison to something like IntelliJ that has auto-importing, go to definition, etc
You can do all those things with vim. Look it up.
I still like IDEs, but here's an example of the kind of thing you're talking about: in ~/.vimrc, I put

    nnoremap <F5> :w<cr>:!printf "\033c";python %<cr>
and now I can execute a Python script I'm editing with one keystroke instead of "save, exit, ./myscript, vi myscript".
You might be interested in the setting makeprg:

set makeprg=python\ %

Vim comes with the :make command which is handy for compiling projects with Makefiles. But you can also set a different value for makeprg to do whatever you want for the current file. Of course you still to set up a key binding in your VimRC:

map <F5> :make<enter>

> instead of "save, exit, ./myscript, vi myscript".

This is something I see a lot of people doing. Obviously, it is not efficient. There is no harm in having another terminal window open where you run the script. If you are using SSH, you can use tmux or screen to have several terminals in one SSH session. And lastly, if you have to edit several different files, do not exit vim to switch files. Learn to use the :e and :b commands.

(The last advice is meant for the general audience and not directly to the previous post's author)