- Make sure you have Emacs with treesitter support:
M-:
(treesit-available-p)
RET
should returnt
- Make sure you have installed python treesitter grammar
tl;dr: If you want to just know the method, skip to How to
section
Clangd is a state-of-the-art C/C++ LSP that can be used in every popular text editors like Neovim, Emacs or VS Code. Even CLion uses clangd under the hood. Unfortunately, clangd requires compile_commands.json
to work, and the easiest way to painlessly generate it is to use CMake.
For simple projects you can try to use Bear - it will capture compile commands and generate compile_commands.json
. Although I could never make it work in big projects with custom or complicated build systems.
But what if I tell you you can quickly hack your way around that, and generate compile_commands.json
for any project, no matter how compilcated? I have used that way at work for years, originaly because I used CLion which supported only CMake projects - but now I use that method succesfully with clangd and Neovim.
In the last years I've been asked multiple times about the comparison between raylib and SDL libraries. Unfortunately, my experience with SDL was quite limited so I couldn't provide a good comparison. In the last two years I've learned about SDL and used it to teach at University so I feel that now I can provide a good comparison between both.
Hope it helps future users to better understand this two libraries internals and functionality.
:help :global
is an incredibly cool command.
One thing I like to do with :global
is to list lines matching a given pattern in the current file and use that to move around. It looks like this:
:g/let/#
7 let &path .= 'src/**,public/**,static/**'
31 unlet b:gqview
33 nmap GQ :let b:gqview = winsaveview():set opfunc=Formatg@
" gq wrapper that: | |
" - tries its best at keeping the cursor in place | |
" - tries to handle formatter errors | |
function! Format(type, ...) | |
normal! '[v']gq | |
if v:shell_error > 0 | |
silent undo | |
redraw | |
echomsg 'formatprg "' . &formatprg . '" exited with status ' . v:shell_error | |
endif |
" :[range]SortGroup[!] [n|f|o|b|x] /{pattern}/ | |
" e.g. :SortGroup /^header/ | |
" e.g. :SortGroup n /^header/ | |
" See :h :sort for details | |
function! s:sort_by_header(bang, pat) range | |
let pat = a:pat | |
let opts = "" | |
if pat =~ '^\s*[nfxbo]\s' | |
let opts = matchstr(pat, '^\s*\zs[nfxbo]') |
" 24 simple pseudo-text objects | |
" ----------------------------- | |
" i_ i. i: i, i; i| i/ i\ i* i+ i- i# | |
" a_ a. a: a, a; a| a/ a\ a* a+ a- a# | |
" can take a count: 2i: 3a/ | |
for char in [ '_', '.', ':', ',', ';', '<bar>', '/', '<bslash>', '*', '+', '-', '#' ] | |
execute "xnoremap i" . char . " :<C-u>execute 'normal! ' . v:count1 . 'T" . char . "v' . (v:count1 + (v:count1 - 1)) . 't" . char . "'<CR>" | |
execute "onoremap i" . char . " :normal vi" . char . "<CR>" | |
execute "xnoremap a" . char . " :<C-u>execute 'normal! ' . v:count1 . 'F" . char . "v' . (v:count1 + (v:count1 - 1)) . 'f" . char . "'<CR>" | |
execute "onoremap a" . char . " :normal va" . char . "<CR>" |