nvim finds the function but vim does not - vim

I am using a vim/nvim plugin asyncrun that enables an API call that works fine in nvim if I implement it in ~/.config/nvim/init.vim using a line:
call asyncrun#run("", "cwd", "firefox")
Now this same line does not work for vim if I try to use it inside ~/.vimrc. I always get a warning:
Unknown finction: asyncrun#run
What needs to be changed in order for this to also work for vim?
Following the #doopNudles comment I also clarify that vim plugin is manually installed in the folder ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim. I install all my vim plugins the same way (using the vim v8 native ability to detect plugins).

The problem was that ~/.vim/pack/my-plugins/start/vim-asyncrun/asyncrun.vim/plugin/asyncrun.vim has one extra folder!
It works if I delete the extra folder asyncrun.vim like this ~/.vim/pack/my-plugins/start/vim-asyncrun/plugin/asyncrun.vim

Related

How to delete empty lines on visual studio code with the vim mode

I've been trying to delete many empty lines from a huge file. On other editors with vim, or vim itself, I could just do:
:%s/\n\n/\n/g
But neither if I use \r or \t it doesn't work. Seems like some vim features are missing on the editor. Is there any configuration to make that work or another way to do that?
To have advanced Vim functionality work within VScode, you can leverage its Neovim integration.
First, you'll have to install Neovim. For instructions, check out: https://github.com/neovim/neovim/wiki/Installing-Neovim
Then, adjust the following settings in your user configuration:
// Use neovim on backend. (only works for Ex commands right now). You should restart VScode after enable/disabling this for the changes to take effect. NOTE: Neovim must be installed (v0.2.0) and neovimPath must be set the executable in order for this setting to work. Otherwise, vscodevim will crash.
"vim.enableNeovim": true,
// Path to run neovim executable. For example, /usr/bin/nvim, or C:\Program Files\Neovim\bin\nvim.exe
"vim.neovimPath": "nvim",
Restart VScode. Now you can use Vim Ex commands, since the commands are sent to a headless Neovim instance that's running in the background. You can even use installed Vim plugin functions to a certain degree.

unable to use cscope multi key stroke via vim editor

I am using VIM 7.0 on RHEL release 5.4, and downloaded cscope plugin from: http://cscope.sourceforge.net/cscope_maps.vim
and copied it to path(one instance at a time): ~/.vim/plugin/cscope_maps.vim & /usr/share/vim/vim70/autoload
and generated cscope -qbR from root dir of source files, & opening *.C files from same dir.
According to this(point 5) & cscope_maps.vim, I should be able to do keyword search by multiple keystroke: CTRL-\ <option> or CTRL-# <option> by placing the cursor under the keyword as we do for ctags. But I am able to access the cscope keyword search only through the vim's command line argument (ie., :cs f d or :cs f c) and not with multiple key stroke shortcut.
I've also tried pasting all the contents of cscope_maps.vim to ~/.vimrc, but it didn't help
Is there something I am doing wrong/ any other way to make it work?
As described in the plugin's documentation, copy the plugin to
~/.vim/plugin/cscope_maps.vim
The autoload directory you've chosen is wrong, this is for plugins' on-demand functionality.
Also, /usr/share/vim/vim70/ is owned by the default Vim package, don't touch anything there (in general), or you'll run into problems when reinstalling / upgrading packages! If you do need to have a system-wide plugin, check :help runtimepath and find / add a proper location that you own on the system.
Probably your code base is other then .c files. I was facing same issue as my code base includes c and c++ both. I was trying with c++ functions and was facing same issue you mentioned.
Hint- Build cscope data base with all required files.
Probably, you are missing the CSCOPE_DB environment variable - i.e, it should point to the valid cscope.out file
To check, once you are in vim, run :echo $CSCOPE_DB, mine shows:
/home/me/views/myrepo/cscope.out
I had the same problem with cscope and Vim 7.4. I could solve it in Arch uncommenting in cscope_maps.vim the bellow lines:
set timeoutlen=4000
set ttimeout
BTW I followed this tutorial to install cscope vim plugin on Arch:
https://wiki.archlinux.org/index.php/vim#cscope

Get ocamlmerlin autocomplete in vim

