Just use the built-in
asm-mode. It gives you syntax highlighting for any assembly languages.
gas-mode does not do that and is not usable with AT&T syntax.
If you want to set indentation for
asm-mode, note that you cannot use
tab-stop-list that specifies spaces that 1 tab, 2 tabs, 3 tabs... can display:
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60
64 68 72 76 80 84 88 92 96 100 104 108 112
The above example means that the fist tab has 4 spaces, 2nd tab (next to the first tab) has 8 spaces, 3rd tab (next to the second tab) has 12 spaces... and so on.
You can also generate the list like this:
(setq tab-stop-list (number-sequence 2 60 2))
number-sequence generates a list of number, with starting number
2 (the first argument) upto
60 (the second argument), each number differs by
2 to the number next to it. And remember to bind
newline-and-indent to RET, so Emacs automatically indents for you.
If you want to jump around, use Ctags like this:
ctags -e -R
-e means generate tag database to be used by Emacs.
-R means recursively generate tags for files in sub-directories from project root.
After that, you can use
helm-etags-select to jump around or another
etags client in Emacs if you don't use Helm.
EDIT: Here is a sample setup:
(add-hook 'asm-mode-hook (lambda ()
(setq indent-tabs-mode nil) ; use spaces to indent
(electric-indent-mode -1) ; indentation in asm-mode is annoying
(setq tab-stop-list (number-sequence 2 60 2))))
(define-key asm-mode-map (kbd "<ret>") 'newline-and-indent)
(define-key asm-mode-map (kbd "M-.") 'helm-etags-select)
You can also have basic completion with
company-complete when pressing
(define-key asm-mode-map (kbd "<backtab>") 'company-complete)
You can use
<tab> to trigger completion because both
M-i run the same command
tab-to-tab-stop that inserts spaces or tabs depends on your setting of
indent-tabs-mode. The nice thing with
company-mode is that you get a brief description of currently highlighted candidate in the minibuffer, if available. For example, if you have a definition like this:
KeyStrokes word 0
When you move the cursor to
KeyStrokes candidate, it prints
word 0 in the minibuffer.