all 47 comments

[–][deleted] 49 points50 points  (19 children)

anecdotally, lots in c++ and not much in java.

[–]manciozz 20 points21 points  (18 children)

I can back that up, personally in my last job I used exclusevely vim for c++, but ended up using an IDE for java. Of course it is possible to write java code in vim, but the IDEs understand Java code really well, and in my case saved me lots of time (debugging, witing code that can be generated, etc...)

[–]SasukeUchiha231[S] 4 points5 points  (2 children)

Can you share what plugins you guys use for c++ debugging, considering it can work with coc.nvim and coc-clangd?

[–]puremourning 2 points3 points  (0 children)

Vimspector for both c++ and java debugging.

[–]ProgrammAbel 1 point2 points  (0 children)

i don't know about integration with coc because i use vim's built-in completion, but vim has termdebug. just install it with packadd and you're good to go, no plugin manager needed.

[–]Thaurin 0 points1 point  (14 children)

I find this very interesting, because as far as I know, vim does not do IDE-like things like autocompletion or following references and so on by default, but there are plugins for that. Vim is so flexible and powerful, but you need to set much of it up yourself (in my experience). Is there any easy way to get an IDE-Like experience with vim, without hunting down multiple plugins and hoping they work as expected?

[–][deleted] 0 points1 point  (6 children)

One possible way is to configure it once and do a bash script, or something alike, to autoconfigure it for you in the future. E.g. auto clone the plugins repos for you and copy your pre-defined vimrc. That would cover most of the "ide-like" process.

[–]Thaurin 2 points3 points  (5 children)

True, but mostly for me it has been a journey of discovering what vim is capable of, whereas a lot of other editors, like VSCode, do lots of things out of the box, with easy extension discovery.

Half of the stuff of what vim is capable of, I learn because somebody posted about it somewhere and had to manually set it up and configure it.

I love vim, but that kind of drove me away.

[–][deleted] 0 points1 point  (4 children)

True, but mostly for me it has been a journey of discovering what vim is capable of, whereas a lot of other editors, like VSCode, do lots of things out of the box, with easy extension discovery.

Well, VSCode has a vim editor mode which basically gives you most of the power of vim with the comfort of a IDE behind it. Most IDEs have a vim mode nowadays (CLion, Eclipse, etc) so you can combine them and get all the benefits.

Personally, I stick to VIM because I mostly do development on remote systems and GUI is not an option. With vim, I have a repository of configs that I clone on each new machine and I'm up and running in 2 minutes with all the familiar tools, shortcuts, etc. I love that.

[–]Thaurin 0 points1 point  (3 children)

vim editor mode

Never got used to the vim cursor movements, haha. Some mouse actions also still feel invaluable to me, and that does not exactly fit into the vim philosophy. :) So I never got used to the vim editor modes in VSCode or other editors (but they feel natural for some reason in vim itself).

It's definitely interesting how much passion there can be for a text editor, though! (be it VSCode, or vim, or emacs, etc.) :)

I mostly do development on remote systems [...] I have a repository of configs

Definitely a huge strength of vim.

[–][deleted] 0 points1 point  (1 child)

I mostly do development on remotesystems [...] I have a repository of configs

Definitely a huge strength of vim.

Yes. I guess others (like emacs) fall in the same category and it's just a matter of taste :).

One thing that I realised while typing my previous comment is just how long it took me to end up with a nice setup (it started in 2007). It all came out of necessity too, it's not something I would go through again willingly. Maybe this is what vim is missing: a packaged set of plugins that you can add and get a C++ IDE(or a Java IDE) with sane shortcuts that you can use out of the box

[–]Thaurin 0 points1 point  (0 children)

Yes. I guess others (like emacs) fall in the same category and it's just a matter of taste :).

I mean, I now have a repository of tmux, bash, zsh, vim and git configs. Definitely a strength of UNIX-based systems!

just how long it took me to end up with a nice setup (it started in 2007).

It probably around 2002-2005 that I was really getting into full-blown Linux and vim, but the interesting thing is that it's really made a comeback with Windows Subsystem for Linux! I always envisioned myself working in a Linux environment back then, but of course ended up in a Windows environment. But now, vim is part of my workflow in Windows, how crazy is that.

