Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: generated vimdoc #106

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions doc/smart-splits.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*smart-splits.txt* Last change: 2023 April 30
*smart-splits.txt* Last change: 2023 May 02

==============================================================================
Table of Contents *smart-splits-table-of-contents*
Expand Down Expand Up @@ -27,6 +27,8 @@ panes. See Multiplexer Integrations <#multiplexer-integrations>.
demo
<https://user-images.githubusercontent.com/8648891/201928611-4338e3cb-cca9-4e15-92c6-0405b7072279.gif>

**Table of Contents**

- Install <#install>
- Configuration <#configuration> - Hooks <#hooks> - Examples: <#examples>
- Usage <#usage> - Multiplexer Integrations <#multiplexer-integrations> - Tmux
Expand Down Expand Up @@ -365,10 +367,11 @@ file (customizing the keys and resize amount if desired):

WEZTERM *smart-splits-wezterm*

**Note** If you are experiencing performance issues with circular navigation,
they are solved by wez/wezterm@96f1585
<https://github.com/wez/wezterm/commit/96f1585b103162b042e2593567884dfcbe32ca21>,
so try using Wezterm nightly for now.
**Note** It is recommended _not to lazy load_ `smart-splits.nvim` if using the
Wezterm integration. If you need to lazy load, you need to use a different
`is_vim()` implementation below. The plugin is small, and smart about not
loading modules unnecessarily, so it should have minimal impact on your
startup time. It adds about 0.07ms on my setup.

**Note** This won't work if the pane is connected over SSH, as the pane will
not properly report the foreground process name.
Expand All @@ -378,15 +381,23 @@ Add the following snippet to your `~/.config/wezterm/wezterm.lua`:
>lua
local w = require('wezterm')

-- Equivalent to POSIX basename(3)
-- Given "/foo/bar" returns "bar"
-- Given "c:\\foo\\bar" returns "bar"
local function basename(s)
return string.gsub(s, '(.*[/\\])(.*)', '%2')
-- if you are *NOT* lazy-loading smart-splits.nvim (recommended)
local function is_vim(pane)
-- this is set by the plugin, and unset on ExitPre in Neovim
return pane:get_user_vars().IS_NVIM == 'true'
end

-- if you *ARE* lazy-loading smart-splits.nvim (not recommended)
-- you have to use this instead, but note that this will not work
-- in all cases (e.g. over an SSH connection). Also note that
-- `pane:get_foreground_process_name()` can have high and highly variable
-- latency, so the other implementation of `is_vim()` will be more
-- performant as well.
local function is_vim(pane)
local process_name = basename(pane:get_foreground_process_name())
-- This gsub is equivalent to POSIX basename(3)
-- Given "/foo/bar" returns "bar"
-- Given "c:\\foo\\bar" returns "bar"
local process_name = string.gsub(pane:get_foreground_process_name(), '(.*[/\\])(.*)', '%2')
return process_name == 'nvim' or process_name == 'vim'
end

Expand Down
2 changes: 2 additions & 0 deletions doc/tags
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ARE smart-splits.txt /*ARE*
NOT smart-splits.txt /*NOT*
screen smart-splits.txt /*screen*
smart-splits-configuration smart-splits.txt /*smart-splits-configuration*
smart-splits-credits smart-splits.txt /*smart-splits-credits*
Expand Down