Add your own title and intro here (Change this under Settings -> General -> Tagline)

Category: Inquiry

This is the category to apply to your Inquiry posts.

Final Summative Product

Terminal Tools That Changed My Workflow

During this term, I’ve been learning tools that improve how I work in the terminal. This post is a summary of what I learned from using Tmux, customizing Vim for writing, and going deeper into Vim/BASH features. For my workflow, learning these tools reduce cognitive overhead and make my workflow faster and more efficient.

Tmux – Why I Use It Now

Before using Tmux, managing multiple projects and terminals was frustrating. I would have to open multiple windows, manually navigate to directories using cd, and I would have to remember exactly what I was working, which is a big deal when working on multiple projects at the same time.

Tmux solves that.

With Tmux I can:

  • Create a session for each project.
  • Save the exact state of that session.
  • Resume exactly where I left off, even after a reboot.

This means:

  • I don’t have to remember what I was doing or in what directory.
  • I don’t have to navigate to directories every time.
  • I can close everything without worrying about losing progress.

Tmux became part of my daily workflow after only a few days of use, because of how much cognitive overhead it reduces.

Making Vim Work for Writing

I originally learned Vim for editing code, but this term required a lot of writing. I didn’t want to use a separate word processor, for several reasons.

So I turned Vim into one.

Vim is a keyboard-based editor with different modes:

  • Normal: Navigate and run commands
  • Insert: Type text
  • Visual: Select text

Using Vim for everything reduces mental overhead. I don’t have to learn multiple apps with different shortcuts.

I wrote a custom command WordMode that makes Vim better for writing:

  • Wraps lines and adds line breaks
  • Enables spell check
  • Smart indenting
  • Light background
  • Remaps movement keys to respect visual lines

Now I can comfortably use one editor for everything—coding, writing, presentations.

Vim and BASH – Advanced Features

I also spent time learning features in Vim and BASH that I hadn’t used much before.

Vim Capture Groups

Vim allows capturing parts of text using regex. This is useful for:

  • Editing repeated patterns
  • Swapping or reordering parts of a line
  • Making batch edits

These features are powerful and eliminate the need for manual editing.

BASH: xargs, ls, tr

Xargs is a very useful command if you need to pipe multiple arguments into another program. To illustrate xargs use consider a practical example: I often search through PDFs when studying. I used to combine files like this:

pdfunite *.pdf all.pdf

But this merges files in the wrong order. A better way is:

ls -tr *.pdf | tr '\n' '\0' | xargs -0 pdfunite all.pdf

This:

  • Sorts PDFs by time
  • Handles filenames with spaces
  • Builds a clean pipeline using UNIX principles

“Write programs to do one thing well. Write programs to work together.”

Final Thoughts

The motivation for my inquiry was to fill the knowledge caps in my workflow which is terminal-focused. I wasn’t using some basic but essential commands like xargs or syntax like $(command). I also wasn’t using many powerful features in Vim like macros, capture groups, or navigation with t and f. I didn’t have a good solution for terminal multiplexing either, adopting Tmux fixed that and gave me a much more organized and efficient workspace. This project gave me the opportunity to dive deeper into the tools I use on a daily basis, and think about what else could be improved and expanded on as well.

Plans to further develop my setup:

  • Git integration using the vim-fugitive plugin
  • Deep dive into Vim’s quickfix lists
  • Create custom remaps for Tmux

These changes are helping me build a focused, minimal setup.

Exploring Vim & BASH advanced features

Exploring Vim & BASH advanced features

In this blog post I illustrate how I have been pushing my knowledge in Vim and BASH by using some of their most powerful features.

tl;dr:

  • Groups can be captured in Vim using the syntax \(<example group>\) which are useful when modifying, adding, and changing text around a pattern that is meant to stay in tact (group).
  • Xargs is an essential and probably one of the most important BASH commands. It allows for powerful piping, and combining commands, which when used together become sophisticated and powerful.

Vim Capture Groups

One of the most useful features in Vim is capture groups. I will be honest, I have known about capture groups for a while but I never pushed myself to learn them, that is why for this weeks inquiry I wanted to get a grasp of this feature. To illustrate what capture groups are, I will explain different use cases for them, and give a visual example of them at work.

