Useful snippets

    Finne prog med port

    2021-03-26

    Relatert

    Eksempel

    Scenario

    Port er opptatt:

    Git bash

    $ docker-compose up -d
    Creating network "lamp_default" with the default driver
    Creating lamp_adminer_1 ...
    Creating lamp-redis     ...
    Creating lamp-database  ... error
    Creating lamp_adminer_1 ... done
    Creating lamp-redis     ... done
    ccess a socket in a way forbidden by its access permissions.
    

    ERROR: for database Cannot start service database: Ports are not available: listen tcp 127.0.0.1:3306: bind: An attempt was made to access a socket in a way forbidden by its access permissions. ERROR: Encountered errors while bringing up the project.

    Finne hvillket program som bruker det

    $ netstat -ano | findstr '3306'
      TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING       5028
      TCP    [::]:3306              [::]:0                 LISTENING       5028
    

    $ tasklist | findstr '5028' mysqld.exe 5028 Services 0 4,144 K

    Resultat

    mysqld.exe
    

    https://veerasundar.com/blog/2009/10/how-to-check-which-application-is-using-which-port/

    Prosjekt som bruker WSL? Hvordan bytte til Git Bash

    2022-06-05

    Hvordan bytte fra wsl til git bash i et prosjekt

    I et prosjekt hvor du allerede har installert npm modules med wsl er det litt tricky å gå over til git bash. Har opplevd det i hvert fall.

    Her er et forsøk som funket, men det er sannsynigvis unødvendige steg her.

    Hvorfor bytte? Vel... react-snap og bruk av chromium er visst ikke helt akseptert av WSL

    WSL

    1. npm cache verify
    2. delete node_modules
    3. npm cache clean --force

    Git bash

    1. npm rebuild
    2. lukk VS Code og åpne som Admin
    3. npm i
    4. npm start

    Og det funker! "React-scripts is not recognised" – no more!

    https://coder-coder.com/npm-clear-cache/
    https://stackoverflow.com/questions/47928735/react-scripts-is-not-recognized-as-an-internal-or-external-command

    Kule porteføljer

    2023-10-22

    MEST UKONVENSJONELLE PORTEFØLJER

    eleventy stuff

    2023-10-22

    Eleventy stuff

    eleventy.js

    Return specific post

    module.exports = function (eleventyConfig) {
      eleventyConfig.addPassthroughCopy("bundle.css");
      eleventyConfig.addPlugin(syntaxHighlight);
      eleventyConfig.addCollection("post", function (collection) {
        const coll = collection.getFilteredByTag("post");
        console.log(coll);
        return [coll[20]];
      });
    };

    Return first 5 posts

    module.exports = function (eleventyConfig) {
      eleventyConfig.addPassthroughCopy("bundle.css");
      eleventyConfig.addPlugin(syntaxHighlight);
      eleventyConfig.addCollection("post", function (collection) {
        const coll = collection.getFilteredByTag("post");
        console.log(coll);
        return coll.slice(0, 5);
      });
    };

    Ivareta git historikk ved file renaming

    2023-10-22

    Ifølge https://koukia.ca/rename-or-move-files-in-git-e7259bf5a0b7

    Hvis du vil være sikker på at file history blir ivaretatt i en fil om du renamer den (eller flytter den), så må du bruke commando-linja og kjøre

    git mv mycoolclass.cs myCoolClass.cs
    

    eller

    git mv layout/CardList common/List
    

    Hvis du renamer direkte i editor-en, så kan du ikke være sikker på at git skjønner at det er samme fil.

    Når du ivaretar git history så kan du bruke ting som git log -p --follow -- path/to/filename. Se gist: https://gist.github.com/paalss/7127b421ff7f3a862ae8d76c772aeb6a

    Kommentarer:

    Mulig det er unødvendig å bruke mv. Da jeg renamet og flyttet layout/CardList til common/List så skjønte git at disse to filene var 74% like.

    git log -p --follow components/common/List/List.tsx funker fjell. Historikken strekker seg tilbake til før renamingen

    Links

    2023-10-22

    Links

    Syntax highlighting i Nano commit diff

    2023-10-22

    nano ~/.nanorc

    sett inn

    https://gist.github.com/keithamus/736220/5e069767b22841610ee18fd2f92bd6026f5eb41d

    syntax "gitcommit" "COMMIT_EDITMSG$"
    color white "#.*"
    color green "#.(modified|added|deleted|unmerged|copy-edit|rename).*"
    color yellow start="# Changes.*" end="# Changed.*"
    color brightgreen "^\+.*"
    color brightred "^-.*"
    color brightyellow "(diff|index|---|\+\+\+).*"
    color brightmagenta "@@.*"
    color white "# Changes .*"
    color white "# Changed .*"
    color white "#.*\(use .*"
    color white "#$"
    

    =

    farger i git commit vinduet!

    Oh my bash adding missing code completions

    2023-10-22

    source /usr/share/bash-completion/completions/git
    __git_complete gco _git_checkout
    __git_complete gb _git_branch
    __git_complete gbs _git_bisect
    __git_complete ga _git_add
    __git_complete gcmsg _git_commit
    __git_complete gcs _git_commit
    __git_complete gd _git_diff
    __git_complete gl _git_pull
    __git_complete gp _git_push
    __git_complete gm _git_merge

    Ohmybash

    2023-10-22

    Hvordan starte med ohmybash, velge theme og laste ned nødvendig font icons

    Installasjon

    bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
    

    Du får med masse aliases med dette. List alle med alias

    Velge theme

    nano ~/.bashrc
    
    OSH_THEME="agnoster"
    

    Save & exit: ctrl + x, y, [Enter]

    Reload:

    . ~/.bashrc
    

    Hvis du har mellomrom i path to oh-my-bash insallation, slik:

    # Path to your oh-my-bash installation.
    export OSH=/c/Users/Pål Stakvik/.oh-my-bash
    

    Må du enkapsulere path-en i quotes, ellers får du error

    skaffe nødvendige font icons

    evt. se på agnoster-zsh-theme

    last ned Hack-fonten

    1. Gå til https://sourcefoundry.org/hack/ og last ned font. Windows executable funker for WSL og VS Code
    2. Kjør executable i nedlastninger
    3. Godta restart

    Sette WSL til å bruke riktig font

    1. Åpne WSL
    2. høyreklikk toppmeny, velg 'properties'
    3. velg "Hack" fonten

    ubuntu-omb

    Sette VS Code til å bruke riktig font

    1. ctrl + shift + p
    2. settings.json
    3. lim inn "terminal.integrated.fontFamily": "Hack", https://stackoverflow.com/questions/37895501/display-issue-with-oh-my-zsh-agnoster-theme#answer-38475948

    vscode-omb

    Erstatte user @ hostname

    ...Med kun hostname:

    prompt_context() {
      if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
        prompt_segment black default "$USER"
      fi
    }

    Eller hva det skal være:

    prompt_segment black default "P"

    image (9)

    prompt_segment black default "%(!.%{%F{yellow}%}.)$USER" skal visstnok også funke, men jeg får bare slik tekst da:

    image (8)

    Git bash merknader

    Får du permission denied ved git add .?

    • Kjør VS Code som administrator

    Får du

    hint: Waiting for your editor to close the file... 'C:\Users\Pål' is not recognized as an internal or external command,
    operable program or batch file.
    error: There was a problem with the editor '"C:\Users\Pål Stakvik\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --wait'.
    Please supply the message using either -m or -F option.
    

    ved git commit (-v)

    • Prøv å kjør git config --global core.editor "code --wait". Les mer https://stackoverflow.com/questions/52195877/how-can-i-fix-git-commit-error-waiting-for-your-editor-to-close-the-file-wi

    fordeler/ulemper med Windows/MacOS

    2023-10-22

    mislikte/misliker med mac:

    1. man må ha app store account og derav også registrere bankkort for å oppdatere OS. (Tror denne er utdatert)
    2. Finder (filutforsker) sorterer filtyper helt alfabetisk i stedet for å putte mapper over alt annet dette kan endres i innstillinger nå
    3. man må aktivt rydde opp filene hele tiden for å få det på stell, og hvis man vil ha auto sortering på noe annet enn filnavn må man takke seg til å gruppere filene i forskjellige rader dette er også mulig nå!
    4. kryss og minifiser og det er på feil side, dessuten er knappene veldig små
      1. dette bryr jeg meg ikke noe om lenger. fungerer helt greit å bruke tastatursnarveier
    5. skrivebordet plasserer alltid programmer på feil side (og man må flytte over programmene manuelt og stille inn grid slik at det går. Det resettes når man velger sortering og nye programmer dukker opp til høyre)
      1. samme her
    6. savner muligheten til å raskt forvandle vindu til å oppta halvparten av skjermen det er mulig nå!
    7. fullscreen-uten-å-ta-bort-dock er upraktisk man trenger ikke bruke denne fullscreen varianten
    8. På Mac XAMPP versjonen må man aktivt mounte xampp/lampp-mappa. Slitsomt
      1. bruker ikke dette programmet mer
    9. launchpad (listen over alle appene) kan noen ganger ta lang tid på å laste inn noen programmer. i hvert fall etter seks år.
    10. Teit at menyelementer ofte finnes på to steder: Både i menylinje og i selve programvinduet. Er for det meste windows programvarer dette gjelder.
    11. ja, det er litt fjollete, men det blir man vandt til
    12. Hvis derimot menyelement kun finnes på det ene stedet (i VSCode så vises den bare i overmenyen, i XAMPP vises nesten ingenting der) så ender man opp med mye ubrukt luft som bare opptar skjermplass
    13. Man kan ikke trykke fn + esc for å slå på og av funksjonstaster
    14. når man kobler til et kamera så går macen bare ut i fra at du vil bruke den fotogalleri-appen. Det er så irriterende! Hvis man kopierer camera raw file derfra så blir de til jpg når man limer dem inn! Jeg trenger å åpne i Finder!
    <h1>Hello CodeSandbox</h1> <h2 id="heading1">Heading 1</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading2">Heading 2</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading3">Heading 3</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading4">Heading 4</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading5">Heading 5</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> </article> </div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script> <script> /*const scrollSpy = new bootstrap.ScrollSpy(document.body, { target: "#list-example" });*/ // $("body").scrollspy({ target: "#navbar-example" }); </script> </body> </html>

    with JS ❌

    Highlight only goes down

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Static Template</title>
        <link
          href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
          rel="stylesheet"
          integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
          crossorigin="anonymous"
        />
      </head>
      <body>
        <div style="display: flex; background: #f5f2f2;">
          <aside>
            <div id="list-example" class="list-group">
              <a class="list-group-item list-group-item-action" href="#heading1">
                Heading 1
              </a>
              <a class="list-group-item list-group-item-action" href="#heading2">
                Heading 2
              </a>
              <a class="list-group-item list-group-item-action" href="#heading3">
                Heading 3
              </a>
              <a class="list-group-item list-group-item-action" href="#heading4">
                Heading 4
              </a>
              <a class="list-group-item list-group-item-action" href="#heading5">
                Heading 5
              </a>
            </div>
          </aside>
          <article style="position: relative; height: 500px; overflow-y: scroll;">
            <h1>Hello CodeSandbox</h1>
            <h2 id="heading1">Heading 1</h2>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <h2 id="heading2">Heading 2</h2>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <h2 id="heading3">Heading 3</h2>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <h2 id="heading4">Heading 4</h2>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
            <h2 id="heading5">Heading 5</h2>
            <p>Some text</p>
            <p>Some text</p>
            <p>Some text</p>
          </article>
        </div>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
        <script src="jquery-3.6.4.min.js"></script>
        <script>
          const scrollSpy = new bootstrap.ScrollSpy(document.body, {
            target: "#list-example"
          });
          // $("body").scrollspy({ target: "#navbar-example" });
        </script>
      </body>
    </html>
    

    With JS ✔

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <title>Static Template</title>
        <link
          href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css"
          rel="stylesheet"
          integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD"
          crossorigin="anonymous"
        />
        <script
          src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
          integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
          crossorigin="anonymous"
        ></script>
      </head>
      <body>
        <div style="background: #f5f2f2;">
          <aside class="navbar navbar-nav fixed-top">
            <div id="list-example" class="list-group">
              <a class="list-group-item list-group-item-action" href="#heading1">
                Heading 1
              </a>
              <a class="list-group-item list-group-item-action" href="#heading2">
                Heading 2
              </a>
              <a class="list-group-item list-group-item-action" href="#heading3">
                Heading 3
              </a>
              <a class="list-group-item list-group-item-action" href="#heading4">
                Heading 4
              </a>
              <a class="list-group-item list-group-item-action" href="#heading5">
                Heading 5
              </a>
            </div>
          </aside>
          <article>
            <!--<article style="position: relative; height: 500px; overflow-y: scroll;">-->
    

    <h1>Hello CodeSandbox</h1> <h2 id="heading1">Heading 1</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading2">Heading 2</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading3">Heading 3</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading4">Heading 4</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading5">Heading 5</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> </article> </div> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script> <script> document.addEventListener("DOMContentLoaded", function () { var scrollSpy = new bootstrap.ScrollSpy(document.body, { target: "#navbar" }); }); </script> </body> </html>

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <link
          href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css"
          rel="stylesheet"
          integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD"
          crossorigin="anonymous"
        />
        <script
          src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"
          integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN"
          crossorigin="anonymous"
        ></script>
      </head>
    
      <body class="m-3">
        <center>
          <div id="navbar">
            <nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
              <ul class="navbar-nav">
                <li class="nav-item">
                  <a class="nav-link" href="#geeks1">Geeks</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="#for">For</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="#geeks2">Geeks</a>
                </li>
              </ul>
            </nav>
            <br /><br />
            <h1 class="text-success">GeeksforGeeks</h1>
            <strong>Scrollspy in Bootstrap 5 via Javascript</strong>
            <br />
            <div id="geeks1" class="border border-dark" style="padding: 20px 20px;">
              <h1>About Us</h1>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>
                GeeksforGeeks is a one-stop destination for Computer Science
                students. Computer Science is a huge field, thus students must
                select a suitable platform that can meet all their needs, including
                Tutorials & Courses, Placement Preparation, and Interview
                Experiences, among others.
              </p>
    
              <p></p>
            </div>
    
            <div id="for" class="border border-warning" style="padding: 20px 20px;">
              <h1>Advantages</h1>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
    
              <p>
                1. One-Stop Destination for Algorithms and Data Structures Knowledge
              </p>
              <p>2. Learn Multiple Programming Languages</p>
              <p>
                3. Boost Your Skills with Various GeeksforGeeks Courses
              </p>
            </div>
    
            <div
              id="geeks2"
              class="border border-secondary"
              style="padding: 20px 20px;"
            >
              <h1>Technology</h1>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
              <p>EEEEEEEEE</p>
    
              <p>
                A Computer Science portal for geeks. It contains well written, well
                thought and well explained computer science and programming
                articles, quizzes and practice/competitive programming/company
                interview Questions.
              </p>
              <p>Prepare With Us</p>
              <p>Get Hired With Us</p>
              <p>Grow With Usling!</p>
            </div>
          </div>
        </center>
    
        <script>
          document.addEventListener("DOMContentLoaded", function () {
            var scrollSpy = new bootstrap.ScrollSpy(document.body, {
              target: "#navbar"
            });
          });
        </script>
      </body>
    </html>

    React

    With data attributes ❌

    not working at all

    With JS 1: ✔

    import "./styles.css";
    import "bootstrap/dist/css/bootstrap.css";
    import "bootstrap/dist/js/bootstrap.bundle.min.js";
    import * as bootstrap from "bootstrap";
    

    import "../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js";

    import { useState, useEffect } from "react";

    export default function App() { useEffect(() => { const scrollSpy = new bootstrap.ScrollSpy(document.body, { target: "#list-example" }); }, []);

    return ( <div style={{ background: "#f5f2f2" }} > <aside class="navbar navbar-nav fixed-top"> <div id="list-example" className="list-group"> <a className="list-group-item list-group-item-action" href="#heading1" > Heading 1 </a> <a className="list-group-item list-group-item-action" href="#heading2" > Heading 2 </a> <a className="list-group-item list-group-item-action" href="#heading3" > Heading 3 </a> <a className="list-group-item list-group-item-action" href="#heading4" > Heading 4 </a> <a className="list-group-item list-group-item-action" href="#heading5" > Heading 5 </a> <a className="list-group-item list-group-item-action" href="#heading6" > Heading 6 </a> </div> </aside> <article> <h1>Hello CodeSandbox</h1> <h2 id="heading1">Heading 1</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading2">Heading 2</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading3">Heading 3</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading4">Heading 4</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading5">Heading 5</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading6">Heading 6</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> </article> </div> ); }

    With JS 2 ❌

    Highlight only goes down

    import "./styles.css";
    import "bootstrap/dist/css/bootstrap.css";
    //import "bootstrap/dist/js/bootstrap.js";
    import "bootstrap/dist/js/bootstrap.bundle.min.js";
    import * as bootstrap from "bootstrap";
    //import "bootstrap/dist/js/bootstrap.bundle.min";
    

    import "../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js";

    import { useState, useEffect } from "react";

    export default function App() { useEffect(() => { const scrollSpy = new bootstrap.ScrollSpy(document.body, { target: "#list-example" }); }, []);

    return ( <div style={{ display: "flex", background: "#f5f2f2" }} > <aside> <div id="list-example" className="list-group"> <a className="list-group-item list-group-item-action" href="#heading1" > Heading 1 </a> <a className="list-group-item list-group-item-action" href="#heading2" > Heading 2 </a> <a className="list-group-item list-group-item-action" href="#heading3" > Heading 3 </a> <a className="list-group-item list-group-item-action" href="#heading4" > Heading 4 </a> <a className="list-group-item list-group-item-action" href="#heading5" > Heading 5 </a> <a className="list-group-item list-group-item-action" href="#heading6" > Heading 6 </a> </div> </aside> <article data-bs-spy="scroll" data-bs-target="#list-example" tab-index="0" style={{ position: "relative", height: "500px", overflowY: "scroll" }} > <h1>Hello CodeSandbox</h1> <h2 id="heading1">Heading 1</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading2">Heading 2</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading3">Heading 3</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading4">Heading 4</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading5">Heading 5</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <h2 id="heading6">Heading 6</h2> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> <p>Some text</p> </article> </div> ); }

    npm link library

    2024-01-06

    Start

    tror det er viktig å uninstalle @scope/library først?

    • npm link in library
    • npm link @scope/library in app

    See if npm link works

    Run npm run build in the library. See if it updates the app.

    If stuff doesn't update in app, try

    • Restart app's dev server
    • Try as suggested in response from npm cache clean:
    npm install --cache /tmp/empty-cache

    Then restart app dev server

    Maybe try this on the app side

    • npm unlink @scope/library
    • npm link @scope/library

    Maybe also try this on the library side

    • npm unlink @scope/library
    • npm link

    I don't think it's necessary to uninstall library from node modules.

    If app cant find css

    attempting to import css from app (like with bootstrap css) does not always work for some reason

    inject css into js so that the package imports css by itself

    Reference

    When npm link works, npm ls @scope/package should return:

    app@0.1.0 /home/user/code/app
    └── @scope/package@0.1.0 extraneous -> ./../packages/package-components-project
    

    Useful information about npm link and cleaning up and stuff, see README!: https://github.com/jasonsturges/vite-typescript-npm-package

    npm link refuses to go away | clear npm cache

    2024-01-06

    If you mistakenly forget to unlink, you can manually clean up artifacts from yarn or npm.

    For npm, the link command creates global packages which can be removed by executing:

    sudo npm rm --global "mylib"
    • https://github.com/jasonsturges/vite-typescript-npm-package

    1. Try

    Maybe unlink package?

    npm unlink @scope/package

    clear / swap out cache on either project

    npm install --cache /tmp/empty-cache

    restart all servers

    1. try uninstalling globally and reinstalling dependency:
    sudo npm rm --global @scope/library
    npm rm --global @scope/library
    npm ls --global @scope/library
    npm uninstall @scope/library
    npm i @scope/librayr@latest --save-exact

    try deleting package.json

    try restarting servers???

    IDE functionalities deactivated by Vim

    2024-01-13

    hvor mye er deaktivert/ufordel i Webstorm/VSCode når du har på Vim plugin?

    Webstorm IdeaVim

    • IDE's multi-select with Ctrl D doesn't work with entering insert mode using eg. using a
    • but c works
    • Annoying to save file that is edited in commit changes window
      • if in normal mode, pressing "Esc" will exit "commit changes"-window
      • unlike when terminal is focused, you can't disable the "Esc-> focus normal file view"
    • paste from OS registry (copy paste from UI app into Webstorm in IdeaVim) Kan fikses ved å registrere ctrl C og ctrl V som IDE-shortcuts (se https://useful-snippets.netlify.app/posts/webstorm-ideavim-shortcut-settings/)
    • vim search not as good as built-in search
      • vim won't highlight/preview as you search/replace
      • to activate built-in search you would have to give up ctrl F and ctrl H to IDE

    VSCode's Vim

    • Fuzzy finder
    • Search?
    • Search in files?

    Rename React component

    2024-01-13

    
    # ask in what path the component resides in
    # if no answer is provided, use default value
    # -e flag is for giving cd-code completion while answering the question

    defaultValue=src/components/

    read -e -p "Where is component located? (default: $defaultValue): " location location=${location:-$defaultValue}

    cd $location

    read -e -p "Enter component name you want to rename: " currentName

    cd $currentName

    # if component ends with a trailing slash if [[ "$currentName" == */ ]]; then # remove trailing slash currentName=${currentName%/} fi

    indexFile=index.ts componentFile=$currentName.tsx storyFile=$currentName.stories.tsx stylesheetFile=$currentName.module.css stylesheetScssFile=$currentName.module.scss

    if [[ $currentName != "" ]]; then echo echo "This will try and rename:" echo "---- folder -----" echo $currentName echo echo "---- files -----" echo - $indexFile echo - $componentFile echo - $storyFile echo - $stylesheetFile echo - $stylesheetScssFile echo

    read -p "Enter new name: " newName if [[ $newName != "" ]]; then echo echo "search replace in files" echo

    sed -i "s/$currentName/$newName/g" $indexFile sed -i "s/$currentName/$newName/g" $componentFile sed -i "s/$currentName/$newName/g" $storyFile sed -i "s/$currentName/$newName/g" $stylesheetFile sed -i "s/$currentName/$newName/g" $stylesheetScssFile

    echo echo "rename files and folders" echo

    mv $componentFile $newName.tsx mv $storyFile $newName.stories.tsx mv $stylesheetFile $newName.module.css mv $stylesheetScssFile $newName.module.scss

    cd ..

    mv $currentName $newName/ fi fi

    IDE vim shortcut override settings

    2024-01-21

    Setup

    Install IdeaVim plugin

    Setup ctrl Q for toggling Vim on/off

    Keymaps

    Settings

    Turn Vim on

    reserve certain shortcuts to IDE

    like:

    • ctrl Q so we can toggle Vim efficiently
    • ctrl C to enable copying to OS registry
    • ctrl V to enable pasting from OS registry

    settings

     

     

    Zed

    {
      "context": "Editor && !menu",
      "bindings": {
        "ctrl-f": "buffer_search::Deploy",      // vim default: page down
        "ctrl-c": "editor::Copy",               // vim default: return to normal mode
        "ctrl-x": "editor::Cut",                // vim default: decrement
        "ctrl-v": "editor::Paste",              // vim default: visual block mode
        "ctrl-a": "editor::SelectAll",          // vim default: increment
        "ctrl-y": "editor::Undo",               // vim default: line up
        "ctrl-t": "project_symbols::Toggle",    // vim default: go to older tag
        "ctrl-o": "workspace::Open",            // vim default: go back
        "ctrl-s": "workspace::Save",            // vim default: show signature
        "ctrl-b": "workspace::ToggleLeftDock"   // vim default: down
      }
    },

    https://zed.dev/docs/vim#restoring-common-text-editing-and-zed-keybindings

     

    Vim

    2024-01-24

    https://vim.rtorr.com/

    Tmux

    2024-01-24

    Enter copy mode

    Ctrl [ eller begynn å scrolle

    Quit copy mode

    Ctrl c eller q

    https://stackoverflow.com/questions/67360866/tmux-exit-ctrl-b-and-stay-observing-the-session

    detach og tmux-attach:

    https://askubuntu.com/questions/824496/how-do-i-access-tmux-session-after-i-leave-it

    List sessions

    Navigate between sessions in tmux

    Ctrl b s

    Just list sessions

    tmux ls

    Med christoomey/vim-tmux-navigator package og instrukser fra https://www.josean.com/posts/tmux-setup / https://www.youtube.com/watch?v=U-omALWIBos&t=584s

    Resize pane

    Ctrl b h eller j eller k eller l

    Move between panes

    Ctrl h eller j eller k eller l

    Move windows

    Move to index

    Ctrl b . 2 

    ... Flere løsninger ...

    https://superuser.com/questions/343572/how-do-i-reorder-tmux-windows

    Neovim WSL copy to Windows system clipboard

    2024-02-13

    EDIT:

    unnamedplus funker for WSL. men bare ikke i windows 11 ser det ut som?

    See if Neovim lacks Clipboard

    :CheckHealth
    
    Clipboard (optional) ~
    - WARNING No clipboard tool found. Clipboard registers (`"+` and `"*`) will not work.
      - ADVICE:
        - :help |clipboard|
    

    Clipboard help: https://useful-snippets.netlify.app/posts/neovim-reference-manual/

    Copy entire line

    1. Select entire line visual mode
    2. Enter command:
    :'<,'>w !clip.exe

    https://stackoverflow.com/questions/61550552/how-to-copy-paste-from-vim-in-wsl

    Click & drag method

    1. :set mouse= Neovim config already has this set as default
    2. Click & drag
    3. Ctrl C

    Should be able to paste text content anywhere else

    copy from vim wsl

    Image: Copy paste " - Javascript" to OS system clipboard


    set clipboard+=unnamed funker for Ideavim (.ideavimrc). Neovim gjennom WSL trenger kanskje mer verktøy for å funke

    Uninstall node & reinstall with nvm

    2024-02-17

    Node uninstall

    sudo apt-get remove nodejs
    sudo apt-get remove npm

    Kanskje:

    sudo apt autoremove
    rm -rf ~/.npm
    rm -rf ~/.node

    https://stackoverflow.com/questions/32426601/how-can-i-completely-uninstall-nodejs-npm-and-node-in-ubuntu

    Confirm uninstallation

    node --version

    Nvm install

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash

    https://www.nvmnode.com/guide/download.html

    Quit WSL

    Reopen

    nvm install 24

    Latest Node version: https://nodejs.org/en/download

    nvm use 20

    Confirm version

    node --version

    Neovim reference manual - clipboard

    2024-02-17

    provider.txt Nvim

    NVIM REFERENCE MANUAL by Thiago de Arruda

    Providers provider

    Nvim delegates some features to dynamic "providers". This document describes the providers and how to install them. E319 Use of a feature requiring a missing provider is an error:

    E319: No "foo" provider found. Run ":checkhealth provider"

    Run the |:checkhealth| command, and review the sections below.

    [...]

    ============================================================================== Clipboard integration provider-clipboard clipboard

    Nvim has no direct connection to the system clipboard. Instead it depends on a |provider| which transparently uses shell commands to communicate with the system clipboard or any other clipboard "backend".

    To ALWAYS use the clipboard for ALL operations (instead of interacting with the "+" and/or "*" registers explicitly): >vim set clipboard+=unnamedplus

    See 'clipboard' for details and options.

    clipboard-tool The presence of a working clipboard tool implicitly enables the '+' and '*' registers. Nvim looks for these clipboard tools, in order of priority:

    • |g:clipboard|

    • pbcopy, pbpaste (macOS)

    • wl-copy, wl-paste (if $WAYLAND_DISPLAY is set)

    • waycopy, waypaste (if $WAYLAND_DISPLAY is set)

    • xclip (if $DISPLAY is set)

    • xsel (if $DISPLAY is set)

    • lemonade (for SSH) https://github.com/pocke/lemonade

    • doitclient (for SSH) https://www.chiark.greenend.org.uk/~sgtatham/doit/

    • win32yank (Windows)

    • termux (via termux-clipboard-set, termux-clipboard-set)

    • tmux (if $TMUX is set)

      g:clipboard To configure a custom clipboard tool, set g:clipboard to a dictionary. For example this configuration integrates the tmux clipboard: >vim

        let g:clipboard = {
              \   'name': 'myClipboard',
              \   'copy': {
              \      '+': ['tmux', 'load-buffer', '-'],
              \      '*': ['tmux', 'load-buffer', '-'],
              \    },
              \   'paste': {
              \      '+': ['tmux', 'save-buffer', '-'],
              \      '*': ['tmux', 'save-buffer', '-'],
              \   },
              \   'cache_enabled': 1,
              \ }
    

    If "cache_enabled" is |TRUE| then when a selection is copied Nvim will cache the selection until the copy command process dies. When pasting, if the copy process has not died the cached selection is applied.

    g:clipboard can also use functions (see |lambda|) instead of strings. For example this configuration uses the g:foo variable as a fake clipboard:

    vim

        let g:clipboard = {
              \   'name': 'myClipboard',
              \   'copy': {
              \      '+': {lines, regtype -> extend(g:, {'foo': [lines, regtype]}) },
              \      '*': {lines, regtype -> extend(g:, {'foo': [lines, regtype]}) },
              \    },
              \   'paste': {
              \      '+': {-> get(g:, 'foo', [])},
              \      '*': {-> get(g:, 'foo', [])},
              \   },
              \ }
    

    The "copy" function stores a list of lines and the register type. The "paste" function returns the clipboard as a [lines, regtype] list, where lines is a list of lines and regtype is a register type conforming to |setreg()|.

    clipboard-wsl For Windows WSL, try this g:clipboard definition:

    vim

        let g:clipboard = {
                    \   'name': 'WslClipboard',
                    \   'copy': {
                    \      '+': 'clip.exe',
                    \      '*': 'clip.exe',
                    \    },
                    \   'paste': {
                    \      '+': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
                    \      '*': 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
                    \   },
                    \   'cache_enabled': 0,
                    \ }
    

    ============================================================================== Paste provider-paste paste

    "Paste" is a separate concept from |clipboard|: paste means "dump a bunch of text to the editor", whereas clipboard provides features like |quote+| to get and set the OS clipboard directly. For example, middle-click or CTRL-SHIFT-v (macOS: CMD-v) in your terminal is "paste", not "clipboard": the terminal application (Nvim) just gets a stream of text, it does not interact with the clipboard directly.

    bracketed-paste-mode Pasting in the |TUI| depends on the "bracketed paste" terminal capability, which allows terminal applications to distinguish between user input and pasted text. https://cirw.in/blog/bracketed-paste This works automatically if your terminal supports it.

    ui-paste GUIs can paste by calling |nvim_paste()|.

    PASTE BEHAVIOR

    Paste inserts text after the cursor. Lines break at , , and . When pasting a huge amount of text, screen-updates are throttled and the message area shows a "..." pulse.

    In cmdline-mode only the first line is pasted, to avoid accidentally executing many commands. Use the |cmdline-window| if you really want to paste multiple lines to the cmdline.

    You can implement a custom paste handler by redefining |vim.paste()|. Example: >lua

    vim.paste = (function(lines, phase) vim.api.nvim_put(lines, 'c', true, true) end)

    ============================================================================== X11 selection mechanism clipboard-x11 x11-selection

    X11 clipboard providers store text in "selections". Selections are owned by an application, so when the application gets closed, the selection text is lost. The contents of selections are held by the originating application (e.g., upon a copy), and only passed to another application when that other application requests them (e.g., upon a paste).

    primary-selection quotestar quoteplus quote+

    There are three documented X11 selections: PRIMARY, SECONDARY, and CLIPBOARD. CLIPBOARD is typically used in X11 applications for copy/paste operations (CTRL-c/CTRL-v), while PRIMARY is used for the last selected text, which is generally inserted with the middle mouse button.

    Nvim's X11 clipboard providers only use the PRIMARY and CLIPBOARD selections, for the "*" and "+" registers, respectively.

    ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl:

    lazygit issues

    2024-02-20

    • kan ikke alltid pulle eller pushe fra branch window.
    • rename branch usynliggjør tekst mens man beveger markøren bakover, men kommer tilbake igjen når man skriver igjen
    • åpne lazygit stash og så klikke _ (underscore). Så ser man ikke innholdet i den stashen. Man må bevege seg ned og opp igjen først

    Regex & capture groups

    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

    Vim multiple cursors / gn

    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

    wezterm pros&cons

    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?

    MSYS2

    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?

    Autohotkey & replacements

    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

    Ascii tegn

    2025-05-05

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

    tmux config

    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

    Vim registers

    2025-05-16

    Yank / delete to 's' register

    prepend with "s

    yank

    "sy*
    

    delete

    "sd*
    

    paste

    "sp
    

    insert mode:

    <C-r>*
    

    Bootstrap margin & padding (spacing)

    2025-06-03

    Spacing utilities that apply to all breakpoints, from xs to xxl, have no breakpoint abbreviation in them. This is because those classes are applied from min-width: 0 and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.

    The classes are named using the format {property}{sides}-{size} for xs and {property}{sides}-{breakpoint}-{size} for sm, md, lg, xl, and xxl.

    Where property is one of:

    • m - for classes that set margin
    • p - for classes that set padding

    Where sides is one of:

    • t - for classes that set margin-top or padding-top
    • b - for classes that set margin-bottom or padding-bottom
    • s - (start) for classes that set margin-left or padding-left in LTR, margin-right or padding-right in RTL
    • e - (end) for classes that set margin-right or padding-right in LTR, margin-left or padding-left in RTL
    • x - for classes that set both *-left and *-right
    • y - for classes that set both *-top and *-bottom blank - for classes that set a margin or padding on all 4 sides of the element

    Where size is one of:

    • 0 - for classes that eliminate the margin or padding by setting it to 0
    • 1 - (by default) for classes that set the margin or padding to $spacer * .25
    • 2 - (by default) for classes that set the margin or padding to $spacer * .5
    • 3 - (by default) for classes that set the margin or padding to $spacer
    • 4 - (by default) for classes that set the margin or padding to $spacer * 1.5
    • 5 - (by default) for classes that set the margin or padding to $spacer * 3
    • auto - for classes that set the margin to auto

    (You can add more sizes by adding entries to the $spacers Sass map variable.)

    https://getbootstrap.com/docs/5.3/utilities/spacing/#notation

    Revert changes introduced in old commit

    2025-08-11

    Reverse apply changes from old commit

    git checkout <commit-hash>
    git log # copy previous commit hash
    git diff <previous-commit-hash> > diff.patch
    git checkout <main-or-up-to-date-branch>
    git apply diff.patch --reverse

    Create new commit that revert last commit

    git revert <last-commit-hash>

    compare branch with main

    2025-10-31

    CLI

    git diff main..HEAD # does not include uncommitted changes

    git diff main..$(git branch --show-current) # does not include uncommitted changes

    If MR author forgot to bring feature up to date with main.

    Compare against main at the time when branch was created.

    git diff $(git merge-base main HEAD) HEAD

    git show $(git branch --show-current)

    git branch --show-current is current branch

    Lazygit

    1. Highlight main branch
    2. Shift w & hit enter
    3. highlight the branch you want to compare with

    Webstorm

    1. GitToolBox? Should not be necessary I think

    https://useful-snippets.netlify.app/posts/webstorm-compare-with-branch/

    image

    VS Code

    1. Gitlens?

    Neovim

    1. Diffview

    Jump to main component vim

    2025-12-15

    Vim/Neovim

    yank filename without extension to 'f'-registry

    :let @f = expand('%:t:r')<CR>
    

    search for "const [contents in 'f'-registry]"

    :execute '/const ' . @f<CR>:nohlsearch<CR>
    

    added together

    :let @f = expand('%:t:r')<CR>:execute '/const ' . @f<CR>:nohlsearch<CR>
    

    Ideavim

    Copy file name to + register and search for it. Do not execute immediately () as CopyFileName also includes the file extension

    :action CopyFileName<CR>/const <c-r>+
    

    Fuzzy search

    2025-12-16

    Telescope & Fzf.vim

    Action Telescope Fzf.vim
    Open all items in quickfixlist [Q] Select all items with [Tab] and hit [Enter]
    List all vim keymaps require('telescope.builtin').keymaps :Maps

    More on Telescope: https://useful-snippets.netlify.app/posts/vim/

    Fzf lua

    Q for selecting all elements with fzf-lua:

    config.defaults.keymap.fzf["ctrl-q"] = "select-all+accept"
    

    From Lazyvim config: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/plugins/extras/editor/fzf.lua

    Fzf use cases

    Edit a file

    nvim $(fzf)

    Restore a file from another branch (here: main)

    git checkout main $(fzf)

    Run a specific test in Jest

    npx jest --runTestsByPath $(fzf)

    bash colors

    2026-01-09

    GREEN='\033[0;32m'
    RED='\033[1;91m'
    RESET='\033[0m'

    echo -e "${RED}Found errors:${RESET}" 
    echo -e "${GREEN}Success!${RESET}" 

    https://gist.github.com/JBlond/2fea43a3049b38287e5e9cefc87b2124

    Regular Colors

    Value Color
    \e[0;30m Black
    \e[0;31m Red
    \e[0;32m Green
    \e[0;33m Yellow
    \e[0;34m Blue
    \e[0;35m Purple
    \e[0;36m Cyan
    \e[0;37m White

    Bold

    Value Color
    \e[1;30m Black
    \e[1;31m Red
    \e[1;32m Green
    \e[1;33m Yellow
    \e[1;34m Blue
    \e[1;35m Purple
    \e[1;36m Cyan
    \e[1;37m White

    Underline

    Value Color
    \e[4;30m Black
    \e[4;31m Red
    \e[4;32m Green
    \e[4;33m Yellow
    \e[4;34m Blue
    \e[4;35m Purple
    \e[4;36m Cyan
    \e[4;37m White

    Background

    Value Color
    \e[40m Black
    \e[41m Red
    \e[42m Green
    \e[43m Yellow
    \e[44m Blue
    \e[45m Purple
    \e[46m Cyan
    \e[47m White

    High Intensity

    Value Color
    \e[0;90m Black
    \e[0;91m Red
    \e[0;92m Green
    \e[0;93m Yellow
    \e[0;94m Blue
    \e[0;95m Purple
    \e[0;96m Cyan
    \e[0;97m White

    Bold High Intensity

    Value Color
    \e[1;90m Black
    \e[1;91m Red
    \e[1;92m Green
    \e[1;93m Yellow
    \e[1;94m Blue
    \e[1;95m Purple
    \e[1;96m Cyan
    \e[1;97m White

    High Intensity backgrounds

    Value Color
    \e[0;100m Black
    \e[0;101m Red
    \e[0;102m Green
    \e[0;103m Yellow
    \e[0;104m Blue
    \e[0;105m Purple
    \e[0;106m Cyan
    \e[0;107m White

    Reset

    Value Color
    \e[0m Reset

    other styles

    echo -e "\e[1mbold\e[0m"
    echo -e "\e[3mitalic\e[0m"
    echo -e "\e[3m\e[1mbold italic\e[0m"
    echo -e "\e[4munderline\e[0m"
    echo -e "\e[9mstrikethrough\e[0m"
    echo -e "\e[31mHello World\e[0m"
    echo -e "\x1B[31mHello World\e[0m"

    UV python

    2026-01-22

    Docs: https://docs.astral.sh/uv/


    Install Python version: https://docs.astral.sh/uv/getting-started/features/#python-versions

    uv python install <version>

    Uninstall python version

    uv python uninstall <version> 

    Initialize project

    uv init

    Set correct python version in .python-version

    (re)-build venv

    uv venv

    Updates .venv files

    Activate venv environment

    source .venv/bin/activate
    deactivate

    Install dependencies from requirements.txt

    uv pip install -r requirements.txt

    Install one single dependency

    uv python add <package> 

    Run package command

    uv run <command> 

    prepush / git hooks

    2026-02-25

    To activate pre-push, rename .git/hooks/pre-push.sample to .git/hooks/pre-push


    Example script:

    GREEN='\033[0;32m'
    RED='\033[1;91m'
    RESET='\033[0m'
    

    branch_name="$(git branch --show-current)" allowed_branch_name="my-branch"

    if [ "$branch_name" != "$allowed_branch_name" ]; then echo "Current branch: ${RED}${branch_name}${RESET}" echo "Allowed branch: ${GREEN}${allowed_branch_name}${RESET}" echo echo "You can't push directly to this branch." exit 1 fi

    Insert the current branch into the top of the pre-push file

    sed -i "" "s&An example&$(git branch --show-current)\n# An example&" .git/hooks/pre-push

    Replace "An example" with current branch \n # An example

    Copy current branch to Mac clipboard

    echo $(git branch --show-current) | pbcopy

    From vim:

    :!echo $(git branch --show-current) | pbcopy

    Check if a file exists (pre-push example)

    2026-03-03

    Bash

    Search replace in pre-push(.sample)

    # 1: new branch name
    function update_prepush {
      sed -i'' -e "s/allowed_branch_name=\".*\"/allowed_branch_name=\"$1\"/g" $(gitHookFull pre-push)
    }
    

    #1: name of git hook (e.g. pre-push, post-commit) function gitHookFull { if [[ -f ".git/hooks/$1" ]]; then echo ".git/hooks/$1" else if [[ -f ".git/hooks/$1.sample" ]]; then echo ".git/hooks/$1.sample" else echo "undefined" fi fi }

    Check existence

    lpo() {
      if [[ -f ".git/hooks/pre-push" ]]; then
        echo ".git/hooks/pre-push was found:"
        echo "pre-push is activated"
      else
        if [[ -f ".git/hooks/pre-push.sample" ]]; then
          echo ".git/hooks/pre-push was not found:"
          echo "but .git/hooks/pre-push.sample was found:"
          echo "pre-push is deactivated"
        else
          echo "Hmmmmm"
        fi
      fi
    }

    Nvim edit file

    po() {
      if [[ -f ".git/hooks/pre-push" ]]; then
        echo ".git/hooks/pre-push was found:"
        nvim .git/hooks/pre-push
      else
        if [[ -f ".git/hooks/pre-push.sample" ]]; then
          echo ".git/hooks/pre-push was not found:"
          echo "but .git/hooks/pre-push.sample was found:"
          nvim .git/hooks/pre-push.sample
        else
          echo "Hmmmmm"
        fi
      fi
    }

    Lua nvim edit file

    function file_exists(name)
       local f=io.open(name,"r")
       if f~=nil then io.close(f) return true else return false end
    end
    

    function open_prepush() if file_exists(".git/hooks/pre-push") then vim.cmd("vsplit .git/hooks/pre-push") elseif file_exists(".git/hooks/pre-push.sample") then vim.cmd("vsplit .git/hooks/pre-push.sample") else vim.cmd("echo 'Hmmmmm'") end end

    vim.keymap.set("n", "<leader><leader>po", open_prepush, { desc = "Open pre-push a new split" })

    markdown

    2026-03-10

    <mark>Highlighted text</mark>

    ==Highlighted text==

    Highlighted text

    ==Highlighted text==

    [!NOTE] En note

    [!WARNING] Warning!!

    [!IMPORTANT] !!!!!!

    CSS position floatish relative

    2026-04-01

    https://css-tricks.com/almanac/properties/p/position/#absolute

    To make the child element positioned absolutely from its parent element we need to set this on the parent element itself:

    .element {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
    }
    

    .parent { position: relative; }

    Now properties such as left, right, bottom and top will refer to the parent element, so that if we make the child element transparent we can see it sitting right at the bottom of the parent:

    text

    2026-04-04

    mulig du må fjerne denne blueprint.md filen og referansen til den i cloudcannon config'en for at schema'et skal bli brukt.

    nextjs config

    2026-04-04

    next.config.js og webpack.config.js

    next.config.js er en slags utvidelse til webpack.config.js . Man har ikke direkte tilgang til webpack-filen, men man kan bruke next config filaslik jeg forstår dette sitatet i hvert fall:

    Imagine your next.config.js as something to append to an existing webpack.config behind the scenes. You won't have direct access to the webpack but you can extend it.

    se https://stackoverflow.com/questions/50746420/nextjs-import-images-in-mdx supersizze sin melding

    Media only screen CSS

    2026-04-16

    @media only screen and (min-width: 500px) {

    }

    // X-Small devices (portrait phones, less than 576px)
    // No media query for `xs` since this is the default in Bootstrap
    
    // Small devices (landscape phones, 576px and up)
    @media (min-width: 576px) { ... }
    
    // Medium devices (tablets, 768px and up)
    @media (min-width: 768px) { ... }
    
    // Large devices (desktops, 992px and up)
    @media (min-width: 992px) { ... }
    
    // X-Large devices (large desktops, 1200px and up)
    @media (min-width: 1200px) { ... }
    
    // XX-Large devices (larger desktops, 1400px and up)
    @media (min-width: 1400px) { ... }

    https://getbootstrap.com/docs/5.3/layout/breakpoints/#min-width

    rename branch locally & remote

    2026-04-22

    notes:

    1. rename in lazygit
    2. git push $remote --delete $old_name
    3. git push origin HEAD

    This will close any existing PR if exists


    # Source - https://stackoverflow.com/a/30590238
    # Posted by CodeWizard, modified by community. See post 'Timeline' for change history
    # Retrieved 2026-04-22, License - CC BY-SA 4.0
    

    # Names of things - allows you to copy/paste commands old_name=feature/old new_name=feature/new remote=origin

    # Rename the local branch to the new name git branch -m $old_name $new_name

    # Delete the old branch on remote git push $remote --delete $old_name

    # Or shorter way to delete remote branch [:] git push $remote :$old_name

    # Prevent git from using the old name when pushing in the next step. # Otherwise, git will use the old upstream name instead of $new_name. git branch --unset-upstream $new_name

    # Push the new branch to remote git push $remote $new_name

    # Reset the upstream branch for the new_name local branch git push $remote -u $new_name

    https://stackoverflow.com/questions/30590083/git-how-to-rename-a-branch-both-local-and-remote/30590238#30590238

    At a glance: Branch renaming commands

    Task Command

    Rename current branch git branch -m new-name Rename specific branch git branch -m old-name new-name Delete remote branch git push origin --delete branch-name Push renamed branch git push origin new-name Set upstream tracking git push --set-upstream origin new-name

    https://www.codecademy.com/article/rename-git-branch

    git branch -m new-branch-name 

    https://www.freecodecamp.org/news/git-rename-branch-how-to-change-a-local-branch-name/

    Prevent pre-pushes

    2026-05-11

    read -p "Push anyway?" pushanyway if [[ $pushanyway == "y" ]]; then exit 0 else exit 1 fi


    !!! FØR COMMIT !!!

    TODO: lim inn innhold fra bashrc som er relevant (update_prepush og gitFlowFeatureStart)

    det må også funke da. test i gittesting.

    .------

    relevant bashrc innhld her...

    If you come from bash you might have to change your $PATH.

    export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH

    Path to your Oh My Zsh installation.

    export ZSH="$HOME/.oh-my-zsh"

    -------- Aliases -------

    stuff

    alias c=clear alias compare-home="yadm diff home2 | delta"

    ripgrep

    alias ripgrep="rg"

    live ripgrep

    alias p0="~/rvf.sh " alias p="nn $(fzf)" alias pp="nn $(fzf)"

    yadm (ohmyzsh style aliases)

    alias yl="yadm pull" alias yp="yadm push" alias ya="yadm add" alias yc="yadm commit --verbose" alias yc!="yadm commit --verbose --amend" alias ycn!="yadm commit --verbose --no-edit --amend" alias ycan!="yadm commit --verbose --all --no-edit --amend" alias yst="yadm status" alias yss="yadm status --short" alias yb="yadm branch" alias yd="yadm diff" alias yco="yadm checkout" alias ylg="yadm log --stat" alias ylo="yadm log --oneline --decorate" alias ystl="yadm stash list " alias ystaa="yadm stash apply" alias ysta="yadm stash push" alias ystp="yadm stash pop"

    yadm lazygit

    alias ye="yadm enter lazygit" alias yes="yadm enter lazygit status" alias yesh="yadm enter azygit stash" alias yel="yadm enter lazygit log" alias yeb="yadm enter lazygit branch"

    alias yu="yadm add -u"

    alias grs="git restore --staged"

    alias yadmManaged="yadm list -a"

    alias yadmAddManaged="yadm add -u"

    zshrc/bashrc

    alias bas="nvim ~/.zshrc" alias zs="nvim ~/.zshrc" alias basr=". ~/.zshrc" # source zshrc

    vim & nvim

    alias n="nvim ." alias nn="nvim"

    alias nf="nvim $(fzf)"

    alias v="vim ." alias vv="vim"

    alias vf="vim $(fzf)"

    alias nnvim="cd ~/.config/nvim/ && rename_tmux_window Neovim"

    alias idea="nvim ~/.ideavimrc" alias vimrc="nvim ~/.vimrc" alias rem="nvim ~/.config/nvim/lua/setup/remap.lua" alias set="nvim ~/.config/nvim/lua/setup/set.lua" alias aft="nvim ~/.config/nvim/after/plugin/" alias use="nvim ~/code/useful-snippets/posts/" alias surr="nvim ~/.config/nvim/after/plugin/vim-surround.lua" alias diff="nvim ~/.config/nvim/after/plugin/diffview.lua" alias fzfvim="nvim ~/.config/nvim/after/plugin/fzfvim.lua" alias lsp="nvim ~/.config/nvim/after/plugin/"

    other

    alias gi="nvim ~/.gitconfig" alias bran="echo $(git branch --show-current) | pbcopy"

    function goto {

    cd "$1"

    rename_tmux_window "$2"

    }

    bare kjør denne her hvis alias value starter med å cd til et directory

    Hadde det bært bedre om man lagde en goto-funksjon og brukte det i stedet?

    function rename_tmux_window { if [ -z "$TMUX" ]; then echo "Not in tmux, nothing to rename" else tmux rename-window "$1" fi }

    filesystem navigation

    alias cdc="cd ~/code" alias cdtest="cd ~/code/test/ && rename_tmux_window test" alias hybel="cd ~/code/hybel && rename_tmux_window HYBEL" alias tenant="cd ~/code/tenant-frontend-app && rename_tmux_window TENANT" alias tresults="cd ~/code/test/hybel-test-results-develop && rename_tmux_window test-results" alias dresults="cd ~/code/dbdump-hybeldb2/ && rename_tmux_window db-results" alias useful="cd ~/code/useful-snippets && rename_tmux_window useful-snippets" alias u="cd ~/code/useful-snippets && rename_tmux_window useful-snippets && nvim"

    hybel

    alias shybel="hybel && bash ~/start-hybel.sh" alias stenant="tenant && bash ~/start-tenant.sh" alias suseful="cd ~/code/useful-snippets && bash ~/start-useful.sh" alias home="cd ~ && bash ~/start-home.sh && rename_tmux_window home" alias snvim="nnvim" alias stestcompare="cd ~/code/test/hybel-test-results-develop && bash ~/start-test-compare.sh"

    pre tenant tests

    alias predisttest="tenant && bash ~/prepare-dist-test.sh" alias presrctest="tenant && bash ~/prepare-src-test.sh"

    actions

    alias q="exit" alias e="open ."

    open websites

    alias f1="explorer.exe http://localhost:5173/" alias f2="explorer.exe http://localhost:8000/" alias f3="explorer.exe http://localhost:5173/graphql/" alias f4="explorer.exe http://localhost:6006/" alias f5="explorer.exe http://localhost:3000/tenant/"

    npm scripts

    alias dev="npm run dev" alias compile="npm run compile" alias tsc="npm run compile" alias build="npm run build" alias storybook="npm run storybook" alias preview="npm run preview" alias caddyrun="sudo caddy run --config Caddyfile" alias i18nextract="npm run i18n:extract" alias premerge=" ./_pre-merge-request.sh docker" alias crr="coderabbit --plain --base origin/develop"

    tmux

    alias t="tmux" alias ntmux="nvim ~/.tmux.conf" alias tmu="nvim ~/.tmux.conf" alias tt="bash ~/dev-tmux.sh"

    lazygit

    alias lg="lazygit" alias lgs="lazygit status" alias lgsh="lazygit stash" alias lgl="lazygit log" alias lgb="lazygit branch"

    1: new branch name

    function update_prepush { sed -i'' -e "s&allowed_branch_name=".*"&allowed_branch_name="$1"&g" $(gitHookFull pre-push) }

    #1: name of git hook (e.g. pre-push, post-commit) function gitHookFull { if [[ -f ".git/hooks/$1" ]]; then echo ".git/hooks/$1" else if [[ -f ".git/hooks/$1.sample" ]]; then echo ".git/hooks/$1.sample" else echo "undefined" fi fi }

    #1: name of git hook (e.g. pre-push, post-commit) function gitHook { if [[ -f ".git/hooks/$1" ]]; then echo "$1" else if [[ -f ".git/hooks/$1.sample" ]]; then echo $1.sample else echo "undefined" fi fi }

    function isGitHookActivated { if [[ -f ".git/hooks/$1" ]]; then echo true else if [[ -f ".git/hooks/$1.sample" ]]; then echo false else echo "undefined" fi fi }

    function gitFlowFeatureStart { git flow feature start "$1" update_prepush "feature/$1" }

    git flow

    alias gffs="gitFlowFeatureStart" alias gfrs="git flow release start" alias gfhs="git flow hotfix start" alias gfbs="git flow bugfix start" # bugfix dont exist alias gfrf="git flow release finish" alias gfhf="git flow hotfix finish"

    docker

    alias dcu="docker compose --profile=django up django" alias dcudjango="docker compose --profile=django up django" alias dcr="docker compose --profile=manage run manage migrate" alias dcs="docker compose --profile=manage run manage shell" alias dcd="docker compose down" alias dcdr="docker compose down --remove-orphans"

    skhd (Autohotkey)

    alias ahk="skhd --start-service" alias skh="skhd --start-service" alias starts="skhd --start-service" alias stops="skhd --stop-service"

    alias vers="skhd --verbose"

    alias nahk="nvim ~/.skhdrc" alias nskh="nvim ~/.skhdrc"

    alias activateprepush="mv .git/hooks/pre-push.sample .git/hooks/pre-push" alias deactivateprepush="mv .git/hooks/pre-push .git/hooks/pre-push.sample"

    "po" for "posh" ("push")

    po() { if [[ -f ".git/hooks/pre-push" ]]; then echo ".git/hooks/pre-push was found:" nvim .git/hooks/pre-push else if [[ -f ".git/hooks/pre-push.sample" ]]; then echo ".git/hooks/pre-push was not found:" echo "but .git/hooks/pre-push.sample was found:" nvim .git/hooks/pre-push.sample else echo "Hmmmmm" fi fi }

    "l" as in the "ls -a" alias. "po" as in "posh"

    lpo() { if [[ -f ".git/hooks/pre-push" ]]; then echo ".git/hooks/pre-push was found:" echo "pre-push is activated" else if [[ -f ".git/hooks/pre-push.sample" ]]; then echo ".git/hooks/pre-push was not found:" echo "but .git/hooks/pre-push.sample was found:" echo "pre-push is deactivated" else echo "Hmmmmm" fi fi }

    python

    alias activateHello="source ~/code/hello-world/.venv/bin/activate" alias py="python"

    ------------ Other --------------

    search for word in a file's git history

    usage: filehistorysearch "use-query-params" package.json

    filehistorysearch() { git grep $1 $(git rev-list --all -- $2) -- $2 }

    nvm node version manager

    export NVM_DIR="$HOME/.nvm" [ -s "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" ] && . "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" # This loads nvm [ -s "$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" ] && . "$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion

    usage: Run webstorm . in terminal

    webstorm() {

    open "/Applications/WebStorm.app" .

    open -na "WebStorm.app" --args "$@" }

    pycharm() {

    open "/Applications/PyCharm.app" .

    open -na "PyCharm.app" --args "$@" }

    manage() { if [[ $1 == "runtests" ]]; then docker compose --profile=manage run manage test hybel --parallel else docker compose --profile=manage run manage "$@" fi }

    remove user from shell prompt / primary prompt

    export DEFAULT_USER=$USER

    Set name of the theme to load --- if set to "random", it will

    load a random theme each time Oh My Zsh is loaded, in which case,

    to know which specific one was loaded, run: echo $RANDOM_THEME

    See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

    ZSH_THEME="agnoster"

    Set list of themes to pick from when loading at random

    Setting this variable when ZSH_THEME=random will cause zsh to load

    a theme from this variable instead of looking in $ZSH/themes/

    If set to an empty array, this variable will have no effect.

    ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

    Uncomment the following line to use case-sensitive completion.

    CASE_SENSITIVE="true"

    Uncomment the following line to use hyphen-insensitive completion.

    Case-sensitive completion must be off. _ and - will be interchangeable.

    HYPHEN_INSENSITIVE="true"

    Uncomment one of the following lines to change the auto-update behavior

    zstyle ':omz:update' mode disabled # disable automatic updates

    zstyle ':omz:update' mode auto # update automatically without asking

    zstyle ':omz:update' mode reminder # just remind me to update when it's time

    Uncomment the following line to change how often to auto-update (in days).

    zstyle ':omz:update' frequency 13

    Uncomment the following line if pasting URLs and other text is messed up.

    DISABLE_MAGIC_FUNCTIONS="true"

    Uncomment the following line to disable colors in ls.

    DISABLE_LS_COLORS="true"

    Uncomment the following line to disable auto-setting terminal title.

    DISABLE_AUTO_TITLE="true"

    Uncomment the following line to enable command auto-correction.

    ENABLE_CORRECTION="true"

    Uncomment the following line to display red dots whilst waiting for completion.

    You can also set it to another string to have that shown instead of the default red dots.

    e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"

    Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)

    COMPLETION_WAITING_DOTS="true"

    Uncomment the following line if you want to disable marking untracked files

    under VCS as dirty. This makes repository status check for large repositories

    much, much faster.

    DISABLE_UNTRACKED_FILES_DIRTY="true"

    Uncomment the following line if you want to change the command execution time

    stamp shown in the history command output.

    You can set one of the optional three formats:

    "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"

    or set a custom format using the strftime function format specifications,

    see 'man strftime' for details.

    HIST_STAMPS="mm/dd/yyyy"

    Would you like to use another custom folder than $ZSH/custom?

    ZSH_CUSTOM=/path/to/new-custom-folder

    Which plugins would you like to load?

    Standard plugins can be found in $ZSH/plugins/

    Custom plugins may be added to $ZSH_CUSTOM/plugins/

    Example format: plugins=(rails git textmate ruby lighthouse)

    Add wisely, as too many plugins slow down shell startup.

    plugins=(git)

    source $ZSH/oh-my-zsh.sh

    User configuration

    export MANPATH="/usr/local/man:$MANPATH"

    You may need to manually set your language environment

    export LANG=en_US.UTF-8

    Preferred editor for local and remote sessions

    if [[ -n $SSH_CONNECTION ]]; then

    export EDITOR='vim'

    else

    export EDITOR='nvim'

    fi

    Compilation flags

    export ARCHFLAGS="-arch $(uname -m)"

    Set personal aliases, overriding those provided by Oh My Zsh libs,

    plugins, and themes. Aliases can be placed here, though Oh My Zsh

    users are encouraged to define aliases within a top-level file in

    the $ZSH_CUSTOM folder, with .zsh extension. Examples:

    - $ZSH_CUSTOM/aliases.zsh

    - $ZSH_CUSTOM/macos.zsh

    For a full list of active aliases, run alias.

    Example aliases

    alias zshconfig="mate ~/.zshrc"

    alias ohmyzsh="mate ~/.oh-my-zsh"

    source ~/.safe-chain/scripts/init-posix.sh # Safe-chain Zsh initialization script

    . "$HOME/.local/bin/env"

    Neovim

    2026-06-10

    • nvim --help
    • nvim --clean
    • nvim --startuptime time.txt
      --clean               "Factory defaults" (skip user config and plugins, shada)
      --startuptime <file>  Write startup timing messages to <file>
    

    Slow?

    Ting som folk har rapportert at kan være årsaken

    • treesitter highlight
    • lsp
    • indent lines
    • colorschemes - lsp-zero
    • CursorMoved/CursorMovedI autocommands (tror ikke jeg har noe av det?)