Coder Social home page Coder Social logo

intuitive-tab-line-mode's Introduction

Intuitive Tabs in Emacs.

Installation

  1. clone into a folder of your choice (~/.emacs.d/git for example)

  2. with use-package, configure it like this:

(use-package intuitive-tab-line
  :load-path "git/intuitive-tab-line-mode"
  :bind (("C-<tab>" . tab-line-switch-to-next-tab)
         ("M-<left>" . intuitive-tab-line-shift-tab-left)
         ("M-<right>" . intuitive-tab-line-shift-tab-right))
  :custom
  (tab-line-tabs-function 'intuitive-tab-line-buffers-list)
  (tab-line-switch-cycling t)
  :config
  (global-tab-line-mode 1))

The Goal:

Make Emacs tabs behave intuitively (similar to how tabs behave in a browser).

Problem:

I know many don't feel this way, but I like using tabs. And more than this, I like the simplicity of having one buffer per tab.

I tried doing things The Emacs Way (TM) of having buffers managed invisibly in the background, but I could never get a good mental model for this. I needed a visual representation of what buffers were open and their order.

What I wanted was:

  • For any buffer manually opened by the user to be represented by its own tab.
  • For their order to persist (until manually changed).

Put simply, I want Emacs tabs to work like a browser would.

The Final Solution:

So using tab-line-mode I have created my own custom tab-line-tabs-function: a simple list to manage the tab/buffers I wanted displayed. I then created a set of functions to manipulate that list to get the functionality I was after.

This took a good amount of work on my part (I am not a programmer) and no small amount of guidance from helpful internet strangers, but I've been using it for 6 months now and it is everything I had hoped it would be.

The various functions should more or less be self-explanatory. Please note I use tab-line-switch-to-next-tab and tab-line-switch-to-prev-tab to cycle between tabs.

Tested with Emacs 28.1.

Notes:

  • kill-this-buffer will generally work just fine, but will sometimes cause a previously dropped buffer to get a tab again. This can be prevented by instead using intuitive-tab-line-drop-tab with a non-nil kill argument.
  • You can define which buffers you would like get their own tab and which you would like to remain tabless by editing intuitive-tab-line-add-current-buffer-to-tab.
  • You can manually add a buffer that would normally not be added with intuitive-tab-line-manually-add-current-buffer-to-tab.
  • You can remove the tab for a buffer, without killing the buffer with intuitive-tab-line-drop-tab. The next time you visit the buffer, it will be given a tab again.
  • You can change the order of the tabs with intuitive-tab-line-shift-tab-left and intuitive-tab-line-shift-tab-right.
  • You can set a 'default' tab with intuitive-tab-line-set-default-tab and go to the default tab with intuitive-tab-line-goto-default-tab.
  • You can remove all tabs and leave only your initial-buffer-choice open with intuitive-tab-line-load-initial-buffer-only.

Conclusion:

As I say, this has been a goal of mine ever since I started using Emacs. It was a lot of confusing work to get it to work, but work it does and it is enormously gratifying. Very open to feedback and criticism, but do keep in mind I'm not a programmer and trying my best.

intuitive-tab-line-mode's People

Contributors

thread314 avatar grolongo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.