Post

Linux daily-use and development tools - part 2

Linux daily-use and development tools - part 2

This is the second installment of a multi-part series on Linux daily-use and development tools.

Configure konsole

Konsole is the default terminal emulator for the KDE desktop environment. It is clean, customizable, and takes up less screen space compared to other terminal emulators. With a few tweaks and additions, the already robust Konsole can become even more powerful and productive. This section illustrates how.

Install Oh My Posh

Oh My Posh is a theme engine for shell prompts, compatible with any shell such as bash, zsh, or others. Install with the following command:

1
curl -s https://ohmyposh.dev/install.sh | bash -s

Update the PATH by exporting it to ~/.bashrc.

1
echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc

Reload the bash configuration file:

1
source ~/.bashrc

Install nerd fonts

Nerd fonts are a collection of open source font, programming related symbols and icons tailored specifically for developers, mainly to improve terminal and programming experience. Oh My Posh can install nerd fonts system wide accessible to all users when used with sudo.

1
2
oh-my-posh font install # Downloads and display list of available fonts
oh-my-posh font install cascadiamono # Install CascadiaMono nerd font from the above list.

Activate theme

Oh My Posh has numerous themes located in the $HOME/.cache/oh-my-posh/themes directory. Visit this web page to preview each theme.

I’ve created a custom theme named nsd.json and placed it in the aforementioned themes directory. Here is that file content.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
    "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
    "blocks": [
        {
            "alignment": "left",
            "segments": [
                {
                    "foreground": "#B5B50D",
                    "style": "plain",
                    "template": "\uf0e7",
                    "type": "root"
                },
                {
                    "foreground": "#61AFEF",
                    "properties": {
                        "style": "agnoster"
                    },
                    "style": "plain",
                    "template": "{{ .Path }} ",
                    "type": "path"
                },
                {
                    "foreground": "#F3C267",
                    "properties": {
                        "branch_gone_icon": "\u274e",
                        "branch_identical_icon": "\uf14a"
                    },
                    "style": "plain",
                    "template": "{{ .HEAD }}",
                    "type": "git"
                },
                {
                    "foreground": "#C94A16",
                    "style": "plain",
                    "template": "x{{ reason .Code }} ",
                    "type": "status"
                },
                {
                    "foreground": "#BFA8BF",
                    "style": "powerline",
                    "template": "<#fff>\uf120</> ",
                    "type": "shell"
                }
            ],
            "type": "prompt"
        }
    ],
    "version": 2
}

To enable a specific theme, insert the following line into your $HOME/.bashrc file. Replace nsd.json with the desired theme file name, and then reload the .bashrc file.

1
2
echo 'eval "$(oh-my-posh init bash --config ~/.cache/oh-my-posh/themes/nsd.json)"' >> $HOME/.bashrc
source $HOME/.bashrc

Change konsole settings

  • Settings -> Configure konsole -> profiles -> New (name it nsd)-> Save -> Set a default
  • Settings -> Configure konsole -> General -> Check Remove window titlebar and frame
  • Settings -> Configure konsole -> Tab Bar / Splitters -> Appearance -> Show -> Always
  • Ctrl + Shift + M
  • Select the font by going: Settings -> Configure konsole ->Profiles -> nsd -> Edit -> Appearance -> Color scheme & font -> Choose -> MesloLGL Nerd Font. If you can’t see the font, restart konsole.
  • Select the font by going: Settings -> Configure konsole ->Profiles -> nsd -> Edit -> Scrolling -> Scrollback -> Unlimited -> Apply

Install neovim distribution

Install neovim

Download latest version from https://github.com/neovim/neovim/blob/master/INSTALL.md

1
2
sudo tar xvf ~/Downloads/nvim-linux64.tar.gz -C /opt/
sudo ln -s /opt/nvim-linux64/bin/nvim /home/nsd/.local/bin/

Installing nvpunk

Install latest node LTS from https://nodejs.org/en/download/package-manager using nvm. This installs npm too.

1
2
3
4
5
6
. ~/.bashrc
nvm install 20
node -v
npm -v
. ~/.bashrc
sudo apt install python3.12-venv

Now install nvpunk:

1
2
3
git clone git@github.com:ItsNayabSD/nvpunk.git ~/.config/nvim
nvim +NvpunkUpdate # multiple times. Make sure it's update properly
nvim +'MasonInstall clangd'

Setting up AI plugin for NeoVim

I am using gp.nvim neovim plugin. It’s a GPT prompt that can be used within NeoVim editor. It supports OpenAI, Ollama, GitHub Copilot, Perplexity.ai, Anthropic and Google Gemini.

