Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hi,

I wanted to configure Vim so that if I try to open an .rpy file that's already opened in another Vim window, it would close the current window and bring the other window to front.

I came up with a solution, but it only works partially - closes the first window, but doesn't bring the second to front:
autocmd SwapExists *.rpy let v:swapchoice = "q" | let v:swapcommand = "call foreground()".

Obviously I'm using v:swapcommand here wrongly, but I can't understand how to use it correctly from :help swapcommand-variable. Please help.

Vim ver. 9.2.78.

You must be logged in to vote

Replies: 2 comments

Comment options

try the editexisting.vim package

You must be logged in to vote
0 replies
Answer selected by lkintact
Comment options

Thank you, @chrisbra, the package does the job.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.