diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-01-13 18:54:05 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-01-13 18:54:05 +0200 |
| commit | 8f25e33d579f5d510495727b9f290d72733c4b85 (patch) | |
| tree | b8399cc191b1dc95967445d43bda5b33c4ee191e /internal/client/ui/viminput | |
| parent | ea579d00ef4f57a649370e2a87d3eb1848ae7fe0 (diff) | |
Implemented ctrl+a to select all in viminput and also a very scuffed
pasting from system clipboard in insert mode
Diffstat (limited to 'internal/client/ui/viminput')
| -rw-r--r-- | internal/client/ui/viminput/viminput.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/client/ui/viminput/viminput.go b/internal/client/ui/viminput/viminput.go index 86fcda6..7f1a248 100644 --- a/internal/client/ui/viminput/viminput.go +++ b/internal/client/ui/viminput/viminput.go @@ -5,6 +5,7 @@ import ( "strings" "unicode" + "github.com/atotto/clipboard" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" "github.com/kyren223/eko/internal/client/config" @@ -438,6 +439,13 @@ func (m *Model) handleNormalModeKeys(key tea.KeyMsg) { m.mode = VisualLineMode m.vline = m.cursorLine m.vcol = m.cursorColumn + case "ctrl+a": + m.mode = VisualLineMode + m.vline = 0 + m.vcol = 0 + m.SetCursorLine(len(m.lines) - 1) + line := m.lines[m.cursorLine] + m.SetCursorColumn(len(line) - 1) case "d": fallthrough @@ -609,6 +617,22 @@ func (m *Model) handleInsertModeKeys(key tea.KeyMsg) { return } + if key.Type == tea.KeyCtrlV { + clipboard, err := clipboard.ReadAll() + if err != nil { + return + } + paste := m.Paste() + m.Yank(clipboard) + m.handleNormalModeKeys(tea.KeyMsg{ + Type: tea.KeyRunes, + Runes: []rune{'P'}, + Alt: false, + Paste: false, + }) + m.Yank(paste) + } + if key.Type == tea.KeyTab || key.Type == tea.KeyShiftTab { conf := config.Read() var runes []rune |
