Sunday, March 13, 2016

Re: How can I delete all the ; in column mode? or how can I alignment the semicolons ?

On 2016-03-13, Yang Luo wrote:
> input i_start_addr ;
> input num_pad_y ;
> input i_en ;
> input i_sram_ren0 ;
> input i_sram_raddr0 ;
> input i_wdata0 ;
> input i_sram_ren1 ;
> input i_sram_raddr1 ;
> input i_wdata1 ;
> input i_sram_ren2 ;
> input i_sram_raddr2 ;
> input i_wdata2 ;
> input i_sram_ren3 ;
> input i_sram_raddr3 ;
> input i_wdata3 ;
> input i_sram_ren4 ;
> input i_sram_raddr4 ;
> input i_wdata4 ;
> input i_sram_ren5 ;
> input i_sram_raddr5 ;
> input i_wdata5 ;
> output o_ready ;

I'm not sure what you mean by "column mode", but you can delete all
the semicolons in a particular column by moving the cursor to that
column, typing Ctrl-V to start a visual block mode selection, then
moving the cursor down to select the desired rows, and finally
typing d or x to delete that column.

See

:help CTRL-V
:help 04.4
:help 10.5

For aligning text, I would recommend Dr. Chip's Align plugin, which
you can find at this page: http://www.drchip.org/astronaut/vim/align.html

For example, visually selecting all the lines of your example and
typing

\tsp

will align the columns on spaces with the following result.

input i_start_addr ;
input num_pad_y ;
input i_en ;
input i_sram_ren0 ;
input i_sram_raddr0 ;
input i_wdata0 ;
input i_sram_ren1 ;
input i_sram_raddr1 ;
input i_wdata1 ;
input i_sram_ren2 ;
input i_sram_raddr2 ;
input i_wdata2 ;
input i_sram_ren3 ;
input i_sram_raddr3 ;
input i_wdata3 ;
input i_sram_ren4 ;
input i_sram_raddr4 ;
input i_wdata4 ;
input i_sram_ren5 ;
input i_sram_raddr5 ;
input i_wdata5 ;
output o_ready ;

You can adjust various parameters of the Align plugin to get just
the results you want. I usually start with one of the few Align
commands I know, then use the visual block selection mode discussed
above to tweak the result.

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: