zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.69k stars 1.16k forks source link

set filetype sets the filetype for all opened tabs and not the current focused #3395

Open theredcmdcraft opened 1 month ago

theredcmdcraft commented 1 month ago

Description of the problem or steps to reproduce

If you have multiple files opened in multiple tabs and press Ctrl+e for the Micro internal shell and set the filetype with set filetype txt to txt, for example, this will change the filetype for all open tabs and not for the current focused tab. I would expect that if i set the filetype it only will happen for the current focused tab.

If you need more informations about my system or something else, feel free to ask me.

Specifications

Commit hash: Version: 2.0.11 OS: Debian 12.5

user@host ~ # cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Terminal: xterm-256color (hopefully correct)

Andriamanitra commented 1 month ago

There is a separate setlocal command that you can use instead of set when you only want to change a setting in the current buffer.

dmaluka commented 1 month ago

Actually the filetype option is a special case, it is local-only, so even set filetype should set the filetype for the current buffer only. It was fixed in #3042.

theredcmdcraft commented 1 month ago

Okay. Thank you for the quick reply. Is it fixed in a released version?

dmaluka commented 1 month ago

No, the latest release 2.0.13 was in Oct 2023, while #3042 was merge in Mar 2024. Maybe we will make a new release soon. In the meantime you can either use a nightly build from https://github.com/zyedidia/micro/releases/tag/nightly, or compile micro yourself, or just use setlocal filetype.