Skip to content

feat: add im-select.nvim with terminal-compatible config#20

Merged
Clsan merged 4 commits into
masterfrom
feat/im-select-nvim
Jun 18, 2026
Merged

feat: add im-select.nvim with terminal-compatible config#20
Clsan merged 4 commits into
masterfrom
feat/im-select-nvim

Conversation

@Clsan

@Clsan Clsan commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • common.sh: add brew_tap_and_install helper for tapped formulae
  • nvim_setup.sh:
    • Install im-select via daipeihust/tap
    • Deploy im-select.lua plugin spec (same copy-if-missing pattern as avante)
    • Idempotently append double-Esc → normal mode keymap to keymaps.lua via append_line_if_missing
  • nvim/lua/plugins/im-select.lua: new plugin spec
    • Switches IM to ABC on InsertLeave, CmdlineLeave, TermLeave
    • TermLeave ensures IM switches correctly when exiting both snacks terminal and raw :terminal buffers
    • set_previous_events = {} prevents Korean IME from being restored inside terminal buffers (which caused Escape to be intercepted by the IME)

Test plan

  • Run nvim_setup.sh on a fresh machine — im-select installed and configured
  • Re-run nvim_setup.sh — no duplicates, all steps skipped idempotently
  • In nvim, leave insert mode with Korean active → IM switches to ABC
  • Open snacks terminal (<leader>ft), double-Esc → Normal mode, IM → ABC
  • Open raw terminal (:vsplit | terminal), double-Esc → Normal mode, IM → ABC

🤖 Generated with Claude Code

Clsan and others added 4 commits June 18, 2026 10:35
Add im-select.nvim plugin to automatically switch input method to English when leaving insert mode and restore previous input method when entering insert mode.

Changes:
- Add nvim/lua/plugins/im-select.lua configuration
- Install im-select via Homebrew in nvim_setup.sh
- Deploy im-select.lua to ~/.config/nvim/lua/plugins/ during setup
- Support all input methods (Korean, Japanese, Chinese, etc.)

The plugin automatically detects and handles any non-English input method, switching to English (com.apple.keylayout.ABC) in normal mode and restoring the previous input method in insert mode.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
im-select is not available in the main Homebrew repository. It requires tapping daipeihust/tap first.

Changes:
- Replace direct brew_install with explicit tap + trust + install sequence
- Add idempotency check with command -v im-select
- Handle trust requirement for third-party tap

Verified idempotent: running the script multiple times shows "im-select already installed" without attempting reinstallation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Extract the tap + trust + install pattern into a reusable helper function in common.sh, similar to brew_install and brew_install_cask.

Changes:
- Add brew_tap_and_install(tap, formula) helper to common.sh
- Simplify nvim_setup.sh to use one-line brew_tap_and_install call
- Maintain idempotency with command -v check inside the helper

This makes it easier to install formulae from third-party taps in the future.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Simplify im-select events: remove FocusGained/VimEnter (caused timing
  issues with snacks terminal double-Esc), remove set_previous_events
- Add TermLeave to set_default_events so IM switches to ABC when leaving
  any terminal buffer (raw :terminal or snacks terminal)
- Add idempotent keymaps.lua setup in nvim_setup.sh: appends double-Esc
  → <C-\><C-N> keymap for raw :terminal buffers via append_line_if_missing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Clsan Clsan changed the title feat: add im-select.nvim for automatic input source switching feat: add im-select.nvim with terminal-compatible config Jun 18, 2026
@Clsan Clsan merged commit cfb401a into master Jun 18, 2026
3 checks passed
@Clsan Clsan deleted the feat/im-select-nvim branch June 18, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant