TODO: Expand following content into sections
Editor styles - Evil or Holy modes
You have the choice of using either Vim or Emacs keybindings for your edior. Or you can have both and switch between the two with
Regardless of your choice, you can still use all of the features of Spacemacs via the command menu
Vim is arguably faster, especially once you get used to multi-mode editing (switching between normal & insert mode). This speed is in part due to simpler keybinding when in normal mode as you are not typing content into the editor, simply running commands with each key press. This means you can have single characters to do many of the common commands, eg
l instead of
C-f for moving the cursor forward.
If you are familiar with Emacs keybindings, then probably best to stick to holy mode. If you are new to Emacs or you just want to take advantage of Vim, then select Evil mode.
Why Vim ?
- Cut the Mouse - One of the main wins for Vim has always been that it is an editor that lets you keep your hands on the keyboard. Reaching for the mouse slows you down, and while I never really had a problem with that in the past (I spend more time thinking and reading than I do writing code), now that I’ve experienced 2 months with my hands on the keyboard I do find myself noticing (annoyingly) when I am forced to reach for the mouse.
- Fast Navigation - Moving around inside files in most windows editors involves a lot of home/end/up/down arrow key. Having search and tag based navigation makes getting around within a file much faster. Finding the right file is also easier with the commandt plugin, influenced by Textmate on the Mac, this fuzzy file finder is not typically available in traditional windows editors (last time I looked)
- Split Windows - Splitting windows into panes and navigating around them is a killer feature that I use all the time to see multiple files at once, or multiple areas of the same file at once. In the past I used tabs heavily, but I now prefer split panes that I can manage without reaching for the mouse.
Effort vs Reward
Ok. So I have a theory…
Vim proponents will tell you that the effort you spend learning vim will pay dividends in the long run once you know how to use it properly. After 60 days I can say that I agree with that opinion.
However, if I spent this much effort learning any editor I think it would pay dividends in the long run. The difference is that Vim forces you to go through this pain, whilst other editors work ‘out the box’ and so most programmers are not inclined to learn the power of those editors.
For example, I think UltraEdit, TextMate, even Visual Studio are pretty good editors, but since they all pretty much just work out of the box, its easy to ignore their advanced features and not spend the time customizing and configuring them.
I wonder if I spent 60 days really learning UltraEdit if I couldn’t get the same positives I described here ? Hmmm, a future article maybe? Conclusion
I’m still using Vim after 60 days, and I plan to continue using it for the foreseeable future as long as I can keep taking a little time here and there to dig deeper, customize a bit more, learn how to overcome the negatives and build upon the positives.
Vim seems to be so powerful that I could be learning it forever. Here’s a list of some of the things I want to spend time on in the future.
Movement - I need to learn more code related movement commands like % match Sessions - Both sessions.vim and sessionman.vim seem to struggle with NERDTree and the quickfix window Cut & Paste - I need to learn more about vim registers so I can manage my cut & paste better, errr, sorry, I mean yank & put Undo & Redo - I think I spend too much time in insert mode so when I undo it tends to be more than I’d like HJKL - Maybe I should remap to swap the J and K keys and try again! More Plugins - There are many more plugins I would like to take the time to check out, and perhaps build some of my own.
Working with Buffers
To work with files in Emacs, they are first loaded into a Buffer.
So when you open a file with
M-x find file or
SPC f f a new buffer is created so you can manage that file.
Buffers are displayed in a window and you can change the window to show any of the current buffers.
Here are the most commonly used buffer commands
||helm-mini||List current buffers|
||kill-this-buffer||Kill current buffer|
||home||Switch to Spacemacs home page|
||next-buffer||Switch to next buffer|
||previous-buffer||Switch to previous buffer|
||switch-to-scratch-buffer||Switch to the scratch buffer|
||copy-whole-buffer-to-clipboard||Copy current buffer contents to kill ring|
See the full buffer menu via
Also consider using:
Editing text (especially in Evil mode)
See Vim section
Working with Windows
||Close current window|
||Vertically split current window|
||Horizontally split current window|
||Jump to window number|
You can also create layouts that are a collection of windows