How can I open vim with a particular line number at the top?
Solution 1:
You could issue zt
after opening the file, so something like: vim +500 filename -c 'normal zt'
.
Solution 2:
As an alternative (because I ended up here searching for it), if you want to have the syntax vim <filename>:<linenumber>
, eg vim test.rb:45
, you can use vim-fetch with Vundle:
Plugin 'kopischke/vim-fetch'
Solution 3:
This should do it:
vim +'500|norm! zt' filename
Or you could just start the habit of using zt (top), zz (center), and zb (bottom); In my case, it is so automatic, I wouldn't really require the extra invocation argument