Allowing you to edit your command in the terminal just like any other buffer.
No more smashing left and right arrow when you make a typo.
You can now smash h
and l
instead ;).
i
, a
, A
, I
.d<motion>
, dd
, D
, x
.c<motion>
, cc
, C
, s
, S
.c
in visual mode.d
, x
in visual mode.p
P
"<register>p
"<register>P
r
in normal mode<C-i>
<C-p>
& <C-P>
Lazy.nvim:
{
'chomosuke/term-edit.nvim',
lazy = false, -- or ft = 'toggleterm' if you use toggleterm.nvim
version = '1.*',
}
Packer.nvim:
use { 'chomosuke/term-edit.nvim', tag = 'v1.*' }
vim-plug:
Plug 'chomosuke/term-edit.nvim', {'tag': 'v1.*'}
-- Calling require 'term-edit'.setup(opts) is mandatory
require 'term-edit'.setup {
-- Mandatory option:
-- Set this to a lua pattern that would match the end of your prompt.
-- Or a table of multiple lua patterns where at least one would match the
-- end of your prompt at any given time.
-- For most bash/zsh user this is '%$ '.
-- For most powershell/fish user this is '> '.
-- For most windows cmd user this is '>'.
prompt_end = '%$ ',
-- How to write lua patterns: https://www.lua.org/pil/20.2.html
}
This plugin should work out of the box with default settings.
local default_opts = {
-- Setting this true will enable printing debug information with print()
debug = false,
-- Number of event loops it takes for <Left>, <Right> or <BS> keys to change
-- the cursor's position.
-- If term-edit.nvim is unreliable, increasing this value could help.
-- Decreasing this value can increase the responsiveness of term-edit.nvim
feedkeys_delay = 10,
-- Use case 1: I want to press 'o' instead of 'i' to enter insert.
-- `mapping = { n --[[normal mode]] = { i = 'o' } }`
-- `vim.keymap.set('n', 'o', 'i', { remap = true })` will achieve the same
-- thing. (won't work without remap = true)
-- Use case 2: I want to map 'c' to 'd' and 'd' to 'c'
-- (keymap with remap is no longer an option)
-- `mapping = { n = { c = 'd', d = 'c' } }` (will also map 'cc' to 'dd'
-- and 'dd' to 'cc')
-- Use case 3: I already mapped s to something else and do not want
-- term-edit.nvim to override my mapping.
-- `mapping = { n = { s = false } }`
--
-- For more examples and detailed explaination, see :h term-edit.mapping
mapping = {
-- mode = {
-- lhs = new_lhs
-- }
},
-- Used to detect the start of the command
-- prompt_end = no default, this is mandatory
}
All PRs are welcome.