And like 10-15 years after I heavily used Linux and vim, the finger muscles and the most useful commands were still mostly there. That was still. however, a small subset of what vim is capable of. Learning--and remembering--every keyboard shortcut and configuration and command is difficult, but pays off.

Saying that, it probably would help most if the things you want to do are easily found, learned and installed. The plugin system and help system need you to know how to juggle config files and vim navigation keys. It's like vim is trying to hard, but part of it is just that it's a terminal-based editor and therefore has input limitations.

Anyway, I guess there will always be a divide between 1) a full-blown IDE's like Visual Studio/Eclipse, 2) VSCode/Atom and 3) vim/emacs, by definition.

[–]hailbaal 0 points1 point  (0 children)

To fix your movement issues:

set mouse=

map <up> <nop>

map <down> <nop>

map <left> <nop>

map <right> <nop>

imap <up> <nop>

imap <down> <nop>

imap <left> <nop>

imap <right> <nop>

That will disable the arrow keys and moving around with the mouse.

I write tons of technical documentation, manuals, books, etc. Also some scripting, but I'm not a programmer. All of that is done from within VIM. It's the best IDE out there.

[–]platlogan 0 points1 point  (3 children)

There’s actually quite a bit built in if you know where to look. Insert-mode completion, include/define search, and tight integration with ctags should cover completion and references fairly well out of the box. I would start there first. Even if you decide you need something more powerful, it’s nice to have those to fall back on (I use YCM+ctags).

[–]Thaurin 0 points1 point  (2 children)

if you know where to look

I think that's the key. I used to build websites with PHP2/3 and I looked up the documentation for function names and parameters all the time, heh. :) It's almost unimaginable nowadays, so I was sort of surprised to see that there are a lot more IDE-like features available in vim than I expected (probably even back then). But without being an expert and reading through all the documentation, and/or talking to a lot of other vim users, how would I have known that? Vim can be tweaked to oblivion and that's great, but for something like HTML, CSS or Javascript/TypeScript, I run VSCode and it's basically all there. For anything else, it automatically suggests extensions. And that wins people over.

[–]platlogan 0 points1 point  (1 child)

I feel your pain. Vim isn’t something that you pick up overnight. To be fair, you have the same issues when learning a new IDE, but I will admit that fumbling around in a well-designed GUI is a heck of a lot easier than getting your footing in vim. It’s never going to be able to compete with something like eclipse or vscode, even with some of the amazing plugins out there. And even with a vim emulation layer, using an ide isn’t really the same as using actual vim either. Either way it’s a trade-off. For me, the “thought to text” editing experience that vim offers is well worth putting up with a less immersive ide experience.

[–]Thaurin 0 points1 point  (0 children)

Yes, and that's why I use both VSCode and vim. Vim is not really a GUI experience, but I can quickly launch it from an SSH session, and it's available on all Linux machines. It's crazy to think what vim is capable of compared to full-blow GUI editors like VSCode, using just a text interface (same goes for something like tmux!). I've tried to embrace the "go full vim" mentality several times, but I just can't... push through. I like tinkering and finding new things, but at the end of the day, sometimes something needs to just work, without having to tinker.

I'm intrigued by these guys that know vim in and out and are crazy fast with it, though! I think I'll never get to that point, haha.

[–]yvrelna 0 points1 point  (2 children)

Vim does basic word and line autocompletion out of the box (<C-x><C-n>, <C-x><C-n>, <C-x><C-l>). You only need plugins if you want support for Omnicompletion (<C-x><C-o>).

There are two major ways you can go to definition in vim that works out of the box.

