12 ms·
Using Vim for C++ Development
- W0lf 6y agoBefore switching to CLion eventually, I've used my well curated VIM config[1] together with YouCompleteMe and several clang-based tools such as clang-format, clang-rename etc. for several years, working on smaller and large C/C++ codebases with reasonable success. At some point in time I switched to a full-fledged IDE (CLion) because there are certain refactoring tasks which are probably still possible using this setup but I found them to be mentally too complex to deal with, especially when I am focusing on the task at hand at the same time. [1] https://github.com/NewProggie/Dev-Utils/blob/master/dotfiles/.vimrc https://github.com/NewProggie/Dev-Utils/blob/master/dotfiles...
- me_me_me 6y agoThat would be my advice, if you are comfortable with vim it will be a great tool for small to mid projects. Maybe even larger ones that are clearly modularized and kept lean. But you cannot escape the reality, refactoring kinda needs a good IDE to get it done quickly.
- nonbirithm 6y agoAn IDE or the equivalent of an IDE implemented as a language server. Using language servers make me wonder why it took so long to figure this out. Pretty much all IDEs are awful for text editing if you're a Vimmer but superior for the refactorings you're going to need. Programs like Vim are excellent text editors but JetBrains is never going to invest in VimScript. I am occasionally frustrated that sometimes I am still forced to choose between one or the other because a lot of the servers are still in their infancy. Still waiting for the equivalent of Visual Studio 2019 as a language server that actually works with the projects I have to develop.
- dboshardy 6y agoAt least jetbrains has a vim plugin for all it's IDEs, you know?
- alpaca128 6y agoThere are still a lot of little differences which were fundamentally the reason I even switched to Vim in the first place. The tab switching and window splitting alone is something that drives me mad every time I have to use a Jetbrains IDE. Not to mention IDEs always insist on auto-formatting code while I'm typing it, which feels like using a site where the content jumps around because the ads are still loading.
- geoelectric 6y agoUnless they fixed it in the last year or two, the interactions between JetBrains selection (necessary for a lot of the IDE magic) and Vim visual mode (what you'd actually use in the IdeaVim bindings) weren't always very predictable. That prevented the easymotion clone from working quite like the plugin, other things along those lines. I found it to be a very good emulation of vanilla Vim, but also found when I was using Vim mode I hardly used any of the IDE features aside from passive JSDoc/outline/etc displays. That lack of integration between the two halves killed it for me, not to mention it'd been a long while since vanilla Vim was what I was really using. I love the Language Server concept and hope that just becomes the thing going forward. There was never any reason specific language knowledge should be part of the editor, other than we didn't have a vertical enough ecosystem yet to coordinate a different way. Whatever else I can say about Microsoft, they accomplished that vertical pretty skillfully with VSC and TypeScript, and have been running with it like mad. I'm glad some of that has been to our general benefit.
- winrid 6y agoThe code is being auto formatted because you are writing it in a way that doesn't align with your formatting rules! :) I think you can change that to only on file save, though.
- tesseract2 6y agoIn IntelliJ, it is possible to open the current buffer/editor in emacs using emacsclient. You can configure Tools > External Tools in the preferences. With this, you can have the same line number centered in emacs. There could be something similar for vi too, though I have not explored this route. Could this be a good compromise?
- powersnail 6y agoLanguage servers + vim are sometimes not as performant (or efficient) as an IDE. Once, I tried replacing IntelliJ with vim + deoplete + a linter plugin (whose name I forgot), because Intellij ate my laptop battery too quickly, and because I like editing text in vim more than IntelliJ. Well, the vim setup ate through it twice as fast, and was slightly less responsive.
- SPBS 6y agoYou don't have to pick one. I write my projects in vim and keep the IDE open for when I want to refactor/debug. I'm not against using the IDE mind you, I sometimes refactor then keep on typing in the IDE. But I find myself naturally drifting back to vim when I'm just writing code. (I'm also a firm believer in getting familiar with the default keybindings for any program, so I don't use any vim emulation in an IDE. There's value in learning a set of shortcuts that are usable everywhere)
- me_me_me 6y agoI agree, there is no silver bullet for anything. Editors, languages, tools, cars etc. Every tool has trade-offs, knowing how to use each and when to used them is going to help you work faster and smarter.
- Mr_P 6y agoCLion (and other IDEs) have pretty good vim plugins: IdeaVim, VsVim , Vrapper. They're not perfect, but I also made the switch from vim to CLion and never looked back. With a half-decent plugin for editing text, there's not much value in using a more minimalist vim setup IMHO.
- alfalfasprout 6y ago+1 to CLion. Vim is great for what it is-- if I need to make a small edit or even work on C code it does the job well and is very fast and efficient. But at the end of the day it's not a full blown IDE and as such is missing a graphical debugger and profiler, good configuration for interactively running unit tests, and complex refactoring tools. CLion is pretty much the best C++ IDE I've found by a mile. Eclipse is so slow and terrible I won't even consider it. Visual Studio is amazing but Windows only and really heavyweight. VSCode, Atom, etc. aren't really "proper" IDEs. Then there's open source contenders like Jucipp which while very fast do lack a lot of the niceties of their paid competitors. My only gripe with CLion is that it's CMake only. This limits its usefulness for Bazel or Autotools projects.
- hoot 6y agoClion added support for Makefile based projects back in July. https://www.jetbrains.com/help/clion/makefiles-support.html https://www.jetbrains.com/help/clion/makefiles-support.html
- mrich 6y agoWhat are you missing in VSCode to make it a proper IDE?
- alfalfasprout 6y agoThe lack of a built-in profiler was a big one for me (though this may have improved recently). I do like using external tools like Intel VTune or Morgan Stanley's XPedite but they're not great for the "quick profiling" you might do to test out various implementations of a function or component. Maybe that's been added since I used it 1.5 years or so ago though.
- CalChris 6y agoVSCode gets the look right. Indeed, its look is fantastic. But it doesn't get the feel of vim right at all. My fingers speak vim and they know whether they're talking to vim or something hinky. So after a few days with VSC, I go back. Usually it has to do with ex mode which I power edit in a lot. But I do look at VSC every year or so and it gets better.
- tesmar2 6y agoHow does VsCode compare for C++/Cmake development?
- alfalfasprout 6y agoIt's decent, though the debugger isn't quite as pleasant to use and it lacked a profiler last time I checked. But the actual editing experience is excellent and it uses libclang for a backend so you get up to date features for the latest C++ incarnations.
- finolex1 6y agoHaving used vim for several years, switching to VS Code greatly improved my productivity. Having an in-app file tree, and being able to quickly peek at definitions or all references of a variable are convenient features to have, and IMO not matched by any similar vim plugin. I feel the greatest advantages of Vim are its small memory footprint and keybindings, but it is possible to use plugins in VSCode for the latter and the former is something that has not affected me too greatly.
- versatran01 6y agoJust no
- fsloth 6y agoMy alternative is to use the IDE with Vim keyboard bindings. Much nicer, full tooling support etc. I love vim keybindings but am fully ambivalent about everything else...
- HeckFeck 6y agoWhile I prefer a simple editor, in the instances when I'm forced to use an IDE, I'm glad that VIM keybindings are almost always available. E.g., vsvim works quite well in Visual Studio. If I clinch my eyes it's almost like being at home.
- jamil7 6y agoThis always ends up in some kind of uncanny valley area for me as the editors never properly support everything.
- nonbirithm 6y agoAs it stands Evil is the only Vim keybindings add-on that actually feels like using Vim. Everything else will inevitably be missing a feature or not act in exactly the way you expect, leading to disappointment. That and you also lose out on Vim extensions.
- modernerd 6y agoEvil is very good, but moving to Emacs from vim was not quite the smooth ‘just use evil and you get the best of vim with the power of Emacs’ experience that people say, at least for me. I found it needed some extra configuration before it felt like stock vim. C-u isn’t bound to "scroll up" by default with evil, for example. You have to (setq evil-want-C-u-scroll t). That took a while to figure out and I expected it to work that way by default. Then you have to (setq evil-want-keybinding nil) and install evil-collection and evil-magit to be able to use vim movements in other Emacs buffers. Or you have to learn Emacs shortcuts and just use vim for editing, but that feels awkward for a vim native. As an Emacs newbie I still find it unsettling that documentation for packages and for Emacs itself all uses Emacs-style shortcuts. Of course it couldn’t really be another way, but I either have to learn those or remap things to vim-style leader bindings. It makes vim usage in Emacs feel a little uncanny at times. I could use a distro like Doom which has it all wired up for vimheads already, but then I’m learning someone else’s shortcuts and system, which takes away from the point of Emacs a little for me (the idea that you make it your editor). Maybe it gets easier with time. If any other vim users made the move to Emacs I’d love to hear some tips!
- lionkor 6y agoI can thoroughly recommend vim for C++ development that doesn't stretch over too many files and directories. Especially with custom include paths and a constantly changing bigger project, vim becomes almost unusable for me. I can very much recommend QtCreator. I don't use Qt, but as an IDE it's very well made. The fact that it can also do Qt isn't even apparent when you use it on normal CMake projects and the like. Extremely solid syntax highlighting is also important to me, which, in vim, is horribly difficult if not impossible. If I want something nested like `std::this_thread::get_id` to be highlighted properly, want macros to be a different color, want local scope variables to be a different style than class-scope or globals, vim is out of the question. So yes, I can recomment vim for C++ development as long as you're not using a ton of libraries and are okay with most of your code being the exact same color.
- spacechild1 6y agoI can also recommend QtCreator for C++ development! I regularly use it for my cross-platform open source projects (none of them are Qt based) and it works equally well on Windows, macOS and Linux.
- HeckFeck 6y agoAndreas Kling has used it to develop an entire operating system (Kernel to DE), so it can't be that bad.
- tcbawo 6y agoI agree, but I'll add that vim is much easier on a project where things are well organized and laid out. Some IDEs make it easier to find classes by name or navigate by click. This can lead to disorganization when many people are involved. I've found that in such an environment, there is a fixed overhead which makes vim much harder to use productively.
- hyperpl 6y agoI use a similar setup to the author's and coupled with ctags, I don't have any problem with massive projects and lots of 3rd party libraries.
- ausjke 6y agoI use a similar approach and setting for c++, I purchased clion for two years and rarely used it, vim is just handy and light-weight, I will probably use clion when my project becomes huge, until then, vim is absolutely enough. vim nowadays can find all the headers, do linter and auto-fix and auto completion, and when you're coding, you rarely need move the mouse at all, vim 8.2+ is itself a modern IDE inside a terminal, again, light and fast, I enjoy it.
- parhamn 6y agoIs there a LSPs in a box somewhere yet?
- Lio 6y agoCurrently I think the coc.vim plugin is as close as you can get. It has installers for LSP servers and VSCode extensions. You might also have good luck with a curated vim distribution such as SpaceVim[1], where everything should be pre-installed for you. Later, NeoVim 0.5 is going to have LSP out of the box[2]. So things are very positive. [1] https://spacevim.org/ https://spacevim.org/ [2] https://neovim.io/roadmap/ https://neovim.io/roadmap/
- fredsanford 6y agoYeah, lets take lightweight vim and add a node.js runtime and make a better ide.... sigh At that point you might as well use QT Creator.
- vyskocilm 6y agoI personally prefer https://github.com/dense-analysis/ale https://github.com/dense-analysis/ale plugin. It is in vimscript and supports almost everything (including clangd) out there: https://github.com/dense-analysis/ale/blob/master/supported-tools.md https://github.com/dense-analysis/ale/blob/master/supported-...
- tylerscott 6y ago+1 for Ale. It has simplified my Vim life.
- f00zz 6y agoI've been using syntastic [1] for this. No server needed. [1] https://github.com/vim-syntastic/syntastic https://github.com/vim-syntastic/syntastic
- glennvtx 6y agoSame here
- gen220 6y agoIs there some feature that coc.vim has that ale does not? Can someone explain coc.vim's popularity to me? I don't understand why coc.vim is so popular, when Ale is so performant and "debuggable" (i.e. produces useful performance traces). [long-time ale user here, I don't use clangd but I do use python-language-server, which is similar]
- jswny 6y agoGenerally it's because Coc has completion, snippets, and pretty much everything from the regular VSCode version of the extension built-in, so Coc can replace multiple plugins, and it works very well.
- hknapp 6y agoFor C, default vim comes with: (somewhat) intelligent complete (ccomplete) debugging (termdebug) jump to definition (ctags) reference finding (cscope) file explorer (netrw)
- figomore 6y agoclangd also works C. The same setup works for C.
- Asooka 6y agoOh yeah, for plain C, Vim is absolutely good enough. Virtual methods and templates drive the complexity of intellisense and refactoring up to 11. The absolute worst is when you're trying to call a method on a function argument of a templated type. The completer basically has to analyse every single callsite and present you with the intersection of all types that might be used.
- ravenide 6y agoI tried this. It is basically a slightly improved VSCode at this point. Basically, most the slowness/bulkiness of IDEs does not come from the text editing portion.
- wffurr 6y agoI didn't think setting up YCM was too bad. It also uses clangd as the completion engine for C++.
- kovac 6y agoWell, let me tell you how to do c++ programming with Vim. Get a Linux machine, replace the desktop with i3wm. Get a terminal emulator like urxvt and make it dark and semi transparent. Set a beautiful wallpaper. Install YouCompleteMe. Now you are in paradise :)
- Erlangen 6y agoAgree with everything except the beautiful wallpaper:) That's my setup.
- pjmlp 6y agoOnly if it is a C++ programmer that writes boring POSIX CLI applications and daemons.
- higerordermap 6y ago... instead of boring CRUD applications..
- pjmlp 6y agoThose were already boring in mainframes before UNIX was invented.
- deleted 6y ago[deleted]
- jvanderbot 6y agoGod how i3wm changed my life for the much, much better.
- hyperpl 6y agoThis may be considered blasphemy, but I continue to use i3-gaps on my 43" 4K monitor in 100% floating mode. It actually works quite well. Of course for my small displays I use tiling mode.
- gkfasdfasdf 6y agoI really like using TabNine for completion which does a sort of AI-autocomplete - the suggestions are usually more than just the next token, and sometimes are scarily good.
- benreesman 6y ago+1 for clangd (not to mention clang-tidy and clang-format). On Ubuntu 20.04 clang-10 is is in the standard repositories (I’ve heard it’s well-supported on other distributions), and the setup is seamless. clangd eats big-ass, hairy, template-heavy TUs for breakfast as concerns responsiveness, and I have yet to see it make a mistaken autocomplete suggestion or fail to find a declaration that I agreed with. It’s easily the equal in precision of the Intellisense server that some of my colleagues use and doesn’t bog down the same way. Even the method renaming is pretty solid. For me at least it’s a small but consistent productivity increase over any of the alternatives I’m aware of and fits into your existing emacs/vim/vscode workflow. Would download for free again.
- gpderetta 6y agoit crashes early and often for me though :( Should probably switch to a more recent clangd.
- ComputerGuru 6y agoI’ve been using it since the initial release when it wasn’t even its own tool, and it’s come a long way since then. There was a release that basically flipped a reliability switch and it was night and day in terms of responsiveness, stability, availability of completions, etc. Definitely update!
- benreesman 6y agoWhat environment? It's useful enough to me that I'll try to steer clear of places where it's difficult to get reliably set up. I've used the `clang-9` chain on Ubuntu 18.04 and the `clang-10` chain on Ubuntu 20.04 and it's been absolutely seamless.
- gpderetta 6y agoAll third party libs are custom built from source, but right now I do not remember which version of clang we use; it might be older than 9. It is a big code base,
- 6y ago
- scott31 6y agoClosed the page when I saw cmake mentioned
- benreesman 6y agoWhat should we be using? I’ve had nothing but trouble with Bazel and Buck (I’m a Buck committer). autotools is notoriously painful. Hand-written makefiles can be nice for smaller projects but get cumbersome with bigger projects. What am I missing?
- dgellow 6y agoFor small personal projects I started using dds: https://github.com/vector-of-bool/dds https://github.com/vector-of-bool/dds It's still very very young and in development, so not ready for prime time, but it "just works" and doesn't make me feel stupide the way CMake does...
- benreesman 6y agoThanks for the pointer, I'll take a look. CMake is definitely one of those tools where I look at the last project I was working on when I can to remember how to do stuff.
- oscargrouch 6y agoI would recommend GN (https://gn.googlesource.com/gn/ https://gn.googlesource.com/gn/) It has almost the same syntax as Bazel, but its implemented in C++. Super-fast and tend focus on Ninja build files. I've even created a fork that works for Swift here and it works pretty well. Its the meta-build project for Chrome, so its optimized for big projects with a lot of dependencies. I dont actually understand why is not much widespread giving the bad shape of meta-build systems (like CMake).
- figomore 6y agoCmake is used to generate the json file that clangd uses to do the autocompletion. You can use other tool, like meson, or even create the json file by hand.
- choeger 6y agoStupid question: who controls the language server? If I have multiple projects or multiple branches of one project or even just multiple build folders for different configurations, how do I tell the language server what I am currently working on? If I put the setup in my home directory, I am limited to a single setup (compiler, stdlib). If I put it into the project directory, I am limited to a single build for, and potentially a single branch, and I will have multiple instances of the lsp running if I stop working on one project. If I put it into the build for, which seems sensible, how does the editor decide which server to run or ask? It seems to me that I need some sort of project manager that acts like a lap proxy and then resolves these issues. Do I need to write one myself?
- gkfasdfasdf 6y agoNot a stupid question! The editor/plugin manages the language server process, and starts it as necessary with whatever project config it found for the file being edited.
- mellery451 6y agoas to how clangd sees your current translation unit, it comes down to the compile_commands.json (which is per-TU settings) or the more general compile settings in the config file(s) (https://clangd.llvm.org/config.html https://clangd.llvm.org/config.html). If you need to change your TU settings, you could have a simple scheme that symlinks compile_commands to different files depending on build type and then restart the server. I've not typically needed to do this (I tend to just stick with a debug build compile DB...), but it's something you could do pretty easily. There is one clangd process per editor process. If you have multiple projects with distinct compile_commands you might be able to come-up with a scheme to switch between DBs and relaunch clangd. Alternatively, you could try merge all compile_commands together, but I'm not sure the effort would be worth it -- just running separate vims seems like it makes the most sense to me. For switching between branches, you can typically regenerate the compile commands DB pretty easily (if you use cmake...), but it's really only necessary if there are big differences in files and/or compile settings between branches.
- MrUnderhill 6y agoI too would love a plugin for this.. I'd like to run the LSP server in a Fedora toolbox, then some sort of property in the project's compile_commands.json or .vimrc that tells it where to find the LSP server. (Fedora toolbox mounts your home directory, so paths etc shouldn't be a problem.) At the moment, I run everything (toolchain, LSP server, nvim) in a toolbox. Works well, but it feels unecessary to have a copy of vim in every container.
- necrotic_comp 6y agoWhat's the advantage of using a LSP over, say, ctags and cscope ? I currently am using that, along with the https://github.com/stefandtw/quickfix-reflector.vim https://github.com/stefandtw/quickfix-reflector.vim for quick refactors, and it seems to work fairly well. Is it because of method signatures or is there a killer feature that I'm unaware of ?
- slezyr 6y agocscope looks like dead project with no support of the recent versions of C++(14/17/20)
- hibbelig 6y agoI wish I could find (or create) a working LSP setup for the Java code base at work. It consists of multiple projects, tied together by a Gradle build script. IntelliJ just groks the build.gradle and Eclipse can also import it. Is there an LSP server that can do something similar?
- nonbirithm 6y agoAt one point I tried embedding a language server in a running IntelliJ process. It kind of worked, but a few problems led to me getting tired of maintaining it: - Constant API updates to IntelliJ internals requiring updates to the extension. - The need to run a full copy of IntelliJ in the background, and breakage in the copy leading to requiring a full restart. - A lot of concurrency problems I didn't understand because by necessity it required going deep into IntelliJ's codebase. - I was no longer using Java in my work environment or for personal projects, so I had no need to use IntelliJ. But despite this, the repo stands as the most-starred one I have. People are still starring it even though I haven't made changes in over a year and a half! https://github.com/Ruin0x11/intellij-lsp-server https://github.com/Ruin0x11/intellij-lsp-server So it sounds like this is a thing people would use, if someone wants to take up the maintenance burden.
- Asooka 6y agoIIRC, Vim has some kind of builtin support for Eclipse for Java development, have you tried that? I admit I haven't really looked into it, just seen it mentioned while reading the manual.
- Jeaye 6y agoSemantic highlighting for C++ can be achieved in Vim using color_coded: https://github.com/jeaye/color_coded https://github.com/jeaye/color_coded It can make a huge difference in the highlighting of the source, compared to Vim's regex-based approach. The reasoning for wanting this is to be able to soak in more information about the source without needing more text; the color alone can convey a lot of useful info about the code.
- gkfasdfasdf 6y agoAgreed about the usefulness of semantic highlighting. Also, https://github.com/jackguo380/vim-lsp-cxx-highlight https://github.com/jackguo380/vim-lsp-cxx-highlight works really well with CoC and LanguageClient-neovim, and doesn't need to be compiled.
- commotionfever 6y agoWith neovim 0.5, you can drop two dependencies, Plug -> built-in vim packages CoC -> built-in LSP client
- Khaveesh 6y agoYou could drop Plug even with the existing stable release. Native packages have been supported since Vim8 and NeoVim 0.2
- alfalfasprout 6y agoDo you get semantic highlighting though? That was one of the big reasons just using an LSP client wasn't enough.
- commotionfever 6y agoFor that I just installed vim-polyglot. Its a big ole collection of syntax and indent rules
- commotionfever 6y agoOh checkout nvim treesitter
- fit2rule 6y agoWhat I really love about vim lately: Termdebug. Its such a joy to have cscope bindings and gdb-based debugging direction within vim itself. This has been a joy to re-discover after forgetting that vim has a great integrated debugger now. I keep forgetting it, but man has it been great to use lately.
- ainar-g 6y agoYou don't actually need NPM and CoC. I've been using pure-VimL vim-lsc[1] for a couple of years, and it's been serving me well. My config: let g:lsc_auto_map = {'Completion': 'omnifunc'} let g:lsc_enable_autocomplete = v:false let g:lsc_server_commands = { \ 'c': { \ 'command': 'clangd', \ 'log_level': -1, \ 'suppress_stderr': v:true, \ }, \ 'cpp': { \ 'command': 'clangd', \ 'log_level': -1, \ 'suppress_stderr': v:true, \ }, \} This gives me code completion and other niceness. With Vim 8.1, you don't even need a package manager, since there is one built in. Just clone the Git repo into your ~/.vim/pack/vim-lsc/start/vim-lsc/. [1] https://github.com/natebosch/vim-lsc https://github.com/natebosch/vim-lsc
- Asooka 6y agoMy first advice for anyone who wants to use Vim for C++ development would be - don't. I've used exclusively Vim for over 10 years and it's too comfortable to switch to anything else, so I'm losing out on a lot of productivity, or at least that's what my colleagues, who have never used Vim, claim. Pithy claims aside, it has been an interesting journey actually using Vim for producing C++ code for large projects. There's a strong DIY element and you end up with a setup that's much more customised than a vanilla IDE - on the one hand giving you a certain degree of comfort in your work, but on the other a lot of what you do is unportable to other people. The language server protocol has been a pretty good development, I'm keeping an eye on what comes out of those efforts, though I'm not using one personally right now. My current setup consists mainly of exuberant-ctags for static indexing, YouCompleteMe for intellisense and simple navigation, rtags for rich search and light refactoring and fzf for searching. As to why I ended up settling on these plugins: - ctags: Absolutely essential. Yes, a full semantic index straight from the compiler is better, but ctags is more than good enough for just telling you "where is this defined". When paired with fzf, you can type part of the tag, space, part of the directory and you'll get all tags in that directory. That's due to fzf doing super simple substring matching in the TAGS file's lines based on your query, there's nothing smart going on here. This tool is also very good when you are developing multiplatform software, because the compiler cannot see all places where a function or class is defined, since you have one definition per platform. Technically being able to query a plethora of language servers, one for each configuration, would be ideal, but we're not there yet, and such a setup sounds way too fragile for my taste. - YouCompleteMe: Aside from C++, it provides amazing completion support for many other languages. It can even deal with java project files, if the readme is to be believed. Other than for C++, I mainly use it for python. It's also good in plaintext files for completing words and file paths. I really love its substring matcher, just type gTFBT to get "getTheFooBarThing". Downsides: 1. if your build system cannot produce a compile_commands.json file, you will need to write some python code to specify compilation flags; 2. compiles each file individually, so if some of your headers aren't freestanding, you'll get spurious errors when editing them. - rtags: Basically a language server from before the LSP protocol existed. Mainly developed for Emacs, but the Vim integration is good enough. Continuously indexes your source based on a compile_commands.json file. It can show you who calls a function or uses a variable, class hierarchies, virtual method overloads and more. I've seen it get confused if you jump branches and require you to delete and recreate the index, but I haven't experienced that lately. Apart from those I use a bunch of standard productivity plugins like unimpaired, surround, nerdtree, etc. etc. Vim 8's gdb integration has been very welcome, too. I struggled to find a good interface to gdb previously, as everything seems to want to be Visual Studio and give you a restricted clicky interface, whereas I just wanted the current vim buffer to be synchronised with the instruction pointer and to write gdb commands directly. I don't feel like I'm substantially slower in Vim than my colleagues in other editors and IDEs. Colleagues across the company use Vim, Emacs, VSCode, QtCreator, and Code::Blocks. The Windows developers are all on Visual Studio naturally. I haven't noticed being slower than any of them. The above plugins are enough for the odd rename-refactor I have to do, and anything more substantial is so infrequent, that doing it manually doesn't really have an impact. Also, developing on Linux, I always feel like any graphical application will just disintegrate or cause an unrecoverable freeze in the graphics driver at any random keystroke. Back in the day I had to make do with just ctags, cscope and debugging straight from the commandline, lol. I do believe that Stallman's refusal to allow easily plugging into GCC's AST, like one can just use clang for indexing, held back C++ development tools on the Linux platform significantly. Eclipse's CDT, KDevelop, Anjuta, Code::Blocks, NetBeans, etc. - they all suffered from having to write their own C++ indexers that were always inferior to getting semantic information straight from the compiler. I'm extremely grateful to the open-source community for the continuing work on development tools, and try to donate where I can. Watching the development tools landscape change over the years has been interesting - things don't so much improve, as they evolve chaotically with an overall trend towards improvement. Like anything else on this platform. So far many IDEs have come and gone, but Vim is eternal. I will say that using Vim is entirely up to your taste, it doesn't seem to be substantially faster or slower than an IDE, so use what you like. It is much cheaper than Qt Creator or CLion (AFAIK for both you need a license to develop commercial software), so that might be a factor for you. Companies tend to have a big Windows development team, with a few Linux developers, so they buy bulk Visual Studio licenses and individual Linux IDE licenses, making the latter end up costing more per developer.
- tesmar2 6y agoHas anyone used VsCode for C++/CMake development? What was your experience?
- tinfoilboy 6y agoWorks pretty well with the C++ extension and the cmake-tools extension. Though at some point I ended up just swapping to invoking CMake from the command line.
- tesmar2 6y agoI haven’t found a good CMake linter, do you use one?
- truncate 6y agoI'm primary Emacs user with LSP mode setup. But sometimes, Emacs performance just triggers my frustration enough to use VsCode. To me, VSCode is much better experience from performance and LSP integration perspective. Everything works pretty much as you would expect. I use `ccls` and `goto-symbol-stack` for better tag browsing -- which gives pretty close experience to Emacs "M-." or Vim's "C-[" and go back shortcuts. I don't use any CMake extension. You can basically create tasks and assign one of them as build. I just use those task to run the CMake commands, or my own scripts which sync and compile code remotely. There are some other awesome plugins (I use Git ones), which are incredibly good. If you work on Windows, I hear integration with Linux Subsystem is excellent, and there is some other features for general remote development that I often try. Often, eventually after a day or two of use, I would still get back to Emacs, because what I absolutely miss is years of conditioning and customizability of Emacs. The keybindings are exactly how I want (and they make sense), window splits and workspaces (are in my opinion superior to VSCode), things popup and close when I need them and keybindings around them are straightforward. Bottom line is, if you are hardcore Vim/Emacs user -- (1) you'd probably appreciate the convenience, excellent performance with LSP and bigger files, things working out of box, font sizes/colors being consistent, and nicer UI around code browsing. (2) At the same time you'd miss certain essential things that are heavily engrained into you. Lot of things will be good, but not good enough -- specifically related to keybindings/window splitting/buffer management.