Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by
edited by

hello

sorry but I have 3 questions:


i want to open file with nvim or vim from vifm in a new tab of iterm2

i wrote in vifmrc:

nnoremap o :!nvim %f<cr>

and it opens file with "o" in the same tab as vifm.

What option have I use to open it in a new tab of iterm2.


About sorting in vifm. I use code in vifmrc to toggle sorting by "s":

command! togglesort
\ :if &sort == '-size'
\ | set sort=-mtime,dir
\ | echo 'Sorted by modification date'
\ |else
\ | if &sort == '+name'
\ | set sort=-size
\ | echo 'Sorted by size'
\ | else
\ | set sort=+name
\ | echo 'Sorted by name'
\ | endif
\ |endif

nnoremap s :togglesort<cr>

and it works, but if I change

set sort=+iname,dir

it doesn't toggle


When i use sort by time modificate there 2 columns of time how to split them?

r/vim - need help with vifm
thanks a lot!

1 Answer

+1 vote
by
selected by
 
Best answer

Hi

What option have I use to open it in a new tab of iterm2.

This is really a question about item2. It needs a way to open a new tab with a given command from an existing tab. I've never used it and don't see anything obvious in its documentation.

About sorting in vifm.

The code should always work, but you might need to press s one more time, because first time it will set +name, maybe you just don't notice it.

When i use sort by time modificate there 2 columns of time how to split them?

Increase width of columns in 'viewcolumns'.

by

The code should always work, but you might need to press s one more time, because first time it will set +name, maybe you just don't notice it.

doesn't work

Increase width of columns in 'viewcolumns'

set viewcolumns=*{name}..,40{mtime},7{}

but it is the same

by

doesn't work

OK, I see the mistake. Make the first if look like this (the +name is added implicitly):

\ :if &sort == '-size,+name'

set viewcolumns=*{name}..,40{mtime},7{}

Either left-align second column:

set viewcolumns=*{name}..,-40{mtime},7{}

or change size of the third one:

set viewcolumns=*{name}..,20{mtime},20{}
by

thank you!

with columns it works

with sort it works only as is:

command! togglesort
         \ :if &sort == '-size,+name'
         \ |    set sort=-mtime,dir
         \ |    echo 'Sorted by modification date'
         \ |else
         \ |    if &sort == '+name'
         \ |        set sort=-size
         \ |        echo 'Sorted by size'
         \ |    else
         \ |        set sort=+name
         \ |        echo 'Sorted by name'
         \ |    endif
         \ |endif

if i add in last else sort=+name,dir it doesn't work

by

if i add in last else sort=+name,dir it doesn't work

I didn't understand that's what you're trying to do. You just need to update second condition at the same time:

command! togglesort
         \ :if &sort == '-size,+name'
         \ |    set sort=-mtime,+dir,+name
         \ |    echo 'Sorted by modification date'
         \ |elseif &sort == '+name,+dir'
         \ |    set sort=-size,+name
         \ |    echo 'Sorted by size'
         \ |else
         \ |    set sort=+name,+dir
         \ |    echo 'Sorted by name'
         \ |endif
by

thank you!

it was that i want!!!

...