Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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].

1
vote
0answers
21 views

How to pin a file to a window(/viewport)

When I have multiple files open in multiple splits, when I open a new file via quickfix ( or Ctrl-P ), it sometimes ends up placing the new file in a window that I don't want to be changed. Is there ...
0
votes
1answer
29 views

how to close a single window by mentioning filename opened in that window

I want to close a window by mentioning window name in command line. For example, let's assume I have opened 1.c, 2.c and 3.c in different windows in vim. Now i'm in 2.c and i want to close 3.c. Is ...
0
votes
1answer
18 views

marks between windows

If I make a mark ma in one split pane and then from another I try to jump to it 'a I can't. I guess marks are stored per-buffer. Can I store marks per-tab?
0
votes
1answer
31 views

Equivalent of emacs `winner-undo` and `winner-redo`

Vim's C-w o is equivalent to Emacs's ESC ESC ESC, which closes all the Vim's windows (Emacs's buffers), except the current open one. In Emacs, with the command winner-undo and winner-redo one can ...
1
vote
1answer
40 views

<Alt> to enter normal mode on Windows

I'm new to vim, and I find using <Esc> to enter normal mode to be slow. I'm on Windows. I seldom use the <Alt> keys (left and right) when I'm editing text. It should be convenient to use &...
1
vote
0answers
39 views

YCM is not working with .ycm_extra_conf nor compile_comands.json on Windows

I have problems using YCM plugged for C-family languages. Here are what I have done: project layout -- build -- src -- source file dir0 -- include main.cpp -- source file dir1 ...
3
votes
1answer
31 views

How to close several windows with one mapping?

I use CTRL-W c to close current window. I expected that 5 CTRL-W c close 5 windows in row, but it's not. Now I just type CTRL-W c 5 times. What is correct way to do it and why it don't work as I ...
0
votes
1answer
68 views

vim command Termdebug doesn't show source code

If I open gdb in vim with Termdebug filename command it doesn't show source code in bottom window. cgdb works proper way with same filename.
0
votes
0answers
17 views

Displaying specific text only in the airline of a given window

Suppose that using bufwinnr() I find the windows number where a given buffer is being displayed to be 2. With that information, is there a way to display a specific string only in the airline status ...
1
vote
1answer
131 views

Always open terminal window at the bottom

My ideal editing layout would look like this (in Gvim): ---------------------------------------------------------- | | | | | N | ...
0
votes
1answer
32 views

Prevent a window from resizing [duplicate]

I nearly always have a terminal window open when I'm doing extensive editing in Vim. I've used tnoremap to set mappings for the three heights I want the terminal window to be able to take. ...
0
votes
1answer
24 views

vimL, how to get alternate window's current buffer number

Say, with 2 windows open in vim, cursor is window 2, how can I get the current buffer of the alternate window (window 1 in this case)?
0
votes
2answers
52 views

How to count the number of tilde lines in a window?

When the number of text lines is less than a window height, tilde (~) lines are displayed until the bottom of the window. I want to decrease the window height just enough to display all the lines and ...
1
vote
1answer
52 views

Binding horizontal scroll in a function with feedkeys

I'm trying to create a function to make editing TSV files easier. The function changes spacing settings, turns off wrapping, and creates a 1 row tall split at the top so that the column headers are ...
1
vote
0answers
33 views

stop updating screen until function finishes or manually call redraw

Does vim/neovim have the ability to manually disable screen updating? I run a function that jumps between a few tabs, update the content, and then go back to the original tab. The screen then flash ...
2
votes
2answers
462 views

Conditional window split

I have line to split window at start: au VimEnter * vsplit But sometimes it's annoying because I'm opening vim in small terminal, in this case I'd like to not split my window. I've tried this ...
1
vote
1answer
237 views

opening powershell from inside vim

I want to run powershell from vim and I have achieved it using the following mapping: map <leader>cd :cd %:p:h<cr>:silent !powershell<cr> The problem is that I can't do anything ...
0
votes
1answer
28 views

How come the splitted window failed to update its shapes along with the whole window

