I do not want to use the plugin "surround" (listed as /bundle/vim-surround) when I am using pathogen with vim for javascript files.
I currently have the following:
let g:pathogen_disabled = []
au FileType javascript call add(g:pathogen_disabled, 'vim-surround')
"Pathogen must be called before everything
call pathogen#infect()
Somehow I am still seeing the effects of surround. What's going on?
It doesn't seem to work here either. I've also tried with surround instead of vim-surround and with other random plugins without any success.
I suggest you raise an issue at Tim Pope's GitHub page.
Related
I have installed with Vundle this github colours theme. I installed is with :VundleInstall and it seems to work just fine. The directory ~/.vim/bundle/vim-colors-github is there. Indeed, I can switch the color scheme with colorscheme github.
Next, I have added the following lines to ~/.vimrc to make this change permanent:
" github colors
let g:github_colors_soft = 1
Plugin 'cormacrelf/vim-colors-github'
colorscheme github
But this raises the error "E185: colorscheme «github» not found".
It just doesn't work during the loading of vim!? What's going on here? I guess there is something that hasn't been set yet at the time of calling the change in the colorscheme. How could I debug this?
You seem to be missing the call to vundle#end() at the end of your plug-in configuration. See the quick start guide which shows an example of defining plug-ins in your vimrc:
call vundle#begin()
Plugin ...
call vundle#end() " required
filetype plugin indent on " required
In your case, adding those lines around your Plugin definition will most likely fix the issue:
" load plugins
call vundle#begin()
Plugin 'cormacrelf/vim-colors-github'
call vundle#end() " required
filetype plugin indent on " required
" github colors
let g:github_colors_soft = 1
colorscheme github
Also note that Vundle hasn't really been very thoroughly maintained. While there's nothing wrong with it, vim-plug is a compatible alternative (works the same way, uses similar configuration and similar commands) which is well maintained and offers improvements in terms of performance and features. I'd definitely recommend switching to vim-plug, particularly if you're getting started with a Vim plug-in manager of this style.
Color schemes are searched along 'runtimepath' and 'packpath'. Therefore they will only be found on startup if you install plugins with respect to :h packages (i.e. under 'packpath'), not under arbitrary ~/.vim/bundle.
As for Vundle and such you are expected to manually set up 'runtimepath', so that it includes all plugins before executing :colorscheme. For Vundle it is done by calling vundle#end().
Maybe it's a stupid question, but I can't figure it out. I have installed the UltiSnips plugin [UltiSnips plugin][1]. I followed all the instructions on setting it up. I added this into my .vimrc file but it's not working:
" Track the engine.
Plugin 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
I checked that is not used anywhere in the rest of my .vimrc file. When I pritn 'cl' and press tab nothing happens. However, I am expeting it to offer me insert snippet for the python class.
This is the list of plugin I am using:
ctrlp
jedi-vim
SumpylFold
ultisnips
vim-airline
vim-airline-themes
vim-fugitive
Vundle
indentpython
nerdtree
vim-nerdtree-tabs
syntastic
vim-flake8
What am I missing here?
I got answer here answer to my question. This is some clarification:
I added this line from the documentation of UltiSnips let g:UltiSnipsSnippetDirectories=["UltiSnips"] to the .vimrc file and it's working fine now. It wasn't obvious in my case, though.
I am trying to add for the cuda (.cu) files. The basic objective is to first make all c,cpp snippets available for the cu files and then add additional support. The first thing I did to test is to set the filetype inside vim
set ft:cpp.c
and this works. Then I tried to go to the vim-snippets/snippets and vim-snippets/UltiSnips and tried to copy the cpp.snippets file to cu.snippets. But this is not working (not working as in --the snippets are not detected--) . I have also added
au BufNewFile,BufRead *.cu set ft=cuda
au BufNewFile,BufRead *.cuh set ft=cuda
in my .vimrc. Even after this it is not working.
I also checked the UltiSnipsSnippetDirectories. It is pointing to Ultisnips.
I also tried creating a cu.snippets which just tries to extend cpp (nothing else). This is also not working.
As a side question: As far I understand https://github.com/honza/vim-snippets has two folders with snippets. snippets/* for the snipmate based ones and UltiSnips/* for the ultisnips based ones. However the inc snippet is only provided on the c.snippets in snippets directory (not in ultisnips). But strangely inc works on c files for me. I am positive that I am not using snipmate. How could this happen? Am I missing something. or is it that ultisnips can understand both formats?
Ultisnips uses Vim's filetype detection system. So to see what filetype Vim thinks you have use the :set filetype? command.
If that's incorrect, you can try
autocmd BufRead,BufNewFile *.cu setfiletype cuda
Also, I used Vundle, and I used call vundle#rc(), but I needed to change that to call vundle#begin() and call vundle#end()
I think, some plugin in your plugins list conflicts with your custom filetype detection config. Just faced with the same issue (tried to declare custom filetype for Jest typescript tests for react). My filetype settings overrides by peitalin/vim-jsx-typescript plugin.
So you should to switch off some of yor installed cpp plugins for detect culprit.
First off I'm a windows user using VIM and vundle to manage my plugins.
I have the Syntastic vim plugin (https://github.com/scrooloose/syntastic) and it works great highlighting any syntax errors for the first javascript file I open and save.
I also have the minibufexplorer plugin (https://github.com/sontek/minibufexpl.vim). Once I open a second file the MiniBufExplorer window appears allowing me to navigate between previously opened files via :b1, :b2, etc. I've noticed when this happens Syntastic stops working.
If I remove the minibufexplorer plugin then Syntastic always works. I'd really like to get both working together, does anyone have a solution for this? I would gladly use an alternative to minibufexplorer if it works with Syntastic.
I'm using pathogen to organize my installed plugins. I have syntastic and minibufexplorer and they work well together for me.
I have done no configuration at all to any of thees plugins. But to handle bufferswitching in an easy way (also works without minibufexplorer) I use this in my .vimrc:
map § :bnext^M
map ½ :bprevious^M
Its the key just below the Esc-key. It makes it very easy to just hit the § key to cycle through all open buffers.
Here is a good place to start your configuration.
Since I'm open to alternatives I will be removing the MiniBufExplorer plugin and using the :ls vim command to view the buffer list when desired. It's not as convenient as using the MiniBufExplorer plugin but I find syntax highlighting more important and am satisfied with this workaround.
I'm having trouble with autocompletion. How can I get a code suggestion while I'm typing?
I usually develop in PHP, Ruby, HTML, C and CSS.
Use Ctrl-N to get a list of word suggestions while in insert mode. Type :help i_CTRL-N to see Vim's documentation on this functionality.
Here is an example of importing the Python dictionary into Vim.
You can use a plugin like AutoComplPop to get automatic code completion as you type.
2015 Edit: I personally use YouCompleteMe now.
If you are using VIM version 8+, just type Ctrl + n or Ctrl + p.
You can start from built-in omnifunc setting.
Just put:
filetype plugin on
au FileType php setl ofu=phpcomplete#CompletePHP
au FileType ruby,eruby setl ofu=rubycomplete#Complete
au FileType html,xhtml setl ofu=htmlcomplete#CompleteTags
au FileType c setl ofu=ccomplete#CompleteCpp
au FileType css setl ofu=csscomplete#CompleteCSS
on the bottom of your .vimrc, then type <Ctrl-X><Ctrl-O> in insert mode.
I always rely on this CSS completion.
There is also https://github.com/Valloric/YouCompleteMe and it includes things like Jedi and also has fuzzy match. So far I found YCM to be the fastest among what I have tried.
Edit: There also exists some new ones like https://github.com/maralla/completor.vim
Another option is coc.nvim.
It's really fast and the completion is great as it uses intellisense the same autocompletion as VScode has.
It also has linting capabilities. So it shows you were you might have a bug.
It supports a multitude of languages.
It might take a bit to set up and configure but I think it is the best autocompletion engine for vim out there.
I've used neocomplcache for about half a year. It is a plugin that collects a cache of words in all your buffers and then provides them for you to auto-complete with.
There is an array of screenshots on the project page in the previous link. Neocomplcache also has a ton of configuration options, of which there are basic examples on the project page as well.
If you need more depth, you can look at the relevant section in my vimrc - just search for the word neocomplcache.
Here is link! for PHP.
press the Ctrl + x followed by Ctrl + o keys while writing some PHP functions.
Thanks to Oseems Solutions for the tutorial
If you only wanna auto-completion from cache of your current buffers, supertab is easier to install than neocomplete, can work on Mac pre-installed vim out of box without the need of MacVim.
You can check other alternatives at vim awesome.
For PHP, Padawan with Deoplete are great solutions for having a robust PHP autocompletion in Neovim. I tried a lot of things and Padawan work like a charm!
For Vim you can use Neocomplete instead of Deoplete.
I wrote an article how to make a Vim PHP IDE if somebody is interested. Of course Padawan is part of it.
I recently discovered a project called OniVim, which is an electron-based front-end for NeoVim that comes with very nice autocomplete for several languages out of the box, and since it's basically just a wrapper around NeoVim, you have the full power of vim at your disposal if the GUI doesn't meet your needs. It's still in early development, but it is rapidly improving and there is a really active community around it. I have been using vim for over 10 years and started giving Oni a test drive a few weeks ago, and while it does have some bugs here and there it hasn't gotten in my way. I would strongly recommend it to new vim users who are still getting their vim-fingers!
OniVim: https://www.onivim.io/