Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to always switch in the current window #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion plugin/a.vim
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ if (!exists('g:alternateRelativeFiles'))
let g:alternateRelativeFiles = 0
endif

" If this variable is true then a.vim always open the alternative
" file in the current window
" Feature by Andres Llopis
if (!exists('g:alternateSwitchOnCurrentWindowAlways'))
" by default a.vim will not convert the filename to one relative to the
" current working directory
let g:alternateSwitchOnCurrentWindowAlways = 0
endif

" Function : GetNthItemFromList (PRIVATE)
" Purpose : Support reading items from a comma seperated list
Expand Down Expand Up @@ -782,7 +790,12 @@ function! <SID>FindOrCreateBuffer(fileName, doSplit, findSimilar)
endif

" Buffer was already open......check to see if it is in a window
let bufWindow = bufwinnr(bufNr)
if (g:alternateSwitchOnCurrentWindowAlways == 1)
let bufWindow = -1
else
let bufWindow = bufwinnr(bufNr)
endif

if (bufWindow == -1)
" Buffer was not in a window so open one
let v:errmsg=""
Expand Down