How to run c++11 codes in vim with cvim plugin? - vim

I have installed cvim plugin for vim in Ubuntu from this link :
http://www.thegeekstuff.com/2009/01/tutorial-make-vim-as-your-cc-ide-using-cvim-plugin/
Now I want to run c++11 standard programs in vim.How to configure vim so that it can compile and run c++11 programs ?

The plugin defaults to gcc as the C compiler, configured by g:C_VimCompilerName (as per the help). You need to have a compiler version installed that supports the new C++11 features.
To inquire about general plugin support for C++11 (e.g. in its snippets and other features), best directly ask the plugin author (the plugin page even references a mailing list), and ideally offer patches and your help.

Related

Is it possible to use VSCode language-server-protocol engine along with the Vim or NeoVim?

I have tried different code-analysis engines and tools (like tern_for_vim) for Vim, but they do not provide such a great autocompletion, goto and rename functionality as in VSCode.
As I know VSCode uses language-server-protocol technology to provide IDE functionality. So here is my question:
Is it possible to use VSCode language-server-protocol engine inside the Vim or NeoVim? In other words, it is possible to provide the same good quality of IDE-like functionality as VSCode do?
I have tried javascript-typescript-langserver with deoplete.vim, but the quality of autocompletion and goto-declaration was bad.
Yes, you can use it via coc.nvim installing which is a fork of VSCode. You then apply one of its packages for a specific language eg coc-python.
This is the installation guide for coc.nvim. You then need to install the language package with this command in (Neo)Vim:
:CocInstall coc-python
You can then use the default VS Code completion engine immediately (jedi) or upgrade to what will become its successor, MSPLS:
For MSPLS run the command :CocConfig and enter this in to the file which is opened:
{
"python.jediEnabled": false
}
Then run :CocRestart
There are other other engines like coc.nvim such as YouCompleteMe. They all have small variations / tailoring for specific languages.
In theory, yes. http://langserver.org/ provides a list of editor plugins and language server implementations.
With packages like https://github.com/autozimu/LanguageClient-neovim (which is for neovim, there are others for both vim and neovim) you can use language servers in neovim.
However, some implementations are tied to the way it works within vscode (like haxe lsp), so it may be a little hard to get it working. Javascript should be better integrated, but I didn't try it myself.

"Jump to definition" in Rust