By the normal mode command :vs, I split the current buffer into two equally sized buffers. Then I resize the whole terminal window and only find the left portion of the screen remains the same as ...
0
votes
2answers
395 views

vim split horizontal resize shortcut

I can resize horizontal split windows by ctrl-w-shift-< and ctrl-w-shift->. I would like to have a shortcut for that. Close to the topic, recently I learned about the following maps: nnoremap &...
1
vote
1answer
84 views

How can I automatically preform operations when a vim *window* is resized?

I'm setting up NeoFormat/ALEfix-style code reformatting, and I'd really like to have it automatically and fluidly reformat the code as the window is resized. This is possible for whole-viewport vim-...
1
vote
0answers
49 views

How to auto save on *.coffee files when lose focus (in insert mode) then also back to normal mode

I'd like to lose focus when I'm in insert mode, to trigger auto-save on *.coffee buffers and also I need it to change mode from insert to normal mode to trigger Live compile feature of vim-coffee-...
1
vote
0answers
41 views

How do I open a tag with <C-]> but open it in an existing split?

I usually always have only two vertical splits open. One I use for actual coding and the other for reference. I would like to be able to search for tag in Window1 and have the result appear in ...
9
votes
1answer
226 views

Why does :bd # delete the current buffer when no alternate buffer exists?

Here is how I reproduce the behavior I am observing. First, I enter this command: echo aaaaa > a vim a In Vim, I enter these commands: :ls :e # :echo bufname('#') Here is the output of the ...
0
votes
1answer
68 views

Is it possible to not have the same buffer open in multiple windows?

When we have a buffer open, and we open a new one with :split or :vsplit, if in any opened window we execute :bprev or :bnext, we could have the same buffer open at the same time in both windows. Is ...
1
vote
1answer
50 views

How can I determine if *any* window in the current tabpage is in diff-mode?

So, I found this useful answer about iterating buffers; but due to the tabpage-specific duality of windows in Vim, I failed at adapting it to my needs. Thus: how can I construct a boolean expression, ...
1
vote
2answers
165 views

How to start gvim from command line with predefine pasting from clipboard

I know gvim -c [command] samaple.txt might run command predefined in command body. How to paste text from windows clipboard at the end of sample.txt file?
5
votes
2answers
486 views

Detect if window has neighbour in given direction

