Live data from Hacker News

The State of Vim

lwn.net

201–203 of 203 posts

Re: The State of Vim

#201

Earlier quoted context omitted.

I'm going to try this. I use tmux but the idea of being able to use vim for everything seems nice. If you have tips/suggestions, I'm interested.

For me, some of the things that's really important for a terminal multiplexer include: 1) Keybindings having no conflicts with other terminal applications. For that, vim's default window-management key of is unfortunate, as it is very important for delete words in bash and readline. I remap that to (CTRL-Space) instead, which is basically used by no terminal program that I am aware of. The other key binding that trip…

When you get to using [count]g[something] and g[count][something] and [count]g[something] etc a lot, you start getting a bit confused about where you need to put the count to make things work. So you can make putting the count anywhere work; now, don't worry and just start pressing g or g for window actions, and put a count if you realise you need it:

    map  1 Termcountmap(1, "")
    map  2 Termcountmap(2, "")
    map  3 Termcountmap(3, "")
    map  4 Termcountmap(4, "")
    map  5 Termcountmap(5, "")
    map  6 Termcountmap(6, "")
    map  7 Termcountmap(7, "")
    map  8 Termcountmap(8, "")
    map  9 Termcountmap(9, "")
    map!  1 Termcountmap(1, '')
    map!  2 Termcountmap(2, '')
    map!  3 Termcountmap(3, '')
    map!  4 Termcountmap(4, '')
    map!  5 Termcountmap(5, '')
    map!  6 Termcountmap(6, '')
    map!  7 Termcountmap(7, '')
    map!  8 Termcountmap(8, '')
    map!  9 Termcountmap(9, '')
    tmap  1 Termcountmap(1, 'N')
    tmap  2 Termcountmap(2, 'N')
    tmap  3 Termcountmap(3, 'N')
    tmap  4 Termcountmap(4, 'N')
    tmap  5 Termcountmap(5, 'N')
    tmap  6 Termcountmap(6, 'N')
    tmap  7 Termcountmap(7, 'N')
    tmap  8 Termcountmap(8, 'N')
    tmap  9 Termcountmap(9, 'N')

    function! Termcountmap(initcount, normalkeys)
     let termcount = a:initcount
     while 1
      try
       let char = getchar()
      catch /^Vim:Interrupt$/
       return ""
       endtry
    
      if type(char) == 0
       let char = nr2char(char)
       endif
    
      if char == '0'
       let termcount = termcount * 10
      elseif char == '1'
       let termcount = termcount * 10 + 1
      elseif char == '2'
       let termcount = termcount * 10 + 2
      elseif char == '3'
       let termcount = termcount * 10 + 3
      elseif char == '4'
       let termcount = termcount * 10 + 4
      elseif char == '5'
       let termcount = termcount * 10 + 5
      elseif char == '6'
       let termcount = termcount * 10 + 6
      elseif char == '7'
       let termcount = termcount * 10 + 7
      elseif char == '8'
       let termcount = termcount * 10 + 8
      elseif char == '9'
       let termcount = termcount * 10 + 9
      elseif char == 'g'
       return a:normalkeys .. termcount .. 'g'
      elseif char == "\"
       return a:normalkeys .. termcount .. "\\"
      elseif char == 'w'
       return a:normalkeys .. termcount .. "\w"
      elseif char == 'W'
       return a:normalkeys .. termcount .. "\W"
      elseif char == 't'
       return a:normalkeys .. termcount .. "\t"
      elseif char == 'b'
       return a:normalkeys .. termcount .. "\b"
      else
       return a:normalkeys .. ":\" .. termcount .. ' wincmd ' .. char .. "\\"
       endif
    
      endwhile
     endfunction
    
    map  g g
    
    map  g1 Prefixcountmap (v:count * 10 + 1, "", 'g')
    map  g2 Prefixcountmap (v:count * 10 + 2, "", 'g')
    map  g3 Prefixcountmap (v:count * 10 + 3, "", 'g')
    map  g4 Prefixcountmap (v:count * 10 + 4, "", 'g')
    map  g5 Prefixcountmap (v:count * 10 + 5, "", 'g')
    map  g6 Prefixcountmap (v:count * 10 + 6, "", 'g')
    map  g7 Prefixcountmap (v:count * 10 + 7, "", 'g')
    map  g8 Prefixcountmap (v:count * 10 + 8, "", 'g')
    map  g9 Prefixcountmap (v:count * 10 + 9, "", 'g')
    tmap  g1 Prefixcountmap (v:count * 10 + 1, 'n', 'g')
    tmap  g2 Prefixcountmap (v:count * 10 + 2, 'n', 'g')
    tmap  g3 Prefixcountmap (v:count * 10 + 3, 'n', 'g')
    tmap  g4 Prefixcountmap (v:count * 10 + 4, 'n', 'g')
    tmap  g5 Prefixcountmap (v:count * 10 + 5, 'n', 'g')
    tmap  g6 Prefixcountmap (v:count * 10 + 6, 'n', 'g')
    tmap  g7 Prefixcountmap (v:count * 10 + 7, 'n', 'g')
    tmap  g8 Prefixcountmap (v:count * 10 + 8, 'n', 'g')
    tmap  g9 Prefixcountmap (v:count * 10 + 9, 'n', 'g')
    
    map  1 Prefixcountmap (v:count * 10 + 1, "", '')
    map  2 Prefixcountmap (v:count * 10 + 2, "", '')
    map  3 Prefixcountmap (v:count * 10 + 3, "", '')
    map  4 Prefixcountmap (v:count * 10 + 4, "", '')
    map  5 Prefixcountmap (v:count * 10 + 5, "", '')
    map  6 Prefixcountmap (v:count * 10 + 6, "", '')
    map  7 Prefixcountmap (v:count * 10 + 7, "", '')
    map  8 Prefixcountmap (v:count * 10 + 8, "", '')
    map  9 Prefixcountmap (v:count * 10 + 9, "", '')
    map!  1 Prefixcountmap (v:count * 10 + 1, '', '')
    map!  2 Prefixcountmap (v:count * 10 + 2, '', '')
    map!  3 Prefixcountmap (v:count * 10 + 3, '', '')
    map!  4 Prefixcountmap (v:count * 10 + 4, '', '')
    map!  5 Prefixcountmap (v:count * 10 + 5, '', '')
    map!  6 Prefixcountmap (v:count * 10 + 6, '', '')
    map!  7 Prefixcountmap (v:count * 10 + 7, '', '')
    map!  8 Prefixcountmap (v:count * 10 + 8, '', '')
    map!  9 Prefixcountmap (v:count * 10 + 9, '', '')
    tmap  1 Prefixcountmap (v:count * 10 + 1, 'N', '')
    tmap  2 Prefixcountmap (v:count * 10 + 2, 'N', '')
    tmap  3 Prefixcountmap (v:count * 10 + 3, 'N', '')
    tmap  4 Prefixcountmap (v:count * 10 + 4, 'N', '')
    tmap  5 Prefixcountmap (v:count * 10 + 5, 'N', '')
    tmap  6 Prefixcountmap (v:count * 10 + 6, 'N', '')
    tmap  7 Prefixcountmap (v:count * 10 + 7, 'N', '')
    tmap  8 Prefixcountmap (v:count * 10 + 8, 'N', '')
    tmap  9 Prefixcountmap (v:count * 10 + 9, 'N', '')
    
    function! Prefixcountmap(initcount, prefix, countprefix)
     let termcount = a:initcount
     while 1
      try
       let char = getchar()
      catch /^Vim:Interrupt$/
       return ""
       endtry
    
      if type(char) == 0
       let char = nr2char(char)
       endif
    
      if char == '0'
       let termcount = termcount * 10
      elseif char == '1'
       let termcount = termcount * 10 + 1
      elseif char == '2'
       let termcount = termcount * 10 + 2
      elseif char == '3'
       let termcount = termcount * 10 + 3
      elseif char == '4'
       let termcount = termcount * 10 + 4
      elseif char == '5'
       let termcount = termcount * 10 + 5
      elseif char == '6'
       let termcount = termcount * 10 + 6
      elseif char == '7'
       let termcount = termcount * 10 + 7
      elseif char == '8'
       let termcount = termcount * 10 + 8
      elseif char == '9'
       let termcount = termcount * 10 + 9
      else
       return a:prefix .. termcount .. a:countprefix .. char
       endif
    
      endwhile
     endfunction

