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

Visual select block does not work with astrovim's default config #300

Open
sash-a opened this issue Aug 15, 2022 · 3 comments
Open

Visual select block does not work with astrovim's default config #300

sash-a opened this issue Aug 15, 2022 · 3 comments

Comments

@sash-a
Copy link

sash-a commented Aug 15, 2022

Hi there, this could absolutely be because I'm a complete vim noob, but vaj does not seem to be working correctly for me.
Given this example:

module Test

greet() = print("Hello World!")

for i in 1:100
   nothing
end

end # module

If I put my cursor at the start of the for loop and type vaj it only selects the end at the end of the loop instead of the whole loop, so vaj y p would just paste end instead of the whole for loop block.

Using nvim 0.7.3 with astro nvim's config, julia-vim is the only other custom plugin I am using other than adding the julia ls (not sure if that counts as a plugin). Also on Pop!_OS if that helps.

@Hneuschmidt
Copy link

I have this same problem with my config (not using astrovim).
The other movement commands also do not work (reliably), especially using % does not work at all.

:echo JuliaGetMatchWords()
always returns \<\>:\<\> which is not correct I assume.

@Hneuschmidt
Copy link

Hneuschmidt commented Dec 7, 2022

Okay I did some more digging.
The issue stems from me (and AstroVim) using Treesitter for syntax highlighting.

The filetype plugin from julia-vim relies on synID()
in line 58:
let attr = synIDattr(synID(l, c, 1),"name").

However, when using treesitter for syntax highlighting, synID() always returns 0
which breaks the rest of the JuliaGetMatchWords() function.

In case you (@sash-a) haven't found some other solution, you can make the navigation commands work by disabling treesitter for julia files.

You can do that like this:

require"nvim-treesitter.configs".setup({ ignore_install = {"julia"} }),

in your treesitter configuration and then uninstalling the TS parser for julia:

:TSUninstall julia

It would be nice if there was a way to use julia specific navigation while also using treesitter, but disabling it resolves the problem as a workaround.

@ArbitRandomUser
Copy link

i seem to run into this behaviour without Treesitter installed ,
i can confirm that my juliagetmatchwords returns

\%(\%(\%(@\%([#(]\@!\S\)\+\|\<\%(local\|global\)\)\s\+\)\@<!\%(\%(@\%([#(]\@!\S\)\+\|\<\%(local\|global\)\)\s\+\)\+\%(\.\s*\|@\)\@<!\<\%(function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|let\|do\|\%(bare\)\?module\|quot
e\|if\|for\|while\|try\)\>\)\|\%(\%(\%(@\%([#(]\@!\S\)\+\|\<\%(local\|global\)\)\s\+\)\@<!\%(\.\s*\|@\)\@<!\<\%(function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|let\|do\|\%(bare\)\?module\|quote\|if\|for\|while\|try\)\
>\):\<end\> 

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

3 participants