Skip to content

Remote session#67

Merged
inhesrom merged 10 commits into
masterfrom
remote-session
Feb 23, 2026
Merged

Remote session#67
inhesrom merged 10 commits into
masterfrom
remote-session

Conversation

@inhesrom
Copy link
Copy Markdown
Owner

This pull request introduces significant improvements to window and buffer management for remote file operations and adds a new user command interface for remote session control. The changes enhance robustness by properly handling floating and terminal windows, normalizing buffer positions, and integrating session management for buffers and tree browser state. Additionally, the new commands provide a comprehensive CLI for managing remote sessions.

Window and buffer suitability improvements:

  • Improved exclusion logic for floating windows, terminal infrastructure windows, and special buffers in simple_open_remote_file and tree browser file opening, ensuring files are only opened in appropriate windows. [1] [2] [3] [4]
  • Added normalization for buffer position input, supporting both Vim and LSP formats, and improved boundary validation for line and column values. [1] [2]
  • Enhanced logic for handling the last window when hiding the tree browser to prevent errors, replacing the buffer instead of closing the window if it's the last one.

Session management integration:

  • Registered buffers with the active session and added cleanup logic to remove buffers from all sessions on wipeout, improving session tracking and resource management.
  • Added API functions to the tree browser for getting and restoring expanded directory state, cursor position, base URL, and window ID, supporting session persistence and restoration.

Remote session command interface:

  • Introduced lua/remote-session/commands.lua with user commands for session operations: open, close, minimize, rename, list, picker, and restore, including completion and error handling for improved user experience.

inhesrom and others added 6 commits February 1, 2026 23:12
Prevent files from opening in terminal picker/terminal windows by validating
cached window IDs before reuse. Added is_file_window_suitable() helper that
checks for valid window type, excludes floating windows, and explicitly
excludes terminal infrastructure windows.

The cached file_win_id is now revalidated on every use to ensure it remains
suitable for opening files, fixing the issue where terminals opened in a
previously cached window would incorrectly receive file buffers.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 23, 2026 04:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces a comprehensive remote session management system that unifies file browsing, terminal management, and workspace state persistence. The changes enable users to work with multiple remote connections simultaneously, minimize/restore entire working sessions with their window layouts, and persist session state across Neovim restarts.

Changes:

  • Enhanced window and buffer management to properly exclude floating windows, terminal infrastructure windows, and special buffers when opening remote files
  • Added session association tracking between terminals and remote sessions with filtering in the picker UI
  • Introduced a complete remote-session module with session lifecycle management, persistence, UI picker, statusline integration, and user commands

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
lua/remote-terminal/window_manager.lua Added safe window hiding logic to handle last-window edge case
lua/remote-terminal/terminal_session.lua Improved terminal creation using nvim_buf_call and enhanced close logic to prevent layout corruption
lua/remote-terminal/terminal_manager.lua Added session association tracking and management functions
lua/remote-terminal/picker.lua Implemented session-based terminal filtering
lua/remote-terminal/init.lua Added WinClosed autocmd for detecting externally closed windows
lua/remote-ssh.lua Integrated remote-session setup
lua/remote-session/window_layout.lua New module for capturing and restoring window layouts
lua/remote-session/statusline.lua New module providing statusline components for session display
lua/remote-session/session_manager.lua New core state management module for active/minimized sessions
lua/remote-session/session.lua New module handling session lifecycle operations (create, minimize, restore, close)
lua/remote-session/picker.lua New floating window UI for session selection and management
lua/remote-session/persistence.lua New module for JSON-based session persistence
lua/remote-session/naming.lua New module for auto-generating and validating session names
lua/remote-session/init.lua New public API for the remote-session module
lua/remote-session/config.lua New configuration system with defaults for session behavior
lua/remote-session/commands.lua New user commands for session operations
lua/async-remote-write/tree_browser.lua Enhanced window suitability checks and added session state API functions
lua/async-remote-write/operations.lua Improved window exclusion logic, position normalization, and buffer-session registration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/remote-terminal/terminal_session.lua
Comment thread lua/remote-terminal/terminal_session.lua
Comment thread lua/remote-session/session_manager.lua
Comment thread lua/remote-session/session_manager.lua
Comment thread lua/remote-session/session.lua
Comment thread lua/remote-session/session.lua Outdated
Comment thread lua/remote-session/session.lua Outdated
Comment thread lua/async-remote-write/tree_browser.lua
Comment thread lua/remote-session/session.lua
Comment thread lua/remote-session/naming.lua
inhesrom and others added 3 commits February 22, 2026 22:22
Remove unused `original_state` variable, deduplicate regex match for
host parsing, remove dead legacy `restore_buffer_states` function, and
document `session_buffers` field in RemoteSession class annotation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document the complete remote-session feature introduced in PR #67:
quick start step, features bullet, configuration block, dedicated
usage section with picker keybinds and statusline integration, and
all 7 commands in the commands table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@inhesrom inhesrom merged commit b0fc5c8 into master Feb 23, 2026
2 checks passed
@inhesrom inhesrom deleted the remote-session branch February 23, 2026 05:44
@inhesrom inhesrom mentioned this pull request Feb 28, 2026
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.

2 participants