Questions tagged [vim-windows]
A Vim window is a view of a buffer. A tab page comprises one or more windows. For questions about interaction with the Microsoft operating system, use [microsoft-windows]. For questions about interaction with the desktop windowing system, use [window-management].
321
questions
0
votes
3
answers
55
views
Open Vim help in vertical split
There seems to be a few posts about this, e.g.: Opening Vim help in a vertical split window.
The following works for me - opening help docs in vertical split at left - placed in ~/vimfiles/ftplugin/...
2
votes
1
answer
46
views
Is there a built-in feature to sync the editing position between two windows of the same file?
I often split two windows of the same file to edit,
so that it's easier, like I can implement a function
in a window and check the long comments somewhere in
another window.
Sometimes, after I did ...
0
votes
2
answers
30
views
How can I rebalance splits after the window size of the terminal changed?
I sometimes like using splits. Both vertical and horizontal, depending on the files I'm looking at. When creating a split, vim automatically halves the available size of, in my case, a terminal ...
0
votes
1
answer
62
views
Get an exact copy of the buffer as it appears in the window
Main Question
For a plugin I'm developing, I want to show a floating window somewhere within the buffer view, but want to work out exactly which rows and columns in the window are already taken up by ...
0
votes
2
answers
39
views
Any commands to switch to the window on the far left or right?
Let's say I have a grid of 3x2 windows open and I am focused on the bottom right one. I want to switch to the one on the bottom left with one command, not move left twice. Vice versa as well. There's &...
0
votes
1
answer
69
views
Is it possible to run a command on a specific buffer without switching to it?
A command to run on a buffer given its number or titled printed in :ls. This doesn't seem to be possible with :bufdo.
0
votes
2
answers
40
views
How can I create a new vsplit to the left of the topmost window with the same height with only commands?
Let's say I have two windows on the top and bottom, full width. I want to create a new window to the left of the top one and the same height. If there are two windows on the top taking up half width ...
1
vote
2
answers
537
views
Can I open Neotree in the current window instead of a in a new one?
When I do a command like :Neotree reveal it opens it in a new window on the left, when I want to it to show in the current window and hide the buffer that was there.
1
vote
1
answer
35
views
Command line to open list of files in as many buffer viewports
When I use a command like as:
vim file1 file2 file3 ...
file1 is opened and I can navigate with :next and :previous
I would like all the files listed to be opened each in a different buffer viewports ...
1
vote
2
answers
73
views
Store a windows path in a global variable and access it later?
I want to store a path in a global variable and then change to a directory.
:let g:OneDriveB='C:\Users\bram\SomeDrive\ -\ Das\ Company\ Name\' # Works.
:cd g:OneDriveB # This second ex fails as the ...
1
vote
0
answers
34
views
How to edit file as vsplit panels?
As Vim user, it is useful to view more lines of source code.
Are there any tools which combine left and right panels when using :vsplit to split into two windows. Then move the cursor up/down.
0
votes
1
answer
72
views
Quickly arrange split windows into a grid layout?
Does vim have a way of arranging split windows in a grid pattern? (Preferably, without closing existing splits, and without using a plugin.)
Tmux has some predefined windowpane layouts. For example, ...
1
vote
1
answer
69
views
How do you change the window title line text in Vim?
How do I change where is says [No Name] or where it says gibbersh-letters-of-base64 to a text of my choosing?
0
votes
1
answer
114
views
When I use helpgrep, how can I highlight my search results?
I'm using :helpg session in my Vim.
I would like to highlight the pattern in the results like :set hls does for normal search.
Is there a way to do this?
1
vote
1
answer
174
views
Why so % does not work when vimrc changes with another editor?
I opened a file in Vim.
Then opened vimrc file with another editor (VsCode) and made some changes.
I would like those changes to be reflected in my Vim session.
I tried :so % but it didn't work ...
0
votes
0
answers
26
views
How do I instruct plugin BufExplorer to open a buffer in an existing window?
How do I instruct Vim plugin BufExplorer to open a buffer in a specific existing window rather than open the buffer in a new horizontal (key f or F) or vertical (key v or V) window?
0
votes
1
answer
35
views
rightbelow not exhibiting the correct behavior
I am not seeing the correct behavior when I use the rightbelow command. If I run :vertical term then a terminal opens in a vertical split (terminal on the left, existing pane on the right), but the ...
1
vote
1
answer
41
views
Pause the rendering/refreshing/drawing of the gVim/Vim screen
I am developing a gVim plugin that manages/reorganizes panels, buffers and tabs.
However, while most programmatic re-arranging take milliseconds, they can still look very messy to the eyes while you ...
0
votes
1
answer
34
views
How to make left,right,up,down window movement behave like if windows were a ring?
This is, in the current window layout:
+---+---+---+
| | | |
| A | D | C |
| | | |
+---+---+---+
| E | F | G |
+---+---+---+
If the focused windows is A, then moving to the left should ...
3
votes
1
answer
197
views
How can I run an autocmd before (!) a window is split?
TL;DR:
I want to avoid split windows and tabs. Is there a way to intercept a split command with an autocommand that translates every window split, including those of plugins, into a simple buffer ...
0
votes
2
answers
164
views
Cannot get block-wise visual selections in vimscript?
I am searching for how to get visual selection in vimscript. And I found this: https://stackoverflow.com/a/61486601/4438921, it is great, but the only issue is that, in block-wise visual mode, I ...
1
vote
2
answers
222
views
LeftMouse focus window without moving cursor
Is there a way for clicking on a Vim window to focus that window if inactive (without moving the cursor), then move the cursor if the window is already active?
Here's what I've got so far:
function ...
0
votes
2
answers
42
views
Misunderstanding of interaction between local options, moving between windows, and WinLeave, WinEnter, BufLeave, BufEnter events
This what is logged in :messages when I'm printing the value of nu and rnu upon the 4 events WinLeave, WinEnter, BufLeave, BufEnter during the action, done twice, of opening :help and closing it. The ...
0
votes
1
answer
24
views
Starting from three horizontally split windows in Vim, how to have a new window vertically split to the left of all three initial windows?
Let's say we have three windows split horizontally in Vim and we want to have a new window that is split vertically to the left of all three current windows.
How can this be achieved?
0
votes
2
answers
117
views
How to re-open the same window with the same buffer therein?
Consider the following snippet:
vim9script
# Set stuff in the newly created window
var my_win_nr = winnr('$')
var my_win_id = win_getid(my_win_nr)
win_execute(my_win_id, 'wincmd L')
win_execute(...
0
votes
2
answers
353
views
How to get the number of columns to the left border of the current window?
As title. I want to know the offset regardless of the current buffer. It's not the column number of the current buffer.
1
vote
1
answer
82
views
How to always open the `:h` as a split from the current window?
As title. Say I have A|B and already called :h foo on B then if I call :h bar on A it will not create a new split under A but change the content of the split from B instead. What I expect is that I ...
1
vote
0
answers
40
views
How to map both keymaps `<C-w>q` and `<C-w><C-q>` to do nothing?
As title. I usually mistyped <C-w> into <C-w><C-q> and it close the window I was working on. That is really annoying... I have tried mapping this keymap into <nop> but it didn'...
0
votes
2
answers
45
views
Can I copy options (everything shown when I run `:set` with no arguments) between active windows
I have two windows opened in the same terminal. These are actual vim windows within the same vim instance. The first window is a .py file which has many options set by default, plus additional options ...
1
vote
0
answers
279
views
Is it possible to resize a floating window?
As title. Say I just created a floating window and some lines of it are too long to be displayed properly(to me), then in this case I would prefer to resize that window to make it larger instead of ...
0
votes
2
answers
869
views
Is it possible to prevent the buffer of a window from being changed?
As title. In fact, I just encountered a situation where I cannot change the buffer of the current window, which is created by some plugin. So I guess there might be some window/buffer option(s) to ...
0
votes
0
answers
350
views
vim-plug error on Windows
Longtime Linux, vim and vim-plug user, setting things up on Windows for the first time.
For debugging, I've reduced my .vimrc to just this:
call plug#begin()
Plug 'lifepillar/vim-solarized8'
call plug#...
1
vote
1
answer
42
views
How to increase one window and make all others equal height?
I use Vim version 8.2
I have e.g. 5 windows.
I have made these of equal height by normal command
CTRL-W =
first question:
How to write this to be executed as :excommand in the EXcmd line?
second ...
1
vote
1
answer
67
views
@: does not work to repeat the :qa command
I open the diff files between 2 code revisions using git difftool. I can use :qa to close the current diff and go to the next one. Rather than pressing :qa repeatedly, I would like to use @:, but I ...
1
vote
2
answers
434
views
How can I change undo behavior in Vim?
I'm new to Vim and install that in windows 10.
I write this instructions in Vim then in normal mode pressed u and all the instructions disappeared.
console.log(899) hello you can write some simple ...
0
votes
2
answers
43
views
Event with the same timing as BufEnter but triggers on vsplit?
As title. I have a pair of autocmds which needs each other:
One on WinLeave, this one is fine since it will be triggered when I call :vsplit.
One on BufEnter, this one is NOT fine for the edge case, ...
0
votes
1
answer
118
views
What's the filetype of winbar? Is it a kind of window?
As title. I have some plugins that conflict with each other. If I can know the filetype of winbar then I save much time debugging.
0
votes
3
answers
68
views
How to read a swapfile, but not touch the file which is open in Vim?
I am using vim 9.0 (2022 Jun 20, compiled Nov 30 2022 23:37:37).
I am running KDE and under Konsole I have very many windows with terminals /dev/ptsnn open with shell bash in each.
Many Vim instances ...
2
votes
2
answers
146
views
Vim change window position with precision
Currently my Vim layout is this one :
________________________
| N | | |
| E | | |
| R | | |
| D | | |
| T |---------| |
| r | ...
-1
votes
1
answer
156
views
Edit a file in two different terminal windows
It's nice to edit the same file from two different views. I use a vsplit for this, as described here, and it works well.
However, I'd like to have the two views open in different terminal windows, ...
5
votes
1
answer
763
views
How to toggle Fugitive status window
Fugitive provides a :Git commands that opens a window with basically the output of git status. To close it, I need to switch to that window and close it, which is tedious.
How do I toggle this window?
1
vote
0
answers
39
views
how to pass all open windows to command line in vim [closed]
I want to run clang-format on all open windows.
What I currently do, is:
for each open window:
:!clang-format --style=file -i %
I have 2 issues:
the clang-format runs in shell, so it doesn't ...
1
vote
2
answers
218
views
Does gvimfullscreen.dll working with gVim 9.0 on Windows?
I used to use gvimfullscreen.dll to toggle a full screen window state on gvim for Windows. It made gvim full screen, not maximised, with no titlebar.
I have not used gvim on Windows for some time ...
1
vote
1
answer
548
views
How can I open netrw in a split when opening a directory?
I have figured out how to open a file browser in a split, using the following in vimrc:
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:netrw_browse_split = 4
let g:netrw_winsize = 25
let g:...
1
vote
2
answers
657
views
How can I get the active window in a tab?
For example, if I do:
% vim file
:tabedit one
:split two
I end up with two tabs, and one tab with two windows.
How can I get the active window of the second tab? My goal is to get a list of all tabs ...
0
votes
0
answers
835
views
Coc.nvim doesn't work correctly
Yesterday, I installed coc.nvim in vim on windows. I remember that it showed up the suggestion tab. But today, I removed go and visual studio, then it didn't show up anymore. I tried to reinstall Go, ...
1
vote
1
answer
533
views
Showing text info in window split separators
(I'm using nvim 0.7 and have recently moved from a init.vim to lua, which is baffling me slightly.)
In my old set-up a split would look like this:
→ note that the bar that splits the two windows ...
2
votes
3
answers
399
views
How to save a file for which I have no write permissions on Windows
I would like to edit files like C:\Widows\System32\Drivers\etc\hosts that need administrative privilege to be modified.
How can save the file on Windows if Vim has not been starter with administrator ...
0
votes
1
answer
20
views
Plugin Dev - Keeping Track of Windows inside a single Tab
I'm trying to build a new plugin and I got myself a question about managing multiple windows inside a single tab (hope the terms are correct).
So far the examples and projects I've explored trying to ...
1
vote
0
answers
146
views
Neovim 'tab' or 'vert' no longer splits, just creates buffer
When I start a neovim session, my first command is to startup a terminal session within vim. However lately (perhaps due to an OSX update?) any use of vert or tab no longer performs a vertical split, ...