This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (38)
- # babashka (5)
- # beginners (26)
- # calva (26)
- # cider (1)
- # clj-kondo (36)
- # cljdoc (17)
- # cljs-dev (31)
- # clojure (39)
- # clojure-australia (9)
- # clojure-berlin (2)
- # clojure-dev (31)
- # clojure-europe (22)
- # clojure-france (3)
- # clojure-italy (7)
- # clojure-nl (5)
- # clojure-norway (5)
- # clojure-spec (28)
- # clojure-uk (9)
- # clojured (20)
- # clojurescript (24)
- # community-development (2)
- # conjure (32)
- # core-async (7)
- # cryogen (6)
- # datomic (2)
- # duct (6)
- # fulcro (6)
- # graalvm (53)
- # introduce-yourself (2)
- # jobs (2)
- # luminus (2)
- # nrepl (2)
- # off-topic (35)
- # re-frame (17)
- # reveal (8)
- # shadow-cljs (27)
- # testing (2)
- # xtdb (8)
I've noticed recently that when I open a .clj file on load (i.e.
vim /path/to/something.clj) I am immediately in insert mode. Is it possible that Conjure is doing this somehow?
I wonder if @dave and @rafaeldelboni's issues are related and both related to the auto repl / babashka functionality :thinking_face: obviously "works on my machine" but maybe there's a setting to do with unsaved buffers or something that's confusing things when I swap to the bb REPL buffer and back.
Haha, it's probably just the way I'm creating the terminal. I create a new buffer or window and open a terminal running bb inside that new one. Then close it or swap back to what was there before, I can't remember the process exactly. I'm guessing there's some vim setting that makes this behave weirdly in some setups though...
Maybe I can do something simpler :thinking_face: like rephrasing the operation may be enough to fix it.
I haven't had the time or energy to do another batch of fix-y/feature work, but should get a window this weekend! I need to do short sprints where I fix a few things and add a few features then release it the same day I think.
Aha! I think I do have a hack in place that puts me directly into insert mode when a terminal buffer opens.
" When I open a terminal buffer, I want it to feel like I'm in the terminal. I " don't want to still be in normal mode. autocmd TermOpen * startinsert
Oooo yeah! That'll do it! Still doesn't explain why @rafaeldelboni's Clojure highlighting vanished... that one has me stumped.
I'll see if I can somehow open the term without causing any autocmds maybe? Although not sure how I get around that.
I'm wondering what the right solution is. Maybe there is something I can do on my side. :thinking_face:
Would it make sense for you to switch back to normal mode explicitly when you move back away from the terminal buffer?
:thinking_face: I mean, you shouldn't be in normal mode after that, it's your custom autocmd that does that. So I'd like to find a way to say "just open a terminal but don't trigger anything custom since it's a background process". Patching around the insert mode part seems too narrow to me tbh, I'd like to find a broader fix.
I could maybe not open a terminal and just start the process completely hidden not attached to a buffer. But then you can't interact with it to <c-c> it or type into it. Which will be useful with some REPL setups (not bb sadly, you can't have nREPL and stdio because single thread)
I think I agree. It might actually be worse to switch to normal mode explicitly because maybe someone else's weird setup relies on you putting them back into whatever mode they were in before :man-shrugging:
So I will see if there's anything I can set to say "just open a buffer, don't do anything clever"
Maybe there is a TermLeave event or something that I can respond to by putting me back into normal mode.
If you condition your autocmd to say "only do this if the current window is a terminal" then you'll only run
i when you actually have the terminal in focus, rather than a sort of background thing
I took a stab at this:
Doesn't seem to have any effect, sadly.
" When I open a terminal buffer, I want it to feel like I'm in the terminal. I " don't want to still be in normal mode. autocmd TermOpen * if &buftype ==# 'terminal' \ | startinsert \ | endif
OK, I've solved it! 😄
" When I open a terminal buffer, I want it to feel like I'm in the terminal. I " don't want to still be in normal mode. autocmd TermOpen * startinsert " This doesn't play nice with Conjure, which will sometimes open a terminal " buffer to start a REPL server and then switch back to the previous " buffer. " " As a workaround, I explicitly switch to normal mode when entering any " Clojure buffer. autocmd BufEnter *.clj,*.cljs,*.edn stopinsert " (This doesn't work, for some reason.) " autocmd FileType clojure stopinsert
Haha, well I'm glad you have something but sorry you had to do extra things! Not sure how I can avoid triggering autocmds like this 😞
Don't feel bad about it. I realize that I'm probably an outlier here in that I'm monkeying with the default behavior of terminal buffers.