Jekyll2025-12-13T10:01:08-06:00https://joelchrono.xyz/feeds/vim.xmljoelchrono’s blogjoelchronome@joelchrono.xyzA quick tag editor for my website2023-01-05T08:08:43-06:002023-01-05T08:08:43-06:00https://joelchrono.xyz/blog/a-quick-tag-editor-for-my-websiteI have a bit of a love hate relationship with bash scripting. Because you get to have access to all kinds of small tools, piping and doing unixy things, at the cost of having horrible syntax and being kinda hard to read sometimes.

Anyways, a couple posts ago I shared how to sort tags in different ways, the truth is I’ve been meaning to do some cleaning up, inspired by Adam’s post.

He used the usual commands such as sed and grep, and I decided to quickly write a script to edit the desired tags for any file in a similar manner.

#!/usr/bin/bash
#
file=$1
oldtags=$(cat $1 | grep "tags:" | head -1 | awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}')

echo $oldtags > /tmp/tagedit
vim /tmp/tagedit

newtags=$(cat /tmp/tagedit)

rm -fv /tmp/tagedit

sed -i "s/$oldtags/$newtags/g" "$file"

This code is rather simple, it takes the path of a file, which is given as an argument, running something like

./edit-tags.sh filename

That filename is parsed, using grep, head and awk. a new temporary file containing all existing tags of that file gets opened with vim, containing the existing tags. From there I can add or remove tags as I please, and once saved, I replace the original file accordingly.

It is rather simple, and I think it could be done better. So please, I beg you to give me any suggestions to improve it. I tried my best to understand stuff like getopts and the like, to have arguments and flags but I just didn’t really get it.

Regardless, this is day 5 of my second attempt at #100DaysToOffload

]]>
joelchronome@joelchrono.xyz
Vim macros and Jekyll includes2022-06-30T10:53:30-05:002022-06-30T10:53:30-05:00https://joelchrono.xyz/blog/vim-macros-and-jekyll-includesYesterday I talked about converting all my images to WebP, because it would help keep the file sizes smaller, improving loading times. However I have to say I agree with @isa when she mentioned how annoying it is to not have a jpg or png file available to download since webp is still not as supported by Image viewers and the like, or if you dislike file formats that stick out from the standard.

So I decided to keep both webp and jpg files available. I am not sure of what makes a browser choose one over the other. For now, I pretty much copy pasted the solution used by Simone on his blog, I only added some code to support .gif files, since WebP supports animation too.

Implementing this was not difficult at all. I created a file inside of my _includes folder containing the following template:

<figure class="{{ include.class | default: 'img' }}">
  <picture>
    <source srcset="{{ include.image | replace:'.png','.webp' | replace:'.jpg','.webp' | replace:'.jpeg','.webp' | replace: '.gif','.webp' }}" type="image/webp">
    <source srcset="{{ include.image }}" {% if include.image contains '.jpg' or include.image contains '.jpeg' %}type="image/jpeg"{% elsif include.image contains '.png' %}type="image/png" {%elsif include.image contains '.gif'%}type="image/gif"{% endif %}>
    <img class="mx-auto" src="{{ include.image }}" alt="{{ include.alt | default: include.caption }}" {{ include.width ? include.width | prepend: 'width="' | append: '"' }} {{ include.height ? include.height | prepend: 'height="' | append: '"' }}>
  </picture>
  {% if include.caption %}<figcaption class="caption">{{ include.caption }}</figcaption>{% endif -%}
</figure>

Now all I have to do when using an image in a blogpost is provide both a webp and a jpg/png/gif file with the same filename, and use the following template:

{% include img.html image="/path/to/assets/image.jpg" width="512px" alt="Alternate text" caption="A caption" %}

I was already using Jekyll’s includes for a lot of things, such as the comments system, the articles of blogs I follow and other things. Its a really powerful tool that I quite like. However, editing each existing file could take me a long time. I actually did a poll on mastodon to see what people would do. As of the writing of this post, most people say they would handle this by hand. And, to be honest, that’s kinda what I did, but I had some tricks up my sleve.

Vim macros to the rescue

Using macros with Vim is simply fantastic, I took a while to mention them, for some reason, all I had to do was implement 2 macros for the different kinds of markup I’ve used. Be it plain markdown (![title](source)) or plain html (<figure><img></img><figcaption></figcaption></figure>). There were a couple of edge cases, like when I included links inside of the captions and such.

There are many examples and videos that talk about doign Vim macros, so I will just share some videos of how they worked out.

For Markdown, I pretty much look for ![ and then used Vim keybindings to go word for word w, to the end of the line $ and such, rinse and repeat.

Macro used for Markdown syntax.
Macro used for Markdown syntax.

The steps to make a macro for HTML were a bit more complicated, but doable nonetheless.

Macro used for HTML syntax.
Macro used for HTML syntax.

My macro had some problems, since I was doing dt" to delete the contents of something until a quote showed up, along other similar things, adding a link to a figcaption broke my macro in a couple cases. But other than that, it worked alright. I also had to run my macro from a certain position relative to the HTML, or else other things would not work properly.

I guess doing macros is pretty much its own artform, I’ve seen some uses for them that blew me away. If you have not used them for anything before, you might want to give them a try next time you script something!

Finishing thoughts

If I am honest, I still don’t know how I feel about it making use of includes in this way, since making the changes here was kinda annoying. But, thinking about it, it only took me like half an hour to do. I don’t know, maybe simply using something like xclip or xdotool to quickly access the plain HTML template would be a lot better to keep my markdown platform agnostic. I will think about it, but for now Jekyll is still my platform of choice.

]]>
joelchronome@joelchrono.xyz
Backup your dotfiles using stow2021-08-31T16:20:03-05:002021-08-31T16:20:03-05:00https://joelchrono.xyz/blog/backing-up-my-dotfilesManaging dotfiles has always been quite annoying to me. But thankfully, I never really had a reason to do it too often. When I moved from Void Linux to EndeavourOS, all I did was tar my whole .config and copied the file to an external drive.

That works fine, but it’s not the best way to backup the constant changes I usually do to customize the way my programs look or act, and as a customization freak, that happens quite often.

I had seen many different ways to backup dotfiles: git bare repos, yadm, symlinking scripts, and of course, GNU Stow.

All of these methods have their up and downs, but in the end, stow convinced me, and I decided to give it a try. According to their home page:

GNU Stow is a symlink farm manager which takes distinct packages of software and/or data located in separate directories on the filesystem, and makes them appear to be installed in the same place.

If you don’t really understand it yet, don’t worry, I don’t either! But in this blog, I will do my best to show you the steps to backup your current config files, I hope whoever reads this finds it useful.

Creating a dotfiles repository

The first step to backup your dotfiles, is to create an empty repository in some hosting service, such as GitHub, Codeberg or SourceHut. This is optional if you only want to see how stow works, but necessary to have an external backup outside your computer. Once you are done, clone the empty repo to your home directory, or in any place you want. (This tutorial will be using the home directory).

To clone a repo, just do:

git clone https://site.com/link/to/repo

In my case, I use Tildegit, a Gitea instance, so my command looks like this.

git clone https://tildegit.org/chrono/dotfiles.git

You can clone my dotfiles if you want to use them, here they are if you are interested.

Using stow to backup your configuration

Before actually backing something up, we need to install stow, depending on your distribution, you can install it with your package manager of choice. In my case, Endeavor is based on Arch, so I do:

$ sudo pacman -S stow

Lets start by backing up the configuration of a single program. While we can backup our whole .config folder, that’s not a good idea, since some programs store important information that should stay private, and I think its better to only backup what we have actually configured. For this example, I will backup my picom configurations.

The first step is to create a new directory to use as a base (if you cloned your empty repo, you’ll be using that). You also have to create a folder structure, depending on where you want the configuration to be stored, this depends on the location the program will read its configuration from. We’ll refer to this folder as dotfiles.

