Vim split unless open?

You can't remap the existing split command, as far as I know, but you can achieve the same same effect by writing a new function Split and then using a command-mode abbreviation ( cabbrev ) Here's a function/mapping that should do what you want function! MySplit( fname ) let bufnum=bufnr(expand(a:fname)) let winnum=bufwinnr(bufnum) if winnum! = -1 " Jump to existing split exe winnum ."wincmd w" else " Make new split as usual exe "split " .

A:fname endif endfunction command! -nargs=1 Split :call MySplit("") cabbrev split Split Note that this will only "check" for existing splits in the current tab, and hidden buffers are ignored.(However, it shouldn't be too difficult to add more cases to enhance this functionality.).

You can't remap the existing split command, as far as I know, but you can achieve the same same effect by writing a new function Split and then using a command-mode abbreviation (cabbrev). Here's a function/mapping that should do what you want. Function!

MySplit( fname ) let bufnum=bufnr(expand(a:fname)) let winnum=bufwinnr(bufnum) if winnum! = -1 " Jump to existing split exe winnum . "wincmd w" else " Make new split as usual exe "split " .

A:fname endif endfunction command! -nargs=1 Split :call MySplit("") cabbrev split Split Note that this will only "check" for existing splits in the current tab, and hidden buffers are ignored. (However, it shouldn't be too difficult to add more cases to enhance this functionality.).

Great, thanks a log – iNecas Jul 10 at 10:16.

An alternative would be using :drop {file}. Edit the first {file} in a window. - If the file is already open in a window change to that window.

- If the file is not open in a window edit the file in the current window. If the current buffer can't be abandoned, the window is split first. Also using :sb to switch buffers might also be of use.

See vim: move to buffer? For more information: :h :drop :h :sb :h 'swb.

That's one of the features of searchInRuntime. :GSplit and :GVSplit can be renamed, they support filename completion, and they will ask which file to open when several match the pattern in &path.

You can't remap the existing split command, as far as I know, but you can achieve the same same effect by writing a new function Split and then using a command-mode abbreviation (cabbrev). Here's a function/mapping that should do what you want. Note that this will only "check" for existing splits in the current tab, and hidden buffers are ignored.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions