wincent / scalpel

🔪 Fast within-file word replacement for Vim
MIT License
118 stars 4 forks source link

Issue with substitution in visual mode #8

Closed narcisse81 closed 6 years ago

narcisse81 commented 6 years ago

Hello,

I'm back with a new corner case: In my VHDL code, I select the code below (visual selection): dio_dig: inout slv4

Then I call scalpel (in visual mode, of course), and I've got the following error message: =scalpel#cword(60_GetCurpos()) E121: Undefined variable: l:col: E15: Invalid expression: l:chars[l:col:] :'<,'>S/\v<-1

Best regards Stephane

wincent commented 6 years ago

@narcisse81: I tried to repro this one and I couldn't. Where is the cursor when you invoke Scalpel, and what is the exact range of the visual selection? Also, what version of Vim are you using?

narcisse81 commented 6 years ago

Hi Greg,

Please find below an excerpt of my VHDL code :

-- register field setting of dig_fe
procedure set_digfe_Bw(signal spi_in: out spi_in_type; signal spi_out: in spi_out_type; signal dio_dig: inout slv12; bw_mant: integer; bw_expo: integer);
-- procedure set_digfe_DccEn(signal spi_in: out spi_in_type; signal spi_out: in spi_out_type; signal dio_dig: inout slv4; dcc_en: std_logic);

I start my visual selection by clicking on the 1st letter (d) of dio_dig, then I enter the visual mode: veeee This select "dio_dig: inout slv12" Then I call the scalpel command with \<mapleader>s

Here is my scalpel config in .vimrc: nmap \<Leader>s \<Plug>(Scalpel) vmap \<Leader>s \<Plug>(ScalpelVisual) let g:ScalpelCommand='S'

My version of gvim is 7.4.629 I have the same issue at home and at the office.

Best regards Stephane

wincent commented 6 years ago

Thanks @narcisse81. That's helpful. Looks like a Vim 7.x thing. I'll see if I can get an older version installed so that I can repro this and find a way to make the implementation behave on 7.4.

wincent commented 6 years ago

Good news. I was able to build v7.4.629 from source with a simple make (pleasing that it would work without any issues, since that version is about 3.5 years old now), and I'm able to repro.

wincent commented 6 years ago

Should be fixed in v0.5. Thanks for the report!