Common use cases

Adding text around a group to change how it functions within a program.
Changing the structure of multiple lines.
Swapping, or re-ordering multiple groups.

This video illustrates some of the examples that I have already encountered in my date-to-day work, illustrated through examples. (ignore the last 1 minute of the video, there was a glitch when combining the two videos)

BASH – ls, and xargs commands

The Issue

This term I have been using a lot of BASH commands when accessing and organizing information for my various classes. To illustrate this, consider an example: It is common for me, and I assume other students to be searching for information that is contained in a specific pdf file but unsure which pdf that information is contained in. There are probably many different approaches to this problem, however the way that I usually solve this is combining all of the pdf files into one then searching for keywords.

A Rudimentary Solution

The way that I would traditionally accomplish this would be with a command like pdfunite *.pdf all.pdf however this leads to an issue where the files are out of order, this solution somewhat solves the issue but it could still be better and more robust.

A Good Solution

It would be nice to be able to sort the pdf’s by an identifier, or metadata like the time/date the files were downloaded, or some other parameter. This is not immediately obvious how to accomplish, however incidentally I came across the xargs command (“build and execute command lines from standard input”). Which allows this kind of sorting to be done before passing the file names to a program. In the improved command we can first sort all of the pdf’s in that folder from oldest to newest which would be the order that the pdf’s were released from the prof, then pass that sorted list of files to pdfunite and replace \n to \0 in case the file contains spaces. -t means sort by time -r means reverse the ordering.

ls -tr *.pdf | tr '\n' '\0' | xargs -0 pdfunite all.pdf

Another use I have found is for music being in order from an unsorted album, each song is its own file. We can apply a similar command to ensure that we play the album in the correct order. The -c flag means sort by time the file was modified. Therefore this will sort the files by time they were downloaded.

ls -trc *.mp4 | tr '\n' '\0' | xargs -0 mpv

If you have any bash commands that you find useful I would love to know, thanks for stopping by!

“Write programs that do one thing and do it well.”
“Write programs to work together.”
“Write programs to handle text streams, because that is a universal interface”

https://en.wikipedia.org/wiki/Unix_philosophy

Vim as a Word Processor

I started learning Vim/NeoVim a few years ago in order to become faster at text editing, mainly for coding. However this term I am in a lot of classes that require writing, so for this blog I wanted to set up my Nvim to behave like a word processor.

Vim as a Word Processor demo

Back ground of Vim

Vim is a simple, terminal based text editor, centered around keyboard navigation rather than, mouse navigation. When using Vim the mouse is not used whatsoever. This is achieved through Vim modes. The most used being:
Normal mode: When the user presses <Escape> they enter normal mode. When in normal mode, is when the user can navigate the page or enter commands. Insert mode: Pressing <i> enters insert mode, once in insert mode, the user can insert text. Visual mode: Pressing <v> enters visual mode, which allows the user to select text. Vim uses grammar oriented shortcuts: For example <2ft> this would translate to “second forward letter t” -> “move the cursor to the second t”

Why would I want to use Vim as a word processor rather than just using a word processor?

Mainly because editing text with a mouse is cognitively taxing and not fun. Vim allows me to edit any text in an efficient, fast and fun way, regardless of the file type. I can use it for coding, writing English, and creating presentations. This unified approach reduces cognitive overhead immensely because I do not have to learn new applications that have different shortcuts, I can learn one set and get really good at that set of shortcuts, and I never have to reach for the mouse when I am working in Vim!

How I made Vim into a word processor

Since Vim/NeoVim is open source it is very easy to hack and customize, this made it very easy to create a command called WordMode that turns the editor from a code editor into a word processor. I will not explain this function, but if anyone is interested in adding this to their NeoVim setup, the code will be included at the end.

Conclusion

Creating a WordProcessor mode in Vim has been a game changer for me, because I used to find my self getting stuck while writing and not knowing what to say. Vim allows me to get my ideas out fast, which allows me to flow smoothly while writing.

sources

Download:

https://github.com/neovim/neovim
https://www.lazyvim.org/

Other

