Aubrey Portwood
Senior WordPress Developer/Engineer, Stoic, Girl-Dad², Tennis Player, INTJ,
Enneagram 1, & Vintage Computer Tinkerer—based in Albuquerque, NM.

Posts

Need to use shellcheck with .zsh and or #!/bin/zsh scripts? [SC1071]

If, like me, you find yourself trying to use shellcheck to lint .zsh files with #!/bin/zsh but it keeps telling you:

shellcheck: error
error 
  • ShellCheck only supports sh/bash/dash/ksh scripts. Sorry! [SC1071]
  • What I was able to do is pass the --shell=bash argument to shellcheck and then it would lint my files.

    In my case this was configured in my SublimeLinter config, like so:

    {
        "linters": {
            "shellcheck": {
                "args": [
                    "--shell=bash"
                ]
            },
        }
    }
    

    …just in case you are using Sublime Text!

    CLI Tools in PHP is harder

    In case you’re wondering what’s easier:

    1. Writing CLI tools e.g. shell scripts + zsh plugins
    2. Writing CLI tools using PHP e.g. symfony/console, PHP-CLI, etc

    #2 is harder. I tried it over the weekend.

    Want better keybinding parity between micro and Sublime Text?

    I went through the key-bindings in Micro (which use different modifier keys) and added them to Sublime Text:

        { "keys": ["ctrl+s"], "command": "save", "args": { "async": true } },
        { "keys": ["alt+up"], "command": "swaplineup" },
        { "keys": ["alt+down"], "command": "swaplinedown" },
        { "keys": ["ctrl+left"], "command": "bol" },
        { "keys": ["ctrl+right"], "command": "eol" },
        { "keys": ["ctrl+o"], "command": "prompt_open" },
        { "keys": ["ctrl+z"], "command": "undo" },
        { "keys": ["ctrl+y"], "command": "redo" },
        { "keys": ["ctrl+c"], "command": "copy" },
        { "keys": ["ctrl+x"], "command": "cut" },
        { "keys": ["ctrl+d"], "command": "duplicate_line" },
        { "keys": ["ctrl+v"], "command": "paste" },
        { "keys": ["ctrl+a"], "command": "select_all" },
        { "keys": ["ctrl+b"], "command": "toggleterminuspanel" },
        { "keys": ["ctrl+q"], "command": "close" },
        { "keys": ["ctrl+up"], "command": "move_to", "args": { "to": "bof" } },
        { "keys": ["ctrl+down"], "command": "move_to", "args": { "to": "eof" } },
        { "keys": ["alt+backspace"], "command": "deleteword", "args": { "forward": false, "subwords": true } },
        { "keys": ["ctrl+f"], "command": "show_panel", "args": { "panel": "find", "reverse": false } },
        { "keys": ["alt+shift+f"], "command": "showpanel", "args": { "panel": "findin_files" } },
        { "keys": ["ctrl+t"], "command": "showoverlay", "args": {"overlay": "goto", "showfiles": true} }, // Hurts transpose, but never use.
        { "keys": ["ctrl+e"], "command": "showoverlay", "args": {"overlay": "commandpalette"} },
    

    Modal editing: Here’s where I’ve landed

    If you’ve been following along with my Vim/Modal editing debacle, here’s where I’ve landed.

    ——–

    I’m a all-or-nothing person, so since I can’t do modal editing everywhere (without madness) I’m ditching the paradigm

    I’ve been playing around with using nano this morning for e.g. Git commits, etc and decided to use micro instead.

    Micro is a great editor after-all. Checkout the customizations I’ve made to it to make it more useful:

    .config/micro/settings.json

    .config/micro/bindings.json

    I’m also going to work to have parity with Sublime, here’s what I have so far:

    Packages/User/Default (OSX).sublime-keymap#L66.sublime-keymap#L66)

    I’m going to start trying to improve my editing techniques in normal editing across my system instead of spamming the GUI menu and sloppy ⌘- combos to get more and more efficient at editing in macOS.

    Annoyingly, I’ve disabled Vintage in ST for now…

    How do Vim’mers deal with the frustration of not being able to edit text (like the one I’m writing, here, on dev.to) everywhere else (outside of e.g. Vim) using modal editing?

    I’m not really liking that, yeah, I can get the benefit from modal editing and in Sublime Text (due to e.g. Vintage) but not anywhere else without having to go way-out-there and use something like cknadler/vim-anywhere.

    I feel like it might not be worth it to learn a new paradigm if I can’t use it in more places.

    Annoyingly, I’ve disabled Vintage for now. I might even consider using e.g. micro for text editing in my terminal.

    Getting Sublime Text modal

    So last night I enabled Vintage mode in Sublime via a package called NeoVintageous and this evening I’ve disabled NeoVintageous and have enabled Sublime’s built-in Vintage mode with vintagectrlkeys on instead.

    The reason is, after a day of NeoVintageous, I find I don’t really need Ex mode stuff (beyond :w which I just like for parity with Vim) because I don’t really want that experience. I don’t want Vim. I just want to edit text in a (modal) language for productivity.

    I wanted goto line :# which I thought I could only get from NeoVintageous (as it doesn’t work in Vintage), but turns out I forgot you can #G to get to a line too.

    I’m not looking for Vim (or I would just use Vim), or a Vim emulation; I still want the GUI, native, macOS experience. I don’t want to feel like I’m running Vim, but I do want modal editing! I am really more-looking for Sublime + modality, not necessarily Sublime + Vim.

    Hopefully Vintage is the way to go here. So far I have been enjoying remembering all the motions, I might even be re-visiting vim-tutor for a refresher. I used Vim for four years in the past and I’ve forgotten so much! I’m not super productive yet (having to Google here-and-there for motions and trying not to cheat).

    How I configured (Laravel) Valet + PHP to send ALL email to Mailhog on Mac w/ Homebrew

    I needed to configure PHP + Valet to send any and all emails to Mailhog. This is how I configured my system:

    Basically:

    brew install mailhog
    brew services start mailhog
    

    Then in /opt/homebrew/etc/php/<version>/conf.d/z-php.ini Add:

    sendmail_path=/opt/homebrew/bin/mailhog sendmail
    

    Then:

    brew services restart php
    valet restart
    

    …and if you are using valet isolate in a specific site, also:

    valet isolate php@<version>
    

    This should tell that version of PHP to send ANY email via /opt/homebrew/bin/mailhog sendmail which should end up in the Mailhog UI at http://127.0.0.1:8025.

    You can also:

    valet proxy mailhog.test http://127.0.0.1:8025
    

    And use mailhog.test to access Mailhog.

    Code

    How I configured NIGINX + Valet to stop the 504 Gateway Time out during long XDebug Sessions

    In this video I explain how to stop NGINX (installed via Valet) from 504 Gateway Time-out during long XDebug sessions.

    By default this is set to 30 seconds, so if I was debugging something for longer than 30 seconds it would timeout and I would have to restart my xDebug session — annoying!

    After doing some research, I finally figured out how to include an NGINX configuration file with these configurations:

    proxyconnecttimeout 1200;
    
    proxyreadtimeout 1200;
    proxysendtimeout 1200;
    
    fastcgireadtimeout 1200;
    fastcgisendtimeout 1200;
    

    Note, you can add these directly to /opt/homebrew/etc/nginx/nginx.conf before any Valet configs are loaded, e.g.:

        proxyconnecttimeout 1200;
        proxyreadtimeout 1200;
        proxysendtimeout 1200;
        fastcgireadtimeout 1200;
        fastcgisendtimeout 1200;
    
        include "/Users//.config/valet/Nginx/*";
        include servers/*;
        include valet/valet.conf;
    

    …but I opted to use include and load a configuration file that way.

    I also review some updates to my last video on my XDebug configuration and how I also configured PHP timeouts to also be higher.