Stack Exchange Network

Stack Exchange network consists of 174 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].

2
votes
2answers
391 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
32 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
2answers
36 views

Run command to disable a plugin in modeline

System: gvim 8.1 1-116 / windows10 A file that I'd like to use modeline (enabled): # vim: ft=python but disable ale plugin that will trigger on save - the file contains some python codes. Command ...
0
votes
1answer
21 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
74 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 &...
0
votes
1answer
30 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
25 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-...
0
votes
0answers
28 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 ...
8
votes
1answer
134 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
58 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
31 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
72 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
472 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
36 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
32 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
0answers
464 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
43 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
79 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
63 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
35 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
0answers
20 views

Window resizing with the mouse inside GNU Screen does not work

Resizing the Vim windows with the mouse inside a GNU Screen session doesn't work. I'm using guake, vim 7.4.576 and GNU Screen 4.02.01. Any other mouse operation works ok (the scroll as well as ...
0
votes
1answer
49 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
35 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 ...
0
votes
1answer
138 views

How to successfully back out to command prompt with Ctrl-Z in Neovim on Windows?

I know there's a number of ways you can suspend a Neovim/Vim session. One way being CTRL-Z to jump back into the command prompt, and press fg and ENTER to go back into your Neovim/Vim session. ...
4
votes
1answer
67 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&...
1
vote
1answer
77 views

How to customize the color of an HTML output file generated from Git Bash?

I have used the following command in Git Bash to perform a 'vimdiff' for 2 XML files. vimdiff xml1.xml xml2.xml -c TOhtml -c 'w! result.html' -c 'qa!' The HTML file which is getting generated is ...
1
vote
1answer
367 views

Copying From Vim to Ubuntu Bash on Windows

Note: this question is specific to the relatively new Ubuntu Bash on Windows system. So it seems possible to paste into Vim from the Windows clipboard by simply right clicking in insert mode after ...
0
votes
1answer
40 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
28 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
47 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
111 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
297 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 ...
0
votes
0answers
46 views

Neovim spontaneously resizes and distorts windows after screen unlock

When I lock the screen then unlock it again, the windows are resized and distorted. Unmaximizing then maximizing the terminal window restores the buffers then using ctrl + w + = fixes the windows size....
1
vote
2answers
811 views

UTF-8 not working on VIM

I've search a lot about this on Internet but nothing's working. I'm using Vim 8.0.3 on Windows 10 and I can't get the right encoding to work. It's not a problem when writing code, but the problem ...
3
votes
1answer
161 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 ...
0
votes
2answers
81 views

How do I debug normal/insert/cart mode shortcuts that don't behave as expected? [closed]

I am using exactly the same version of Vim (Gvim 8.0.1123) across all my Windows machines, and only have the following problem on one of them: Problem That I cannot use <c-d> in insert-mode, ...
2
votes
2answers
452 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
26 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
61 views

Why can system directory files not be edited

It seems that vim does not work correctly when editing files in Windows systems directories. For example, editing the PowerShell all users, all hosts profile script fails. The current file has only ...
1
vote
1answer
42 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
91 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
83 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
208 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?
1
vote
1answer
205 views

Closing error window

When I run yapf on my code, an error page appears, rightly showing the error I have in the code. How on earth do I close this window and go back to my code? :lclose doesn't work. :close closed the ...
5
votes
2answers
279 views

Is there a direct way to select the buffer displayed in a non-active window?

I usually have two windows open, one in which I'm working and one in which I'm viewing some information (compiler messages, relevant library headers, etc. etc.). Now, it's easy to switch the buffer on ...
1
vote
1answer
68 views

Why <C-W> does not enter operator pending mode?

I use Colemak layout. In order to use hjkl I remapped several keys nearby with noremap. It works fine. However, window movement commands somehow do not recognize these mappings. E.g. although I have '...
2
votes
1answer
109 views

How to open file in specific window (create or reuse)?

I'm trying to develop a plugin that would show results of SQL queries, by executing them inside tmux split and using mysql pager option to save them to the specific file. What I want now is to either ...
0
votes
1answer
65 views

Do not reopen buffers of last session

When Vim starts, it always opens buffers of last session too. That is to say, when I leave Vim by closing all windows, but do not explicitly close buffers (by :bd), those buffers will be opened next ...
1
vote
1answer
81 views

How can I keep the Tab title text fixed, during movement through separate split panes/panels?

Generally, I only use split panes inside of a Tab when using plugins like NerdTree, TagBar, and Codi, or when opening up helptags with :help. When I enter one of these panes, the Tab title text ...