I'm trying to get autocompletion for OCaml. I like using Vim and I found this plugin:
https://github.com/the-lambda-church/merlin
I installed it using OPAM and added the required lines to load it to my .vimrc
I made sure that OPAM bin folder (which contains ocamlmerlin) is in my .profile file and
checked that I can access it from the terminal and for vim I printed the PATH variable using "Ctrl-r =$PATH" and it shows that it contains OPAM bin folder.
It still doesn't work, I have no clue what else to do to make it work. I get syntax highlighting but that exists without merlin anyway. I want autocompletion to work.
If I press Ctrl-N to show completion suggestion I get "normal" vim completion which is basically just a list of words that are mentioned in the document.
Checking the startup log file, I can see that Vim did indeed load merlin:
chdir(/home/incraved/.opam/system/share/ocamlmerlin/vim/plugin)
fchdir() to previous dir
sourcing "/home/incraved/.opam/system/share/ocamlmerlin/vim/plugin/merlin.vim"
finished sourcing /home/incraved/.opam/system/share/ocamlmerlin/vim/plugin/merlin.vim
Searching for "/home/incraved/.opam/system/share/ocamlmerlin/vimbufsync/plugin/**/*.vim"
Any ideas?
Ctrl-N is the default completion; its sources are configured by the 'complete' option, but cannot include custom sources.
The Merlin plugin uses Omni completion, which is triggered with Ctrl-X Ctrl-O; see :help compl-omni.

gVim 7.3 in fullscreen mode

I'm using the script to open gVim in fullscreen downloaded from here: http://www.vim.org/scripts/script.php?script_id=2596.
I've also added this line to the startup settings:
:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)
When running gVim with this setting, I get the following error:
Error detected while processing _virmc:
E364: Library call failed for "ToggleFullScreen()"
Is there anything else I need to do with the files from that script? If I need to compile it somehow, would like someone to guide me through that process as I'm fairly new to Vim. Thanks!
Edit: I'm running Windows 7
I guess you mean ~/.vimrc or ~/.gvimrc by "startup settings". When that is executed, the GUI isn't initialized yet. Try delaying the execution with an autocmd:
:autocmd GUIEnter * call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)
It doesn't seem to be working if you place that call line in your vimrc. It should be called after Vim has finished loading. I suggest using that mapping from the readme:
map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
It worked for me.
I had the same problem when I was install this script through Vundle.
It's solved the problem:
Copy the DLL to the folder where GVIM.EXE is located.
An alternative to copying the gvimfullscreen.dll to the executable directory is to specify the file path, like this:
call libcallnr(expand("$VIM") . "/bundle/gvimfullscreen_win32/gvimfullscreen.dll", "ToggleFullScreen", 0)
In this example, I'm using $VIM and the bundle directory, but you can change this to a full path, or use another variable/path that works better for you.
This isn't a direct answer, but after searching for a solution for quite a while, I've decided that the prettiest way to run Vim on Windows is via Cygwin, via the (bundled) mintty terminal. It has a genuine full screen and even transparencies!

vim and latex-box

I installed the vim plugin latex-box but I am having trouble getting it to compile my Latex file. The docs say it uses latexmk to do the compiling, and I have that installed and it works when called by itself.
But when I use the plugin's \ll command to compile I get an error that says 'cannot run latexmk in background without a VIM server'. I cannot find an explanation of why this error would occur in the plugin documentation.
EDIT:
I found a solution to this issue, but ran into others.
To fix this, you need to install the full version of vim (which is different depending on your OS) which will include things like server support. I suggest doing this even if you don't use this plugin because it will fix not been able to copy/paste from/to vim. In (K)ubuntu, install the package vim-gtk.
Start vim like this vim --servername SOMETHING file.tex
After doing this, the servername error went away and the compilation went through but the output from latexmk shows up on top of the file I'm editing. It doesn't overwrite it, it's just displayed on top of the text. When I move the cursor and vim highlights a word or bracket, that appears back on the screen. The only quick way I found to get rid of the compiler output is to scroll the file up and back down, that makes the text appear again.
You can ask vim to redraw the screen like this:
:redraw!
Append that command after running your latex command.

Resources