Google offers free of charge limits for all of its’ AI models. You can get the API Key at https://aistudio.google.com/app/apikey

Write down or copy the API key somewhere. Or create a file ~/.config/googleai_api_key and store the key in it.

Installing the plugin gp.nvim

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
mkdir -p .config/nvpunk/lua/user/
touch .config/nvpunk/lua/user/{init.lua,plugins.lua,themes.lua}

cat >> ~/.config/nvpunk/lua/user/plugins.lua << EOF
return {
        {
                "robitx/gp.nvim",
                config = function()
                        local conf = {
                                -- For customization, refer to Install > Configuration in the Documentation/Readme
                        }
                        require("gp").setup(conf)

                        -- Setup shortcuts here (see Usage > Shortcuts in the Documentation/Readme)
                end,
        },
}
EOF

Open nvim, it should install gp.nvim. If not, Install with :Lazy install gp.nvim

Configuration

1
sudo apt-get install sox libsox-fmt-mp3

~/.local/share/nvim/lazy/gp.nvim/lua/gp/config.lua need to be edited for GeminiAI to work. Here is the patch to apply

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
diff --git a/lua/gp/config.lua b/lua/gp/config.lua
index c80c3c5..9118fce 100644
--- a/lua/gp/config.lua
+++ b/lua/gp/config.lua
@@ -29,7 +29,7 @@ local config = {
                -- secret : "sk-...",
                -- secret = os.getenv("env_name.."),
                openai = {
-                       disable = false,
+                       disable = true,
                        endpoint = "https://api.openai.com/v1/chat/completions",
                        -- secret = os.getenv("OPENAI_API_KEY"),
                },
@@ -58,9 +58,9 @@ local config = {
                        secret = "dummy_secret",
                },
                googleai = {
-                       disable = true,
+                       disable = false,
                        endpoint = "https://generativelanguage.googleapis.com/v1beta/models/:streamGenerateContent?key=",
-                       secret = os.getenv("GOOGLEAI_API_KEY"),
+                       secret = {"cat", "/home/nsd/.config/googleai_api_key"},
                },
                pplx = {
                        disable = true,

Configure shortcuts

Create the file * ~/.local/share/nvim/lazy/which-key.nvim/lua/which-key/gp.lua* with the following content

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
require("which-key").add({
    -- VISUAL mode mappings
    -- s, x, v modes are handled the same way by which_key
    {
        mode = { "v" },
        nowait = true,
        remap = false,
        { "<C-g><C-t>", ":<C-u>'<,'>GpChatNew tabnew<cr>", desc = "ChatNew tabnew" },
        { "<C-g><C-v>", ":<C-u>'<,'>GpChatNew vsplit<cr>", desc = "ChatNew vsplit" },
        { "<C-g><C-x>", ":<C-u>'<,'>GpChatNew split<cr>", desc = "ChatNew split" },
        { "<C-g>a", ":<C-u>'<,'>GpAppend<cr>", desc = "Visual Append (after)" },
        { "<C-g>b", ":<C-u>'<,'>GpPrepend<cr>", desc = "Visual Prepend (before)" },
        { "<C-g>c", ":<C-u>'<,'>GpChatNew<cr>", desc = "Visual Chat New" },
        { "<C-g>g", group = "generate into new .." },
        { "<C-g>ge", ":<C-u>'<,'>GpEnew<cr>", desc = "Visual GpEnew" },
        { "<C-g>gn", ":<C-u>'<,'>GpNew<cr>", desc = "Visual GpNew" },
        { "<C-g>gp", ":<C-u>'<,'>GpPopup<cr>", desc = "Visual Popup" },
        { "<C-g>gt", ":<C-u>'<,'>GpTabnew<cr>", desc = "Visual GpTabnew" },
        { "<C-g>gv", ":<C-u>'<,'>GpVnew<cr>", desc = "Visual GpVnew" },
        { "<C-g>i", ":<C-u>'<,'>GpImplement<cr>", desc = "Implement selection" },
        { "<C-g>n", "<cmd>GpNextAgent<cr>", desc = "Next Agent" },
        { "<C-g>p", ":<C-u>'<,'>GpChatPaste<cr>", desc = "Visual Chat Paste" },
        { "<C-g>r", ":<C-u>'<,'>GpRewrite<cr>", desc = "Visual Rewrite" },
        { "<C-g>s", "<cmd>GpStop<cr>", desc = "GpStop" },
        { "<C-g>t", ":<C-u>'<,'>GpChatToggle<cr>", desc = "Visual Toggle Chat" },
        { "<C-g>w", group = "Whisper" },
        { "<C-g>wa", ":<C-u>'<,'>GpWhisperAppend<cr>", desc = "Whisper Append" },
        { "<C-g>wb", ":<C-u>'<,'>GpWhisperPrepend<cr>", desc = "Whisper Prepend" },
        { "<C-g>we", ":<C-u>'<,'>GpWhisperEnew<cr>", desc = "Whisper Enew" },
        { "<C-g>wn", ":<C-u>'<,'>GpWhisperNew<cr>", desc = "Whisper New" },
        { "<C-g>wp", ":<C-u>'<,'>GpWhisperPopup<cr>", desc = "Whisper Popup" },
        { "<C-g>wr", ":<C-u>'<,'>GpWhisperRewrite<cr>", desc = "Whisper Rewrite" },
        { "<C-g>wt", ":<C-u>'<,'>GpWhisperTabnew<cr>", desc = "Whisper Tabnew" },
        { "<C-g>wv", ":<C-u>'<,'>GpWhisperVnew<cr>", desc = "Whisper Vnew" },
        { "<C-g>ww", ":<C-u>'<,'>GpWhisper<cr>", desc = "Whisper" },
        { "<C-g>x", ":<C-u>'<,'>GpContext<cr>", desc = "Visual GpContext" },
    },

    -- NORMAL mode mappings
    {
        mode = { "n" },
        nowait = true,
        remap = false,
        { "<C-g><C-t>", "<cmd>GpChatNew tabnew<cr>", desc = "New Chat tabnew" },
        { "<C-g><C-v>", "<cmd>GpChatNew vsplit<cr>", desc = "New Chat vsplit" },
        { "<C-g><C-x>", "<cmd>GpChatNew split<cr>", desc = "New Chat split" },
        { "<C-g>a", "<cmd>GpAppend<cr>", desc = "Append (after)" },
        { "<C-g>b", "<cmd>GpPrepend<cr>", desc = "Prepend (before)" },
        { "<C-g>c", "<cmd>GpChatNew<cr>", desc = "New Chat" },
        { "<C-g>f", "<cmd>GpChatFinder<cr>", desc = "Chat Finder" },
        { "<C-g>g", group = "generate into new .." },
        { "<C-g>ge", "<cmd>GpEnew<cr>", desc = "GpEnew" },
        { "<C-g>gn", "<cmd>GpNew<cr>", desc = "GpNew" },
        { "<C-g>gp", "<cmd>GpPopup<cr>", desc = "Popup" },
        { "<C-g>gt", "<cmd>GpTabnew<cr>", desc = "GpTabnew" },
        { "<C-g>gv", "<cmd>GpVnew<cr>", desc = "GpVnew" },
        { "<C-g>n", "<cmd>GpNextAgent<cr>", desc = "Next Agent" },
        { "<C-g>r", "<cmd>GpRewrite<cr>", desc = "Inline Rewrite" },
        { "<C-g>s", "<cmd>GpStop<cr>", desc = "GpStop" },
        { "<C-g>t", "<cmd>GpChatToggle<cr>", desc = "Toggle Chat" },
        { "<C-g>w", group = "Whisper" },
        { "<C-g>wa", "<cmd>GpWhisperAppend<cr>", desc = "Whisper Append (after)" },
        { "<C-g>wb", "<cmd>GpWhisperPrepend<cr>", desc = "Whisper Prepend (before)" },
        { "<C-g>we", "<cmd>GpWhisperEnew<cr>", desc = "Whisper Enew" },
        { "<C-g>wn", "<cmd>GpWhisperNew<cr>", desc = "Whisper New" },
        { "<C-g>wp", "<cmd>GpWhisperPopup<cr>", desc = "Whisper Popup" },
        { "<C-g>wr", "<cmd>GpWhisperRewrite<cr>", desc = "Whisper Inline Rewrite" },
        { "<C-g>wt", "<cmd>GpWhisperTabnew<cr>", desc = "Whisper Tabnew" },
        { "<C-g>wv", "<cmd>GpWhisperVnew<cr>", desc = "Whisper Vnew" },
        { "<C-g>ww", "<cmd>GpWhisper<cr>", desc = "Whisper" },
        { "<C-g>x", "<cmd>GpContext<cr>", desc = "Toggle GpContext" },
    },

    -- INSERT mode mappings
    {
        mode = { "i" },
        nowait = true,
        remap = false,
        { "<C-g><C-t>", "<cmd>GpChatNew tabnew<cr>", desc = "New Chat tabnew" },
        { "<C-g><C-v>", "<cmd>GpChatNew vsplit<cr>", desc = "New Chat vsplit" },
        { "<C-g><C-x>", "<cmd>GpChatNew split<cr>", desc = "New Chat split" },
        { "<C-g>a", "<cmd>GpAppend<cr>", desc = "Append (after)" },
        { "<C-g>b", "<cmd>GpPrepend<cr>", desc = "Prepend (before)" },
        { "<C-g>c", "<cmd>GpChatNew<cr>", desc = "New Chat" },
        { "<C-g>f", "<cmd>GpChatFinder<cr>", desc = "Chat Finder" },
        { "<C-g>g", group = "generate into new .." },
        { "<C-g>ge", "<cmd>GpEnew<cr>", desc = "GpEnew" },
        { "<C-g>gn", "<cmd>GpNew<cr>", desc = "GpNew" },
        { "<C-g>gp", "<cmd>GpPopup<cr>", desc = "Popup" },
        { "<C-g>gt", "<cmd>GpTabnew<cr>", desc = "GpTabnew" },
        { "<C-g>gv", "<cmd>GpVnew<cr>", desc = "GpVnew" },
        { "<C-g>n", "<cmd>GpNextAgent<cr>", desc = "Next Agent" },
        { "<C-g>r", "<cmd>GpRewrite<cr>", desc = "Inline Rewrite" },
        { "<C-g>s", "<cmd>GpStop<cr>", desc = "GpStop" },
        { "<C-g>t", "<cmd>GpChatToggle<cr>", desc = "Toggle Chat" },
        { "<C-g>w", group = "Whisper" },
        { "<C-g>wa", "<cmd>GpWhisperAppend<cr>", desc = "Whisper Append (after)" },
        { "<C-g>wb", "<cmd>GpWhisperPrepend<cr>", desc = "Whisper Prepend (before)" },
        { "<C-g>we", "<cmd>GpWhisperEnew<cr>", desc = "Whisper Enew" },
        { "<C-g>wn", "<cmd>GpWhisperNew<cr>", desc = "Whisper New" },
        { "<C-g>wp", "<cmd>GpWhisperPopup<cr>", desc = "Whisper Popup" },
        { "<C-g>wr", "<cmd>GpWhisperRewrite<cr>", desc = "Whisper Inline Rewrite" },
        { "<C-g>wt", "<cmd>GpWhisperTabnew<cr>", desc = "Whisper Tabnew" },
        { "<C-g>wv", "<cmd>GpWhisperVnew<cr>", desc = "Whisper Vnew" },
        { "<C-g>ww", "<cmd>GpWhisper<cr>", desc = "Whisper" },
        { "<C-g>x", "<cmd>GpContext<cr>", desc = "Toggle GpContext" },
    },
})

Add this gp.lua into the the file: ~/.local/share/nvim/lazy/which-key.nvim/lua/which-key/plugins/init.lua like the following:

1
2
3
4
5
6
7
8
9
10
diff --git a/lua/which-key/plugins/init.lua b/lua/which-key/plugins/init.lua
index 1c2359e..77803ab 100644
--- a/lua/which-key/plugins/init.lua
+++ b/lua/which-key/plugins/init.lua
@@ -1,5 +1,6 @@
 local Config = require("which-key.config")
 local Util = require("which-key.util")
+local gp = require("which-key.gp")

 local M = {}

Here is the reference: https://github.com/Robitx/gp.nvim

Creating project desktop shortcut

Create a desktop shortcut for the project. Create a file and drag on the task manager

1
2
3
4
5
6
7
8
9
[Desktop Entry]
Exec=nvim +NvpunkExplorerOpen
GenericName=Open nayab.dev blog
Name=NayabBlogNeoVim
Path=/home/nsd/nayab.dev/
Icon=//home/nsd/Documents/DesktopShortcuts/icons/embedded_blog.png
StartupNotify=true
Terminal=true
Type=Application

Libation audible manager

You are purchasing audiobooks from Audible. These audiobooks should belong to you and not be restricted by DRM. Libation downloads your audiobooks and converts them into DRM-free audio files, allowing you to use your preferred audio player to enjoy them.

Download Libation from Github and install it.

Install unison

Unison is a file synchronization utility I frequently use for backing up files to my external hard drive. It can sync two directories on the same host or different hosts. To install it on Debian-based systems, use the command below.

sudo apt install unison

Install Telegram desktop flatpak

No need of any introduction to the Telegram app. Install the flatpak from the FlatHub

Install qbittorrent

It’s a BitTorrent client for peer to peer data transfer. Installation instructions:

1
sudo apt install qbittorrent
This post is licensed under CC BY 4.0 by the author.