This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-11
Channels
- # announcements (1)
- # architecture (23)
- # beginners (189)
- # boot (1)
- # calva (62)
- # clj-kondo (23)
- # cljs-dev (9)
- # clojure (336)
- # clojure-dev (11)
- # clojure-europe (2)
- # clojure-italy (17)
- # clojure-nl (25)
- # clojure-uk (53)
- # clojurescript (12)
- # core-async (29)
- # data-science (1)
- # emacs (6)
- # fulcro (23)
- # garden (3)
- # graphql (2)
- # jobs (1)
- # joker (7)
- # off-topic (17)
- # om (2)
- # qlkit (1)
- # reagent (15)
- # reitit (18)
- # rewrite-clj (7)
- # shadow-cljs (176)
- # sql (1)
- # test-check (4)
- # vim (32)
- # xtdb (30)
The obsessive complusive is getting the better of me 🙂 Does anyone know of a plugin (or way?) to sort alphabetically the (:require [......])
block in vim?
clojure-lsp does this I believe, with crcn
. In fact it's the only thing its crcn
impl can do, so perfect for you 🙂
presently, I just whack whatever I require into the require block as I'm working on it, and it gets messy 🙂
Someone made me sort JavaScript imports by line length once for no other reason than "it looked nice". Each to their own, I just prefer some grouping based on how they're related.
I'm afraid I'm in that category too 🙂 In Java/Kotlin I usually sort my annoations from smallest to biggest, like a pyramid 🙂
clojure-lsp
has this feature, though i think it's experimental
https://github.com/snoe/dotfiles/blob/master/home/.vimrc#L270
Maybe define
(defn sort-require [req]
(concat (list (first req))
(sort-by first (rest req))))
in some util namespace then eval your (:require ...)
with it quoted :thinking_face:My dream is to have a way to not only alphabetize my requires, but also vertically align the :as / :refer
I'm using clean-ns feature in refactor-nrepl via vim-iced. https://liquidz.github.io/vim-iced/vim-iced.html#%3AIcedCleanNs