Enable extensions that come with vim-airline - vim

After I installed vim-airline, I found that there are a variety of plugins in the path
vim-airline\autoload\airline\extensions
but only a part of them are loaded every time I start Vim.
How can I enable extensions such as syntastic, tagbar, unite, ctrlp and so on?
A possible way is to copy the .vim file to 'plugins' folder that vim provides. However, I want a solution that airline provides so that I don't have to manipulate files and can just configure them by a few commands.

Here's what I have in my old vimrc, it still seems to work:
let g:airline#extensions#tabline#enabled = 1
"" Whitespace Machine
" enable/disable detection of whitespace errors.
let g:airline#extensions#whitespace#enabled = 1
I'd imagine you can enable other extensions with the same syntax.
(If you like a more fully-featured vim development enviroment -- check out Spacemacs.)

I have been confused with how those extensions work for a few days.
It turns out that I have misunderstood what those extensions are.
Extensions come with airline are not plugins themselves, but some additional features related to those plugins to be displayed in the statusline.
That is to say, one has to install those plugins first before he enables those extensions. And after the installation of plugins, airline can work perfectly with them, providing cool style to display their status.

Related

How can I use vim plugins with Ideavim?

I would like to use Tim Pope's vim surround plugin in my Pycharm IDE. I've been using the IdeaVim plugin for Pycharm to use vim motions and commands.
I know I can use ~/.ideavimrc like my normal .vimrc but I cannot find
information about how to use plugins with ideavim.
Can I specify the plugins directory inside my ~/.ideavimrc or do I have to go another way? Can I use a plugin manager like pathogen?
The latest version of IdeaVim includes the vim-surround plugin. Enable it by adding
set surround
to your .ideavimrc file
https://github.com/JetBrains/ideavim#emulated-vim-plugins
Most applications only emulate Vim's / vi key bindings (and often only the basic navigation and editing commands). That goes a long way to helping vi users edit comfortably, but it isn't the real thing.
Unfortunately, to be able to use Vim plugins, you'll need the full Vimscript interpreter and infrastructure around 'runtimepath'. I'm not aware of any application that provides this, and because of the complexities and idiosyncrasies of Vim, this would be very hard indeed.
To get more of Vim's special capabilities into your IDE, use both concurrently; it is very easy to set up a external tool in your IDE that launches Vim with the current file (and position). Automatic reloading of changes allows you to edit source code in both concurrently.
If it's any comfort to you, the same applies to Emacs / Elisp as well.
The ideaVim plugin added "Support for vim-surround commands ys, cs, ds, S, enable it with set surround in your ~/.ideavimrc" since version 0.46.
No. Vote for VIM-506 for Vim scripts support (unlikely to be implemented) and for VIM-769 for vim-surround emulation (likely to appear in future versions).
This was mentioned in a changelog relatively recently.
https://github.com/JetBrains/ideavim/blob/master/CHANGES.md#features-5
I didn't mange this work. Looks like I need vim-plug installed and I use another package manager in my NeoVim and also I don't want to mix up two configs. It should work in general.

How to create my custom vim snippets?

