Published on 30 December 2022

TS file rename from https://discord.com/channels/789885435026604033/789890622424219658/931962294903144448
If you would scroll a little bit up in the msgs you would find a link (from ajit, me) of a lua nvim implementation
Only thing being you need to code in a way to delete old file (as on rename a new file is created) ← double check this

Independent buffers for same file https://youtu.be/Ey54ovJUdQ4?t=887

Buffers, windows and frames https://www.oreilly.com/library/view/learning-gnu-emacs/0596006489/ch04.html

zc and zo work to fold code. to fold jsx tags, there is <C-c><C-f>. To go to bracket pair, use %. To go to tag pair, there is <C-c><C-n>.
Update: with matchit installed, all one would need is %.

To get value of a variable, use <C-h>v and type in the variable’s name.

Commands like :!sort, :noh, :read .bashrc are still supported.

to switch to a buffer, use <C-x>b.

In magit, sometimes j command is overriden by vim keys. Use h to bring help first and then type the key. Alternatively, use <C-z> to toggle to Emacs mode.

Apart from <C-n> <C-p>, if fn overload is available (shown by 1/3), use alt+n alt+p to toggle b/w them.
^ C-j and C-k also works too

gd and gD to definition and references. SPC c t will go to type definition. there’s SPC c i to go to implementations. In

const fzf = new Fzf();

try using gd and SPC c t on fzf which is in 2nd line to see the difference.

Right click, hover, mouse click, drag to resize splits (windows) works in emacs.

Don’t use lsp symbols for a file, use <SPC> s i or g O instead. LSP stuff is under <SPC> c.

There is diff-buffer-with-file under M-x to see modifications done after last save.

https://emacs.stackexchange.com/a/189 ← there is find alternate file option in emacs. Not sure how to use it
^ Also, this question is actually related to reloading the file when it changes on file system. the process is called reverting in emacs https://emacs.stackexchange.com/a/355.

To exit a command or a menu, while Esc works, another way is to <C-g>. More at https://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-fourteen-days.html. q also sometimes help you to quit buffers, info, helpers and finders.

<C-c> is like user keymapping space. also it somewhat changes depending on which file/buffer you are on.

Workspaces https://github.com/hlissner/doom-emacs/blob/develop/modules/ui/workspaces/README.org
Echo all using ctrl+shift+t
add new using ctrl+t
M-x persp or M-x workspace
^ C-c p                   ^ SPC TAB
^ this is better, gt and gT also works

nnoremap (nore) doesn’t exist because all maps are overrides. To see current key assignment command use SPC h k or C-h k and type that key. It can be a single key or key chord.
To get help on keybinding itself, see SPC h f map\!.

Might be super outdated: github.com/noctuid/evil-guide

SPC o - to open dired.

As doing ciw on stuff_l|ike_this would only affect like and not the whole variable, Doom provides cio/cao (change inner/around symbol). There are other text objects too, see https://github.com/hlissner/doom-emacs/blob/43ddb109703c25a105c4d2e156f6055ffc58181b/docs/faq.org#why-do-non-evil-users-get-expand-region-but-not-evil-users

On file watchers https://github.com/hlissner/doom-emacs/issues/6000#issuecomment-1013795522
I haven’t increased file watchers in ubuntu yet like what vscode usually suggests

On .elc files when running doom doctor, also just to make a fresh start

While gi, g;, c-o in insert mode do work, ops like alt+o, alt+h don’t.

Rather than using :noh, you can use Esc. Same for f/T motions.

Display checkmarks in org mode https://discord.com/channels/406534637242810369/484105925733646336/929169461511061525

On using special chars https://www.youtube.com/watch?v=HjUquOQtIYs


