diff --git a/README.md b/README.md index 6171146..b030f01 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ See the [ubuntu-server README](ubuntu-server/README.md) for details on the Nix c - Shared configuration modules to eliminate duplication - POSIX-compliant environment setup across all shells - macOS login shell compatibility + - [inshellisense](https://github.com/microsoft/inshellisense) IDE-style inline autocomplete across all three shells (skipped in editor terminals; see [shell README](shared/.config/shell/README.md#inshellisense-ide-style-autocomplete)) - **✏️ Editors**: - **Neovim (Kickstart)** - Default, mapped to `nvim`/`vim` commands - **Neovim (AstroVim)** - Available via `astrovim` alias diff --git a/shared/.bashrc b/shared/.bashrc index 49b2417..8076aa5 100644 --- a/shared/.bashrc +++ b/shared/.bashrc @@ -66,3 +66,9 @@ for config_file in "$HOME/.bashrc.d/"*.sh; do done eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv bash)" + +# inshellisense autocomplete — MUST be the last command (it wraps the shell in a +# child session; keep new startup logic above this). Setup: .config/shell/README.md +if [ -f "$HOME/.inshellisense/init/bash/init.sh" ] && ! is_integrated_terminal; then + . "$HOME/.inshellisense/init/bash/init.sh" +fi diff --git a/shared/.config/fish/README.md b/shared/.config/fish/README.md index 8bc4bf8..cb00b4a 100644 --- a/shared/.config/fish/README.md +++ b/shared/.config/fish/README.md @@ -77,6 +77,7 @@ fisher update - **fzf** - Fuzzy finder - **zoxide** - Smart directory navigation - **fisher** - Plugin manager +- **inshellisense** (`is`) - IDE-style inline autocomplete (optional; run `is init fish` to enable) ## Usage diff --git a/shared/.config/fish/config.fish b/shared/.config/fish/config.fish index 19a98cf..c97d897 100644 --- a/shared/.config/fish/config.fish +++ b/shared/.config/fish/config.fish @@ -42,3 +42,9 @@ for config_file in ~/.config/fish/config.*.fish source $config_file end end + +# inshellisense autocomplete — MUST be the last command (it wraps the shell in a +# child session; keep new startup logic above this). Setup: .config/shell/README.md +if status is-interactive; and test -f ~/.inshellisense/init/fish/init.fish; and not is_integrated_terminal + source ~/.inshellisense/init/fish/init.fish +end diff --git a/shared/.config/nix-darwin/README.md b/shared/.config/nix-darwin/README.md index 77aecc6..141fd09 100644 --- a/shared/.config/nix-darwin/README.md +++ b/shared/.config/nix-darwin/README.md @@ -41,7 +41,7 @@ This configuration manages macOS systems declaratively using Nix, providing: ### Nix Packages (System-wide) - **Development**: `neovim`, `gh`, `lazygit`, `ripgrep`, `fd` -- **Shell**: `fish`, `zellij`, `tmux`, `fzf`, `zoxide`, `atuin` +- **Shell**: `fish`, `zellij`, `tmux`, `fzf`, `zoxide`, `atuin`, `inshellisense` - **Tools**: `stow`, `oh-my-posh`, `volta`, `asdf-vm` - **AI**: `claude-code`, `codex` diff --git a/shared/.config/nix-darwin/darwin.nix b/shared/.config/nix-darwin/darwin.nix index 81efd84..0e8ea53 100644 --- a/shared/.config/nix-darwin/darwin.nix +++ b/shared/.config/nix-darwin/darwin.nix @@ -42,6 +42,7 @@ git gofumpt gum + inshellisense lazygit neovim nil diff --git a/shared/.config/shell/README.md b/shared/.config/shell/README.md index f619125..bfc1309 100644 --- a/shared/.config/shell/README.md +++ b/shared/.config/shell/README.md @@ -101,6 +101,47 @@ The `shared/` profile establishes each `.d/` directory (with a `.gitkeep`). The This complements the existing `.config/shell/` pattern (`aliases.*.sh`, `exports.*.sh`, `functions.*.sh`) for cases where profile-specific logic needs to live in the root init files rather than the shared shell config directory. +## inshellisense (IDE-style autocomplete) + +[inshellisense](https://github.com/microsoft/inshellisense) provides fig-like, +IDE-style inline command autocompletion for all three shells. It works by +auto-starting a session that *wraps* the interactive shell, so the integration +has a few non-obvious requirements that are baked into this repo: + +- **Must be the last command.** The source line is appended to the very end of + `.bashrc`, `.zshrc`, and `fish/config.fish` (after the profile `.d/` and + `config.*.fish` loops). inshellisense recurses into a child shell guarded by + the `ISTERM` env var, so anything after it in the rc file would not run in the + outer shell. If you add new startup logic, keep it *above* this block. +- **Skipped in IDE/editor terminals.** The block is gated behind + `is_integrated_terminal`, mirroring `auto_start_tmux`, so it stays out of + VS Code / Neovim / Emacs / Zed terminals where a nested PTY is unwanted. +- **No-op until provisioned.** Each shell sources + `~/.inshellisense/init//init.` only if that file exists. The file + is created by `is init` (see below), so shells on un-provisioned machines and + the non-interactive CI startup-time harness are unaffected. + +### Installing / enabling + +The `is` binary is declared for macOS in +`shared/.config/nix-darwin/darwin.nix` (`environment.systemPackages`). On +Ubuntu / remote sandboxes install it via npm: + +```sh +npm install -g @microsoft/inshellisense +``` + +Then generate the per-shell init files once (regenerate after upgrades): + +```sh +is init # detects the current shell, or pass bash|zsh|fish +``` + +`is init` writes `~/.inshellisense/init//init.`, which the rc files +already source. No changes to the rc files themselves are needed — do **not** +run `is init >> ~/.rc` (the upstream instructions), as that would +duplicate the source line this repo already manages. Run `is doctor` to verify. + ## Benefits 1. **No duplication**: Shared configuration is centralized diff --git a/shared/.zshrc b/shared/.zshrc index 3098534..245b1a6 100644 --- a/shared/.zshrc +++ b/shared/.zshrc @@ -204,3 +204,9 @@ for config_file in "$HOME/.zshrc.d/"*.sh; do . "$config_file" fi done + +# inshellisense autocomplete — MUST be the last command (it wraps the shell in a +# child session; keep new startup logic above this). Setup: .config/shell/README.md +if [[ -f "$HOME/.inshellisense/init/zsh/init.zsh" ]] && ! is_integrated_terminal; then + . "$HOME/.inshellisense/init/zsh/init.zsh" +fi