If you want to add a README file or other stuff that you is not a config files, you can create another directory inside of dotfiles, in my case, I have made a stow_home folder, which will be where we’ll run the stow command. 1

Lets explain how stow works. Picom expects its config file in ~/.config/picom/picom.conf, so, inside of the new home_stow directory, we recreate that folder structure, but using the program name (picom) instead of the tilde (~), which usually refers to the home folder. 2

Lets put all of this together in the terminal.

mkdir dotfiles && cd dotfiles # mkdir only if you didn't clone it
touch README.md other_file.txt # optional
mkdir -p ~/dotfiles/stow_home/picom/.config/picom/
mv ~/.config/picom/ ~/dotfiles/stow_home/picom/.config/

Once you do that, your picom folder is no longer in the .config directory, but inside of dotfiles/home_stow, following the same folder structure, as if home_stow was the /home directory, followed by the user picom and the path to the picom configuration files. 3

Now we repeat this process with all of the files and directories we want to back up. Once done, the behavior of the programs you use, such as vim, should revert to their default configurations, since the user config files are no longer there. So, now its time to fix that! Inside of stow_home, run the following command:

stow -vt ~ *

This will symlink everything inside of stow_home 4, targetting ~ as the starting point. The -v flag will let you know of everything being done, so you should see an output like this, depending on the programs you backed up:

# $ stow -vt ~ *
LINK: .config/awesome => ../dotfiles/stow_home/awesome/.config/awesome
LINK: .config/bat => ../dotfiles/stow_home/bat/.config/bat
LINK: .config/dunst => ../dotfiles/stow_home/dunst/.config/dunst
LINK: .config/nvim => ../dotfiles/stow_home/nvim/.config/nvim
LINK: .config/picom => ../dotfiles/stow_home/picom/.config/picom
LINK: .config/rofi => ../dotfiles/stow_home/rofi/.config/rofi
LINK: .config/spectrwm => ../dotfiles/stow_home/spectrwm/.config/spectrwm

File versioning with git

If you stumbled upon this guide, you probably know the necesary git commands to backup everything to the service you chose at the beginning of this guide.

Generally, everytime you do changes you only need to follow these three commands, inside of your dotfiles folder.

git add *
git commit -m "Added config files"
git push

Remember that the last command will not work if you don’t have an external repository.

The manual of GNU Stow contains a lot more than what I mentioned here, like unlinking and other flags that can be used and might be useful for your use case.

Finishing up

Anyways, that’s all folks, this has been day 54 of #100DaysToOffload, you can check out my dotfiles if you want to see how stow looks once setup, besides, my Spectrwm configuration is quite sick if I do say so myself.

If you feel like a step is not clear enough, please let me know in the comments or via e-mail.

Secret bonus script!

So, if you read until the end of this blog. I actually did a pretty decent bash script to automate everything here.

All you need to do is configure it to your liking and run it like this

dotstow file_or_folder

The script is as follows, it uses basic tools like cut and of course, stow

#!/usr/bin/bash
# Dotstow - Backup your chosen dotfiles in one go using stow.
# Run it outside of the folder/file you want to back up
# $ dotstow file-or-program
# This program was made by joelchrono12

STOW_DIR=$HOME/dotfiles/stow_home
DIR=$(pwd | cut -d '/' -f4-)
NEW_DIR=$STOW_DIR/$1/$DIR
mkdir -pv $NEW_DIR
mv -v $1 $NEW_DIR
cd $STOW_DIR
stow -vt ~ $1

The program does not check if a folder already exists or anything like that. So feel free to send any suggestions and changes to it in a comment or using git send-email to my email address.


  1. You can just use dotfiles as is without a folder inside it, but if you want to be able to quickly deploy everything using *, you must make a folder where README and other files you don’t want to symlink won’t interfere . 

  2. Other files, like .bashrc, are not in the .config folder, keep in mind that the path to use depends on where the program needs it to be. In this case, it would have to be placed in ~/dotfiles/stow_home/bash/.bashrc

  3. You can also move specific files of a configuration folder. For example, tut, a mastodon client, saves the account data (passwords, etc) inside of another file in its configuration folder. if thats the case. You should move only the files you want, instead of the whole directory. stow should manage the rest. 

  4. If you are unsure about the paths you created, you can run the -n flag to simulate the output and see exactly where each symlink would be placed. That way you dont end up symlinking in the wrong place and doing weird stuff to your filesystem. 

]]>
joelchronome@joelchrono.xyz
Changing my workflow, making it Vim-like, switching rom2021-05-07T18:20:03-05:002021-05-07T18:20:03-05:00https://joelchrono.xyz/blog/changing-my-workflowLately I have decided to change a bunch of stuff when it comes to my workflow with my devices. Be it my laptop or my android phone. I have made some changes mostly out of boredom, but also because I have got a few problems that I didn’t feel like fixing on Spectrwm, as well as other quality of life changes.

🪟 Leaving Spectrwm, embracing Awesome, considering DWM

I really, really liked Spectrwm, I might as well go back to it in a few days, since the main reason I am moving away from it might not be that hard to fix. I find the system tray to be quite useful to me, my choice was trayer, since it was good enough. However, I had some problems that made it feel pretty clunky.

  • I can only show tag numbers,or numbers + name. I want to display only the names, which are Nerd Font glyphs.
  • The systray will overlap with the bar content, at least on the position I want it to be.
  • The systray wont follow me when switching workspace, but I have a script that moves it using wmctrl
  • When trayer gets moved to my current workspace, it steals focus, if I close every window, it steals focus
  • If trayer gets mouse focus, I cannot do anything, no keybindings will work. The only thing that works is clicking an icon that opens a window (like Discord) or killing Spectrwm from a TTY

Honestly, most of these problems are not a big deal most of the time. But as I said, I am doing this mainly out of boredom, so let me be.

Installing dwm also came to mind, and I decided to give it a try, but right now I can’t wrap my head around it, but I might check it out later.

🌐 Changing Firefox, checking out Qutebrowser

For quite some time, I have heard good things about Qutebrowser. So I have decided to give it a try. I actually loved it, I really liked the way it works and I found myself extremely comfortable using Vim keybindings on it. I really enjoyed how smooth it was and the keyboard driven workflow.

Its engine is now based on Chromium, which is a bit annoying since I support Firefox’s Gecko. However it now will display most websites better than when it was using WebKit as a base.

So right now I decided to go back to Firefox, and set it up in a similar manner to HexDSL’s configuration, which has tabs on the left side and gets rid of most of the GUI, making it pretty nice looking to me. I will change to Qutebrowser once I set it up properly and get ad-blocking on it.

For now, Firefox + VimVixen will do to give me that Vim-like workflow. I actually can’t believe how handy and nice it is.

💻 Maybe distro hopping, changing rom again

After all this, I have also been thinking about changing my distro once again. I have enjoyed void for quite a while, and its great, with no doubt, I might just be a bit inspired while writing this and I might end up not switching after all.

I have been considering something like EndeavourOS, or maybe reinstalling Void, but base only, we will see. I am a bit tempted by the “terminal driven” workflow the claim to have, I already have that on Void, but I am still curious.

Also, I will change my Android rom soon. I haven’t updated it in a while, and I have been looking for a bit more customization than what I already have. I have downloaded CrDroid, which has an official rom available for my Redmi Note 8, so I will give it a try later today.

Syncthing and Migrate are great tools for making backups, and I think I will have to install minimal Gapps due to school stuff, and because I got some paid apps I can’t live without, such as Nova Launcher or Typing Hero. I am working towards changing that, but not right now.

I always feel quite dirty when I have to change rom and reinstall the Google apps, especially when I try to defend FOSS and Android in general, but well, you gotta do what you gotta do.

