Tuesday, April 2, 2024

Switching From Xcode to Neovim

Wojciech Kulik:

To give you an idea what it means, here is a simple example. Let’s say you want to delete the current line in Xcode. You would probably use the mouse to select the line, then press cmd + x to cut it or backspace to delete it. In Neovim, you can do the same thing with just one command: dd.

Another example is let’s say deleting everything within the nearest brackets. In Xcode, you would have to manually select the text, while in Neovim you can do it with dib or cib if you want to start typing right away.

These are both pretty easy to do in Xcode. You can use Control-A, Control-K to delete the current line. And I assign Command-Shift-B to Xcode’s Balance command to select everything within the nearest brackets. It does not have editor macros, though.

You could have thought: “ok, but what’s the difference between Neovim and VSCode? It also offers thousands of plugins.”

The difference is that Neovim allows you to extend the environment without creating the whole plugin and the knowledge on how to do that. You just need to know the basics of Lua language (which is very easy to learn) and you can right away customize whatever you want directly in your config.

Previously:

Update (2024-04-03): Timothy Perfitt:

i just discovered recently that xcode has a VIM mode as well. so you literally can do dd in xcode as well.

2 Comments RSS · Twitter · Mastodon

> You can use Control-A, Control-K to delete the current line.

It is also worth noting that this is the same in Emacs. So if anything, if you want to switch from Xcode to a more powerful editor, you should switch to Emacs 🤓 You can continue to use the keyboard shortcuts you already know, you get advanced features like editor macros, and you can extend it w/o huge plugins (admittedly Lua is probably a more approachable language than Lisp).

FWIW double clicking on a bracket also performs a 'Balance'

Leave a Comment