Re: The State of Vim

#202
post #196

Earlier quoted context omitted.

It’s astonishing that you can arrive at this conclusion from my comment. He did great work, his development process did not scale. I am happy that I was able to use vim for more than a decade prior to neovim. The fact that after the neovim fork vims development started to pick up speed again is a fact (and doesn’t devalue bram’s work in any way). I am happy with bram’s work on vim and with the neovim devs and their w…

> his development process did not scale I hope my development projects fail like Moolenaar's! Vim has been extraordinarily successful for decades, possibly the top 5 or 10 FOSS projects ever (?). Citing Vim as an example of development process failure is really incredible.

Again, it is not a failure of him or his project that his development process heavily relied on him reviewing, modifying and merging patches and that he at times did not commit time to do that. He was not obliged to do more than what he did and vim was indeed very successful.

However, it is also very understandable why vim was forked by the neovim devs, in my view it has been a great success. That doesn't diminish Bram Molenaars achievements and contributions to the world.

Re: The State of Vim

#203

Earlier quoted context omitted.

For me, some of the things that's really important for a terminal multiplexer include: 1) Keybindings having no conflicts with other terminal applications. For that, vim's default window-management key of is unfortunate, as it is very important for delete words in bash and readline. I remap that to (CTRL-Space) instead, which is basically used by no terminal program that I am aware of. The other key binding that trip…

(equivalently, if you use screen; the key point is the \eP and the \e\\ between which the real xterm escape codes go, or else screen will eat your escape codes which will never see the light of day) augroup term_normal au! autocmd WinNew * let w:winnew = 1 autocmd CmdlineEnter * let w:outcmd = 0 autocmd CmdlineLeave * let w:outcmd = 1 autocmd WinEnter * if exists ('w:winnew') | unlet w:winnew | if (mode() == 't') | c…

thanks for the reply and tips, lots of useful information in there.
Post reply on HN