8000 Respect original `bra` and `ket` when changing function · Issue #171 · machakann/vim-sandwich · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Respect original bra and ket when changing function #171

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

Open
YuruiHong opened this issue Feb 5, 2024 · 0 comments
Open

Respect original bra and ket when changing function #171

YuruiHong opened this issue Feb 5, 2024 · 0 comments

Comments

@YuruiHong
Copy link

I personally prefer the vim-surround grammar. When using csff<function name> to change a function name for a language that does not use () for functions, e.g. Mathematica using [], my configuration is like:

augroup sandwich-ft-mma
  autocmd BufRead,BufNewFile *.wl let b:sandwich_magicchar_f_patterns = [
                              \   {
                              \     'header' : '\<\%(\h\k*\.\)*\h\k*',
                              \     'bra'    : '\[',
                              \     'ket'    : '\]',
                              \     'footer' : '',
                              \   },
                              \ ]
augroup END

For the function below:

f[x_] := x^2

When my cursor is in the brackets, dsf can successfully delete the function to make it x_. However, when I tried to rename f to g using csffg, the result was:

g(x_) := x^2

It seems the [] brackets matched by bra and ket patterns were ignored in the final output, and the behavior of csff always assumes () are used for function calls. I wonder if it's better to respect the original surrounding characters.

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

No branches or pull requests

1 participant
0