I want to create some snippets when writting c++.
for example:
create a file, cpp.snippets.
priority -1
snippet exam
This is an example!
endsnippet
and put it in ~/.vim/my-snippets/snippets/.
then, add following statement in ~/.vimrc:
set runtimepath+=~/.vim/my-snippets/
let g:UltiSnipsSnippetsDir='~/.vim/my-snippets/'
let g:UltiSnipsSnippetDirectories=["snippets"]
But it not work, how can i fix it ?
UltiSnips plugin includes detailed documentation. Have you read the following help page?
:help UltiSnips-snippet-search-path
Update:
One of the things that was obvious when I read that help section was that in UltiSnips the name "snippets" can't be used in g:UltiSnipsSnippetDirectories because it is reserved for snipMate compatible snippets. This does not happen in the link shared in the comment below, where the name "my-snippets" is used instead.
I do not use UltiSnips, but from the documentation I would suggest the following approach:
Do not set g:UltiSnipsSnippetsDir nor g:UltiSnipsSnippetDirectories.
Keep the runtimepath+= configuration.
Create the following directory: ~/.vim/my-snippets/UltiSnips.
Place the personal snippets under this new directory.
Reasoning:
By default UltiSnips searches for all UltiSnips directories under your runtime paths, so no configuration is required if this name is used.
Although the runtime setting is required for personal snippets, this configuration is automatically maintained if a plugin manager is used.
The last point allows the installation of vim plugins that contain snippets. For example, this plugin contains various snippets for both snipMate and UltiSnips, including C++.
If you are using the sirver/ultisnips plugin (UltiSnips) the correct way to do this is simply run the :UltiSnipsEdit command which opens up a custom snippets file for the current language / filetype.
I had so much grief with this. Here is an answer for future reference for those of you who do not want to suffer headaches.
I have a shared .vimrc served on a samba share. Both Windows gViM and ViM use this file.
Relevant Part of .vimrc for Windows
I have a samba share mounted under L:. Note that I actually had to use POSIX for the path, not Windows backslashes \ despite being a path for Windows.
if has('win32') || has('win64') "If gVim under Windows"
let g:UltiSnipsSnippetDirectories=["L:/.vim/custom_snippets"]
endif
Relevant Part of .vimrc for Unix
My terminal opens xterm-256color for more colors, but you could exchange that with xterm. Here the path can expand ~ correctly, since this is the real home directory where my ``.vim` lives.
if $TERM == "xterm-256color"
let g:UltiSnipsSnippetDirectories=["~/.vim/custom_snippets"]
endif
Finishing Touches to Load custom_snippets
You don't need any! The following changes are NOT necessary:
"let g:UltiSnipsSnippetDirectories=["custom_snippets"]
"let g:UltiSnipsSnippetsDir="~/.vim/snippets_custom/"
However, Putty does not pass the tab key or control key properly it seems, despite all paths working fine. I tested the paths with :UltiSnipsEdit while in a file type environment set ft=tex and it took me to ~/.vim/snippets_custom/tex.snippets as it should (both in gvim on Windows and from my unix console).
Perhaps Useful for enabling in Putty
Patch: Creating a ctrl+tab keybinding in PuTTY
How to solve the collision of TAB key mapping of `UltiSnips` plugin in the Vim
https://unix.stackexchange.com/questions/53581/sending-function-keys-f1-f12-over-ssh

Use code completion in vim as in sublime text

I would to have a autocompletion exactly as in sublime text but in vim.
I want this behaviour :
When I start to type a word, I want to have a box which suggest completions;
In the suggested completions, I want to have last words used;
I want to have functions finded through ctags;
I want to have standard functions for the language I'm using;
I want to have snippets;
There is a lot of plugins about autocompletion for vim and I'm lost.
Currently I'm using YouCompleteMe... It's very good, though I dunno whether it can be configured to sort words based on last usage. It has general fuzzy completion capabilities that will work on any file type (you may find fuzzy completion awesome), but it also contains semantic completion for C/C++/Objective-C/Objective-C++ through libclang.
Particularly, I aways compile the lastest clang, libc++ and VIM from sources to tune and set VIM to use my environment python/ruby/etc and get a decent C++11 support. I then, compile YouCompleteMe from sources too, though I first install it through a plugin manager. My current choice is VAM, but there're others like Vundle and Pathogen.
Try this method:
for plugin in plugins
try
install plugin
read doc
test plugin
catch
remove plugin
endtry
endfor
Also, make sure you read and understand :h ins-completion before hunting down plugins.

How can I configure VIM so that files with extension .less are edited with zen-coding?

How can I configure VIM so that files with extension .less are edited with zen-coding?
I can use within the zencoding notepad + + on windows normally. But now I want to use the same way inside vim.
ZenCoding is probably activated on a per-filetype basis, if that's the case, just type :set filetype=css.
If you want this setting to stick, add this line to your .vimrc:
autocmd BufRead,BufNewFile *.less set filetype=css
If you want to retain the normal features that go with .less files (if any) you can do :set ft=less.css but some plugins don't like that.
I first tried to write a comment, but found then something that could be an answer.
So I think the question is: How can I configure VIM so that files with extension .less are edited with zen-coding?
At the official site for zen-coding, there are lists of editors that support zen-coding:
Official
third-party
Unofficial
There for VIM, the following sites are mentioned:
Sparkup
Zen Coding for VIM
I have read into both, and both seem to expand shortcuts to HTML code, not to less-code. But perhaps I have misunderstood the question.
I didn't know you could use Zencoding for css. I use it in Vim for html.It s great!I started using Less and I was wondering an hour ago ,If something like this existed. I guess it's something to work on.

Hide (or fold) columns of text in (g)Vim (horizontally)

is there a way to hide columns of a buffer (text file, you know what I mean) while editing it in Vim? e.g. text visible in the buffer before hiding column 2&3:
abbcccccc
accdddddd
And after hiding them:
acccccc
adddddd
(Not to mention I'm working with really huge files (sometimes over 200 gb).)
And yeah, I had found foldcol.vim, but it requires a patch, and I don't have gcc to compile it as a user on a server.
Thanks in advance.
Cannot be done in stock vim; there is a conceal patch that has not been accepted. The most recent version is only for vim7, and not 7.2 (much less 7.2+patches), so it's probably best considered dead.
Is foldcol.vim maybe what you need? No clue if it works on your huge files though. 200 gb! Impressive in a geeky kind of way. =)
The best version I have seen so far is following:
https://github.com/paulhybryant/foldcol
this github project is based on
http://vim.sourceforge.net/scripts/script.php?script_id=1161
however it has some improvements - it actually shows hidden column as '*'
it needs vim-maktaba plugin, so in order to install this in your vim, then do following:
add to your ~/.vimrc file :
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Install vim-maktaba plugin for plugin developers - used in foldcol
Plugin 'google/vim-maktaba'
" Install foldcol - folding columns using <ctrl-v> visual mark, then :VFoldCol
Plugin 'paulhybryant/foldcol'
" All of your Plugins must be added before the following line
call vundle#end() " required
Notice the two plugins added in the vundle.begin -> vundle.end section ; the vim-maktaba and the foldcol
After adding this to your ~/.vimrc file then start vim as administrator or if you are running on ubuntu then write sudo vim
then write :PluginInstall and if needed then write your user and password for your GitHub account - this will give you access to downloading and installing vim plugins from github
example usage in terminal vim started; use <ctrl-v> and mark column :
it may seem cumbersome, however it is actually just adding two lines to your ~/.vimrc file and running :PluginInstall
enjoy

Resources