This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-29
Channels
- # announcements (5)
- # beginners (25)
- # calva (53)
- # clj-kondo (9)
- # clojure (25)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (21)
- # clojure-uk (1)
- # conjure (2)
- # data-science (1)
- # datalevin (4)
- # datascript (6)
- # deps-new (5)
- # emacs (5)
- # etaoin (6)
- # figwheel-main (1)
- # fulcro (46)
- # gratitude (3)
- # hyperfiddle (8)
- # introduce-yourself (13)
- # lsp (13)
- # nextjournal (5)
- # off-topic (2)
- # pathom (4)
- # polylith (11)
- # re-frame (16)
- # releases (4)
- # scittle (67)
- # shadow-cljs (38)
- # slack-help (4)
- # specter (13)
- # sql (29)
- # squint (21)
- # test-check (3)
- # vim (13)
- # xtdb (15)
Does anyone know if it's possible to make it so that I could visit but not add a newline at the end of the file?
Where would you want to go if there weren't a newline at the end of the file? Does gg?\n<CR>
do what you want?
I can open Spacemacs and save this file:
Then open it in vim and see this:
So clearly Spacemacs allows to have an empty line in the UI but then doesn't save that line into the file. So I wanted to have this in vim too :thinking_face: Not sure if it's possible
It simply throws me off that it's non-consistent and I got used to it in Spacemacs. That's pretty much it.
That's not quite right. Emacs saves the \n
just fine. It's just emacs happens to display a final \n
as an empty line, and vim doesn't. It's because of how they differ in their interpretation of what \n
means by default
For example, this is an issue where the conclusion is "this isn't a bug, it's just different": https://github.com/vim/vim/issues/488
For instance this behavior throws me off: let's say we have file like this in both editors:
hello
hello
[cursor]
hello
hello
Then I press dG
and delete last two lines.
In vim the result is like this:
hello
[cursor]hello
In Spacemacs it's like this:
hello
hello
[cursor]
But when there are more paragraphs then vim behaves like this (after pressing d}
):
a
a
[cursor]
b
b
c
c
->
a
a
[cursor]
c
c
So IMO vim is inconsistent with itself because it hides that last newlineYeah I can see that that seems inconsistent. For your second example, I think it's because }
motion is characterwise by default. If you type dV}
instead (forcing linewise motion) then it is consistent with G
(which is linewise by default). Likwise, you can do dvG
to force G
to move characterwise.
(that doesn't change the fact that vim & emacs seem to display a final newline differently, but may be useful to you getting the behaviour you want in vim)
I don't know how to do it. But at least vim displays the truth. Even thought adds this small weirdness.