{"id":5336,"date":"2026-08-30T15:40:38","date_gmt":"2026-08-30T06:40:38","guid":{"rendered":"https:\/\/donguri3.net\/server-tech\/windows-terminal-vim-visual-block-fix-2\/"},"modified":"2026-08-30T15:40:40","modified_gmt":"2026-08-30T06:40:40","slug":"windows-terminal-vim-visual-block-fix","status":"publish","type":"post","link":"https:\/\/donguri3.net\/en\/server-tech\/development-programming-git\/windows-terminal-vim-visual-block-fix\/","title":{"rendered":"How to Fix Issues When Visual Block Selection Fails in Vim on Windows Terminal"},"content":{"rendered":"<p>Using Windows Terminal has become common as a standard terminal environment in Windows. While it offers the convenience of centrally managing PowerShell, WSL, and SSH clients, it also introduces a significant issue for Vim users: key binding conflicts.<\/p>\n<p>Specifically, this involves the Ctrl+v shortcut used for Visual Block selection in Vim. In the default settings of Windows Terminal, Ctrl+v is assigned to &#8220;Paste from clipboard&#8221;. Consequently, attempting to perform a Visual Block selection in Vim fails to enter visual block mode, resulting in the contents of the clipboard being pasted instead.<\/p>\n<p>While Vim provides Ctrl+q as an alternative key, depending on the connected Linux environment (particularly enterprise OSs such as RHEL), even this Ctrl+q may fail to respond. Why does Ctrl+q work in environments like Ubuntu on WSL, but fail on certain SSH connection targets? This article describes the causes and countermeasures.<\/p>\n<h2>Objective: Environment Setup Aligned with Your Operation Style<\/h2>\n<p>The goal of the solution in this article is to achieve one of the following two patterns:<\/p>\n<ol>\n<li>Use the alternative key Ctrl+q (Recommended): Keep the Windows Terminal &#8220;Paste (Ctrl+v)&#8221; function, and modify the Linux-side settings to ensure Ctrl+q works reliably.<\/li>\n<li>Use the native Ctrl+v: Remove the Windows Terminal &#8220;Paste&#8221; setting and let Ctrl+v pass through to Vim.<\/li>\n<\/ol>\n<h2>The Problem: Flow Control and the Barrier of Client Settings<\/h2>\n<p>The causes preventing Visual Block selection exist on both the client (Windows) and server (Linux) sides.<\/p>\n<ul>\n<li>Client-side issue (Ctrl+v): Because the Windows Terminal app preferentially processes Ctrl+v as &#8220;Paste&#8221;, the keycode does not reach Vim within the SSH session.<\/li>\n<li>Server-side issue (Ctrl+q): In Linux terminal settings (TTY), if historical &#8220;software flow control (XON\/XOFF)&#8221; is enabled, Ctrl+q is processed as a &#8220;resume communication&#8221; signal. As a result, key input does not reach Vim.<\/li>\n<\/ul>\n<p>Specific solutions for each approach are described below.<\/p>\n<h2>Solution A: Change Server Settings to Use &#8220;Ctrl+q&#8221;<\/h2>\n<p>This is the workaround when you do not want to change the standard Windows operating feel (pasting with Ctrl+v). It disables flow control on the Linux side and enables Ctrl+q.<\/p>\n<h3>Check Current Settings<\/h3>\n<p>Execute the following command on the target server to check the terminal settings.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">stty -a<\/pre>\n<p><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-2657\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-1024x165.png\" alt=\"Checking ixon status with stty -a\" width=\"1024\" height=\"165\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-1024x165.png 1024w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-300x48.png 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-768x124.png 768w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-530x86.png 530w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-565x91.png 565w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-710x115.png 710w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-725x117.png 725w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033-64x10.png 64w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/dc2fa5ac80a7487fb14be4a311c18033.png 1046w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p>If ixon is displayed in the output results, flow control is enabled (it is disabled if shown as -ixon). When enabled, Ctrl+q will not function as Visual Block selection.<\/p>\n<h3>Disabling Flow Control<\/h3>\n<p>Run the following command to disable flow control.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">stty -ixon<\/pre>\n<p>This disables the special functions of Ctrl+s and Ctrl+q, allowing them to be passed to the application as normal key inputs. Confirm that entering Ctrl+q in Vim allows you to transition to Visual Block mode.<\/p>\n<h3>Making Settings Permanent (Adding to .bashrc)<\/h3>\n<p>Since temporary command execution resets settings upon logout, you should append the settings to your .bashrc. However, to prevent errors during non-interactive connections such as SCP or SFTP, you must include a conditional branch (if [ -t 0 ]) to execute only when standard input is connected to a terminal.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\"># Append to .bashrc\n# Disable flow control (XON\/XOFF) only when connected to a terminal (TTY)\nif &#x5B; -t 0 ]; then\nstty -ixon\nfi<\/pre>\n<p>This configuration safely enables Ctrl+q exclusively during terminal operations without affecting automated processes like file transfers.<\/p>\n<h2>Solution B: Change Windows Terminal Settings to Use &#8220;Ctrl+v&#8221;<\/h2>\n<p>This is the workaround when you want to prioritize Vim&#8217;s native Ctrl+v operation. Modify the Windows Terminal settings to resolve the key conflict.<\/p>\n<h3>Open the Settings Menu<\/h3>\n<p>Launch Windows Terminal and press the shortcut key Ctrl + , (comma) to open the settings tab.<\/p>\n<p><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-2655\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-1024x577.png\" alt=\"Opening Windows Terminal settings\" width=\"1024\" height=\"577\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-1024x577.png 1024w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-300x169.png 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-768x433.png 768w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-320x180.png 320w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-530x299.png 530w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-565x318.png 565w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-710x400.png 710w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-725x408.png 725w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d-64x36.png 64w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/1220708aef81fca24cf8a842ff24961d.png 1115w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h3>Navigate to the &#8220;Actions&#8221; Menu<\/h3>\n<p>Select &#8220;Actions&#8221; (or &#8220;Interactions&#8221; depending on the version) from the left sidebar. A list of shortcut keys will be displayed here.<\/p>\n<p><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c.png\"><img decoding=\"async\" class=\"aligncenter size-large wp-image-2656\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-1024x577.png\" alt=\"Windows Terminal Actions Menu\" width=\"1024\" height=\"577\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-1024x577.png 1024w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-300x169.png 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-768x433.png 768w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-320x180.png 320w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-530x299.png 530w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-565x318.png 565w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-710x400.png 710w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-725x408.png 725w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c-64x36.png 64w, https:\/\/donguri3.net\/wp-content\/uploads\/2026\/02\/3b66248abbc7d0588637060f4eab777c.png 1115w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h3>Modify the &#8220;Paste&#8221; Setting<\/h3>\n<p>Find the &#8220;Paste&#8221; item in the list. By default, Ctrl+v is assigned to it.<\/p>\n<ul>\n<div>Delete assignment: Remove the key assignment using the trash can icon next to the item or via the right-click menu.<\/div>\n<div>Change to another key: If necessary, change it to a non-conflicting key such as Ctrl+Shift+v.<\/div>\n<\/ul>\n<p>Setting changes take effect immediately (click the save button if prompted). This prevents Windows Terminal from intercepting Ctrl+v, passing key inputs directly to Vim instead. As a result, Visual Block selection using Ctrl+v becomes possible in Vim.<\/p>\n<h2>Conclusion<\/h2>\n<p>The issue of not being able to use Vim&#8217;s Visual Block selection in Windows Terminal is caused by a combination of factors on both the client and server sides.<\/p>\n<ul>\n<li>Ctrl+v: Windows Terminal preferentially processes it as &#8220;Paste&#8221;.<\/li>\n<li>Ctrl+q: May be preferentially processed as &#8220;flow control&#8221; in the Linux-side terminal settings (stty).<\/li>\n<\/ul>\n<p>While you can reclaim Ctrl+v by modifying Windows Terminal settings, reviewing the stty settings on the Linux side is a more logical approach to avoid compromising standard Windows usability. When key inputs fail to respond, checking communication control-level settings (ixon) in addition to key bind configurations is the shortcut to a resolution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using Windows Terminal has become common as a standard terminal environment in Windows. While it offers the co [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":2658,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/donguri3.net\/?p=2654","footnotes":""},"categories":[1172],"tags":[105,488,352,538,10,381,974],"class_list":["post-5336","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development-programming-git","tag-linux","tag-ssh","tag-ubuntu","tag-vim","tag-server","tag-381","tag-974","en-US"],"_links":{"self":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/5336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/comments?post=5336"}],"version-history":[{"count":1,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/5336\/revisions"}],"predecessor-version":[{"id":5339,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/5336\/revisions\/5339"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/media\/2658"}],"wp:attachment":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/media?parent=5336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/categories?post=5336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/tags?post=5336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}