Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C-k <bs> not work in terminal windows #970

Closed
2 tasks done
gxing opened this issue Aug 24, 2023 · 2 comments · Fixed by #1029
Closed
2 tasks done

C-k <bs> not work in terminal windows #970

gxing opened this issue Aug 24, 2023 · 2 comments · Fixed by #1029
Labels
bug Something isn't working env Issues caused by incorrect environment settings (terminal, package manager, etc.)

Comments

@gxing
Copy link

gxing commented Aug 24, 2023

Version confirmation

  • Confirm

Following prerequisites

  • Confirm

Neovim version

0.9.1

Operating system/version

Linux

Terminal name/version

iTerm2

$TERM environment variable

xterm-256color

Branch info

main (Default/Latest)

Fetch Preferences

HTTPS (use_ssh = false)

How to reproduce the issue

use
:Terminal
or A-d
or C-\
or A-
open terminal

C-k and backupspace

Expected behavior

delete to end of line(C-k)
delete previous char ( backspace)

Actual behavior

terminal loss focus

Additional information

found in

lua/core/mapping.lua (line 20-23)

["t|<C-h>"] = map_cmd("<Cmd>wincmd h<CR>"):with_silent():with_noremap():with_desc("window: Focus left"),
["t|<C-l>"] = map_cmd("<Cmd>wincmd l<CR>"):with_silent():with_noremap():with_desc("window: Focus right"),
["t|<C-j>"] = map_cmd("<Cmd>wincmd j<CR>"):with_silent():with_noremap():with_desc("window: Focus down"),
["t|<C-k>"] = map_cmd("<Cmd>wincmd k<CR>"):with_silent():with_noremap():with_desc("window: Focus up"),
@gxing gxing added the bug Something isn't working label Aug 24, 2023
@ayamir
Copy link
Owner

ayamir commented Aug 25, 2023

We defined Ctrl and h, j, k, and l to focus switch at lua/core/mapping.lua.
A common requirement is when you use C-\ or A-\ to open the horizontal or vertical terminal, you want to use the keyboard shortcut to switch to the code window and keep the terminal not hidden.
EDITED:
Pull the latest config first.
If you need the native bash shortcut, you can unset it by adding these lines to lua/user/keymap/core.lua.

return {
	["t|<C-k>"] = "",
}

Disable all of above mappings and define other suitable mappings for the focus switch behavior in lua/user/keymap/core.lua like <C-w> with h, j, l, and l like this:

local map_cmd = require("keymap.bind").map_cmd

return {
	["t|<C-h>"] = "",
	["t|<C-l>"] = "",
	["t|<C-j>"] = "",
	["t|<C-k>"] = "",
	["t|<C-w>k"] = map_cmd("<Cmd>wincmd k<CR>"):with_silent():with_noremap():with_desc("window: Focus up"),
	["t|<C-w>h"] = map_cmd("<Cmd>wincmd h<CR>"):with_silent():with_noremap():with_desc("window: Focus left"),
	["t|<C-w>l"] = map_cmd("<Cmd>wincmd l<CR>"):with_silent():with_noremap():with_desc("window: Focus right"),
	["t|<C-w>j"] = map_cmd("<Cmd>wincmd j<CR>"):with_silent():with_noremap():with_desc("window: Focus down"),
}

cc @gxing

@ayamir
Copy link
Owner

ayamir commented Aug 31, 2023

Close due to inactivity and being anwsered.

@ayamir ayamir closed this as completed Aug 31, 2023
@Jint-lzxy Jint-lzxy added the env Issues caused by incorrect environment settings (terminal, package manager, etc.) label Sep 3, 2023
@ayamir ayamir reopened this Oct 19, 2023
@ayamir ayamir linked a pull request Oct 19, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working env Issues caused by incorrect environment settings (terminal, package manager, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants