nmasur / dotfiles

Nix configuration and settings
MIT License
152 stars 6 forks source link

What is the purpose of `vl`? #74

Closed eblume closed 3 months ago

eblume commented 3 months ago

Hi @nmasur , I hope you are well! I have another question about your config.

What is the purpose of this vl alias?

nvim -c 'normal! `0' -c 'bdelete 1'

I understand (I think) that "nvim -c 'normal! `0'" means "open vim to the last edited position", which is cool enough. What does bdelete 1 mean here though? I understand from :help bdelete that it's something to do with closing an open buffer, but from my own testing I seem to generally not be working in buffers starting from 1 - it's actually kind of curious, I haven't ever had much cause to work with :ls in vim and so I hadn't noticed the behavior before but it seems to retain old cached buffer numbers for files, is this related to the way you set up nvim backup and swap?

Thanks again!

nmasur commented 3 months ago

Hey @eblume,

This is a quirky one, and I think it's due to the fact that I have the bufferline.nvim plugin installed, which shows buffers as a tab bar at the top of the Neovim window.

Whenever I open Neovim, it defaults to an empty buffer. With the -c 'normal! `0' command it will then jump to the last edited position of the most recent file, but it will leave open the empty buffer as [No Name]:

Screenshot 2024-07-10 at 9 48 41 AM

So by adding -c 'bdelete 1', we kill the first empty buffer and only get the file we want.

eblume commented 3 months ago

Thanks, that explains it! I've disabled bufferline in my build, so I don't even see the other buffer being left 'open'.

Appreciated as always!