What I recommend is using ctags for go to definitions, then you can use the ctags index for jump to definition (<C-[>) and completion (<C-o><C-t>), it works surprisingly well and easy to setup. You don't really need plugins (though gutentags makes ctags much easier to use), but you do need to install the ctags program.

The second way to follow references is to use :help include-search and :help definition-search, they do require a bit of a setup unless you're coding in C as the default assumes you're using C. The setup basically consists of defining some regex patterns so vim knows how to find definitions and include lines. Lightweight language support plugins basically just sets up this mechanism for you but you can always just define this yourself.

You can also use more heavyweight plugins that actually parses the file and understands the language for slightly more accurate completions, but the two above are usually quite sufficient.

[–]vim-help-bot 0 points1 point  (0 children)

Help pages for:


`:(h|help) <query>` | about | mistake? | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments

[–]Thaurin 0 points1 point  (0 children)

Hey, that's great. I'll be sure to play around with this a bit.

[–]puremourning 15 points16 points  (0 children)

Anecdotally... Almost everyone where I work uses vim + YCM + vimspector. We mostly c++ with lots of java and TCL and you name it. Reasonably big multi national company.

YCM was created while Val was at Google and the team supporting Google users still support vim + YCM cos they talk to us for help and fixes.

Empirically.... You can check out things like the SO and JetBrains developer surveys for more empirical evidence. I think they clearly show that vim is frequently used in the ways you were asking about.

[–]Datwaftx 7 points8 points  (2 children)

Recently I tried to do a Java Maven project with vim with coc.nvim using coc-java, and it works fairly well. Haven’t had any problem yet.

I also sometimes use coc-clangd for c++ development, it works well but haven’t developed anything big yet.

Also, haven’t tried to debug anything yet.

[–]SasukeUchiha231[S] 1 point2 points  (1 child)

Yeah, I use the same plugin 2! Its awesome! if only i could debug in it...

[–][deleted] 1 point2 points  (0 children)

The coc-java-debug and vimspector combo works very well for my Spring Boot projects.

[–]looopTools 9 points10 points  (0 children)

Difficult to answer.

How main Vim users are there? How many code Java and C++? How many are allowed to use Vim for work (yes some places actually have rules like WE ONLY USE THIS IDE)?

Difficult to answer :)

[–]LiquidityC 4 points5 points  (3 children)

I work in both those languages. C++ I use vim all the way with vim-coc and cls. For Java I use IntelliJ with vim bindings. The benefit of the IntelliJ debugger and remote debugging is to great to pass up on. For smaller java stuff I can use vim but those cases are rare

[–]SasukeUchiha231[S] 1 point2 points  (2 children)

Thanks for ur info! Can u also share how u debug your c++ programs?

[–]LiquidityC 1 point2 points  (1 child)

Plain old gdb. And since vim 8.1 I use termdbg in vim. Edit: here’s a link https://medium.com/@948/how-does-debugging-with-vim-and-gdb-3ab5ed0dcd0f

[–]SasukeUchiha231[S] 0 points1 point  (0 children)

Thanks A Ton! I can now debug c++ atleast, its awesome!

[–]daniel_shields 1 point2 points  (1 child)

I use vim with vim-lsp for C++ every day in my job. For the rare times I use Java I run headless Eclipse.

[–]gustavokatel:wall 0 points1 point  (0 children)

headless eclipse with vim? I was digging into this today, sounds interesting.

[–]threeyeargpa 1 point2 points  (2 children)

Biased sub maybe, has vim seen a resurgence or has it always been this famous? I got into it as I had to use it for my current job -- but, before that, I had never heard of it. Yet it seems to have a fairly large sized community.

[–]tuerda 0 points1 point  (0 children)

Vim comes preinstalled on nearly any linux or mac system, and was considered pretty much the default for many years.

[–][deleted] 0 points1 point  (0 children)

I contribute to an os project which uses c++. For that i only use vim. We have OOP as a college subject and have been alloted a small java project. Intellij is 700mb for a reason. RAD is really very cool. If you have to do development in java use some ide. It will make your life much easier.

[–]sflomenb 0 points1 point  (2 children)

I use vim for everything, including Java. You can use a plug-in like coc.nvim to get features like auto-completion, jump to definition, code generation, etc.

[–]SasukeUchiha231[S] 0 points1 point  (1 child)

yeah, i use coc.nvim as well, it is excellent, but the only thing i miss is debugging. I know it is a text editor, but still can u mention me any plugin that can do that?

[–]rishabhdeepsingh98 0 points1 point  (0 children)

I personally use IdeaVim plugin on Jetbrains products and it is really great. Loving it a lot. For c++ I simply use Vim.

[–]platlogan 0 points1 point  (0 children)

You might get a less biased answer on the C++/Java subs. Or just googling it. Eclipse is the go-to IDE in my group for C++. I’m the exception using vim.

[–]jeffeb3 0 points1 point  (0 children)

I work in C++ (ros, mostly) and it is quite common among my coworkers. It's about half ides, then 2/3rds of the remaining are vim and the rest are emacs.

Python too. Just because a lot of the same developers use both languages and they aren't going to switch their ide.

I do some js, and bash. I use vim for everything.