Wrapping up

Anyways, after all of this I gotta say I am quite happy with the changes I’ve done, and I hope the ones I still have to make will be good too. I have had some problems with time management, and I know that it’s kind of a meme the amount of time you invest on setting everything up on Linux to get actual work done. But well, I enjoy it, and I still managed to deliver all of my homework! So I consider this a win. I have exams next week, so let’s see what happens with that.

This has been day 34 of #100DaystoOffload

]]>
joelchronome@joelchrono.xyz
Automating the creation of this blog2021-03-09T21:32:00-06:002021-03-09T21:32:00-06:00https://joelchrono.xyz/blog/making-a-script-to-blogAs the title said, I have been playing with some bash scripting since I was kinda bored. I was thinking about a blog made by Kev, where he expressed how he moved away from Jekyll and back to WordPress. Now, I have never used WP, so I don’t really know how many advantages, besides the mentioned in his blog, it has.

But that blog helped me to see, and recognize some of problems and annoyances I have with my current workflow.

Recently, I started to use Neovim to make my blogs, like the one you are reading right now. And since I am already trying to be as minimal as possible, I decided to make a script that helped me do the following things

  1. Create a post file
  2. Name it and add its date
  3. Add the metadata to it
  4. Open it to start editing

Doing scripting stuff (Not a tutorial tbh)

So, doing a script on linux is kinda easy, because of the way UNIX like systems work, I can make use of small utilities that can do small things and wrap everything together to make new useful scripts to automate the little things. In my case, I made something like this.

#! /bin/bash
echo "Type filename"
read name
filename=$(date +"%Y-%m-%d"-$name)
touch /path/to/_posts/$filename.md
printf '%b\n' "$(cat /path/to/_template.md)" >> /path/to/_posts/$filename.md
alacritty -e nvim /path/to/_posts/$filename.md

A quick explanation

  • In this case, echo allows me to print text, just like printf, to keep the format of my template.md file, containing the metadata of the blog, sp I only have to fill it out (I could probably automate this too, honestly).

  • I used date to create the and format the filename of the post, as well as add the given title using read (I cannot use spaces, but I always use dashes - anyways).

  • I used touch to create the markdown file and place it in the right locations.

  • Finally, I open the file on Neovim in a new terminal window (my choice is alacritty).

Wrapping up

And that was it! I actually managed to do it. I am not sure if I could make it even simpler, but I am happy with the result. I can now start my blogs in a better way than before, where I copied and pasted everything from a previous file, that I had to open and close and I also had to be type the path of the file and make it and all of the usual stuff. But hey, now it’s everything automated for me!

Also! I also made some changes to the font sizes of this blog, and other CSS things, just because I felt that everything was a little too big, and I didn’t feel like scrolling that much just to get past the title. I think I still have to tweak it a little bit, but it is a good start.

This was day 23 of #100DaystoOffload, let me know if you found this kinda useful for you too. Or if you have a better script or anything that you use to make your blog workflow better!

]]>
joelchronome@joelchrono.xyz
Writing a blog from the terminal2021-03-02T18:35:00-06:002021-03-02T18:35:00-06:00https://joelchrono.xyz/blog/blogging-on-vimSo, up until now I have been using Typora, a markdown text editor that I decided to use, mainly because of the spell checking capabilities that it offers.

Most other editors, like Gedit, which is the GUI editor I use for most simple things, doesn’t really offer any way to check for errors, and even though I try to type correctly, sometimes I just miss a letter, or an accent (Especially because I do most of my homework and note taking in Spanish, English is too easy in comparison).

So anyways, I have decided to try and do this blog using Neovim and only that, with the help of a few external programs to help me deal with the caveats that using terminal editor brings.

Some plugins and external programs later…

