Useful snippets

    Toggle casing vim

    Thu 15. May 2025 | 2025-05-15

    Normal mode

    g~iw # toggle
    
    guiw # lowercase
    
    gUiw # uppercase
    

    Visual mode

    u # lowercase
    
    U # uppercase
    

    tmux config

    Thu 08. May 2025 | 2025-05-08

    Active colors

    Window/tab bar

    In version 3.3 use the answer in comment provided here by @AntK.

    set-window-option -g window-status-current-style bg=red
    In version 2.9 You should change this options to something like:
    

    Active window title color

    setw -g window-status-current-style fg=black,bg=white
    

    https://unix.stackexchange.com/questions/210174/set-the-active-tmux-tab-color

    Panel

    https://stackoverflow.com/questions/4889724/how-can-you-tell-which-pane-in-tmux-is-focused

    Ascii tegn

    Mon 05. May 2025 | 2025-05-05

    ─ │ ┐ ┘ ┌ └ ├ ┤ ┬ ┴ ┼ 
    ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ 
    

    Autohotkey & replacements

    Mon 28. April 2025 | 2025-04-28

    Windows

    Shift F1 to open http://localhost:5173/

    script.ahk

    +F1::Run "http://localhost:5173/"
    

    pn1 to print 29090816894 (macro)

    script.ahk

    :*:pn1::29090816894 
    

    keyboard shortcut to print characters

    backtick (`) and tilde (~)

    script.ahk

    !1::SendText "``"
    !2::Send "~ "
    

    Mac

    Shift F1 to open http://localhost:5173/

    Shortcuts app

    1. New shortcut
    2. Open URL
    3. Details > Run with: (type Shift F1)

    Shortcut app may be closed

    Shortcut app

    pn1 to print 11113306361

    https://altitudemarketing.com/blog/text-macros-macos/

    Settings app

    keyboard shortcut to print characters

    backtick (`) and tilde (~)

    .config/skhd/skhdrc

    lalt - 1: skhd -t "\`"
    lalt - 2: skhd -t "~"
    

    Ctrl Shift d to print 11113306361

    Follow same approach as printing current date: https://useful-snippets.netlify.app/posts/print-current-date/

    SKHD links

    MSYS2

    Mon 07. April 2025 | 2025-04-07

    msys2.org

    • Node: pacman -S mingw-w64-x86_64-nodejs: https://packages.msys2.org/packages/mingw-w64-x86_64-nodejs

    Use MINGW64 app?

    wezterm pros&cons

    Wed 02. April 2025 | 2025-04-02

    pros

    • enkel å confige, forståelige docs

    cons

    • kan ikke defaulte shell til bash?
    • ctrl c stopper prosess selv i "visual" markering mode. WSL gjorde ikke det
    • treg på windows drive... fordi den fortsatt buker wsl-ubuntu bash?

    Vim multiple cursors / gn

    Mon 17. March 2025 | 2025-03-17

    multi cursor addons


    Vim gn

    cgn: enter change mode for next occurence

    1. / search for word
    2. cgn change word
    3. . repeat for next word

    Search navigate stuff

    Regex & capture groups

    Thu 16. January 2025 | 2025-01-16

    Match ett ord

    • [^\s]+
    • [a-z]+
    • \w+??

    Search replace capture group

    for å replace

    - export default Component;
    + export { Component }
    

    Kan man kjøre

    Search export default (\w+)

    Replace export { $1 }

    Se pål-notater for mer...

    Newline i search replace

    search replace kan legge til newline med \n