Xdebug - Joonty vdebug switching between windows - vim

So I am debugging my php app with xdebug and https://github.com/joonty/vdebug/ as my vim plugin. When I hit get the debug running i get 4 windows. In other vim plugins I was able to switch between these windows so i could scroll up and down in case the data became too big. I can't seem to figure out how to do this.
Anyone know how to switch between windows with xdebug using vim?

If it is just split window, you can read about it here
:h window-move-cursor
To make it more simple put this mapping into your vimrc
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
Now just press ctrl-J to get to window below current one, etc.

Related

How solve the issue of the NERDTree icons displaying incorrectly?

When I configured my init.vim of the neovim on my Linux Ubuntu 22.04, I simply copied the file from here, which uses the NERDTree shortcuts as follows:
nnoremap <C-f> :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsible="~"
But when I use the shortcut Ctrl+T to toggle the :NERDTreeToggle function, the display was erratic:
and
But the desired outlook should be as follows:
and
I tried adding :set encoding=UTF-8, but it still didn't display properly. Can anyone help?

In vim with pathogen, how can I check if a plugin will be loaded?

I'm using pathogen to manage my plugins in vim, and I have a section in my vimrc that I would like to run only if a certain plugin isn't installed/won't be loaded. E.g.
if(dwm.vim not in use)
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
endif
The two options that would probably work in most cases are to check if dwm.vim is in g:pathogen_disabled and/or to check if the directory .vim/bundle/dwm.vim exists.
However these checks seem somewhat brittle. For example if I don't have dwm at all checking for dwm.vim not to be pathogen disabled is insufficient, and if for whatever reason dwm.vim is in some nonstandard location that still makes it into the runtimepath the path check won't work.
The whole point of pathogen is to make managing my runtimepath easier, so an elegant solution would be to search this path. But searching the help, the pathogen source, google, and here revealed no easy way to do this. Can I do this in vim/pathogen natively? Is there a plugin that will do this for me? Should I not be doing this at all, since the cases where the checks fail are fairly corner-casey and won't happen as long as I manage my plugins properly?
Most plugins have a (re)inclusion guard. Usually named g:loaded_pluginname. Using this and the after directory you can conditionally load your mappings.
Put the following in ~/.vim/after/plugin/dwm.vim:
if !get(g:, 'loaded_dwm', 0)
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
endif
For more help see:
:h write-plugin
:h after-directory
:h get()
Add this after pathogen#infect():
if globpath(&runtimepath, 'dwm.vim', 1) !=# ''
" dwm.vim caught in the act
endif

Custom Hotkeys in gvim

I am using gvim under linux and I really love it, the problem I have with it is that Shorcuts like Crlt+C doesn't work...
I added the following code to my gvimrc but it doesn't have any effect :/
nmap <C-V> "+gP
nmap <C-V> "+y
nmap <C-A> ggVG
nmap <C-Z> u
nmap <C-Y> ^R
The problem is not that the shortcuts don't work, rather than that you don't know what the shortcuts are supposed to do.
It might help for you if you add behave mswin to your .vimrc. It remaps many key bindings to behave more like other programs.

Vim execute code on remapping in vimrc

I have created the following mapping in my vimrc file:
noremap <C-p> ! firefox -new-tab http://php.net/<cword><C-m>
The problem is that it proceeds to delete the line under the cursor.
How would I make this mapping work correctly?
If I understood what you're trying to do the following should work:
nmap <c-p> :!firefox -new-tab http://php.net/<c-r>=expand('<cword>')<CR><CR>
See docs for further information.
You are using noremap which means that it triggers:
in normal mode
in visual mode
in operator-pending mode.
You should use nnoremap or xnoremap instead. Also, note that ! is a shortcut for :.! in normal mode (acts on current line) and for :'<,'>! in visual mode (acts on current visually-selected lines). If you don't want that:
nnoremap <c-p> :!firefox ...
xnoremap <c-p> :<c-u>!firefox ...

How to increment in vim under windows (where CTRL-A does not work...)

While CtrlX works fine in vim under windows, CtrlA selects all (duh).
Is there a way to increment a number with a keystroke under windows?
You can make CtrlA to increment in windows by opening up the 'mswin.vim' file in your vim directory and finding the section that looks like:
" CTRL-A is Select all
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
snoremap <C-A> <C-C>gggH<C-O>G
xnoremap <C-A> <C-C>ggVG
Comment out all of these lines as follows:
" CTRL-A is Select all
"noremap <C-A> gggH<C-O>G
"inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
"cnoremap <C-A> <C-C>gggH<C-O>G
"onoremap <C-A> <C-C>gggH<C-O>G
"snoremap <C-A> <C-C>gggH<C-O>G
"xnoremap <C-A> <C-C>ggVG
and the CtrlA keystroke will increment.
This is a pretty nice option when your keyboard doesn't have a real number pad.
Try Ctrl-NumPad + ?
(from here)
I realize that this is an old question, but I ran across another option today based on the following question. Making gvim act like it does on linux will allow CTRL-A to work as you expect it to:
how to make gvim on windows behave exacly like linux console vim?
There is a section of the _vimrc that has the following items. These cause many of the control characters to act like they do on Windows.
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
I commented out (with ") the mswin lines and the set nocompatible line. From there, I added set compatible. This causes gvim to act like it does on linux. Thus, mine looks something like:
set compatible
source $VIMRUNTIME/vimrc_example.vim
"set nocompatible
"source $VIMRUNTIME/mswin.vim
"behave mswin
I just learned this trick today, so if I'm not completely correct in my information, please let me know.
I modified TMealy's solution so that CtrlA still selects all (I find this useful), while CtrlI increments (also useful).
noremap <C-I> <C-A>
" CTRL-A is Select all
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
snoremap <C-A> <C-C>gggH<C-O>G
xnoremap <C-A> <C-C>ggVG
A similar problem occurs under GNU/Linux when using Vim with mswin.vim.
Remapping Alt+X to Ctrl+A prior to evoking mswin.vim solved my issue.
execute "set <A-x>=\ex"
noremap <A-x> <C-A>
source $VIMRUNTIME/mswin.vim
behave mswin
Now, Alt+X and Ctrl+X respectively increase and decrease numbers in Vim.
Mapping to Alt key combinations is often not evident in Vim; read more about this here.
I am using cygwin terminal + screen, so <c-a> is captured by the terminal multiplexer. I used this mapping:
:noremap <c-i> <c-a>
It seems that the CtrlA got mapped somewhere in startup.
As suggested before, use:
unmap <c-x>
I would use unmap, not nunmap.

Resources