I am using pine-script-mode
with a 4 space TAB.
Here is an inner block of an if
statement that is already aligned. How can I prevent adding a TAB
char (or 4 space chars) when I press TAB
?
pine file:
if x == 1
true
Here when cursor is at the beginning of the true
line and I press TAB
it adds 4 spaces. Instead, since it is already aligned I want it to do nothing.
basic emacs config file:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)
(fset 'yes-or-no-p 'y-or-n-p)
(use-package pine-script-mode
:ensure t
:pin melpa-stable
:mode (("\\.pine" . pine-script-mode)))
(defun pine-custom-settings ()
(setq indent-tabs-mode nil)
(setq tab-width 4))
(defun c/pinescript-indent ()
"Just do dumb indentation rather than emacs' relative indentation."
(setq indent-tabs-mode nil)
(setq tab-width 4) ; this can be omitted if standard-indent is 4
(setq indent-line-function 'insert-tab))
(add-to-list 'indent-line-ignored-functions 'insert-tab)
(add-hook 'pine-script-mode-hook 'c/pinescript-indent)