Unite.vim file_rec/async - vim

I'm getting started using vim for a week and many things still new to me. During the research, I found Unite.vim is extremely great. However, I cannot manage to get this command works:
nnoremap <leader>f :<C-u>Unite -start-insert file_rec/async.
I looked into doc file and it says the following:
file_rec/async Same as |unite-source-file_rec|, but get files asynchronously.
Note: This source requires vimproc.
Note: This source requires "ag" or "find" command.
Note: Windows "find" command is not supported.
I'm using vim windows and don't find the way to have Ag or find compatible commands (I guess it would be for mac/linux)
Any instructions would be appreciate. Tks :)

All of this is assuming you have cygwin, and vim with pathogen managing your plugins:
Before you use the file_rec/async command, you need to have vimproc, because what happens is Unite runs the search in another process, and then searches through the results with your vim process:
mkdir -p ~/.vim/bundle
git clone https://github.com/Shougo/vimproc.vim.git ~/.vim/bundle/vimproc.vim
cd ~/.vim/bundle/vimproc.vim
make -f make_cygwin.mak # <-- This is directly from the vimproc readme
Next, ensure that it works by running vi, and staying in command mode and entering:
:Unite -start-insert file_rec/async
If that works, then I would advise you to setup your binding in ~/.vimrc like this:
nnoremap <C-u> :Unite file_rec/async<cr>
Getting ag on your machine might be difficult, as the documentation states that it's "Complicated" and advises you to install a package manager for windows and some libs: https://github.com/ggreer/the_silver_searcher/wiki/Windows
However, if you do manage to get ag on your machine, here is the configuration I've gotten it to work with Unite.vim with in my ~/.vimrc:
" Use ag for search
if executable('ag')
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts = '--nogroup --nocolor --column'
let g:unite_source_grep_recursive_opt = ''
endif

Ag (a.k.a. the Silver Searcher) is a utility like ack, you can find it here, there also seems to be a dedicated Windows port.
Alternatively, you can try the GNU find Windows port from the unxutils project, or use Cygwin for Windows.

Get vimproc neccesary dll from http://www.kaoriya.net/software/vim/. On website there are 32 and 64bits version downloads.
http://files.kaoriya.net/goto/vim74w32
http://files.kaoriya.net/goto/vim74w64
Inside each zip there is a plugins directory (example with 64bits): "vim74-kaoriya-win64-20150628.zip\vim74-kaoriya-win64\plugins\vimproc\autoload\" where you can find it without compile.
For ag use windows port as #Ingo Karkat says.
NOTE: ag suffers from searchs on paths long than 256 chars (at this time). Use platinum searcher if that is a problem in your case.

Related

ack-grep: command not found in gvim after upgrade to Ubuntu 18.04

Running :Ack anything in gvim now gives
|| /bin/bash: ack-grep: command not found
ack-grep is already the newest version (2.22-1)
It was working fine in Ubuntu 16.04. I have the ack.vim plugin in ~/.vim/bundle/ack.vim/
Assuming you are using this ack.vim plugin. Then you shouldn't have to do anything.
Ack.vim will search for executables in the following order: ack-grep, ack. You can override this with g:ackprg. If you have set g:g:ackprg then you will need to adjust g:ackprg to be set to where the ack executable path.
let g:ackprg = '/usr/local/bin/ack'
Personally, I would avoid setting the g:ackprg variable unless you really need to.
You may also want to look into faster grep program's than ack. e.g. The Silver Searcher or ripgrep. I also haven't really found a need for a plugin like ack.vim, I just set 'grepprg' and 'grepformat' and search with :grep.

Vim picking up Cscope command instead of ctags?

I have installed ctags but not installed cscope.
When I press Ctrl-], vim correctly takes me to the definition.
However, when I press Ctrl-t, it replies back with error - "E567: no cscope connections".
vim --version has +cscope in it.
I tried setting "set nocst" in my vimrc, but to no avail.
Try:
:set csto=1
From the documentation http://vimdoc.sourceforge.net/htmldoc/if_cscop.html#csto
The value of 'csto' determines the order in which |:cstag| performs a search.
If 'csto' is set to zero, cscope database(s) are searched first, followed
by tag file(s) if cscope did not return any matches. If 'csto' is set to
one, tag file(s) are searched before cscope database(s). The default is zero.
I hope this will help you.
You may have cscope_maps.vim installed. Or, perhaps another related cscope related plugin/bundle. If so, you'll need to remove it.
If you already have ctags installed and you are trying to use an outline viewer for your code, I would recommend using https://github.com/majutsushi/tagbar. It works really well with just ctags.
If you are are using Vundle, install using
Plugin 'majutsushi/tagbar'

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

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: Recommendations for vimball plugins in pathogen

I plan to switch to vim 7.3 in the next days on my windows box - linux will soon follow. I also plan to switch my vim setup and let pathogen handle my plugins.
I've googled but not yet found a solution how to handle plugins using vimball technique for setup. Any hints?
You are looking for :UseVimball [path]
Open the vimball up with vim. Instead of sourcing it with :so % do
$ vim somthing.vba
:!mkdir ~/.vim/bundle/bundle-dir-name-here
:UseVimball ~/.vim/bundle/bundle-dir-name-here
Note you will have to make sure the path exists before you execute this command.
:h :UseVimball
You can try vim-addon-manager: it is able to put every plugin in a separate directory and correctly handles Vimball.

Resources