One of the most important things to being a developer is your development environment. Being productive depends a lot on what tools are available to you and how much are you familiar with them. As a coder, what software you use to write code will be one of your most important tools.
I strongly believe productivity is tied to comfort. And for me, being comfortable is being able to do more with less. I always tried to learn the keyboard shortcuts of every software I use as it's often the fastest and simplest way to do something. When I learned about the keyboard-driven nature of vim, it seemed perfect for me. It fitted with a goal I had at that time which was to lessen my usage of a mouse (I had a pretty bad trackpad so I had to use an external mouse).
Another thing I believe is a tool should be adapted to your needs, not the other way around. My expectations were shaped by my experience with the Jetbrains' products. Things that were essential for me were auto-completion (mostly for variables' names), linting code (a real time saver when fixing syntax errors), project management (mostly for launching commands inside a directory, git (for basic stuff like viewing diffs and committing) and snippets (that came later).
For auto-completion, I started with youcompleteme inside of Vim. It was overly complex for me to install, so most of the time, I did not even bother and just use the default completion engine inside Vim. But after learning about deoplete, I made the switch to Neovim (it was easier to install in Neovim). Now, I'm using COC which is even easier to install and configure. The default completion engine would suffice, but using COC make it simpler for me.
There's nothing that can speed up your coding like linting. Being able to correct syntax errors as well as correctly formatting your files help greatly during the development process. At first, I didn't know about Vim's
make system. I used Syntastic, then I switched to Ale when I moved to Neovim. Now, I know about the
make system and understand the edit-compile-fix process, but it is easier for me to use Ale.
I don't need project management as the IDEs do. What I needed was switching between files quickly and launching commands in the context of the directory I opened the editor in. For the first one, I started with CtrlP. But, as soon as I heard about FZF, I switched to it. As for file explorer, I started by using the default one, Netrw, then nothing for a long time (FZF was enough). A few months back, I tried to used Denite and [The NERD Tree)(https://vimawesome.com/plugin/nerdtree-red), but I could not feel comfortable with them so I moved back to FZF and Netrw.
My needs for git within the editor are the basic ones. I only need to be able to see which files were modified, to select which ones I'd stage and to quickly write the commit message. Since starting, I've used fugitive. It fits perfectly within my process. I've added a couple of mappings to the most used commands.
I don't use snippets that much. But I've installed UltiSnips and I've added a couple of snippets. It's very powerful and fast.
And that's it. Neovim does everything I want from a text editor. I also analyze my coding process from time to time to see what I could improve in it. You can find my config here init.vim.
Top comments (14)
Pretty similar to my setup. I use MacVim though, not Neovim. What's your argument of Neovim over that?
Side note: CoC is amazing!
I've not used MacVim as I was using Neovim with Linux before getting an MBP. But I like being in one terminal when I'm working (All the applications I used daily is usually on full screen (small screen)). It's easier for me to focus on one thing that way (I was using a tiling window manager on Linux). I close and reopen Neovim multiple times throughout the day. Let's say I need to change branch to fix a bug. I suspend the current vim session (
ctrl-z), switch to the branch (
gco <new-branch>, open a new neovim instance (
nvim .), fix the bug, close the recent instance of neovim (
:qa), go back to the branch I was (
gco <old-branch>) and resume my work where I left it (
fg). I don't say you can't do the same process using MacVim, but I don't like switching applications when I'm working.
Your workflow sounds like a perfect use of the Neovim split window(neovim.io/doc/user/windows.html) and built-in terminal (neovim.io/doc/user/nvim_terminal_e...) features, instead of all of that suspending.
@tnolte . I tried it before, but it felt a little strange. I'm already in a terminal so I just used that instead. I can't run longstanding command in it as I close and reopen Neovim a lot (mainly for reloading file (have to make a script for that or find one). I don't copy messages from the terminal and pressing
command or alias,
resumeis more sastifying than
term full-command. Or maybe I should try it again....
Worth noting is that everything people are saying you can do better in neovim here, you can do in vim.
I feeled the same until I've found vim-wintabs that had changed my way of dealing with tabs and buffers and helped me to reconsider tabs as helpful.
I only had to add some extra mappings to change tabs following the plugins'
Also, one last thing to consider although but I'm used to it now, is the
<C-\><C-N>to escape the terminal (but also scrolling with the mouse or clicking outside the terminal buffer does it).
Finally, thank you for sharing your experience that syntheticly.
Can't wait for the next year or two with all the communities work...
You can also use
gco -to go back to the previous branch just like you would use
Makes sense. Thanks for the info!
Neovim works on other systems? I mean, not as many as Vim, but more than MacVim :)
Very true lol good point.
Never tried Windows, but it works on Mac and Linux perfectly
I've been struggling with a half broken deoplete/Padawan/ctags setup ever since upgrading to Neovim 0.4.0, and general resource utilization of ctags. It's all been costing me productivity lately. I saw CoC not long ago and after your write up I'm going to have to give it a go and hopefully get my productivity back. Thanks!
I don't know if it worked fine for php. I've only written php occasionally and it was with the Laravel framework. But it was usable.
I used this coc-phpls, but you can check the php section of coc docs
Definitely check out github.com/jarun/nnn
Ive replaces netrw with this and its been great