This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-04
Channels
- # announcements (10)
- # asami (6)
- # babashka (22)
- # beginners (44)
- # biff (1)
- # calva (8)
- # clj-kondo (13)
- # clojure (62)
- # clojure-art (1)
- # clojure-europe (27)
- # clojure-nl (1)
- # clojure-norway (19)
- # clojure-spec (19)
- # clojure-uk (2)
- # component (29)
- # datascript (1)
- # fulcro (9)
- # gratitude (2)
- # kaocha (6)
- # klipse (1)
- # luminus (16)
- # malli (9)
- # nbb (5)
- # off-topic (4)
- # reagent (5)
- # shadow-cljs (85)
- # spacemacs (1)
- # tools-deps (10)
- # vim (9)
- # xtdb (2)
I’d like to toggle between two files/buffers using a single command / key binding For example: I am working on two files, router.clj and handler.clj with just one window open. A toggle to show the last open buffer (so would that be last -1). So each time the command is called, it will show either the router our handler ?
I’m still learning Neovim so dont yet know how it organises the buffer history, if its by when a buffer was originally opened or last opened (it seems to be the former) I can use the separate commands, :bnext and :bprevious, but then need to remember which buffer is previous or next 🙂. Have I missed something obvious (apart from just having two windows open)
Toggling between the last two active windows or tabs would also be useful
there is a command b#
. Personally i mapped it to <leader><tab>
mostly covers the described need.
nnoremap <leader><tab> :b#<CR>
nnoremap <silent> <space><tab> <cmd>exe v:count ? v:count . 'b' : 'b' . (bufloaded(0) ? '#' : 'n')<cr>
I use space + tab to switch between 2 files. This logic also allows to ignore buffers like StartifyVim natively supports going switching between two files: http://vimdoc.sourceforge.net/htmldoc/editing.html%23CTRL-%5E
:b#
looks the simplest thing to use to start with, mapped to <TAB> key.
I occasionally use startup.nvim, but perhaps not that often that I think it would interfere, although useful to know how to manage if it does.
The vimdoc nicely explains why b# works, so thanks for that too.
Thanks everyone.