Is there a robust way to detect whether a window has a neighbour in a given direction? So far, the only solution I found uses wincmd, let winnum = winnr() noautocmd wincmd h if winnum != winnr(...
1
vote
0answers
47 views

How to pass C-r to Vim terminal window? [closed]

In the Vim terminal I want to be able to search history in bash and ipython but C-r is already bound to basic Vim functionality. Is there any general way to pass this and other characters to the ...
0
votes
0answers
35 views

Highlight block of injected code [duplicate]

windows 10/ gvim 1-1802. I use Javascript and there are sometimes blocks of HTML code that need to be inside a particular region that can be indicated by """, for example . I have a similar ...
1
vote
2answers
1k views

Fatal Python error: Py_Initialize: unable to load the file system codec ImportError: No module named 'encodings'

I am new to vim. As much as I love it, there seem to be a lot of bugs or errors every time I try doing something. I am unable to run the plugin "browserlink.vim" (https://github.com/jaxbot/...
0
votes
1answer
53 views

How to have a buffer takes 1/4 of a window and another takes all the rest?

I have two buffers, and would like one takes 1/4 of a window and other takes rest of the window. Normal behavior would be for example sp or vsp would split buffer to take 50/50 percent each, there ...
0
votes
2answers
880 views

How to switch between buffer and terminal (cmd windows)

I have a vim's buffer and a terminal in the same vim's window but each time switch to terminal I can only exit it to go back to vim's buffer, Is there a way to keep terminal session but be able to ...
1
vote
1answer
288 views

Unable to Open NERDTree

I'm new to Vim, and for the paste couple of weeks, I've been using NERDTree with no problems. However, I recently added a few key mappings and am now unable to open NERDTree with the <C-n> ...
1
vote
1answer
76 views

Quit a window by its win_getid() identifier?

I use something like zoomwintab to zoom in/out of a single window view, using tabs to simulate the effect. It exposes a toggle function to zoom in on a single window, and to zoom back out to the ...
0
votes
1answer
102 views

Contextual key bindings when a specific context menu is open

I recently installed fzf CLI fuzzy search utility, and the accompanying fzf.vim file with it. They both work great, and I have been enjoying my experience with them thus far. However, I'd like to ...
1
vote
0answers
41 views

Disable regex searching in specific windows

I usually have about 4 or 5 windows open in Vim. Currently - one of my files is very large(in size) - a CPU cache trace. Every time I search with "/", vim searches all windows before returning the ...
1
vote
0answers
17 views

Resize windows “visually” [duplicate]

When I use tmux, I can hold Ctrl-c and continue pressing any of the 4 arrow directions I want to resize a pane: I then see the pane of interest resizing while pressing and I stop when I get visually ...
4
votes
1answer
278 views

How to lock a window height / width?

I jot notes in a tiny split window (buffer) regularly: <C-W>s :enew :res 5 ... jot jot... When I create a new horizontal split in the same tab, that little window resizes, as if doing <C-W&...
0
votes
1answer
48 views

Where are my recent commands stored in Vim?

So I have made about 10/12 substitutions in my current file using %s/longpatternN//g. Unfortunately I have to apply these same substitutions in 10 or more of my files. I can access my last commands ...
0
votes
1answer
30 views

Toggle showing a file (e.g. individual Cheatsheet)

To learn my mappings, I want to toggle an individual help (like e.g. a cheatsheet or so). I don't know how to toggle showing of a window, is there any way or neat key map to toggle something like ":...
1
vote
0answers
59 views

Avoid Scrolling When Switching Back to a Buffer

When switching back to a buffer (.e.g with Ctrl^ and :bn, etc.), Vim tries to scroll whatever line the cursor was on last to the center of the window. I find this behavior extremely disorienting, so I ...
1
vote
1answer
356 views

How to open a vertical split to the main view not just next to the current one in case of horizontal splitted viewport? [duplicate]

I have 2 buffers on eachother covering top and bottom of the screen. I want ot open a third buffer on right split but the problem is is I make a right split it will only split the top right or bottom ...
4
votes
1answer
353 views

How can I open a split at whose height is a percentage of the main window?

Is there a Vim function or variable that would return 1/3rd (or any dynamic value) of the current window height? I'm using Neoterm, and it's terminal splits open at half the current window height by ...
3
votes
1answer
227 views

What is a working setup to use Vim plugins UndoTree and Goyo together?

I love UndoTree, saving me many times when I deleted/rewritten entire paragraphs but days later I realized that I needed to extract a phrase/sentence from them, without completely messing up my ...
2
votes
2answers
456 views

Any recommendations to enforce use of keybindings rather than equivalent command mode commands?

Context: I learned about the :[v]split command long before I learned the shortcuts Ctrl-w+[s|v] and as a result I find myself typing these commands often. Is there a way to break this habit ? (as a ...
1
vote
1answer
40 views

how can I make keymap to open a new file in a vertical split? [duplicate]

I tried nnoremap <c-m><c-m> <c-w>vs ene and nnoremap <c-m><c-m> <c-w>vs<space>ene but I don't get a new file, I get the same file in a new buffer.
1
vote
1answer
53 views

Getting tab and windows movement with one key combination

Recently I found this question: Is it possible to map one key to two commands, doing 2nd command only if first fails It's working well, but I'd like it to work this way: when Alt-l is pressed, do ...
1
vote
1answer
124 views

Is it possible to map one key to two commands, doing 2nd command only if first fails

I want to map the tab key to <c-w>w to switch windows when there is more than one window open. But if there is only one window but multiple tabs, I want it to detect that there is only one ...
1
vote
1answer
102 views

Is there a shortcut to open a blank vertical split window?

I know there is a shortcut to open a new blank split window horizontally. Namely, ctrl-w + n. But is there a shortcut to do the same thing vertically? More precisely, I want a shortcut for :vs ene. ...
4
votes
2answers
383 views

Close all windows except the current one and NERDTree

I know about :only and Ctrl+wo. But I want to keep NERDTree window untouched. Is there a way to achieve it?