I installed a few plugins that I saw in some videos, such as Goyo and Limelight, that are supposed to help focus on typing and only that (I am struggling to get Limelight to work with the Nord color scheme, I will sort it out later). But I have seen a few others that can do more powerful stuff, like prettifying tables made with pipes and such, as well as automatically hiding markdown elements like *italics* and __boldness__, as well as [hyperlinks](https://https://joelchrono.xyz). But I am currently seeing all of this pretty clearly.

Also, I found a pretty epic terminal utility called Aspell, which is quite a life-saver, since, as its name implies, it is pretty useful to check for mistakes and errors in this text.

All I have to do is install the right dictionaries, and run the following command:

$ aspell -l en_US --mode markdown -c file.md

And that will look for mistakes and correct them in case there are any, as you can see in this screenshot:

I definitely made those mistakes on purpose
I definitely made those mistakes on purpose

To be honest, I just wanted to have something to type right now. Since I have been a little busy with University and was struggling to keep up with my blog.

Now I am going to share a little screenshot of how this setup looks, because why not?

Is this some kind of blogception???
Is this some kind of blogception???

So, yeah this was not that hard to do, there are still some things I have to figure out, luckily, most of these tools will also be useful for my homework workflow so, that’s a win for me! This has been day 21 of #100DaystoOffload

]]>
joelchronome@joelchrono.xyz
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<feed xmlns="http://www.w3.org/2005/Atom">
<generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator>
<link href="https://joelchrono.xyz/feeds/vim.xml" rel="self" type="application/atom+xml"/>
<link href="https://joelchrono.xyz/" rel="alternate" type="text/html"/>
<updated>2025-12-13T10:01:08-06:00</updated>
<id>https://joelchrono.xyz/feeds/vim.xml</id>
<title type="html">joelchrono’s blog</title>
<author>
<name>joelchrono</name>
<email>me@joelchrono.xyz</email>
</author>
<entry>
<title type="html">A quick tag editor for my website</title>
<link href="https://joelchrono.xyz/blog/a-quick-tag-editor-for-my-website/" rel="alternate" type="text/html" title="A quick tag editor for my website"/>
<published>2023-01-05T08:08:43-06:00</published>
<updated>2023-01-05T08:08:43-06:00</updated>
<id>https://joelchrono.xyz/blog/a-quick-tag-editor-for-my-website</id>
<content type="html" xml:base="https://joelchrono.xyz/blog/a-quick-tag-editor-for-my-website/">
<![CDATA[ <p>I have a bit of a love hate relationship with bash scripting. Because you get to have access to all kinds of small tools, piping and doing unixy things, at the cost of having horrible syntax and being kinda hard to read sometimes.</p> <p>Anyways, a couple posts ago I shared how to sort tags in different ways, the truth is I’ve been meaning to do some cleaning up, inspired by <a href="https://www.adamsdesk.com/posts/clean-tags-categories-two/">Adam’s post</a>.</p> <p>He used the usual commands such as <code class="language-plaintext highlighter-rouge">sed</code> and <code class="language-plaintext highlighter-rouge">grep</code>, and I decided to quickly write a script to edit the desired tags for any file in a similar manner.</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/usr/bin/bash</span> <span class="c">#</span> <span class="nv">file</span><span class="o">=</span><span class="nv">$1</span> <span class="nv">oldtags</span><span class="o">=</span><span class="si">$(</span><span class="nb">cat</span> <span class="nv">$1</span> | <span class="nb">grep</span> <span class="s2">"tags:"</span> | <span class="nb">head</span> <span class="nt">-1</span> | <span class="nb">awk</span> <span class="s1">'{for (i=2; i&lt;NF; i++) printf $i " "; print $NF}'</span><span class="si">)</span> <span class="nb">echo</span> <span class="nv">$oldtags</span> <span class="o">&gt;</span> /tmp/tagedit vim /tmp/tagedit <span class="nv">newtags</span><span class="o">=</span><span class="si">$(</span><span class="nb">cat</span> /tmp/tagedit<span class="si">)</span> <span class="nb">rm</span> <span class="nt">-fv</span> /tmp/tagedit <span class="nb">sed</span> <span class="nt">-i</span> <span class="s2">"s/</span><span class="nv">$oldtags</span><span class="s2">/</span><span class="nv">$newtags</span><span class="s2">/g"</span> <span class="s2">"</span><span class="nv">$file</span><span class="s2">"</span> </code></pre></div></div> <p>This code is rather simple, it takes the path of a file, which is given as an argument, running something like</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>./edit-tags.sh filename </code></pre></div></div> <p>That filename is parsed, using grep, head and awk. a new temporary file containing all existing tags of that file gets opened with vim, containing the existing tags. From there I can add or remove tags as I please, and once saved, I replace the original file accordingly.</p> <p>It is rather simple, and I think it could be done better. So please, I beg you to give me any suggestions to improve it. I tried my best to understand stuff like <code class="language-plaintext highlighter-rouge">getopts</code> and the like, to have arguments and flags but I just didn’t really get it.</p> <p>Regardless, this is day 5 of my second attempt at <a href="https://100daystooffload.com">#100DaysToOffload</a></p> ]]>
</content>
<author>
<name>joelchrono</name>
<email>me@joelchrono.xyz</email>
</author>
<category term="tutorial"/>
<category term="coding"/>
<category term="bash"/>
<category term="vim"/>
<summary type="html">
<![CDATA[ Yeah, I keep adding new scripts to make my blogging life easier. In this case, to help me edit tags with less hassle. ]]>
</summary>
</entry>
<entry>
<title type="html">Vim macros and Jekyll includes</title>
<link href="https://joelchrono.xyz/blog/vim-macros-and-jekyll-includes/" rel="alternate" type="text/html" title="Vim macros and Jekyll includes"/>
<published>2022-06-30T10:53:30-05:00</published>
<updated>2022-06-30T10:53:30-05:00</updated>
<id>https://joelchrono.xyz/blog/vim-macros-and-jekyll-includes</id>
<content type="html" xml:base="https://joelchrono.xyz/blog/vim-macros-and-jekyll-includes/">
<![CDATA[ <p>Yesterday I talked about converting all my images to WebP, because it would help keep the file sizes smaller, improving loading times. However I have to say I agree with <a href="https://thenighthas.me/@isa">@isa</a> when she mentioned how annoying it is to not have a jpg or png file available to download since webp is still not as supported by Image viewers and the like, or if you dislike file formats that stick out from the standard.</p> <p>So I decided to keep both webp and jpg files available. I am not sure of what makes a browser choose one over the other. For now, I pretty much copy pasted the solution used by <a href="https://minutestomidnight.co.uk/blog/implementing-webp-images-in-jekyll/">Simone on his blog</a>, I only added some code to support <code class="language-plaintext highlighter-rouge">.gif</code> files, since WebP supports animation too.</p> <p>Implementing this was not difficult at all. I created a file inside of my <code class="language-plaintext highlighter-rouge">_includes</code> folder containing the following template:</p> <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;figure</span> <span class="na">class=</span><span class="s">"{{ include.class | default: 'img' }}"</span><span class="nt">&gt;</span> <span class="nt">&lt;picture&gt;</span> <span class="nt">&lt;source</span> <span class="na">srcset=</span><span class="s">"{{ include.image | replace:'.png','.webp' | replace:'.jpg','.webp' | replace:'.jpeg','.webp' | replace: '.gif','.webp' }}"</span> <span class="na">type=</span><span class="s">"image/webp"</span><span class="nt">&gt;</span> <span class="nt">&lt;source</span> <span class="na">srcset=</span><span class="s">"{{ include.image }}"</span> <span class="err">{%</span> <span class="na">if</span> <span class="na">include.image</span> <span class="na">contains</span> <span class="err">'.</span><span class="na">jpg</span><span class="err">'</span> <span class="na">or</span> <span class="na">include.image</span> <span class="na">contains</span> <span class="err">'.</span><span class="na">jpeg</span><span class="err">'</span> <span class="err">%}</span><span class="na">type=</span><span class="s">"image/jpeg"</span><span class="err">{%</span> <span class="na">elsif</span> <span class="na">include.image</span> <span class="na">contains</span> <span class="err">'.</span><span class="na">png</span><span class="err">'</span> <span class="err">%}</span><span class="na">type=</span><span class="s">"image/png"</span> <span class="err">{%</span><span class="na">elsif</span> <span class="na">include.image</span> <span class="na">contains</span> <span class="err">'.</span><span class="na">gif</span><span class="err">'%}</span><span class="na">type=</span><span class="s">"image/gif"</span><span class="err">{%</span> <span class="na">endif</span> <span class="err">%}</span><span class="nt">&gt;</span> <span class="nt">&lt;img</span> <span class="na">class=</span><span class="s">"mx-auto"</span> <span class="na">src=</span><span class="s">"{{ include.image }}"</span> <span class="na">alt=</span><span class="s">"{{ include.alt | default: include.caption }}"</span> <span class="err">{{</span> <span class="na">include.width</span> <span class="err">?</span> <span class="na">include.width</span> <span class="err">|</span> <span class="na">prepend:</span> <span class="err">'</span><span class="na">width=</span><span class="s">"' | append: '"</span><span class="err">'</span> <span class="err">}}</span> <span class="err">{{</span> <span class="na">include.height</span> <span class="err">?</span> <span class="na">include.height</span> <span class="err">|</span> <span class="na">prepend:</span> <span class="err">'</span><span class="na">height=</span><span class="s">"' | append: '"</span><span class="err">'</span> <span class="err">}}</span><span class="nt">&gt;</span> <span class="nt">&lt;/picture&gt;</span> {% if include.caption %}<span class="nt">&lt;figcaption</span> <span class="na">class=</span><span class="s">"caption"</span><span class="nt">&gt;</span>{{ include.caption }}<span class="nt">&lt;/figcaption&gt;</span>{% endif -%} <span class="nt">&lt;/figure&gt;</span> </code></pre></div></div> <p>Now all I have to do when using an image in a blogpost is provide both a webp and a jpg/png/gif file with the same filename, and use the following template:</p> <div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span>img.html<span class="w"> </span><span class="na">image</span><span class="o">=</span><span class="s2">"/path/to/assets/image.jpg"</span><span class="w"> </span><span class="na">width</span><span class="o">=</span><span class="s2">"512px"</span><span class="w"> </span><span class="na">alt</span><span class="o">=</span><span class="s2">"Alternate text"</span><span class="w"> </span><span class="na">caption</span><span class="o">=</span><span class="s2">"A caption"</span><span class="w"> </span><span class="cp">%}</span> </code></pre></div></div> <p>I was already using Jekyll’s includes for a lot of things, such as the comments system, the articles of blogs I follow and other things. Its a really powerful tool that I quite like. However, editing each existing file could take me a long time. I actually did a <a href="https://benign.town/@joel/108564145793713657">poll on mastodon</a> to see what people would do. As of the writing of this post, most people say they would handle this by hand. And, to be honest, that’s kinda what I did, but I had some tricks up my sleve.</p> <h1 id="vim-macros-to-the-rescue">Vim macros to the rescue</h1> <p>Using macros with Vim is simply fantastic, I took a while to mention them, for some reason, all I had to do was implement 2 macros for the different kinds of markup I’ve used. Be it plain markdown (<code class="language-plaintext highlighter-rouge">![title](source)</code>) or plain html (<code class="language-plaintext highlighter-rouge">&lt;figure&gt;&lt;img&gt;&lt;/img&gt;&lt;figcaption&gt;&lt;/figcaption&gt;&lt;/figure&gt;</code>). There were a couple of edge cases, like when I included links inside of the captions and such.</p> <p>There are many examples and videos that talk about doign Vim macros, so I will just share some videos of how they worked out.</p> <p>For Markdown, I pretty much look for <code class="language-plaintext highlighter-rouge">![</code> and then used Vim keybindings to go word for word <code class="language-plaintext highlighter-rouge">w</code>, to the end of the line <code class="language-plaintext highlighter-rouge">$</code> and such, rinse and repeat.</p> <figure class="img"> <picture> <source srcset="/assets/img/blogs/2022-06-30_macros.gif" type="image/webp" /> <source srcset="/assets/img/blogs/2022-06-30_macros.gif" type="image/gif" /> <img class="mx-auto" src="/assets/img/blogs/2022-06-30_macros.gif" alt="Macro used for Markdown syntax." /> </picture> <figcaption class="caption">Macro used for Markdown syntax.</figcaption></figure> <p>The steps to make a macro for HTML were a bit more complicated, but doable nonetheless.</p> <figure class="img"> <picture> <source srcset="/assets/img/blogs/2022-06-30_macros2.gif" type="image/webp" /> <source srcset="/assets/img/blogs/2022-06-30_macros2.gif" type="image/gif" /> <img class="mx-auto" src="/assets/img/blogs/2022-06-30_macros2.gif" alt="Macro used for HTML syntax." /> </picture> <figcaption class="caption">Macro used for HTML syntax.</figcaption></figure> <p>My macro had some problems, since I was doing <code class="language-plaintext highlighter-rouge">dt"</code> to <em>delete</em> the contents of something un<em>til</em> a <em>quote</em> showed up, along other similar things, adding a link to a <code class="language-plaintext highlighter-rouge">figcaption</code> broke my macro in a couple cases. But other than that, it worked alright. I also had to run my macro from a certain position relative to the HTML, or else other things would not work properly.</p> <p>I guess doing macros is pretty much its own artform, I’ve seen some uses for them that blew me away. If you have not used them for anything before, you might want to give them a try next time you script something!</p> <h1 id="finishing-thoughts">Finishing thoughts</h1> <p>If I am honest, I still don’t know how I feel about it making use of includes in this way, since making the changes here was kinda annoying. But, thinking about it, it only took me like half an hour to do. I don’t know, maybe simply using something like <code class="language-plaintext highlighter-rouge">xclip</code> or <code class="language-plaintext highlighter-rouge">xdotool</code> to quickly access the plain HTML template would be a lot better to keep my markdown platform agnostic. I will think about it, but for now Jekyll is still my platform of choice.</p> ]]>
</content>
<author>
<name>joelchrono</name>
<email>me@joelchrono.xyz</email>
</author>
<category term="webdev"/>
<category term="coding"/>
<category term="vim"/>
<category term="jekyll"/>
<category term="fediverse"/>
<category term="blog"/>
<summary type="html">
<![CDATA[ I've not talked about Vim in a while, but today it was quite handy while setting up WebP fallbacks to support old browsers using Jekyll's includes feature ]]>
</summary>
</entry>
<entry>
<title type="html">Backup your dotfiles using stow</title>
<link href="https://joelchrono.xyz/blog/backing-up-my-dotfiles/" rel="alternate" type="text/html" title="Backup your dotfiles using stow"/>
<published>2021-08-31T16:20:03-05:00</published>
<updated>2021-08-31T16:20:03-05:00</updated>
<id>https://joelchrono.xyz/blog/backing-up-my-dotfiles</id>
<content type="html" xml:base="https://joelchrono.xyz/blog/backing-up-my-dotfiles/">
<![CDATA[ <p>Managing dotfiles has always been quite annoying to me. But thankfully, I never really had a reason to do it too often. When <a href="/blog/switching-distro-ending-school/">I moved from Void Linux to EndeavourOS</a>, all I did was <code class="language-plaintext highlighter-rouge">tar</code> my whole <code class="language-plaintext highlighter-rouge">.config</code> and copied the file to an external drive.</p> <p>That works fine, but it’s not the best way to backup the constant changes I usually do to customize the way my programs look or act, and as a customization freak, that happens <em>quite often</em>.</p> <p>I had seen many different ways to backup dotfiles: git bare repos, <a href="https://yadm.io">yadm</a>, symlinking scripts, and of course, GNU Stow.</p> <p>All of these methods have their up and downs, but in the end, <code class="language-plaintext highlighter-rouge">stow</code> convinced me, and I decided to give it a try. According to their <a href="https://www.gnu.org/software/stow/">home page</a>:</p> <blockquote> <p>GNU Stow is a symlink farm manager which takes distinct packages of software and/or data located in separate directories on the filesystem, and makes them appear to be installed in the same place.</p> </blockquote> <p>If you don’t really understand it yet, don’t worry, <em>I don’t either!</em> But in this blog, I will do my best to show you the steps to backup your current config files, I hope whoever reads this finds it useful.</p> <h1 id="creating-a-dotfiles-repository">Creating a dotfiles repository</h1> <p>The first step to backup your dotfiles, is to create an <strong>empty</strong> repository in some hosting service, such as <a href="https://github.com">GitHub</a>, <a href="https://codeberg.org">Codeberg</a> or <a href="https://sourcehut.org">SourceHut</a>. This is optional if you only want to see how <code class="language-plaintext highlighter-rouge">stow</code> works, but necessary to have an external backup outside your computer. Once you are done, clone the empty repo to your home directory, or in any place you want. (This tutorial will be using the home directory).</p> <p>To clone a repo, just do:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://site.com/link/to/repo </code></pre></div></div> <p>In my case, I use <a href="https://tildegit.org">Tildegit</a>, a Gitea instance, so my command looks like this.</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://tildegit.org/chrono/dotfiles.git </code></pre></div></div> <p>You can clone my dotfiles if you want to use them, <a href="https://tildegit.org/chrono/dotfiles.git">here</a> they are if you are interested.</p> <h1 id="using-stow-to-backup-your-configuration">Using stow to backup your configuration</h1> <p>Before actually backing something up, we need to install <code class="language-plaintext highlighter-rouge">stow</code>, depending on your distribution, you can install it with your package manager of choice. In my case, Endeavor is based on Arch, so I do:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>pacman <span class="nt">-S</span> stow </code></pre></div></div> <p>Lets start by backing up the configuration of a single program. While we can backup our whole <code class="language-plaintext highlighter-rouge">.config</code> folder, that’s <strong>not</strong> a good idea, since <strong>some</strong> programs store <strong>important</strong> information that <em>should</em> stay private, and I think its better to only backup what we have actually configured. For this example, I will backup my <code class="language-plaintext highlighter-rouge">picom</code> configurations.</p> <p>The first step is to create a new directory to use as a base (if you cloned your empty repo, you’ll be using that). You also have to create a folder structure, depending on where you want the configuration to be stored, this depends on the location the program will read its configuration from. We’ll refer to this folder as <code class="language-plaintext highlighter-rouge">dotfiles</code>.</p> <p>If you want to add a <code class="language-plaintext highlighter-rouge">README</code> file or other stuff that you is not a config files, you can create another directory inside of <code class="language-plaintext highlighter-rouge">dotfiles</code>, in my case, I have made a <code class="language-plaintext highlighter-rouge">stow_home</code> folder, which will be where we’ll run the <code class="language-plaintext highlighter-rouge">stow</code> command. <sup id="fnref:1"><a href="#fn:1" class="footnote" rel="footnote" role="doc-noteref">1</a></sup></p> <p>Lets explain how <code class="language-plaintext highlighter-rouge">stow</code> works. Picom expects its config file in <code class="language-plaintext highlighter-rouge">~/.config/picom/picom.conf</code>, so, inside of the new <code class="language-plaintext highlighter-rouge">home_stow</code> directory, we recreate that folder structure, but using the program name (<code class="language-plaintext highlighter-rouge">picom</code>) instead of the tilde (<code class="language-plaintext highlighter-rouge">~</code>), which usually refers to the home folder. <sup id="fnref:2"><a href="#fn:2" class="footnote" rel="footnote" role="doc-noteref">2</a></sup></p> <p>Lets put all of this together in the terminal.</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">mkdir </span>dotfiles <span class="o">&amp;&amp;</span> <span class="nb">cd </span>dotfiles <span class="c"># mkdir only if you didn't clone it</span> <span class="nb">touch </span>README.md other_file.txt <span class="c"># optional</span> <span class="nb">mkdir</span> <span class="nt">-p</span> ~/dotfiles/stow_home/picom/.config/picom/ <span class="nb">mv</span> ~/.config/picom/ ~/dotfiles/stow_home/picom/.config/ </code></pre></div></div> <p>Once you do that, your picom folder is no longer in the <code class="language-plaintext highlighter-rouge">.config</code> directory, but inside of <code class="language-plaintext highlighter-rouge">dotfiles/home_stow</code>, following <em>the same folder structure</em>, as if <code class="language-plaintext highlighter-rouge">home_stow</code> was the <code class="language-plaintext highlighter-rouge">/home</code> directory, followed by the user <code class="language-plaintext highlighter-rouge">picom</code> and the path to the picom configuration files. <sup id="fnref:4"><a href="#fn:4" class="footnote" rel="footnote" role="doc-noteref">3</a></sup></p> <p>Now we repeat this process with all of the files and directories we want to back up. Once done, the behavior of the programs you use, such as <code class="language-plaintext highlighter-rouge">vim</code>, should revert to their default configurations, since the user config files are no longer there. So, <strong>now its time to fix that!</strong> Inside of <code class="language-plaintext highlighter-rouge">stow_home</code>, run the following command:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>stow <span class="nt">-vt</span> ~ <span class="k">*</span> </code></pre></div></div> <p>This will symlink <strong>everything</strong> inside of <code class="language-plaintext highlighter-rouge">stow_home</code> <sup id="fnref:3"><a href="#fn:3" class="footnote" rel="footnote" role="doc-noteref">4</a></sup>, targetting <code class="language-plaintext highlighter-rouge">~</code> as the starting point. The <code class="language-plaintext highlighter-rouge">-v</code> flag will let you know of everything being done, so you should see an output like this, depending on the programs you backed up:</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># $ stow -vt ~ *</span> LINK: .config/awesome <span class="o">=&gt;</span> ../dotfiles/stow_home/awesome/.config/awesome LINK: .config/bat <span class="o">=&gt;</span> ../dotfiles/stow_home/bat/.config/bat LINK: .config/dunst <span class="o">=&gt;</span> ../dotfiles/stow_home/dunst/.config/dunst LINK: .config/nvim <span class="o">=&gt;</span> ../dotfiles/stow_home/nvim/.config/nvim LINK: .config/picom <span class="o">=&gt;</span> ../dotfiles/stow_home/picom/.config/picom LINK: .config/rofi <span class="o">=&gt;</span> ../dotfiles/stow_home/rofi/.config/rofi LINK: .config/spectrwm <span class="o">=&gt;</span> ../dotfiles/stow_home/spectrwm/.config/spectrwm </code></pre></div></div> <h1 id="file-versioning-with-git">File versioning with git</h1> <p>If you stumbled upon this guide, you probably know the necesary <code class="language-plaintext highlighter-rouge">git</code> commands to backup everything to the service you chose at the beginning of this guide.</p> <p>Generally, everytime you do changes you only need to follow these three commands, inside of your <code class="language-plaintext highlighter-rouge">dotfiles</code> folder.</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git add <span class="k">*</span> git commit <span class="nt">-m</span> <span class="s2">"Added config files"</span> git push </code></pre></div></div> <p>Remember that the last command will not work if you don’t have an external repository.</p> <p>The manual of GNU Stow contains a lot more than what I mentioned here, like unlinking and other flags that can be used and might be useful for your use case.</p> <h1 id="finishing-up">Finishing up</h1> <p>Anyways, that’s all folks, this has been day 54 of <a href="https://100DaysToOffload.com">#100DaysToOffload</a>, you can check out my dotfiles if you want to see how <code class="language-plaintext highlighter-rouge">stow</code> looks once setup, besides, my <a href="/blog/spectrwm-setup">Spectrwm configuration</a> is quite sick if I do say so myself.</p> <p>If you feel like a step is not clear enough, please let me know in the comments or via e-mail.</p> <h2 id="secret-bonus-script">Secret bonus script!</h2> <p>So, if you read until the end of this blog. I actually did a pretty decent bash script to automate everything here.</p> <p>All you need to do is configure it to your liking and run it like this</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dotstow file_or_folder </code></pre></div></div> <p>The script is as follows, it uses basic tools like <code class="language-plaintext highlighter-rouge">cut</code> and of course, <code class="language-plaintext highlighter-rouge">stow</code></p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/usr/bin/bash</span> <span class="c"># Dotstow - Backup your chosen dotfiles in one go using stow.</span> <span class="c"># Run it outside of the folder/file you want to back up</span> <span class="c"># $ dotstow file-or-program</span> <span class="c"># This program was made by joelchrono12</span> <span class="nv">STOW_DIR</span><span class="o">=</span><span class="nv">$HOME</span>/dotfiles/stow_home <span class="nv">DIR</span><span class="o">=</span><span class="si">$(</span><span class="nb">pwd</span> | <span class="nb">cut</span> <span class="nt">-d</span> <span class="s1">'/'</span> <span class="nt">-f4-</span><span class="si">)</span> <span class="nv">NEW_DIR</span><span class="o">=</span><span class="nv">$STOW_DIR</span>/<span class="nv">$1</span>/<span class="nv">$DIR</span> <span class="nb">mkdir</span> <span class="nt">-pv</span> <span class="nv">$NEW_DIR</span> <span class="nb">mv</span> <span class="nt">-v</span> <span class="nv">$1</span> <span class="nv">$NEW_DIR</span> <span class="nb">cd</span> <span class="nv">$STOW_DIR</span> stow <span class="nt">-vt</span> ~ <span class="nv">$1</span> </code></pre></div></div> <p>The program does not check if a folder already exists or anything like that. So feel free to send any suggestions and changes to it in a comment or using <a href="https://git-send-email.io/">git send-email</a> to my email address.</p> <hr /> <div class="footnotes" role="doc-endnotes"> <ol> <li id="fn:1"> <p>You can just use dotfiles as is without a folder inside it, but if you want to be able to quickly deploy everything using <code class="language-plaintext highlighter-rouge">*</code>, you must make a folder where README and other files you don’t want to symlink won’t interfere . <a href="#fnref:1" class="reversefootnote" role="doc-backlink">&#8617;</a></p> </li> <li id="fn:2"> <p>Other files, like <code class="language-plaintext highlighter-rouge">.bashrc</code>, are not in the <code class="language-plaintext highlighter-rouge">.config</code> folder, keep in mind that the path to use depends on where the program needs it to be. In this case, it would have to be placed in <code class="language-plaintext highlighter-rouge">~/dotfiles/stow_home/bash/.bashrc</code>. <a href="#fnref:2" class="reversefootnote" role="doc-backlink">&#8617;</a></p> </li> <li id="fn:4"> <p>You can also move specific files of a configuration folder. For example, <code class="language-plaintext highlighter-rouge">tut</code>, a mastodon client, saves the account data (passwords, etc) inside of another file in its configuration folder. if thats the case. You should move only the files you want, instead of the whole directory. <code class="language-plaintext highlighter-rouge">stow</code> should manage the rest. <a href="#fnref:4" class="reversefootnote" role="doc-backlink">&#8617;</a></p> </li> <li id="fn:3"> <p>If you are unsure about the paths you created, you can run the <code class="language-plaintext highlighter-rouge">-n</code> flag to <em>simulate</em> the output and see exactly where each symlink <em>would be</em> placed. That way you dont end up symlinking in the wrong place and doing weird stuff to your filesystem. <a href="#fnref:3" class="reversefootnote" role="doc-backlink">&#8617;</a></p> </li> </ol> </div> ]]>
</content>
<author>
<name>joelchrono</name>
<email>me@joelchrono.xyz</email>
</author>
<category term="linux"/>
<category term="foss"/>
<category term="vim"/>
<category term="tutorial"/>
<category term="dotfiles"/>
<category term="coding"/>
<category term="bash"/>
<summary type="html">
<![CDATA[ I finally figured out a nice way to backup my config files, and I decided to upload mine once and for all. ]]>
</summary>
</entry>
<entry>
<title type="html">Changing my workflow, making it Vim-like, switching rom</title>
<link href="https://joelchrono.xyz/blog/changing-my-workflow/" rel="alternate" type="text/html" title="Changing my workflow, making it Vim-like, switching rom"/>
<published>2021-05-07T18:20:03-05:00</published>
<updated>2021-05-07T18:20:03-05:00</updated>
<id>https://joelchrono.xyz/blog/changing-my-workflow</id>
<content type="html" xml:base="https://joelchrono.xyz/blog/changing-my-workflow/">
<![CDATA[ <p>Lately I have decided to change a bunch of stuff when it comes to my workflow with my devices. Be it my laptop or my android phone. I have made some changes mostly out of boredom, but also because I have got a few problems that I didn’t feel like fixing on <a href="https://github.com/conformal/spectrwm">Spectrwm</a>, as well as other quality of life changes.</p> <h1 id="-leaving-spectrwm-embracing-awesome-considering-dwm">🪟 Leaving Spectrwm, embracing Awesome, considering DWM</h1> <p>I really, really liked Spectrwm, I might as well go back to it in a few days, since the main reason I am moving away from it might not be that hard to fix. I find the system tray to be quite useful to me, my choice was <a href="https://github.com/sargon/trayer-srg">trayer</a>, since it was good enough. However, I had some problems that made it feel pretty clunky.</p> <ul> <li>I can only show tag numbers,or numbers + name. I want to display only the names, which are Nerd Font glyphs.</li> <li>The systray will overlap with the bar content, at least on the position I want it to be.</li> <li>The systray wont follow me when switching workspace, but I have a script that moves it using <code class="language-plaintext highlighter-rouge">wmctrl</code></li> <li>When trayer gets moved to my current workspace, it steals focus, if I close every window, it steals focus</li> <li>If trayer gets mouse focus, I <strong>cannot</strong> do <strong>anything</strong>, no keybindings will work. The only thing that works is clicking an icon that opens a window (like Discord) or killing Spectrwm from a TTY</li> </ul> <p>Honestly, most of these problems are not a big deal most of the time. But as I said, I am doing this mainly out of boredom, so let me be.</p> <p>Installing <a href="https://dwm.suckless.org/">dwm</a> also came to mind, and I decided to give it a try, but right now I can’t wrap my head around it, but I might check it out later.</p> <h1 id="-changing-firefox-checking-out-qutebrowser">🌐 Changing Firefox, checking out Qutebrowser</h1> <p>For quite some time, I have heard good things about <a href="https://qutebrowser.org/">Qutebrowser</a>. So I have decided to give it a try. I actually loved it, I really liked the way it works and I found myself extremely comfortable using Vim keybindings on it. I really enjoyed how smooth it was and the keyboard driven workflow.</p> <p>Its engine is now based on Chromium, which is a bit annoying since I support Firefox’s Gecko. However it now will display most websites better than when it was using WebKit as a base.</p> <p>So right now I decided to go back to Firefox, and set it up in a similar manner to <a href="https://gitlab.com/hexdsl/dots/-/tree/master/firefox">HexDSL’s configuration</a>, which has tabs on the left side and gets rid of most of the GUI, making it pretty nice looking to me. I will change to Qutebrowser once I set it up properly and get ad-blocking on it.</p> <p>For now, Firefox + <a href="https://github.com/ueokande/vim-vixen">VimVixen</a> will do to give me that Vim-like workflow. I actually can’t believe how handy and nice it is.</p> <h1 id="-maybe-distro-hopping-changing-rom-again">💻 Maybe distro hopping, changing rom again</h1> <p>After all this, I have also been thinking about changing my distro once again. I have enjoyed void for quite a while, and its great, with no doubt, I might just be a bit inspired while writing this and I might end up not switching after all.</p> <p>I have been considering something like <a href="https://endeavouros.com/">EndeavourOS</a>, or maybe reinstalling Void, but base only, we will see. I am a bit tempted by the “terminal driven” workflow the claim to have, I already have that on Void, but I am still curious.</p> <p>Also, I will change my Android rom soon. I haven’t updated it in a while, and I have been looking for a bit more customization than what I already have. I have downloaded <a href="https://crdroid.net/">CrDroid</a>, which has an official rom available for my Redmi Note 8, so I will give it a try later today.</p> <p>Syncthing and Migrate are great tools for making backups, and I think I will have to install minimal Gapps due to school stuff, and because I got some paid apps I can’t live without, such as Nova Launcher or Typing Hero. I am working towards changing that, but not right now.</p> <p>I always feel quite dirty when I have to change rom and reinstall the Google apps, especially when I try to defend FOSS and Android in general, but well, you gotta do what you gotta do.</p> <h1 id="wrapping-up">Wrapping up</h1> <p>Anyways, after all of this I gotta say I am quite happy with the changes I’ve done, and I hope the ones I still have to make will be good too. I have had some problems with time management, and I know that it’s kind of a meme the amount of time you invest on setting everything up on Linux to get actual work done. But well, I enjoy it, and I still managed to deliver all of my homework! So I consider this a win. I have exams next week, so let’s see what happens with that.</p> <p>This has been day 34 of <a href="https:/100DaystoOffload.com">#100DaystoOffload</a></p> ]]>
</content>
<author>
<name>joelchrono</name>
<email>me@joelchrono.xyz</email>
</author>
<category term="linux"/>
<category term="lifestyle"/>
<category term="android"/>
<category term="foss"/>
<category term="vim"/>
<summary type="html">
<![CDATA[ I feel like testing stuff out, switching my workflow around, evading being bored and completing my homework in time! ]]>
</summary>
</entry>
<entry>
<title type="html">Automating the creation of this blog</title>
<link href="https://joelchrono.xyz/blog/making-a-script-to-blog/" rel="alternate" type="text/html" title="Automating the creation of this blog"/>
<published>2021-03-09T21:32:00-06:00</published>
<updated>2021-03-09T21:32:00-06:00</updated>
<id>https://joelchrono.xyz/blog/making-a-script-to-blog</id>
<content type="html" xml:base="https://joelchrono.xyz/blog/making-a-script-to-blog/">
<![CDATA[ <p>As the title said, I have been playing with some bash scripting since I was kinda bored. I was thinking about a blog made by <a href="https://kevq.uk/the-wonderful-world-of-wordpress-wizardry-for-working-with-websites/">Kev</a>, where he expressed how he moved away from Jekyll and back to WordPress. Now, I have never used WP, so I don’t really know how many advantages, besides the mentioned in his blog, it has.</p> <p>But that blog helped me to see, and recognize some of problems and annoyances I have with my current workflow.</p> <p>Recently, I started to use Neovim to make my blogs, like the one you are reading right now. And since I am already trying to be as minimal as possible, I decided to make a script that helped me do the following things</p> <ol> <li>Create a post file</li> <li>Name it and add its date</li> <li>Add the metadata to it</li> <li>Open it to start editing</li> </ol> <h1 id="doing-scripting-stuff-not-a-tutorial-tbh">Doing scripting stuff (Not a tutorial tbh)</h1> <p>So, doing a script on linux is kinda easy, because of the way UNIX like systems work, I can make use of small utilities that can do small things and wrap everything together to make new useful scripts to automate the little things. In my case, I made something like this.</p> <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#! /bin/bash</span> <span class="nb">echo</span> <span class="s2">"Type filename"</span> <span class="nb">read </span>name <span class="nv">filename</span><span class="o">=</span><span class="si">$(</span><span class="nb">date</span> +<span class="s2">"%Y-%m-%d"</span>-<span class="nv">$name</span><span class="si">)</span> <span class="nb">touch</span> /path/to/_posts/<span class="nv">$filename</span>.md <span class="nb">printf</span> <span class="s1">'%b\n'</span> <span class="s2">"</span><span class="si">$(</span><span class="nb">cat</span> /path/to/_template.md<span class="si">)</span><span class="s2">"</span> <span class="o">&gt;&gt;</span> /path/to/_posts/<span class="nv">$filename</span>.md alacritty <span class="nt">-e</span> nvim /path/to/_posts/<span class="nv">$filename</span>.md </code></pre></div></div> <h2 id="a-quick-explanation">A quick explanation</h2> <ul> <li> <p>In this case, <code class="language-plaintext highlighter-rouge">echo</code> allows me to print text, just like <code class="language-plaintext highlighter-rouge">printf</code>, to keep the format of my <code class="language-plaintext highlighter-rouge">template.md</code> file, containing the metadata of the blog, sp I only have to fill it out (I could probably automate this too, honestly).</p> </li> <li> <p>I used <code class="language-plaintext highlighter-rouge">date</code> to create the and format the filename of the post, as well as add the given title using <code class="language-plaintext highlighter-rouge">read</code> (I cannot use spaces, but I always use dashes <code class="language-plaintext highlighter-rouge">-</code> anyways).</p> </li> <li> <p>I used <code class="language-plaintext highlighter-rouge">touch</code> to create the markdown file and place it in the right locations.</p> </li> <li> <p>Finally, I open the file on Neovim in a new terminal window (my choice is <a href="https://github.com/alacritty/alacritty">alacritty</a>).</p> </li> </ul> <h1 id="wrapping-up">Wrapping up</h1> <p>And that was it! I actually managed to do it. I am not sure if I could make it even simpler, but I am happy with the result. I can now start my blogs in a better way than before, where I copied and pasted everything from a previous file, that I had to open and close and I also had to be type the path of the file and make it and all of the usual stuff. But hey, now it’s everything automated for me!</p> <p>Also! I also made some changes to the font sizes of this blog, and other CSS things, just because I felt that everything was a little too big, and I didn’t feel like scrolling that much just to get past the title. I think I still have to tweak it a little bit, but it is a good start.</p> <p>This was day 23 of <a href="https://100daystooffload.com">#100DaystoOffload</a>, let me know if you found this kinda useful for you too. Or if you have a better script or anything that you use to make your blog workflow better!</p> ]]>
</content>
<author>
<name>joelchrono</name>
<email>me@joelchrono.xyz</email>
</author>
<category term="linux"/>
<category term="coding"/>
<category term="tutorial"/>
<category term="vim"/>
<summary type="html">
<![CDATA[ I tried to make a script to automate the creation of this blog, as a proper linux user should (kinda). And some blog CSS changes ]]>
</summary>
</entry>
<entry>
<title type="html">Writing a blog from the terminal</title>
<link href="https://joelchrono.xyz/blog/blogging-from-terminal/" rel="alternate" type="text/html" title="Writing a blog from the terminal"/>
<published>2021-03-02T18:35:00-06:00</published>
<updated>2021-03-02T18:35:00-06:00</updated>
<id>https://joelchrono.xyz/blog/blogging-on-vim</id>
<content type="html" xml:base="https://joelchrono.xyz/blog/blogging-from-terminal/">
<![CDATA[ <p>So, up until now I have been using <a href="https://typora.io/">Typora</a>, a markdown text editor that I decided to use, mainly because of the spell checking capabilities that it offers.</p> <p>Most other editors, like <a href="https://wiki.gnome.org/Apps/Gedit">Gedit</a>, which is the GUI editor I use for most simple things, doesn’t really offer any way to check for errors, and even though I try to type correctly, sometimes I just miss a letter, or an accent (Especially because I do most of my homework and note taking in Spanish, English is too easy in comparison).</p> <p>So anyways, I have decided to try and do this blog using Neovim and only that, with the help of a few external programs to help me deal with the caveats that using terminal editor brings.</p> <h1 id="some-plugins-and-external-programs-later">Some plugins and external programs later…</h1> <p>I installed a few plugins that I saw in some videos, such as <a href="https://github.com/junegunn/goyo.vim">Goyo</a> and <a href="https://github.com/junegunn/limelight.vim">Limelight</a>, that are supposed to help focus on typing and only that (I am struggling to get Limelight to work with the Nord color scheme, I will sort it out later). But I have seen a few others that can do more powerful stuff, like prettifying tables made with pipes and such, as well as automatically hiding markdown elements like <code class="language-plaintext highlighter-rouge">*italics*</code> and <code class="language-plaintext highlighter-rouge">__boldness__</code>, as well as <code class="language-plaintext highlighter-rouge">[hyperlinks](https://https://joelchrono.xyz)</code>. But I am currently seeing all of this pretty clearly.</p> <p>Also, I found a pretty epic terminal utility called <a href="http://aspell.net/">Aspell</a>, which is quite a life-saver, since, as its name implies, it is pretty useful to check for mistakes and errors in this text.</p> <p>All I have to do is install the right <a href="https://ftp.gnu.org/gnu/aspell/dict/en/">dictionaries</a>, and run the following command:</p> <div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ aspell -l en_US --mode markdown -c file.md </code></pre></div></div> <p>And that will look for mistakes and correct them in case there are any, as you can see in this screenshot:</p> <figure class="img"> <picture> <source srcset="/assets/img/blogs/2021-03-02-aspell.webp" type="image/webp" /> <source srcset="/assets/img/blogs/2021-03-02-aspell.jpg" type="image/jpeg" /> <img class="mx-auto" src="/assets/img/blogs/2021-03-02-aspell.jpg" alt="I definitely made those mistakes on purpose" /> </picture> <figcaption class="caption">I definitely made those mistakes on purpose</figcaption></figure> <p>To be honest, I just wanted to have something to type right now. Since I have been a little busy with University and was struggling to keep up with my blog.</p> <p>Now I am going to share a little screenshot of how this setup looks, because why not?</p> <figure class="img"> <picture> <source srcset="/assets/img/blogs/2021-03-02-nvim-to-write.webp" type="image/webp" /> <source srcset="/assets/img/blogs/2021-03-02-nvim-to-write.jpg" type="image/jpeg" /> <img class="mx-auto" src="/assets/img/blogs/2021-03-02-nvim-to-write.jpg" alt="Is this some kind of blogception???" /> </picture> <figcaption class="caption">Is this some kind of blogception???</figcaption></figure> <p>So, yeah this was not that hard to do, there are still some things I have to figure out, luckily, most of these tools will also be useful for my <a href="/blog/doing-school-work/">homework workflow</a> so, that’s a win for me! This has been day 21 of <a href="https://100daystooffload.com">#100DaystoOffload</a></p> ]]>
</content>
<author>
<name>joelchrono</name>
<email>me@joelchrono.xyz</email>
</author>
<category term="foss"/>
<category term="linux"/>
<category term="vim"/>
<summary type="html">
<![CDATA[ I have decided to try and write a blog on Nvim, it is quite easy until it is not, but I will get used to it ]]>
</summary>
</entry>
</feed>