To add lines below and above, there are shortcuts around 2 [ o. Search for evil newline in M-x.

% navigates to bracket pair. you can do the same using doom emacs, but using Tab is more ergonomic.
Update: with evil-matchit installed, using % is more preferrable.

From https://github.com/syl20bnr/spacemacs/issues/10502#issuecomment-404453194

(setq default-text-properties '(line-spacing 0.1 line-height 1.1))

Another option is https://github.com/tam5/font-patcher (uses fontforge, so not that good).

There is (SPC s i), while non-LSP, it also shows parent symbol (like constructor’s class name) thus it is more useful:

(evil-define-key 'normal 'global (kbd "SPC j") 'consult-lsp-file-symbols)

I don’t think i would ever use it, also seems like (SPC s s) just does exactly this:

(evil-define-key 'normal 'global (kbd "SPC l") 'consult-line)

Didn’t automatically detected projects for me
Also need to add a tmp wksp which isn’t ghq as it would be my playground:

(setq projectile-project-search-path '("~/ghq"))

Use M-<number> to directly insert
or use C-<number>j to navigate to the item in completion

(setq company-show-quick-access t)

If you want to expand snippet on TAB, disable https://github.com/hlissner/doom-emacs/blob/f73ae8eee176b46fc8d02d8702d2da9bc25b3472/modules/config/default/%2Bevil-bindings.el#L145
and use yas/expand instead (find it on M-x).

https://github.com/kana/vim-textobj-user for ci, (change inner comma)

Yanked from browser, deleted stuff on emacs and now used paste but it pasted the deleted text? Fear not, C-p (evil-paste-pop) is here. (There’s also C-n but it is to navigate forward in paste history.)

Don’t use visual mode to select and yank. your cursor will also won’t move after yanking if you are on normal mode (see https://github.com/emacs-evil/evil/issues/727). If you are on fn ending bracket, you can do y<tab> to yank content inside {} including brackets, otherwise do yV<tab> to yank whole fn.

Use gss to go to specific row and column.

(map! :nvo "gj" #'evilem-motion-next-line)
(map! :nvo "gk" #'evilem-motion-previous-line)

^^ I could’ve used these last two bindings but I myself want to encourage the use of gss.

To get typewriter mode, see https://github.com/zkessin/centered-cursor-mode (see also the repo where it is forked from)
https://two-wrongs.com/centered-cursor-mode-in-vanilla-emacs and https://www.reddit.com/r/emacs/comments/efywlx/scrollpreservescreenposition_screws_up/

When using SPC SPC and on a file list, use C-; to see all available options for it (embark shows these options). While options list (which-key) is opened you can use C-h to search and select an option. I still do not know how to see next list of options (2/3) for example through which key.
There’s also https://hungyi.net/posts/doom-emacs-search-replace-project/ ← for mass search and replace.

golang does auto import, but we also have M-x go impor. (Past Ajit might meant import, not impor).

To swap lines, use M-arrow up/down. See https://discord.com/channels/406534637242810369/406554085794381833/936273837471985716

When searcing a project for text with SPC s p, is there a way to limit to a specific file extension?

You could use foo -- -g*.org (well, any ripgrep flags)
Don’t quote the glob term.

#foo#org will work too, but will produce more false positives
The Y in #X#Y is matched against all output, including file names.

foo -- ARGS
ARGS = ripgrep arguments

bar = vertico/consult is doing the filtering

Indentation is detected using dtrt-indent-mode https://discord.com/channels/406534637242810369/406554085794381833/935927391430266900
Just so you know, as it looks like you already solved this issue but in C mode (and I believe even C-like modes, which is basically several modes) there’s a variable called c-indent-tabs-mode that supersedes the standard indent-tabs-mode. In fact, you should check whatever modes you use to see if and what formatting and indentation functionality they use, override, or downright ignore the standard settings of.

Get https://github.com/sgur/vim-textobj-parameter functionality!!
change fn arg using: ci, (vim) → cia (emacs) & ca,caa
This is provided by the evil-args package
There’s also gsa/gsA to move b/w args

Still don’t know what can be done for https://github.com/Julian/vim-textobj-variable-segment
Maybe you can modify this? https://emacs.stackexchange.com/questions/14439/evil-package-alternative-for-motion-through-camelcase-words
And also taking help from evil-args

For changing case, there are:

For future use https://github.com/meain/evil-textobj-tree-sitter

Also redir to new buffer on SPC e maybe
Make ls+ work (show only modified buffers, it’s a vim things)
How to only navigate through errors when warnings are shown too?
List all errors
List search results and filter, remove, navigate (gf and gF)
While searching, skip to next file result
Which key embark see next shortcuts

Also a way to store ripgrep results in a folder for easy search on them like vim-bqf (there is embark-export but it’s somewhat clunky)

While in insert mode, what key do you press to expand a snippet? Asking because currently, pressing TAB goes through autocompletion list

Live file change like when using find references when navigating

Disable ESC on quick jk press https://github.com/hlissner/doom-emacs/issues/1946#issuecomment-546012335
that link above also mentions after! syntax
usually it’s not safe to disable an internal pkg this way https://github.com/hlissner/doom-emacs/issues/2280#issuecomment-569976805
another way at https://discord.com/channels/406534637242810369/936355238582050887/936355552794120213 (← if this doesn’t open, just copy and search for the link above)

C-h b b ← describe bindings, is context aware | there’s also M-x describe-mode

(defun do-the-thing ()
  (select-window (split-window-below))

(map! :n "C-k" #'do-the-thing)

K key may give info alongwith type info when used at a point (symbol)
others ctrl ], K, gd, c-i, c-o, c-t, g-; , g-, ← vim

Use editorconfig for indentation

Write :noa w equivalent to save without format-all

Install treesitter
and treesitter powered comments, see https://github.com/numToStr/Comment.nvim

On go and flycheck https://discord.com/channels/406534637242810369/406554085794381833/936968917006577724

c-h v major-mode to see major mode, other way which somewhat gives incorrect results is c-h b m

M-/ in insert mode to auto-complete from buffer ← it’s prety powerful when used correctly
See https://emacs.stackexchange.com/questions/15179/company-backend-for-words-inside-the-buffer
and https://emacs.stackexchange.com/questions/2762/jump-to-documentation-buffer-with-company-mode

C-x C-f in insert modes completes file-names.
There’s also company-files backend.

Emacs has alt+q to wrap comment, and apparently, it wrap only comment if there is source code just below it (looking at you vim’s gq and gQ)
Still, not as smart as vscode comment plugin.

Windows term + emacs https://discord.com/channels/406534637242810369/930877409929068564/935956670780170310

Doom works fine for me with emacs-ng after deleting .emacs.d and re-cloning/reinstalling Doom. You might be able to get way with just deleting .emacs.d/.local/straight and running doom build again.

rm -rf ~/.emacs.d/.local/straight && doom sync

M-j to indent to new line is pretty useful if you want to format code a little (or comment even).

If getting error on describe variable or describe key

Apart from using SPC < to list all buffers, one can also use :b <partial filename><tab>









word wrap.
^^^ toggle word wrap not working

voicemail in inbound

in emacs mode, many time j/k and alt-p/n can work, and c-n/p work like j/k of vim in vc-region-history


you to toggle emacs state using C-z


^ on persp-mode and emacs client

On multi cursors https://discord.com/channels/406534637242810369/406554085794381833/938105347778936892

(map! :n "R" #'whatever-you-want) ;; replace evil map

Fix issues w/ WSL copy https://github.com/microsoft/wslg/issues/15
Don’t upgrade using microsoft store version, otherwise you would face port issues. (See this post)

Doom provides a way to open link using gf. but you would need to enable windows interop

On invalidating caching when using magit https://emacs.stackexchange.com/a/26272

Taken from https://old.reddit.com/r/evilmode/comments/may1mp/what_is_evils_equivalent_of_vims_ctrlg/grwapi5/

M-x indirect

If you visit the wrong file unintentionally by typing its name incorrectly, type C-x C-v (find-alternate-file) to visit the file you really wanted. C-x C-v is similar to C-x C-f, but it kills the current buffer (after first offering to save it if it is modified). When C-x C-v reads the file name to visit, it inserts the entire default file name in the buffer, with point just after the directory part; this is convenient if you made a slight error in typing the name.

M-x find-alternate-file <RET> and then hitting enter is a great way to reset a file if :e(!) doesn’t work

C- a/e/w/u — start / end of line / clear word / clear line (from terminal, applies in emacs/vim too)