https://en.m.wikipedia.org/wiki/File:Neovim-logo.svg

-- Define the "Word Processing Mode"
local function word_processor_mode()
  -- Set format options for text formatting
  vim.opt_local.formatoptions = 't1'
  -- Set text width to 80 for line wrapping
  --vim.opt_local.textwidth = 80
  -- Map 'j' and 'k' to move through visual lines instead of wrapped lines
  vim.api.nvim_buf_set_keymap(0, 'n', 'j', 'gj', { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(0, 'n', 'k', 'gk', { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(0, 'n', '0', 'g0', { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(0, 'n', '$', 'g$', { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(0, 'v', 'j', 'gj', { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(0, 'v', 'k', 'gk', { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(0, 'v', '0', 'g0', { noremap = true, silent = true })
  vim.api.nvim_buf_set_keymap(0, 'v', '$', 'g$', { noremap = true, silent = true })
  -- Enable smart indent
  vim.opt.colorcolumn = ''
  vim.opt_local.smartindent = true
  vim.opt_local.spell = true
  vim.opt_local.wrap = true
  vim.opt_local.linebreak = true
  -- Enable spell checking with English (US) dictionary
  vim.opt_local.spelllang = 'en_us'
  -- Disable tab expansion to spaces
  vim.opt_local.expandtab = false
  -- Set background to light mode
  vim.opt.background = 'light'
  vim.opt.scrolloff = 1
  -- require('zen-mode').toggle()
end

-- Create a command to trigger "Word Processing Mode"
vim.api.nvim_create_user_command('WordMode', word_processor_mode, {})

CLI Tools: TMUX – Terminal Multiplexer

As a programmer, it is expected to spend a significant time using UNIX shells. However out of the box the vanilla UNIX experience can be clunky and inefficient. There are many terminal based tools (CLI tools) that address this issue, one being Tmux. I have been using Tmux for only a few weeks, but its been so useful that I have already integrated it into my workflow. In this post I will go over what I personally have found useful about Tmux, and why its worth considering if you use the terminal frequently.

“(tmux — terminal multiplexer) tmux is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached”. – TMUX man(1) page

The main benefit of Tmux is that it minimizes cognitive overhead by containerizing terminal sessions, to illustrate this, consider an example: You’re working on 3 programming projects and for each of those projects you’re actively working on 3 files, plus a shell for testing/running code. That’s already potentially 12 windows that you would have to manage on a daily basis if you were not using Tmux. Not only would you have to manage these windows on the screen but you would also have to navigate to that location everyday, this would be tedious and a waste of time.

Here is the Tmux indicator, showing that I am connected to the session “mysession” and there are three windows numbered 1,2,3. 1:nvim is indicating that window 1 has nvim open.

Now, consider the same example but with using Tmux. You can create a Tmux session for each of the projects you’re working on. After creating a session for each project, the current state of each session is saved, even after reboot. This saves time and frustration by: not having to think about what you were working on over a long period of time (potentially months working on a software project), not having to repetitively navigate to what you were working on, and acts as a safe guard against unexpected reboots like a power outage.

Consider the following two videos. The first is a workflow without using Tmux, the second is one using Tmux.

This is the manual way of “cd’ing” into a directory, without Tmux. Very repetitive and wastes time.
Using Tmux simple as running tmux attach -> C-a + o -> select session -> returns to what I was working on.

The way that I have been using Tmux, is to have a session for each of my classes. This allows me to work on muliple written assignments at once without having to remember exactly what I was working on, I can just attach to the session and continue working. This will be a game changer for me, because I was wasting a lot of time before just using cd and lf to navigate files.

The following posts will explore more CLI tools, and a deep dive into NeoVim. Thanks for stopping by!

Resources:

https://github.com/omerxx/dotfiles/tree/master/tmux

https://upload.wikimedia.org/wikipedia/commons/e/e4/Tmux_logo.svg

Digital Literacy Inquiry

Assignment 1: Deeper Dive Inquiry process posts and summary posts will be shared using the category “Inquiry,” as this post does. As you can see, it is set up to pull these posts into the Inquiry menu on your blog.

© 2025 PM Blog

Theme by Anders NorenUp ↑