After years of coding in modern IDEs (Visual Studio, Xcode, JetBrain's products) I'm quite used to invaluable Jump to definition feature. It is especially invaluable for system libraries and frameworks when you yet learning the core features of the new language.
Is there any way to achieve the same functionality for the Rust combined with any modern IDE or text editor? Any vim, sublime text plugin?
IDE support for Rust is not there yet. There exists at least the Racer project, that provides a jump-to-definition feature among other things.
Racer is intended to be integrated into any IDE/text editor, and ships with an emacs integration.
In Vim and emacs you can use ctags to get you a lot of the way there; the language definitions are in src/etc/ctags.rust and you can produce tags for the Rust distribution with make TAGS.vi (or make TAGS.emacs for emacs’ format). See mk/ctags.mk for more information.
For setting them up and using them in Vim, see :help tags.
There is a project called rusty-tags generating ctags for Rust. At the time of this post, it is still actively maintained.
The RustDT IDE now supports Open Definition functionality, using the Racer tool.
Sublime's RustAutoComplete has a working Go to Definition using a separately installed Racer.
I'm using it and it works.
That being said, in 2014 the language is still in a flux and the Racer functionality is still limited.
I currenly have "auto_complete": false and only use the completion manually (with a keyboard shortcut) in order to avoid some Racer crashes.
Emacs can be integrated with rust-analyzer via lsp-mode. This will allow you to navigate the source code using Rust's type system. I describe a detailed setup in the code navigation section of my Rust with Emacs guide.
dumb-jump works well for rust.

Some questions about MS Gvim

I am a MS Gvim user and I have some questions about MS Gvim.I hope that I can get answers from here. Thanks all of you in advance.
1.How is the Gvim on windows version developed?Using Visual Studio or Qt?how can I get the source code?
2.When I have installed the Gvim ,I will have a directory in C:\Program Files(x86)\Vim.
In Vim directory, there are two directories and a file: (1)vim74 (2)vimfiles (3)_vimrc
I just wonder what the two directories represent and how it is used when I start my Gvim.
3.Can vimscript be called a language? How is it compiled or interpreted?
Development and source code
The latest source code and runtime files can be downloaded via FTP or retrieved from Mercurial; see vim.org for details. Using Mercurial is easiest:
hg clone https://vim.googlecode.com/hg/ vim
Vim can be compiled with various versions of the Visual Studio C++ compilers, see the corresponding Makefile in src/Make_mvc.mak. You don't need a full Visual Studio installation, the (free) compiler from the Windows SDK will do:
nmake -f Make_mvc.mak
Alternatively, you can use the MinGW compiler through src/Make_ming.mak.
GVIM uses the native Win32 widgets; Qt isn't used (on Unix, Gnome is the prevalent UI toolkit).
Vim installation structure
The Vim binaries and supporting files reside in the (versioned, so you can have multiple versions installed in parallel) vim74 directory. vimfiles and _vimrc contain a default configuration. Note that it is recommended to do customizations to copies in your home directory instead. The whole process and which files are read (it's complex) is described under :help startup.
Vimscript
Yes, Vimscript is the language used for extending Vim and writing plugins (though a variety of other languages like Perl, Python, and Ruby can be integrated with Vim and then be invoked via a single Vimscript command).
It started as the set of Ex commands (:delete, :substitute, etc.) it inherited from vi, but also has built-in functions (e.g. getbufvar(), system()) and the ability to define custom functions and (primitive) objects. Since version 7.0, Vimscript has (Python-inspired) data structures like List and Dictionary, and is a fully-fledged, powerful (but still in some aspects somewhat quirky) language.

Using doxygen with qtcreator

I want to use doxygen with qt creator on my linux box with Mageia 3, and I found a qtcreator plugin for this purpose (here). Unfortunately this is for qt creator version 2.4 (I use 2.7).
So is there a plugin for 2.7 or is it possible to use doxygen without the plugin in qtcreator? I mean like doxygen tags autocompletion and the like...
Regarding the plugin you found: the wiki and binaries are not on par with the source code but it is compatible with qtc 2.7 if you compile it from source. I guess what you want is a binary if you didn't find out yourself.
qtcreator can generate doxygen blocks if you manually start to write the block (activate it in the completion settings of the text editor inside qtcreator settings). However interaction with doxygen binaries is not integrated.
Regards.

Emacs/VIM vs. Compiler

Since Emacs and VIM are just text editors, does that mean I have to copy paste the code into an IDE so it can be compiled?
Well you edit your files in emacs or vim. Then you save them and then you invoke the target language compiler.
Typically, C projects would use Makefiles that are meant to track down the files needed to be compiled into a program, and their dependencies. Then you typically type make in the command line and make reads the Makefile you authored and takes care of invoking the compiler on the files etc...
For Java, people often use Ant or Maven to build their software.
...I know that my answer is vague, the list of languages and build tools is long, you should narrow down your question.
Very often, under Linux, when I don't need a massive IDE, I'm using Pida. It brings me a list view of the different Vim buffers, a convenient treeview of the filesystem and a shell: see screenshot.
See:
GNU Make
CMake
Autotools
Ant
Maven
[insert your favorite build tool here]
Text editors just edit files.
Compilers just compile files.
IDE's just bring files and the compiler together in a convenient way.
So... No, you don't need to copy/paste the code into an IDE, however you do have to make sure your compiler (IDE in your case) knows where to find the file you want to compile.
You don't need an IDE to compile a program. You just need a compiler. Emacs/Vim are text editors that allow you to write your program. You then call the compiler and it will do the compilation.
Also, Emacs and Vim are scriptable and have routines that allow you to call a compiler directly on the file you're editing.
In vim, you type :make. In emacs, you type a M-x compile-frobnicate style command which I'm sure someone will provide.
Apart from what already has been said, take a few tutorials to learn how to code/compile with vim and Emacs:
Intro to C/C++ Programming with vim
Using Emacs for programming
In VIM (with no extensions installed) something like
! /path/to/make (C/C++ world)
or
! /path/to/ant build (Java world)
It depends on your compiler, platform, and program. Most, like gcc, can be called from the command line (or from within either of those editors) although you may have to first write a makefile for the linker. Other compilers are integrated into IDEs (or are difficult to control externally), although even these won't require copy/pasting. Simply save your program and open it from within the IDE.
So far: IDE = a poor editor + compiler + debugger + other_unnecessary_stuffs
Go get a compiler and a debugger and you do not need an IDE anymore
Many IDEs can detect if the source file is changed by an external program, and prompt you to reload. I know this is the case with MS Visual Studio and CodeWarrior.
This is useful if your project is already managed by the IDE and you don't want to move it to something like Make, for example if you're on a team who mostly use the IDE, but you want to use a different editor. Simply edit and save the file in vim or emacs, switch back to your editor and hit Compile.
No, you don't need an IDE to compile code that you write in emacs.
I use emacs very extensively for building .NET code in C#.
The .NET runtime includes compilers.
I downloaded the .NET SDK, which includes other tools, like nmake, msbuild, XML tools, debuggers and so on.
I grabbed csharp-mode.el, which teaches emacs how to highlight and indent C# modules.
C-x C-e , for me, runs the command compile. I type in msbuild there, and emacs runs the build, using the .NET SDK tools.
I do something similar with C code, and with Java code, and with Javascript.
The same idea will work with other languages as well.
For Visual Studio integration, I highly recommend ViEmu.
It basically turns the editor in VS into Vim. I use it every day at work, and it is very stable. I can't imagine working without it!
(source: viemu.com)

Resources