I was discussing with a tamil writer, on his explorations of a good text editor.
As he is a lover of plaintext, his requirements are interesting to me.
We concluded that the below are the good requirements.
Fullscreen editor
The text editor should open in fullscreen modealways. No need of Top menu, side menu etc.
Word Count
Count of total words should be displayed in bottom or can be shown on any menu click action.
Real time display is good. but not necessary.
Wondered to see many text editors are counting the Tamil language words wrongly.
Few text editors dont have that feature to count the words.
dark mode
A dark back ground and bright color for text is essential
No additional colors
Many text editors like vscode, show the text in different colors based on the syntax,
which is unncessary.
No syntax hightlighting
no need to show the symbols, syntax in different colors
show the linenumbers.
showing linenumbers is good. but not essential.
OS
should be available for all computer operating systems like GNU/Linux, Mac and Windows
Cost
Should be free
Configurable
Good to have more configurable possibilities.
font/size
Default font and size should be confifurable.
Based on these requirements, I did an analysis of various text editors.
Will give detailed analysis for all text editors later.
I hope, emacs can be a perfect for all these requirements.
I need the below features in Emacs.
open emacs in fullscreeen by default
Open in writeroom-mode by default
if possible, show the word count in the mode line, in the writeroom mode.
if mode line is not possible in write room mode, add a menu item to get the words count
if possible show line numbers or give menu item for it.
Load the theme “tango-dark” by default.
Set the normal short keys for the below operations.
(cua-mode t)
(delete-selection-mode t)
(global-set-key (kbd "<left>") 'backward-char)
(global-set-key (kbd "<right>") 'forward-char)
(global-set-key (kbd "<up>") 'previous-line)
(global-set-key (kbd "<down>") 'next-line)
(global-set-key (kbd "C-f") 'isearch-forward)
(global-set-key (kbd "C-r") 'query-replace)
(global-set-key (kbd "C-S-h") 'query-replace-regexp)
(global-set-key (kbd "C-s") 'save-buffer)
(global-set-key (kbd "C-a") 'mark-whole-buffer)
By setting the above in emacs config file, we can get
Open = Ctrl + O
Cut = Ctrl + x
Copy = Ctrl + c
Paste = Ctrl + v
Undo = Ctrl + z
But, the File menu, shows the default keys of emacs only.
Need to edit the short keys shown on the file menu too, so that it will be in sync.
Please help to set all these for emacs.
here is the my emacs config I am trying to achieve all these.
1 Like
zororg
April 2, 2025, 5:54am
2
some of the bits I can think of
;; fullscreen
(toggle-frame-fullscreen)
(writeroom-mode t)
;; or add hook to text mode
(add-hook 'text-mode-hook #'writeroom-mode)
;; load tango theme
(load-theme 'tango-dark t)
;; M-= to cound words or do M-x count (to see commands)
(global-display-line-numbers-mode t)
We need to unset the old key and set the new keys then the changes will be reflected
;; Unset the default save key binding
(global-unset-key (kbd "C-x C-s"))
;; Bind C-s to save-buffer
(global-set-key (kbd "C-s") 'save-buffer)
Also arrows keys works by default we don’t need to set it.
we can add our own menus using the below code, I have created My menu and add count word menu item in it.
(defun my-count-words ()
"Count the number of words in the current buffer and display the count."
(interactive)
(let ((word-count (count-words (point-min) (point-max))))
(message "Word count: %d" word-count)))
(require 'easy-mmode)
(easy-menu-define my-custom-menu
global-map
"My Custom Menu"
'("My Menu"
["count words" my-count-words t]
"---"
["Quit" save-buffers-kill-terminal t]))
Proof of concept, Done during my following stream
;; Disable starup screen
(setq inhibit-startup-screen t)
;; Custom file configration
(setq custom-file (locate-user-emacs-file "custom.el"))
(load custom-file :no-error-if-file-is-missing)
;; Cursor modification
(blink-cursor-mode -1)
(setq-default cursor-type 'bar)
;; Enable visual line mode
(global-visual-line-mode t)
;; No autoback up and lock files
(setq
make-backup-files nil
auto-save-default nil
create-lockfiles nil)
;; Auto revert mode
(global-auto-revert-mode 1)
;; Package initialize
(require 'package)
(package-initialize)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
;; Use package installation
(when (< emacs-major-version 29)
(unless (package-installed-p 'use-package)
(unless package-archive-contents
(package-refresh-contents))
(package-install 'use-package)))
;; Warning and compile log window handling
(add-to-list 'display-buffer-alist
'("\\`\\*\\(Warnings\\|Compile-Log\\)\\*\\'"
(display-buffer-no-window)
(allow-no-window . t)))
;; Delete selection mode
(use-package delsel
:ensure nil ; no need to install it as it is built-in
:hook (after-init . delete-selection-mode))
;; hide scroll and tool bar
;;(menu-bar-mode 1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
;; Font size changes
(let ((mono-spaced-font "Monospace")
(proportionately-spaced-font "Sans"))
(set-face-attribute 'default nil :family mono-spaced-font :height 150)
(set-face-attribute 'fixed-pitch nil :family mono-spaced-font :height 1.0)
(set-face-attribute 'variable-pitch nil :family proportionately-spaced-font :height 1.0))
;; fullscreen
(toggle-frame-fullscreen)
;;(tab-bar-mode 1) ;; Enable tabs
;;(setq tab-bar-show 1) ;; Show tabs only if more than one tab is open
;; load tango theme
(load-theme 'tango-dark t)
;; Line numbers
(global-display-line-numbers-mode t)
;; Cua mode
(cua-mode t)
(global-unset-key (kbd "C-x C-s"))
(global-set-key (kbd "C-s") 'save-buffer)
(global-set-key (kbd "C-f") 'isearch-forward)
(global-set-key (kbd "C-r") 'query-replace)
(global-set-key (kbd "C-S-h") 'query-replace-regexp)
(global-set-key (kbd "C-a") 'mark-whole-buffer)
;; Custom menu for word count
(defun my-count-words ()
"Count the number of words in the current buffer and display the count."
(interactive)
(let ((word-count (count-words (point-min) (point-max))))
(message "Word count: %d" word-count)))
(require 'easy-mmode)
(easy-menu-define my-custom-menu
global-map
"My Custom Menu"
'("Essentials"
["count words" my-count-words t]
"---"
["Quit" save-buffers-kill-terminal t]))
;; Hide mode line
(use-package hide-mode-line
:ensure t
:init (global-hide-mode-line-mode))
;; centaur-tabs
(use-package centaur-tabs
:ensure t
:init
(centaur-tabs-mode t)
:bind
("C-<prior>" . centaur-tabs-backward)
("C-<next>" . centaur-tabs-forward))
;;By default, Emacs starts with the *scratch* buffer containing some text.
;;To start with a clean empty buffer, add:
(setq initial-scratch-message nil)
;; Write room
(use-package writeroom-mode
:ensure t
:init
(global-writeroom-mode))
;;; Configure the minibuffer and completions
(use-package vertico
:ensure t
:hook (after-init . vertico-mode))
(use-package marginalia
:ensure t
:hook (after-init . marginalia-mode))
(use-package orderless
:ensure t
:config
(setq completion-styles '(orderless basic))
(setq completion-category-defaults nil)
(setq completion-category-overrides nil))
(use-package savehist
:ensure nil ; it is built-in
:hook (after-init . savehist-mode))
;;; Themes
(use-package ef-themes
:ensure t
:config
(load-theme 'ef-night t))
;; which key
(use-package which-key
:ensure t
:init (which-key-mode)
:diminish which-key-mode
:config
(setq which-key-idle-delay 0.3))
;; (use-package markdown-mode)
;;; Consult package
;; Example configuration for Consult
(use-package consult
:ensure t
;; Replace bindings. Lazily loaded by `use-package'.
:bind (;; C-c bindings in `mode-specific-map'
("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
([remap Info-search] . consult-info)
;; C-x bindings in `ctl-x-map'
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
;; M-g bindings in `goto-map'
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ;; orig. goto-line
("M-g M-g" . consult-goto-line) ;; orig. goto-line
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings in `search-map'
("M-s d" . consult-find) ;; Alternative: consult-fd
("M-s c" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history) ;; orig. next-matching-history-element
("M-r" . consult-history)) ;; orig. previous-matching-history-element
;; Enable automatic preview at point in the *Completions* buffer. This is
;; relevant when you use the default completion UI.
:hook (completion-list-mode . consult-preview-at-point-mode)
;; The :init configuration is always executed (Not lazy)
:init
;; Tweak the register preview for `consult-register-load',
;; `consult-register-store' and the built-in commands. This improves the
;; register formatting, adds thin separator lines, register sorting and hides
;; the window mode line.
(advice-add #'register-preview :override #'consult-register-window)
(setq register-preview-delay 0.5)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
;; Configure other variables and modes in the :config section,
;; after lazily loading the package.
:config
;; Optionally configure preview. The default value
;; is 'any, such that any key triggers the preview.
;; (setq consult-preview-key 'any)
;; (setq consult-preview-key "M-.")
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
;; For some commands and buffer sources it is useful to configure the
;; :preview-key on a per-command basis using the `consult-customize' macro.
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep consult-man
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
;; :preview-key "M-."
:preview-key '(:debounce 0.4 any))
;; Optionally configure the narrowing key.
;; Both < and C-+ work reasonably well.
(setq consult-narrow-key "<") ;; "C-+"
;; Optionally make narrowing help available in the minibuffer.
;; You may want to use `embark-prefix-help-command' or which-key instead.
;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") #'consult-narrow-help)
)
1 Like