mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.85k stars 710 forks source link

Fill regular buffer as Kakoune entry point #1496

Open alexherbo2 opened 7 years ago

Delapouite commented 6 years ago

I think I see what you mean.

Sometimes, you start kakoune, write some stuff in the default *scratch* buffer and want to save your progression :w foo.txt. You keep going writing stuffs and want to save again with a simple :w. It raises an error because the current buffer is still not linked to a file. So maybe the first :w foo.txt could transform the scratch buffer into a regular one.

danr commented 6 years ago

I wish :w <file> would set the buffer name to <file> instead of retaining it. It is what vim does I think.

mawww commented 6 years ago

@danr Would that do it for any buffer ? Say if I edit a.txt and do :w b.txt, would that rename the buffer to b.txt ? Or would that be the behaviour only for scratch buffers ?

lenormf commented 6 years ago

Adding a side effect to this pure command would probably bend its orthogonality, but I suppose that's what most users use it for anyway?

maximbaz commented 6 years ago

nvim does this only for *scratch* buffer, but to be honest I would prefer this behavior to happen in all cases, i.e. I would prefer to be switched to buffer b.txt.

alexherbo2 commented 5 years ago

How about filling a splash buffer as New document?

All other editors do this, when editing a new document with no file-name yet. They don’t allow to quit before yelling for unsaved changes.

I think it’s prone to accidents for Kakoune and new-comers to have a scratch buffer as its entry-point, instead of a regular one.

In conjunction to #2360, write document.txt would rename *splash*document.txt.

*splash* is just a name for a normal buffer when no explicit name was given.