Vim(spf13) auto debug when save - linux

Vim "spf13" offer a plug-in that when you try to save the file in vim (:w), it will show all compile error on left(by red arrow). For example, when I open a ".cc" file and try to save it(:w), the vim will show all error information same as when you "g++" it. but some of my code use c++14 style(e.g.: shared_ptr). So I want change the default compiler of this plug-in to g++ -std=c++14. (I don't know the plug-in name), so what should I do?

From what I could find, spf13 is basically just vim preconfigured with other plugins that exist already. So your real question isn't about spf13, but the syntax checking plugin that it uses, which appears to be Syntastic. For a quick fix let g:syntastic_cpp_compiler_options = ' -std=c++14' should probably do the trick. I would recommend looking more into syntastic's settings so you can configure it on a per-project basis with .syntastic files.
If you are feeling a little more ambitious to break out of the plugins spf13 comes pre-configured with, I have become a fan of ALE: The Asyncronous Lint Engine which makes use of Vim8's jobs to lint in the background instead of freezing while it lints.

Related

Change buffers in FakeVim

Does anyone know some shortcuts for FakeVim to change between files?
Is it possible to use buffers in Fake Vim? I accidentally found out that Ctrl+w,w gets you the next window. Does anyone know other? For example getting to the left, right, top, bottom windows?(vim's Ctrl+w,l and others)? Is there any documentation on FakeVim? Is it possible to configure FakeVim's vimrc file to create shortcuts for changing between buffers and the Projects view?
Thanks!
Recently I've been doing most of the changes on FakeVim plugin.
You can find list of Vim commands supported by FakeVim at https://github.com/hluk/FakeVim (recent version from Git master branch).
I'm still not sure how to document the features in Qt Creator. I'll probably implement something like :help <command> in near future.
The FakeVim documentation is severely lacking. This paragraph, for example, is so fuzzy it's borderline irresponsible:
In the FakeVim mode, most keystrokes in the main editor will be intercepted and interpreted in a way that resembles Vim. Documentation for Vim is not included in Qt Creator. For more information on using Vim, see Documentation on the Vim web site.
Basically, without a proper documentation or a look at the editor's source code it's impossible to know what should work, what shouldn't and in which way the behavior of what works deviates from Vim's behavior. And that's what passes for a modern IDE, these days.
Whatever…
I think that your best bet is simply trial and error: since you appear to know how to use Vim you'll have a lot of commands and shortcuts to try.

VIM Omni Completion: Pattern Not Found

Ive been trying to get the VIM auto completion working, but am running into issues unfortunately.
Right now I tried just starting with the basics. trying to get the auto completion to work on HTML documents first. But even this is becoming an issue.
I set the correct DOCTYPE, and have even specified different ones to see if it will work on Transitional, or Strict, or even XHTML or HTML5, but none are seeming to work.
The htmlcomplete.vim file is indeed in the "autoload" directory.
In my vimrc file, the correct setting is applied:
filetype plugin indent on
But still this isn't working, and no amount of research is helping me, because the only relevant results are issues with C++ auto completion, in VIM. (which vim does not fully support at this time, but it DOES support HTML auto completion, as I know because I have had it work on multiple instances of different systems before.)
What do you guys think I should do next? Im not sure where I should go from here..
No matter what, when I use the "omni completion" option. AKA (Ctrl+X, Ctrl+O), it always says:
Omni Completion (^O^N^P) Pattern not found
The syntax highlighting works by default without even using:
:syntax on/:syntax enable
it just recognizes by the filetype as it should. so that works.
The indentation has started working ever since I uncommented the "filetype plugin indent on". but I just cant get this to work correctly.
But maybe, I am missing the point here, and thinking about this the wrong way. So please correct me if I am wrong.
What function I am looking for, is when I type "<" it will automatically bring up a drop down list with all the tags it could be, and say I type "<" it will further refine to "div", etc. This is the functionality I am used to in Vim, without any configuring, just by default.
When I use the command "Ctrl+N" or "Ctrl+P" I get a very small (12 tags) list of possible tags, but that is manual, and not automatically detecting the typed "<".
Am I looking at the wrong thing? Is Omni Completion not the right option I should be looking at configuring? Or was this a different plugin to provide this functionality?
Whenever I look into it, it always refers to "Ctrl+X + Ctrl+O" as the syntax auto completion, so I assumed this is the feature I have come to know. but maybe I am wrong.
So can someone help to explain this better to me, point me in the right direction. Or let me know I am on the right path (if I am) and help me fix this issue?
Thank you guys.
Take care.
As requested here is the information:
The vimrc file is here: http://pastebin.com/QfUDVvdP
My version is 7.3 (aka vim73)
I am using the CLI version, as I find GVIM actually more confusing. but I have both. and they use the same vim runtime.
I have not added any more plugins or extra feautres, as this is a fresh install on Ubuntu 12.04, which is also a fresh install. The only thing that has been altered or added is "smali.vim" syntax highlighting to syntax folder, as well as opa.vim, and opajs.vim. also opacomplete.vim to autoload.
there is vimrc, and vimrc.tiny, as well as gvimrc in /etc/vim/ folder.
and all the files for vim are located in the default directory, /usr/share/vim/vim73/ and /usr/share/vim/. None of the files are moved, changed, or altered besides what was already specified.
hope that helps.
First of all, Omni Completion never worked (or works) automatically. You said popup should appear when you insert '<' - this is not working in Vim by default. You have to press Ctrl X O combination. At least it is not working for me.
http://vimdoc.sourceforge.net/htmldoc/version7.html#new-omni-completion
I guess you have a plugin for that or something. It's not hard to implement it. Start Vim without loading any plugins to check it out. Anyway, to the question.
Many folks do not know, that Vim 7+ has decent support for XML/XHTML/HTML languages (no plugins needed!) with possibilities to extend it with any XML-based language you want. What you can do is to use DTD/RNG converters that prepares Vim definition which is used to give you omni completion.
For example, my Vim installation contains support for HTML4 and XHTML languages by default:
$ rpm -ql vim vim-common | grep xml
/usr/share/vim/vim73/autoload/xml
/usr/share/vim/vim73/autoload/xml/html32.vim
/usr/share/vim/vim73/autoload/xml/html401f.vim
/usr/share/vim/vim73/autoload/xml/html401s.vim
/usr/share/vim/vim73/autoload/xml/html401t.vim
/usr/share/vim/vim73/autoload/xml/html40f.vim
/usr/share/vim/vim73/autoload/xml/html40s.vim
/usr/share/vim/vim73/autoload/xml/html40t.vim
/usr/share/vim/vim73/autoload/xml/xhtml10f.vim
/usr/share/vim/vim73/autoload/xml/xhtml10s.vim
/usr/share/vim/vim73/autoload/xml/xhtml10t.vim
/usr/share/vim/vim73/autoload/xml/xhtml11.vim
/usr/share/vim/vim73/autoload/xml/xsd.vim
/usr/share/vim/vim73/autoload/xml/xsl.vim
/usr/share/vim/vim73/autoload/xmlcomplete.vim
/usr/share/vim/vim73/compiler/xmllint.vim
/usr/share/vim/vim73/compiler/xmlwf.vim
/usr/share/vim/vim73/ftplugin/xml.vim
/usr/share/vim/vim73/indent/xml.vim
/usr/share/vim/vim73/syntax/docbkxml.vim
/usr/share/vim/vim73/syntax/xml.vim
The trick is Vim's autoloading feature. You need to make sure the file you are opening has the proper DOCTYPE definition which is correct. So use that for HTML and XHTML files, then Vim 7+ will automatically enable XML/HTML omni completion for you. Example for HTML4:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
</html>
Now try to insert body tag, type "bo" and hit Ctrl X O. Bang. Try to add an attribute, type "on" and hit it again. Bingo.
You can use Ctrl X O and other features:
after "<" complete the tag name, depending on context
inside of a tag complete proper attributes
when an attribute has a limited number of possible values help to complete
them
complete names of entities (defined in |xml-omni-datafile| and in the
current file with "
when used after "
More info (and possible user customization with own XML definitioins) here:
http://vimdoc.sourceforge.net/htmldoc/insert.html#ft-xml-omni
Omnicompletion is the right feature and <C-x><C-o> is the right shortcut. You should stop calling it autocompletion, by the way, because it's far from being automatic.
You don't need anything in ~/.vim/autoload because htmlcomplete.vim is already in $VIMRUNTIME.
In brief, given what I know of your settings, completion should work.
But it isn't. Please append the content of your ~/.vimrc, a list of installed plugins (and how/where they are installed) and details on your Vim version, platform and if you use the GUI or the CLI version.
edit
Omnicompletion is the right feature but you are looking for a specific plugin that uses omnicompletion under the hood on each couple of keystroke as there's no built-in setting to enable Auto completion. AutoComplPop is one such plugin (and the one I use), there are others. Pick the one that most closely matches with your previous experience.
You shouldn't touch anything in /usr/share/vim/ or /etc/vim/. All your settings should go into ~/.vimrc and your plugins should go into ~/.vim/.
~
.vim/
autoload/
opacomplete.vim
syntax/
opa.vim
opajs.vim
smali.vim
.vimrc
You must revert the default files and directories to their original state before going further.
endedit

VIM as an IDE - Suggestions

I am looking for recommendations on using VIM as an IDE. I generally code in a number of programming languages, including C, C++, assembler, MATLAB, Maple, BASH scripts, to name a few.
In general, I like to use a single IDE for the bulk of my projects for the sake of consistency, and I have found that I perform about 90% of all my coding in VIM, and occasionally use Eclipse instead for certain projects in C/C++ (ie: projects people have already put together as an Eclipse project, or PIC24/32 projects from www.microchip.com).
I am already very familiar with the basic functionality of VIM (windows vs buffers, text manipulation, scripting), and would like to use it as my primary IDE. I have already taken a few tips from here:
http://vim.wikia.com/wiki/Use_Vim_like_an_IDE#Writing_Code
I already use the nerdTree plugin for directory browsing in a project, etc, but I need to do something about code completion and symbol resolution, as those are my two greatest concerns.
Symbol resolution
I have some limited experience in the use of C-tags, and wanted a suggestion on what I should use if I am working with a VERY large code-base that changes frequently. The projects I work on typically are pulling in header files from at least a dozen other projects, and I would like to be able to jump to the file where a function, constant, or macro is defined quickly (ie: like the CTRL-G feature in Eclipse, "jump to definition"), as well as rapidly get a list of all calls/references to a function/macro/constant/etc (ie: like the CTRL-SHIFT-G feature in Eclipse, "Show all references in project or current working directory").
Tab completion
One of the features I really like in Visual Studio and Eclipse, for example, is when I type in a variable name (ie: pointer to struct) and it resolves the names and types of all structure members and gives me a tab completion list to choose the appropriate member. They also point out when I've incorrectly used "." vs "->" for member access. I've tried superTab in VIM, but I just couldn't get it working. I also want the tab-completion feature to use the same C-tags as generated by the symbol resolution plugin
Handling build output
The final concern of mine is having an auto-generated list of build warnings and build errors. When I, for example, just run "make all" at the command-line prompt, it is a pain to have to read through code listings to manually find all build warnings.
I realize this is a lot to ask, and that I could always just fall-back to Visual Studio or Eclipse, but I really want just a simple cross-platform console-capable modal editor for all my development needs, and none of the major IDE's out there fill this need.
Thank you all in advance.
http://eclim.org/ - bring Eclipse functionality to the Vim editor
https://github.com/scrooloose/syntastic - syntax checker warnings in quickfix list
I think (but haven't checked) that Eclim satisfies #1 and #2 while I'm sure that Syntastic satisfies #3. More things of interest:
https://github.com/Lokaltog/vim-powerline - just nice
https://github.com/kien/ctrlp.vim - quick file finder
https://github.com/tpope/vim-pathogen - plugin manager (to install the others)
And are you aware of omnicompletion via Ctrl-p and Ctrl-n (prev and next) in insert mode? That's not code completion, but frequently does the job.
For the auto-completion part (point 2), I am proficiently using clang_complete.
For a quick setup and reference, try this page: http://zwiener.org/vimautocomplete.html
EDIT: this is for C, C++ and Objective-C only.
I use the following configuration in vim:
zipped file
It has autocomplete based on tag list, ctags, nerd commenter and some more plugins.
Hope it helps.. :)
I have been using Vim as an IDE for about a year now. All of my customization is online at github.
That said, I don't think a Vim beginner should start using vim like this; rather I think the Vim beginner should learn vim incrementally. The only changes that I think are so essential I would make them from the very beginning are:
Remap ESC to jk
Switch : and ;
Set leader key to ,

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)

Vim as Visual Studio IDE

I have spent lot of time doing research on VIM. I am Windows guy since last 6 yrs and was using VS.
Now started working on Linux. I want to make VIM as close as possible to VS.
I want features like
Project Navigation
Files in Different Tabs
Search in Project
AutoCompletion
I have found plugins for the above requirements
Project Pligin
MiniExplore
Taglist
OmniComplete
I am not able to correctly set vimrc script.
When I try to open file from Project it gets open in different tabs.I want to get it open in different buffers.
Also when I want to close file in buffer , complete window gets closed.
Open taglist and project window makes all mess.
Has any one done settings with these plugin..
Could you guys please post your vimrc files??
It will save lot of time for newbies like me..
Vim is a very different tool than Visual Studio. Plugins may help you get certain bits of functionality you desire, but do not expect them to work exactly like VS, work well together, or even work at all.
If you are looking for a programming environment more like Visual Studio, there are many good graphical IDE's you can use such as NetBeans, Eclipse, Code::Blocks, KDevelop, Anjuta, etc. Some of these tools are, IMHO, better heavyweight IDE's than Visual Studio, and all are available on Linux for free.
You should either learn to use Vim the way it was built to be used, or find a different tool that suits you better. Shoehorning Vim into a surrogate for Visual Studio will probably cause you more pain than it's worth.
Yes it's different to VS, but that doesn't mean it can't be used in the same way. It's just not as easy to do it :)
Personally I go the other way and use ViEmu to get VS to behave like VIM. But I'm not in the same situation as the author of this question.
Why not have a dig through some uploaded vimrc files on dotfiles.org?
You can use the following script, Trinity.
http://www.vim.org/scripts/script.php?script_id=2347
It will require 3 more scripts, and Vim will look like an IDE.
The TagList at left, a file exporer (NERDTree) at right, and Source Explorer at bottom.
Also, you can find some very useful blog entries at
http://kevin-berridge.blogspot.com/search/label/vim
The author, Kevin, explains how to compile solutions form inside Vim. He also shows interfacing and jumping between them which is very useful too.
Furhermore, there is the script vim-visual-studio which can be found at
http://code.google.com/p/vim-visual-studio/
This script is using Python extension. I have Python 2.5 installed in Windows. I am using Gvim 7.2 which is compiled with Python 2.4. So, I have replaced the executables of Gvim as explained here:
http://www.gooli.org/blog/gvim-72-with-python-2526-support-windows-binaries/
So, Gvim became compatible with Python 2.5 and raised no problems. Also, a menu entry "Visual Studio" has appeared as expected. It connects to Visual Studio itself, and it works perfectly. It does not just compiles a file, it can compile a solution containing more than one project as in Visual Studio. You can even use the Vim's 'quickfix' feature. Hope this helps.
If you really want to have vim as the front end, try Eclim. It uses Eclipse as a backend daemon for code completion and project management, and vim as the interface.
If you only like vim because of the vi key bindings, but want it to be more IDE like, you could try the latest MonoDevelop that has it built in.
These plugins used to exist long before vim had tabs. I'd be quite surprised there isn't a way to tune these plugins to split windows instead of opening tabs.
Now I can't help you much as I don't use these specific plugins but other ones. You should look at their help (:h project, :h taglist, etc)
PS: in vim terminology (it will help you browse the help files), what you call "buffer" is actually called "window", while a "buffer" is just the text you are working on, it may be associated to a file, or not. For a given buffer, there may be no or several window displaying parts of the buffer.
you can give a try to eXvim
http://code.google.com/p/exvim/

Resources