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

fix(split): no fold find if foldexpr setup #166

Merged
merged 1 commit into from
May 31, 2024
Merged
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
2 changes: 2 additions & 0 deletions lua/hurl/split.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ M.show = function(data, type)
-- After 200ms, the highlight will be applied
vim.defer_fn(function()
vim.bo[split.bufnr].filetype = type
-- recomputing foldlevel, this is needed if we setup foldexpr
vim.api.nvim_feedkeys('zx', 'n', true)
Comment on lines +60 to +61
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Consider adding a configuration option for the zx command.

The use of vim.api.nvim_feedkeys('zx', 'n', true) to recompute the fold level is a clever workaround, but it might have side effects depending on the user's configuration or other plugins. To avoid potential issues, consider adding a configuration option to enable or disable this behavior based on user preference.

Analysis chain

Ensure proper handling of zx command.

The use of vim.api.nvim_feedkeys('zx', 'n', true) to recompute the fold level is a clever workaround, but it might have side effects depending on the user's configuration or other plugins. Consider adding a check or configuration option to enable or disable this behavior based on user preference.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `zx` command is properly handled across different filetypes.

# Test: Search for issues related to `zx` command handling in different filetypes.
rg --type lua $'zx'

Length of output: 80



Script:

#!/bin/bash
# Description: Search for configurations or plugins related to fold settings and `foldexpr` in the codebase.

# Test: Search for fold settings in the codebase.
rg --type lua 'fold'

# Test: Search for foldexpr settings in the codebase.
rg --type lua 'foldexpr'

Length of output: 445

end, 200)

local function quit()
Expand Down
Loading