0

What would be the easiest way of shuffling between a few source files, usually of the same type, say .py or .js. C-x C-b and selecting gets a little tedious once your open buffers list grows. I would like the following options if possible

  • toggle between two files only, same window, just going back and forth
  • all open buffers filtered by the same file extension as current one
  • all open buffers filtered by files from the same projectile project

I don't mind using a little bit of elisp code in my configuration with my own shortcuts.

Any pointers will be appreciated. I currently use magit, projectile, helm, neotree, ivy at a high level to manage multiple git repos

Edit: Till i get really comfortable with shortcuts i will be ok to use my mouse a little bit. So an option which is more mouse friendly or even mouse dependent is also an ok option for now.

2
  • Please narrow your question to cover only one of the "options" you want to know about. You can post separate questions for each of them, if you like.
    – Drew
    Sep 17, 2023 at 17:50
  • Oops, I figured there would be a common solution or package to address all of these :) Sep 17, 2023 at 18:21

1 Answer 1

1

You might find better answers elsewhere (and many people will have other opinions), so I will be brief. See chapter 20.1 Creating and Selecting Buffers of the Emacs manual for several options.

First, C-x b (aka switch-to-buffer, not C-x C-b aka list-buffers) is what I use most often. It prompts you to input the name of a buffer to switch to, but the default is always the next most recently used buffer so simply hitting ENTER will take you right to it. This is how I normally swap back and forth between two buffers.

For dealing with projects, C-x p b (project-switch-to-buffer) is the same but limits the completion to just buffers from the current project. See chapter 29.2.2 Project Commands That Operate on Buffers in the Emacs manual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.