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

columns width behaviours an others tests #41

Open
solyarisoftware opened this issue Jan 22, 2015 · 9 comments
Open

columns width behaviours an others tests #41

solyarisoftware opened this issue Jan 22, 2015 · 9 comments

Comments

@solyarisoftware
Copy link

Hi Christian,

here below I submit some screenshots to show some minor points/possible small issues:

column widths (collpase feature)

see:
default_width

ArrangeColumn do great job here!
Nevertheless a possible useful feature could be to have a width collapse to show the minimum-necessary spaces, in the screen above there are many spaces between a column and another, that's clear but minimize the number of columns in view. Maybe a "Collapse" flag (why not a optional paremeter of ArrangeColumn command?) could help to set in view the max number of columns avoiding much panning (in case of many columns)... it's just a feature
(BTW I tested Fixed columns feature but I had no success, myabe I didn't well understood behaviour).

To be fully clear, now is like that:

TITLE OF COLUMN 1 | LONG TITLE OF COLUMN 2 | ...
             1890 |                   alfa | ...
             1894 |                   beta | ...
             1890 |                  gamma | ...

visualization proposed as optional ("ArrangeColumn collapse"):

    MN 1 |   LUMN 2 | ...
    1890 |     alfa | ...
    1894 |     beta | ...
    1890 |    gamma | ...

Setting vim numbering

If I set numbering on a CVV file, : set nu I got this:

Inumbering

so the header become dis-aligned. Minor point. if I reset vim numbering, all back correct:

Inumbering

ArrangeColumn does not fix sometime

Here below I edited line 11381 changing a filed in column 3 with vi command cwgiorgioybr01 and I got this:

Ino_arrange

strangely neither ArrangeColumn or %ArrangeColumn correct visualization.

CSVTable

if I run: :CSVTable

it seem that Header is not keep inside:
Table

Searching

Searching inside an (highlihghted) column is a great feature!
I experienced sometime that is printed sort of vimscript in last vim line.
just a bit confusing at first glance, but it's real a minor point :-)

Search

Sorry for my "picky" notes, is just to reward your great work on csv.vim!

respect
giorgio

@chrisbra
Copy link
Owner

Hi Giorgio!

Okay, let me see, what I can do here for you.

On Do, 22 Jan 2015, Giorgio Robino wrote:

Hi Christian,

here below I submit some screenshots to show some minor points/possible small issues:

column widths (collpase feature)

see:
default_width

ArrangeColumn do great job here, nevertheless a possible useful feature could be to have a width collapse to show the minimum-necessary spaces, in the screen above there are many spaces between a column and another, that's clear but minimize the number of columns in view. Maybe a "Collapse-Column could help to set in view the max number of columns avoiding panning... just a feature (BTW I tested Fixed columns feature but I had no success).

To be fully clear:

now:

TITLE OF COLUMN 1 | LONG TITLE OF COLUMN 2 | ...
1890 | alfa | ... 1894 | beta | ... 1890 | gamma | ...

visualization proposed (Column Collapse):
`
MN 1 | LUMN 2 | ...
1890 | alfa | ...
1894 | beta | ...
1890 | gamma | ...

Should that only apply to the heading? Perhaps I can conceal the header
to a fixed width... I need to think about that.

Setting vim numbering

If I set numbering on a CVV file,

: set nu

I got this:

Inumbering

so the header become dis-aligned

if I reset vim numbering, all back correct:

Inumbering

Okay, I can only workaround the issue, since there is no autocommand for
setting some options or changing the appearance of windows, I can only
hook into CursorHold autocommand to adjust for changes of the numbering
option. That has the drawback, that you have to wait for some seconds
until this is corrected, but other than that, it should work and that is
how I have implemented it now.

ArrangeColumn does not fix sometime maybe:

Here below I edited line 11381 changing a filed in column 3 with vi command
cwgiorgioybr01 and I got this:

Inumbering

strangely neither ArrangeColumn or %ArrangeColumn correct visualization.

You need :%ArrangeColumn! (only when the '!' is used, the width will be
newly calculated, otherwise it uses the cached values to be a little bit
faster).

CSVTable

if I run
:CSVTable
it seem that Header is not keep inside:
Table

Was there an empty newline after the header? By default using :CSVTable
without a range, it will try to guess the region and if there is an
empty line, it will guess wrong.

Try visually selecting the region and then use :Table, so that it looks
like this :'<,'>CSVTable
This should adjust the borders correctly.

Searching

Searching inside an (highlihghted) column is a great feature!
I experienced sometime that is printed sort of vimscript in last vim line.
just a bit confusing at first glance, but it's real a minor point :-)

Search

What you are seeing here, is the regular expression that is generated to
search within that particular column. I have fixed that now, so it will
not be displayed anymore.

Thanks for the feedback!

Best,

Christian

Wenn ein Politiker stirbt, kommen viele zur Beerdigung nur deshalb, um
sicher zu sein, daß man ihn wirklich begräbt.
-- Georges Clemenceau

@solyarisoftware
Copy link
Author

visualization proposed (Column Collapse):

Should that only apply to the heading? Perhaps I can conceal the header to a fixed width... I need to >think about that.

what I mean is reduce automatically the column width to a MINIMUM fxed size for each column, truncating eventually the header line in compliance, for example in this case:

instead of this (as now behave):

  long header title 1 | long header title 2  | ...
                 1900 |                 2001 | ...
                 1901 |                 2002 | ...
                 1902 |                 2003 | ...
                 1903 |                 2004 | ...

optionally having this:

   le 1 | le 2 | ...
   -----------------
   1900 | 2001 | ...
   1901 | 2002 | ...
   1902 | 2003 | ...
   1903 | 2004 | ...

Okay, I can only workaround the issue, since there is no autocommand for setting some options or >changing the appearance of windows, I can only hook into CursorHold autocommand to adjust for >changes of the numbering option. That has the drawback, that you have to wait for some seconds >until this is corrected, but other than that, it should work and that is how I have implemented it now.

no problems. In facts setting line (= rows) numbers with :set nu is a plus, and the row line appear in the standard vim bottom line..

You need :%ArrangeColumn! (only when the '!' is used, the width will be newly calculated, >otherwise it uses the cached values to be a little bit faster).

I see, Ok!

CSVTable / CSVTabularize

Let consider this file:

$ cat TeamsHalf.csv | more
yearID,lgID,teamID,Half,divID,DivWin,Rank,G,W,L
1981,NL,ATL,1,W,N,4,54,25,29
1981,NL,ATL,2,W,N,5,52,25,27
1981,AL,BAL,1,E,N,2,54,31,23
1981,AL,BAL,2,E,N,4,51,28,23
1981,AL,BOS,1,E,N,5,56,30,26
1981,AL,BOS,2,E,N,2,52,29,23
1981,AL,CAL,1,W,N,4,60,31,29
1981,AL,CAL,2,W,N,6,50,20,30
1981,AL,CHA,1,W,N,3,53,31,22
1981,AL,CHA,2,W,N,6,53,23,30
1981,NL,CHN,1,E,N,6,52,15,37
1981,NL,CHN,2,E,N,5,51,23,28
1981,NL,CIN,1,W,N,2,56,35,21
1981,NL,CIN,2,W,N,2,52,31,21
1981,AL,CLE,1,E,N,6,50,26,24
1981,AL,CLE,2,E,N,5,53,26,27
1981,AL,DET,1,E,N,4,57,31,26
1981,AL,DET,2,E,N,2,52,29,23
1981,NL,HOU,1,W,N,3,57,28,29
1981,NL,HOU,2,W,N,1,53,33,20
1981,AL,KCA,1,W,N,5,50,20,30
1981,AL,KCA,2,W,N,1,53,30,23
1981,NL,LAN,1,W,N,1,57,36,21
1981,NL,LAN,2,W,N,4,53,27,26
1981,AL,MIN,1,W,N,7,56,17,39
1981,AL,MIN,2,W,N,4,53,24,29
1981,AL,ML4,1,E,N,3,56,31,25
1981,AL,ML4,2,E,N,1,53,31,22
1981,NL,MON,1,E,N,3,55,30,25
1981,NL,MON,2,E,N,1,53,30,23
1981,AL,NYA,1,E,N,1,56,34,22
1981,AL,NYA,2,E,N,5,51,25,26
1981,NL,NYN,1,E,N,5,51,17,34
1981,NL,NYN,2,E,N,4,52,24,28
1981,AL,OAK,1,W,N,1,60,37,23
1981,AL,OAK,2,W,N,2,49,27,22
1981,NL,PHI,1,E,N,1,55,34,21
1981,NL,PHI,2,E,N,3,52,25,27
1981,NL,PIT,1,E,N,4,48,25,23
1981,NL,PIT,2,E,N,6,54,21,33
1981,NL,SDN,1,W,N,6,56,23,33
1981,NL,SDN,2,W,N,6,54,18,36
1981,AL,SEA,1,W,N,6,57,21,36
1981,AL,SEA,2,W,N,5,52,23,29
1981,NL,SFN,1,W,N,5,59,27,32
1981,NL,SFN,2,W,N,3,52,29,23
1981,NL,SLN,1,E,N,2,50,30,20
1981,NL,SLN,2,E,N,2,52,29,23
1981,AL,TEX,1,W,N,2,55,33,22
1981,AL,TEX,2,W,N,3,50,24,26
1981,AL,TOR,1,E,N,7,58,16,42
1981,AL,TOR,2,E,N,6,48,21,27

plugin seem to detect perfectly:

teams

if i now run

:%CSVTable

I got:
teams

now, if I Undo and I run:

:%CSVTabularize

I got:
teams

and strangely, if i do

vi TeamsHalf.csv
:%CSVTabularize

I got
teams

thanks for you patience
giorgio

@chrisbra
Copy link
Owner

chrisbra commented Feb 4, 2015

The Table command should be fixed now. I leave the issue still open for the collapse feature

@jubilatious1
Copy link

Hi just a thought here on correcting the header misalignment when doing :set nu.

Instead of using the CursorHold autocommand, would using either the FocusLost/FocusGained autocommand pair, or the VimResized autocommand work? When a misalignment is noted, the user could then click away to another window (or desktop) in the first case, or in the second case change the window size slightly. Might be faster than CursorHold. Just a thought.

Thanks for this plugin, and keep up the great work!!

@chrisbra
Copy link
Owner

Hi jubilatious1!

On Fr, 18 Dez 2015, jubilatious1 wrote:

Hi just a thought here on correcting the header misalignment when doing :set nu.

Instead of using the CursorHold autocommand, would using either the FocusLost/FocusGained autocommand pair, or the VimResized autocommand work? When a misalignment is noted, the user could then click away to another window (or desktop) in the first case, or in the second case change the window size slightly. Might be faster than CursorHold. Just a thought.

Thanks for this plugin, and keep up the great work!!

You mean for the header command? Did you notice any misalignments, that
do not come from setting relativenumber, number or foldcolumn?

For now I have added an extra autocommand for the
VimResized,FocusLost/FocusGained command, but not sure how well this
will work...

Best,

Christian

Gast: "Ich warte schon seit zwei Stunden auf mein Fünf-Minuten-Steak."
Kellner: "Seien Sie froh, daß Sie keine Tagessuppe bestellt haben."

@jubilatious1
Copy link

Hi Christian! Thanks for the fast response!

Regarding your changes, maybe user:solyaris can give us his review? I'll check what you ask and post back here. Thanks again for all your hard work!

@fderop
Copy link

fderop commented Nov 5, 2021

Hello,
Apologies for responding to such an old thread, however, I had the exact same functionality in mind that @solyarisoftware shows in his example:

   le 1 | le 2 | ...
   -----------------
   1900 | 2001 | ...
   1901 | 2002 | ...
   1902 | 2003 | ...
   1903 | 2004 | ...

This idea solves the computational needs of ArrangeColumn: each column is collapsed to the same width, and possible un-collapsed when the cursor is active in it.

I've been scanning the documentation, but I have not found if something like this is possible in the newer version of csv.vim. I can imagine that if this is not possible in the current version of csv.vim, it would take considerable effort to add! I have read in other, more recent issues that you're no longer actively using the plugin yourself, so I understand if this is no longer possible.

Kind regards and thank you for the plugin

Florian

@chrisbra
Copy link
Owner

chrisbra commented Nov 5, 2021

Thanks for the feedback and the nice words. Unfortunately, it is not really possible to collapse a column. We would need some kind of vertical folding for that, but this is not available in Vim yet. I once started to implement this. There is the :VertFold command that implements something like this using concealing.

But even then, if collapsing would be available, I think it wouldn't buy us much, :ArrangeCol would still need to re-calculate the columns widths, because data could have been changed (therefore it does this only when using the ! attribute, to speed up things, else caches the existing width).

Perhaps using vim9script could speed up things a bit, not sure.

And yes you are right, I am not using this plugin much anymore. Nevertheless, I am trying to fix bugs reported here.

@fderop
Copy link

fderop commented Nov 6, 2021

Okay, I understand!

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

4 participants