Skip to content

Instantly share code, notes, and snippets.

@baatochan
Last active February 18, 2024 17:03
Show Gist options
  • Save baatochan/b22bc106c42ebaa410ac5c64ea618a07 to your computer and use it in GitHub Desktop.
Save baatochan/b22bc106c42ebaa410ac5c64ea618a07 to your computer and use it in GitHub Desktop.
Linux (Manjaro) workspace configuration

Linux (Manjaro) workspace configuration

This is my to-do list what needs to be configured before you can start working on the new Linux PC. This steps were done by me after completing the Manjaro installation process explained in my second gist. I decided to split it up because that other gist about configuring what needs to be done to have a working OS on the machine while the steps here are about software configuration and are mostly personal. Tbh the main reason I'm doing this list is for my future self to remember what needs to be done and in which order after the OS is installed. This tutorial is also very hardware independent and covers the steps needed to be taken on every PC with Manjaro (Linux in general) and not only the Thinkpad mentioned in the second gist.

Nano config

My terminal text editor of choice is nano, but working in it with the default config is kinda annoying so the first thing to do is going thru the ~/.nanorc file.

To create the file take the default one from /etc/nanorc and create copy as ~/.nanorc. You may also take my current one I'm attaching to this gist (for version 6.4) but if the version is lot newer/older it's better to compare it with the default one and manually create the desired one.

Remember also to set .nanorc for root user as this config is being used when sudo nano. Installing the nano-syntax-highlighting package is also a good idea.

Colordiff

Manjaro doesn't have colordiff package installed by default, but I'm suggesting installing it and making an alias for it. You may install it with

# pacman -S colordiff

and create the alias by adding alias diff=colordiff to your .bashrc/.zshrc.

Sometime ago I also found an dark mode for colordiff which might be put into ~/.colordiffrc

# Example colordiffrc file for dark backgrounds
#
# Set banner=no to suppress authorship info at top of
# colordiff output
banner=no
# By default, when colordiff output is being redirected
# to a file, it detects this and does not colour-highlight
# To make the patch file *include* colours, change the option
# below to 'yes'
color_patches=no
# Sometimes it can be useful to specify which diff command to
# use: that can be specified here
diff_cmd=diff
#
# available colours are: white, yellow, green, blue,
#                        cyan, red, magenta, black,
#                        darkwhite, darkyellow, darkgreen,
#                        darkblue, darkcyan, darkred,
#                        darkmagenta, darkblack
#
# Can also specify 'none', 'normal' or 'off' which are all
# aliases for the same thing, namely "don't colour highlight
# this, use the default output colour"
#
plain=off
newtext=darkgreen
oldtext=darkred
diffstuff=darkcyan
cvsstuff=cyan

Konsole config

Remember to create custom profile (default ones are read-only) and change some settings:

  • set scrollback to unlimited (if system drive is encrypted)
  • turn on "Mouse click in input line moves cursor"

SSH

This is the most complicated step for me because I don't remember in which order I had configured this stuff. Following subsections shows all the stuff that needs to be done, they don't need to be done in that order tho.

Set up the ssh server

All configs for the ssh server are stored in /etc/ssh/sshd_config file. For me the best way is to just copy the config from the old PC and compare it with the default one to see what you need to change.

Set up the ssh client

The same goes with the SSH client, but the config for it is in ~/.ssh/config file. This file is also used for specifying custom host names. I'm attaching a little redacted version of this file here for future reference.

Set up the authorized_keys

The ~/.ssh/authorized_keys file contains the ssh keys that can be used for given user authentication. So to be able to login to this PC with certain key it needs to be added there (even if you have that key on the machine used as your identity key).

You may add keys with ssh-copy-id -i <private-key-file> <user>@<host> command from the old PC (or just copy this file from the old PC).

Set up the proxy settings

If you need to use a proxy to connect via ssh to certain hosts you may need to use the special config (ProxyCommand) and netcat package. The config below is done for the openbsd-netcat package so choose this one when asked, because gnu-netcat has a different command syntax.

For hosts behind the proxy use ProxyCommand nc -X connect -X <ProxyIP>:<port> %h %p and for other hosts use ProxyCommand none.

Secure the user config files and private keys

After the setup remember to set all files from ~/.ssh to read/write only by the owner. You may do it with a command

chmod 600 ~/.ssh/*

Turn on the ssh server

If you're sure that your ssh server config is OK then you may start the server with

sudo systemctl enable sshd.service
sudo systemctl start sshd.service

Set up the SSH agent

This step is about setting up the SSH agent which let's you use your SSH key without entering the passphrase (actually it asks for a password ones but the pwd is being provided via kwallet which is unlocked automatically when you login to the PC). IMO this is the most complicated step and I'm not really sure how I did it. If I'm not mistaken I have followed this tutorial but I remember I had some issues with that. I'm trying to recreate the way I did it below.

Install any required packages

You may do it with this command

sudo pacman -Syu --needed kwallet ksshaskpass kwalletmanager

Set the required env vars

The only way it worked for me (which was mentioned by @openminded in their comment as well) was to set both of the required env vars in the /etc/profile.d/ssh-askpass.sh file. So adding the following lines to that file worked for me

export SSH_ASKPASS=/usr/bin/ksshaskpass
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR"/ssh-agent.socket

Create the ssh-agent systemd service

This step is to create a ~/.config/systemd/user/ssh-agent.service file (creating the dir might be required before) with following content

[Unit]
Description=SSH agent (ssh-agent)

[Service]
Type=simple
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
Environment=DISPLAY=:0
ExecStart=ssh-agent -D -a $SSH_AUTH_SOCK
ExecStop=kill -15 $MAINPID

[Install]
WantedBy=default.target

Reload the user-level system daemon and enable the new user-level systemd service

You may do it with following commands

systemctl --user daemon-reload
systemctl --user enable ssh-agent.service

Create startup script to add SSH keys to the agent

In this step you need to create the ~/.config/autostart/ssh-add.desktop file with following content

[Desktop Entry]
Exec=ssh-add -q /home/<user>/.ssh/key1 /home/<user>/.ssh/key2 /home/<user>/.ssh/key3 < /dev/null
Name=ssh-add
Type=Application

The most important part here is to keep the absolute path to the key (/home/<user>/.ssh/key1, NOT ~/.ssh/key1), because it wasn't working with the ~ or $HOME.

Reboot and add your SSH key passphrases to kwallet

The next step is to reboot the PC. During the next login you may be asked for a passphrases for all you SSH keys. If possible provide them and select the checkbox to add the passphrase into kwallet. If not after the login run the command ssh-add with needed keys to trigger the passphrase box once more and then provide the passphrase.

On my old PC I've been using different setup for ssh-agent which is considered worse (doesn't work in terminal only sessions) and is explained here. I ended up with this solution because I wanted to have auto-login turned on which results in kwallet not being unlocked automatically so I turned on another pop up to ask for kwallet password. At that time it looked like a better idea (I really don't know why).

Check in and out connections

This point is straightforward. Here you just need to check if

  • ssh-agent is working (no asking for the SSH passphrase)
  • you can connect to other PC with your SSH key
  • you can connect to this PC from other one
  • you can connect to localhost
  • you can connect to some weird host in the Internet
  • proxy is working OK and all hostnames are reachable
  • and others

Check if agent forwarding is working

When connecting to any host check if you still have your ssh keys inside the agent (the easiest way is to do a loop of connection to the localhost or from your PC (PC1) connect to some other device (PC2) and back again to PC1.

AUR config

I found kinda strage situation in Manjaro - on clean install it is possible to install any AUR package using pamac in the terminal, but running pamac update shows no packages to update even tho some of them are outdated. Turns out to properly use AUR with pamac you HAVE TO open the "Add/Remove Software" GUI, enter settings and turn on support for AUR. Without that you can install AUR packages but pamac will not remember that they were installed from AUR and won't let you update them without reinstalling.

To list all foreign packages on the system you can use pacman -Qm. To list all AUR packages installed via pamac (with AUR support turned on) you can use pamac list -i | grep AUR. If the output of the second command is empty while you know some of the packages were installed from AUR (pacman lists some foreign packages) you haven't turned on the AUR support properly.

Yakuake config

Yakuake is a drop-down terminal app which works great with KDE and Konsole. I suggest installing it as having a drop-down terminal is really handy.

In terms of the config this app needs to be manually added to the list of autostarted apps in KDE and you should change the profile to the same custom one you created for Konsole.

In terms of the skin/theme I stick to using the Breath Dark theme (when using Manjaro). This theme is not available in the Yakuake skin repo so if you don't have access to the Breath Dark I would go with Breeze Perfect Dark (by noahadvs/Noah Davis) which is the one I use on my Steam Deck.

Other useful packages to install

Here's the list of packages that are useful and are not part of the basic Manjaro installation:

  • net-tools - for ifconfig (or use modern ip command)
  • NOT ceph-libs - this issue is rather specific to my machine but remember to not install the ceph-libs from AUR. This package is very often updated and it takes years to compile it. If you really need this package install the ceph-libs-bin. Right now both of them are in AUR, but I had it installed on my machine for some reason.

GPG Keys

I'm using the GPG key to sign my commits so during the new PC setup I need to copy my key from one machine to another. I'm using this key only for git so this setup here is connected with the git setup.

Moving the key from one machine to another

The following steps are based on this and this tutorials.

Firstly identify your private key and remember its ID (the part after the /).

gpg --list-secret-keys user@example.com

Next export the selected key to the file - you will be asked for a passphrase, even if you have it in the keyring (eg. kwallet), so have it prepared.

gpg --export-secret-keys <key-id> > private.key

Transfer the file to the second machine securely, eg. using the scp.

scp <local-path> <host>:<remote-path>

The next step is to import the key (again, have your passphrase ready).

gpg --import private.key

You may also need to add the key to the gpg2 key list but in my case it was done automatically. After that you need to raise that key to the ultimate trust. To do this enter the key edit mode.

gpg --edit-key <key-id>

In the key edit mode enter trust to edit the trust level, select the desired level (in this case 5) and enter save to commit changes.

Right now it should be possible to use the key, but being asked for the passphrase every time.

Setting up the gpg-agent

The steps required to set up the gpg-agent are explained on the arch-wiki.

Start with installing required packages - pinentry and kwalletcli (the second one is available in AUR repos).

sudo pacman -S pinentry
pamac build kwalletcli

After that put the required config into the ~/.gnupg/gpg-agent.conf file. For me the content of this file looks like that.

default-cache-ttl 18748800
max-cache-ttl 18748800
pinentry-program /usr/bin/pinentry-kwallet

After that restart the gpg-agent (or your PC) and the next time you're using the gpg key you should be asked to save the passphrase into the kwallet.

Git

Setting up git is pretty straightforward. The first step is to set up ~/.gitconfig file. If you don't have any additional config just setting up fields for name and email is enough, but I'm attaching my whole .gitconfig to this gist for future reference.

The next step is cloning the required repos and checking if committing (here you might have an issue with GPG key) and push (here you might have an issue with SSH key) works.

To check if commit is properly signed you may use

git log --show-signature

If both of that works remember about repo specific settings (like different email address for work repos and so on).

Visual Studio Code

The official package that is available in the Arch repos is code which is open-source version of VSCode which is stripped from the proprietary code. Because I prefer the official release I suggest using the visual-studio-code-bin package that is available in the AUR. You may install it with

pamac build visual-studio-code-bin

After that the only thing that needs to be done is to open the app, go thru the into checklist and enable the settings sync. I haven't yet go thru the whole VSCode settings so I'm not gonna put it here, but I can list few must-have plugins:

  • C/C++
  • Gist
  • Code Spell Checker (with language plugins)
  • GitLens
  • Markdown All in One
  • Markdown PDF

fzf - fuzzy finder

This tool is a game changer for me when using a terminal. OK, sure, I don't use everything it can, but the sole command finder is so nice, that I can't use terminal without it.

During this system reinstall I took some time to went thru the fzf docs and did some configuration of this tool. However for basic operation it's enough to just instal the tool and source two files mentioned on arch-wiki. On the other hand installing the version from the github sources these files automatically.

If you want to check out other setting of this tool you may read this article on github wiki. My current config (for zsh) based on what I found in the wiki is as follows (it required to additionally install ag and tree packages).

# fzf
## turning on fzf
source "/usr/share/fzf/key-bindings.zsh"
source "/usr/share/fzf/completion.zsh"
## fzf settings
export FZF_COMPLETION_TRIGGER='' # fuzzy completion works without any trigger
bindkey '^Y' fzf-completion # fuzzy completion is binded to ctrl+y
bindkey '^T' fzf-file-widget # ctrl+t is default file search
bindkey '^I' $fzf_default_completion # tab works normally
## show hidden files in file search
export FZF_CTRL_T_COMMAND='ag --hidden --ignore .git -g ""'
## file search shows file preview
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
## command search can have preview activated by ?
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
## fast cd (alt+c) shows tree in preview
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"

For bash you need to change the sourced files to the correct ones (ending with .bash) and skip the part about the FZF_COMPLETION_TRIGGER and keybindings as it doesn't really works with bash (you can still uze fuzzy search with **<TAB>).

# fzf
## turning on fzf
source "/usr/share/fzf/key-bindings.bash"
source "/usr/share/fzf/completion.bash"
## show hidden files in file search
export FZF_CTRL_T_COMMAND='ag --hidden --ignore .git -g ""'
## file search shows file preview
export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
## command search can have preview activated by ?
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
## fast cd (alt+c) shows tree in preview
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"

.bashrc/.zshrc

This chapter is about setting up your shell. Until now I've been using only bash and the fact the newest Manjaro uses zsh by default was something new for me. However as a lot of ppl suggest that zsh is in fact more user friendly then I decided to give it a try. This step is almost at the end because I knew it will take me a lot of time to find out how to use zsh and what settings I really need. I'm also went thru the .bashrc as I want to have it set up as well if I need to use it for some reason (eg. ssh connection).

The default Manjaro .bashrc and .zshrc files are OK and I'm mostly leaving them as they are and I only add my stuff to it.

git prompt and setting up your custom prompt

For a long time I liked having the git status showed as part of the bash prompt and I was using the git-prompt.sh script which is a part of the git itself.

bash

To have it set up in the bash you need to do two things. The first one is sourcing that file at the beginning of the .bashrc file (and setting up some additional settings if you want):

# git prompt
source /usr/local/bin/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export GIT_PS1_SHOWUPSTREAM="auto"

The second one is modifying the PS1 var which is the definition of your prompt. As I didn't like the original Manjaro prompt I have it changed as follows:

if ${use_color} ; then
    if [[ ${EUID} == 0 ]] ; then
        PS1='\[\033[01;31m\][\u@\h\[\033[01;37m\]:\[\033[01;36m\]\w\[\033[01;37m\]$(__git_ps1 " (%s)")\[\033[01;31m\]]#\[\033[00m\] '
    else
        PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\]:\[\033[01;34m\]\w\[\033[01;37m\]$(__git_ps1 " (%s)")\[\033[01;32m\]]\$\[\033[00m\] '
    fi
else
    if [[ ${EUID} == 0 ]] ; then
        PS1='[\u@\h:\w$(__git_ps1 " (%s)")]# '
    else
        PS1='[\u@\h:\w$(__git_ps1 " (%s)")]\$ '
    fi
fi

These changes uses the default Manjaro var (use_color) and are the same for my user as well as for root. Having the git-prompt as part of the root prompt is kinda useless, but as I have set it up some day ago then I'm leaving it like that now.

zsh

The default Manjaro zsh prompt already has a support for git-prompt (which is also lot cooler than the basic one that I was using in bash) so I haven't edited anything in that matter in zsh. I might edit the prompt itself in the future but as for now I'm leaving the default settings. If that happens I'll edit this doc as well.

Default aliases

Manjaro default .bashrc has a list of 5 aliases that are by default commented out but I like having them uncommented. I also set them up in my .zshrc file now. I'm putting these aliases below (and yes, I know that having the cp -i as default cp is kinda unsafe as it teaches you to not care when using cp, but I'm having it only as the last resort):

alias cp="cp -i"                          # confirm before overwriting something
alias df='df -h'                          # human-readable sizes
alias free='free -m'                      # show sizes in MB
alias np='nano -w PKGBUILD'
alias more=less

Other defaults

Beside the above aliases in the default Manjaro .bashrc you have this two settings which I find useful.

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.  #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize

# Recursivly check for aliases
shopt -s expand_aliases

fzf config

This part is explained in the part about the fzf.

Longer history

The default history behavior on Manjaro is that it remembers 10k commands (counting duplicates) and the file is updated only when exiting the terminal session (meaning that when you have two terminals open you don't have history from the first in the second).

However I prefer to have shared history between terminals and save more than 10k commands (I'm very often using the Ctrl+R to find the desired command). Set up for it differs in bash and zsh.

bash

# longer bash history
export HISTSIZE=40000 # history size for one terminal
export HISTFILESIZE=200000 # whole history size
shopt -s histappend # when exit bash append history to a file
export PROMPT_COMMAND="history -a;history -n;$PROMPT_COMMAND" # append history to file every command (requeires above line to work)

zsh

# longer and shared history
export HISTSIZE=40000
export SAVEHIST=200000
setopt share_history

Useful aliases

Self explaining aliases

# aliases
## alias for colordiff
alias diff=colordiff
## ls with all files
alias la='ls -A'
## ll
alias ll='ls -alF'
## ll without hidden files
alias l='ls -CFlh'
## going upppp
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
alias .......="cd ../../../../../.."
alias ........="cd ../../../../../../.."
## sudo last command
alias s='fc -e "sed -i -e \"s/^/sudo /\""'

Alias for safe rm

Same as with cp mentioned earlier I like having more secure version than the original rm. However as rm is a lot more destructive than cp I'm not changing the default behavior for it, but I have an alias for del. The same alias goes for zsh and bash.

## safe rm
alias del='rm -i'

Setting nano as default editor

If you're not a fan of vi then it might be useful to export the EDITOR variable with path to nano to make it your default editor in terminal. You may do it by adding the following lines to your .bashrc/.zshrc:

# set nano as default
export VISUAL=nano
export EDITOR=nano

Support for Ctrl+Backspace/Del

I really like using this shortcut when writing in a text editor and found myself trying to use it when entering commands in bash. It doesn't support it natively but you can turn it on with following commands.

# ctrl+backspace and ctrl+del; better put it in .inputrc without bind for systemwide support
if [[ $- == *i* ]]; then # check if shell is interactive
    bind '"\C-h": backward-kill-word'
    bind '"\e[3;5~": kill-word'
fi

Setting up correct screen order for SDDM

SDDM is the display manager for KDE Plasma. Most of its settings are overridden by user config after login so in reality most SDDM configs are for the login screen. By default when you have multiple screens SDDM puts them in the order defined by hardware (mostly GPU, but other stuff such as the docking station can influence it as well). It puts displays in the very basic order one after another from left to right. Sometimes that's enough, sometimes you just don't care because the correct screen order is loaded just after you login in, however if you wanna fix that (and have a pretty consistent monitor setup) you can do it easily. It's explained in detail in this tutorial and here I will just put my config.

So, the first and obvious step it to set the correct display order after you login in. When you have your screens set up, you can run xrandr | grep ' connected' to print all connected screens with its basic config and device names (which will be needed in the next step).

$ xrandr | grep ' connected'

eDP-1 connected 1920x1080+0+1080 (normal left inverted right x axis y axis) 309mm x 174mm
DP-3-1-5 connected primary 1920x1080+1920+474 (normal left inverted right x axis y axis) 531mm x 299mm
DP-3-1-6 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm
DP-3-2 connected 1920x1080+3840+474 (normal left inverted right x axis y axis) 527mm x 296mm

The next step is to create the Xsetup config file for SDDM - /usr/share/sddm/scripts/Xsetup is the default location which might be already present in your distro (it was in my Manjaro at least). The content of this file is explained in the above-mentioned tutorial, but in short it should be the xrandr command with parameters for each device. It should be put in one line but I split it by putting \ at the end of each line for better readability. The content of this file in my case is as follow:

#!/bin/sh
# Xsetup - run as root before the login dialog appears

xrandr \
--output DP-3-1-6 --mode 1920x1080 --pos 0x0       --rotate normal \
--output eDP-1    --mode 1920x1080 --pos 0x1080    --rotate normal \
--output DP-3-1-5 --mode 1920x1080 --pos 1920x474  --rotate normal \
--output DP-3-2   --mode 1920x1080 --pos 3840x474  --rotate normal

After that you might need to edit the SDD config file (/etc/sddm.conf) to include the file you just created, but in my case, it was already specified as DisplayCommnand. If you don't have it specified, you need to add the following lines to your config. Note: [XDisplay] might be replaced by [X11] depending on your system.

[XDisplay]
DisplayCommand=/usr/share/sddm/scripts/Xsetup

After rebooting the PC, you should see your config working.

Mouse cursor on SDDM too big

After making the above changes the mouse cursor on SDDM became unnaturally big (I guess 36-48px). It might be also the result of the recently installed update tho. Anyway, to fix that you need to add the CursorSize config into KDE settings for SDDM - /etc/sddm.conf.d/kde_settings.conf. You can check your cursor size in System Settings -> Appearance -> Cursors -> Size (on the bottom near buttons). I believe the default size is 24px.

[Theme]
CursorSize=24
[user]
name = Bartosz Rodziewicz
email = bartoszka1996@gmail.com
signingkey = 64E1506CEEE62625
[core]
editor = nano
autocrlf = input
safecrlf = warn
[alias]
#amd = !git add -A && git commit --amend --no-edit
#amd = "!f() { git add -A && git commit --amend ${1+-m} \"${1---no-edit}\"; }; f"
amd = "!f() { if [[ -z $1 ]]; then git add -A && git commit --amend --no-edit; else git add -A && git commit --amend; fi; }; f"
amend = commit --amend
nb = checkout -b
#com = "!f() { git add -A; git commit -m \"$1\"; }; f"
com = "!f() { git add -A && git commit ${1+-m \"$1\"}; }; f"
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lga = lg --all
#stat = diff HEAD~1 --stat
stat = "!f() { git diff HEAD~\"${1-1}\" --stat; }; f"
stats = stat
#w = !git add -A && git commit -m "x" && git push
w = "!f() { git add -A && git commit -m \"${1-x}\" && git push; }; f"
push-for = "!f() { git push origin HEAD:refs/for/${1-master}; }; f"
push-wip = "!f() { git push origin HEAD:refs/for/${1-master}%wip; }; f"
push-priv = "!f() { git push origin HEAD:refs/for/${1-master}%private; }; f"
push-wippriv = "!f() { git push origin HEAD:refs/for/${1-master}%wip%private; }; f"
#push-draft = push origin HEAD:refs/drafts/master
chekcout = checkout
c = checkout
cm = checkout master
cr = checkout review
cd = checkout develop
ct = checkout test
r = rebase
rebm = rebase master
rebpm = !git fetch -u origin master:master && git rebase master
reb = rebpm
oldest-ancestor = !zsh -c 'diff --old-line-format= --new-line-format= <(git rev-list --first-parent \"${1:-master}\") <(git rev-list --first-parent \"${2:-HEAD}\") | head -1' -
[push]
default = upstream
[commit]
gpgsign = true
[pull]
ff = only
## Sample initialization file for GNU nano.
##
## For the options that take parameters, the default value is shown.
## Other options are unset by default. To make sure that an option
## is disabled, you can use "unset <option>".
##
## Characters that are special in a shell should not be escaped here.
## Inside string parameters, quotes should not be escaped -- the last
## double quote on the line will be seen as the closing quote.
## Make 'nextword' (Ctrl+Right) and 'chopwordright' (Ctrl+Delete)
## stop at word ends instead of at beginnings.
set afterends
## When soft line wrapping is enabled, make it wrap lines at blanks
## (tabs and spaces) instead of always at the edge of the screen.
set atblanks
## Automatically indent a newly created line to the same number of
## tabs and/or spaces as the preceding line -- or as the next line
## if the preceding line is the beginning of a paragraph.
# set autoindent
## Back up files to the current filename plus a tilde.
# set backup
## The directory to put unique backup files in.
# set backupdir ""
## Use bold text instead of reverse video text.
# set boldtext
## Treat any line with leading whitespace as the beginning of a paragraph.
# set bookstyle
## The characters treated as closing brackets when justifying paragraphs.
## This may not include any blank characters. Only closing punctuation,
## optionally followed by these closing brackets, can end sentences.
# set brackets ""')>]}"
## Automatically hard-wrap the current line when it becomes overlong.
# set breaklonglines
## Do case-sensitive searches by default.
# set casesensitive
## Constantly display the cursor position in the status bar or minibar.
# set constantshow
## Use cut-from-cursor-to-end-of-line by default.
# set cutfromcursor
## Do not use the line below the title bar, leaving it entirely blank.
# set emptyline
## Set the target width for automatic hard-wrapping and for justifying
## paragraphs. If the specified value is 0 or less, the wrapping point
## will be the terminal's width minus this number.
# set fill -8
## Draw a vertical stripe at the given column, to help judge text width.
## (This option does not have a default value.)
set guidestripe 80
## Remember the used search/replace strings for the next session.
set historylog
## Display a "scrollbar" on the righthand side of the edit window.
set indicator
## Scroll the buffer contents per half-screen instead of per line.
# set jumpyscrolling
## Display line numbers to the left (and any anchors in the margin).
set linenumbers
## Enable vim-style lock-files. This is just to let a vim user know you
## are editing a file [s]he is trying to edit and vice versa. There are
## no plans to implement vim-style undo state in these files.
# set locking
## Fall back to slow libmagic to try and determine an applicable syntax.
# set magic
## The opening and closing brackets that are found by a matching-bracket
## search. This may not contain blank characters. The opening brackets
## must come before the closing ones, and they must be in the same order.
set matchbrackets "(<[{)>]}"
## Suppress the title bar and show the filename plus a cursor-position
## percentage in the space of the status bar.
# set minibar
## Enable mouse support, if available for your system. When enabled,
## mouse clicks can be used to place the cursor, set the mark (with a
## double click), and execute shortcuts. The mouse will work in the
## X Window System, and on the console when gpm is running.
set mouse
## Switch on multiple file buffers (inserting a file will put it into
## a separate buffer).
set multibuffer
## Don't convert files from DOS/Mac format.
# set noconvert
## Don't display the helpful shortcut lists at the bottom of the screen.
# set nohelp
## Don't automatically add a newline when a file does not end with one.
# set nonewlines
## Set operating directory. nano will not read or write files outside
## this directory and its subdirectories. Also, the current directory
## is changed to here, so any files are inserted from this dir. A blank
## string means the operating-directory feature is turned off.
# set operatingdir ""
## Remember the cursor position in each file for the next editing session.
# set positionlog
## Preserve the XON and XOFF keys (^Q and ^S).
# set preserve
## The characters treated as closing punctuation when justifying paragraphs.
## This may not contain blank characters. Only these closing punctuations,
## optionally followed by closing brackets, can end sentences.
# set punct "!.?"
## Make status-bar messages disappear after 1 keystroke instead of after 20.
# set quickblank
## The regular expression that matches quoting characters in email
## or line-comment introducers in source code. The default is:
# set quotestr "^([ ]*([!#%:;>|}]|//))+"
## Try to work around a mismatching terminfo terminal description.
# set rawsequences
## Fix Backspace/Delete confusion problem.
# set rebinddelete
## Do regular-expression searches by default.
## Regular expressions are of the extended type (ERE).
# set regexp
## Save a changed buffer automatically on exit; don't prompt.
# set saveonexit
## Put the cursor on the highlighted item in the file browser, and
## show the cursor in the help viewer; useful for people who use a
## braille display and people with poor vision.
# set showcursor
## Make the Home key smarter: when Home is pressed anywhere but at the
## very beginning of non-whitespace characters on a line, the cursor
## will jump to that beginning (either forwards or backwards). If the
## cursor is already at that position, it will jump to the true start
## of the line (the left edge).
set smarthome
## Spread overlong lines over multiple screen lines.
set softwrap
## Use this spelling checker instead of the internal one. This option
## does not have a default value.
# set speller "aspell -x -c"
## Use the end of the title bar for some state flags: I = auto-indenting,
## M = mark, L = hard-wrapping long lines, R = recording, S = soft-wrapping.
# set stateflags
## Use this tab size instead of the default; it must be greater than 0.
set tabsize 4
## Convert each typed tab to the fitting number of spaces.
# set tabstospaces
## Snip whitespace at the end of lines when justifying or hard-wrapping.
set trimblanks
## Save files by default in Unix format (also when they were DOS or Mac).
# set unix
## The two single-column characters used to display the first characters
## of tabs and spaces. 187 in ISO 8859-1 (0000BB in Unicode) and 183 in
## ISO-8859-1 (0000B7 in Unicode) seem to be good values for these.
## The default when in a UTF-8 locale:
set whitespace "»·"
## The default otherwise:
# set whitespace ">."
## Detect word boundaries differently by treating punctuation
## characters as parts of words.
# set wordbounds
## The characters (besides alphanumeric ones) that should be considered
## as parts of words. This option does not have a default value. When
## set, it overrides option 'set wordbounds'.
# set wordchars "<_>."
## Let an unmodified Backspace or Delete erase the marked region (instead
## of a single character, and without affecting the cutbuffer).
set zap
## Hide the bars plus help lines and use the whole terminal as edit area.
# set zero
## Paint the interface elements of nano. These are examples; there are
## no colors by default, except for errorcolor and spotlightcolor.
set titlecolor bold,white,blue
set promptcolor lightwhite,grey
set statuscolor bold,white,green
set errorcolor bold,white,red
set spotlightcolor black,lightyellow
set selectedcolor lightwhite,magenta
set stripecolor black,cyan
set scrollercolor cyan
set numbercolor black,cyan
set keycolor cyan
set functioncolor green
## In root's .nanorc you might want to use:
# set titlecolor bold,white,magenta
# set promptcolor black,yellow
# set statuscolor bold,white,magenta
# set errorcolor bold,white,red
# set spotlightcolor black,orange
# set selectedcolor lightwhite,cyan
# set stripecolor ,yellow
# set scrollercolor magenta
# set numbercolor magenta
# set keycolor lightmagenta
# set functioncolor magenta
## === Syntax coloring ===
## For all details, see 'man nanorc', section SYNTAX HIGHLIGHTING.
## To include most of the existing syntax definitions, you can do:
# include "/usr/share/nano/*.nanorc"
include /usr/share/nano-syntax-highlighting/*.nanorc
## Or you can select just the ones you need. For example:
# include "/usr/share/nano/html.nanorc"
# include "/usr/share/nano/python.nanorc"
# include "/usr/share/nano/sh.nanorc"
## In /usr/share/nano/extra/ you can find some syntaxes that are
## specific for certain distros or for some less common languages.
## If <Tab> should always produce four spaces when editing a Python file,
## independent of the settings of 'tabsize' and 'tabstospaces':
extendsyntax python tabgives " "
## If <Tab> should always produce an actual TAB when editing a Makefile:
# extendsyntax makefile tabgives " "
## === Key bindings ===
## For all details, see 'man nanorc', section REBINDING KEYS.
## If you want to suspend nano with one keystroke (instead of with ^T^Z):
# bind ^Z suspend main
## The <Ctrl+Delete> keystroke deletes the word to the right of the cursor.
## On some terminals the <Ctrl+Backspace> keystroke produces ^H, which is
## the ASCII character for backspace, so it is bound by default to the
## backspace function. The <Backspace> key itself produces a different
## keycode, which is hard-bound to the backspace function. So, if you
## normally use <Backspace> for backspacing and not ^H, you can make
## <Ctrl+Backspace> delete the word to the left of the cursor with:
bind ^H chopwordleft main
## For a more mnemonic Comment keystroke (overriding Cut-from-cursor):
# bind M-K comment main
## If you want ^L to just refresh the screen and not center the cursor:
# bind ^L refresh main
## When you sometimes type M-J instead of M-K, or M-T instead of M-R:
# unbind M-J main
# unbind M-T main
## (Those functions are still accessible through ^T^J and ^T^V.)
## For quickly uppercasing or lowercasing the word under or after the cursor.
## (These effectively select a word and pipe it through a sed command.)
#bind Sh-M-U "{nextword}{mark}{prevword}{execute}|sed 's/.*/\U&/'{enter}" main
#bind Sh-M-L "{nextword}{mark}{prevword}{execute}|sed 's/.*/\L&/'{enter}" main
## For copying a marked region to the system clipboard:
# bind Sh-M-T "{execute}|xsel -ib{enter}{undo}" main
## For snipping trailing blanks when you save a file:
# bind ^S "{execute}| sed 's/\s\+$//' {enter}{savefile}" main
## If you would like nano to have keybindings that are more "usual",
## such as ^O for Open, ^F for Find, ^H for Help, and ^Q for Quit,
## then uncomment these:
#bind ^X cut main
#bind ^C copy main
#bind ^V paste all
#bind ^Q exit all
#bind ^S savefile main
#bind ^W writeout main
#bind ^O insert main
#set multibuffer
#bind ^H help all
#bind ^H exit help
#bind ^F whereis all
#bind ^G findnext all
#bind ^B wherewas all
#bind ^D findprevious all
#bind ^R replace main
#unbind ^U all
#unbind ^N main
#unbind ^Y all
#unbind M-J main
#unbind M-T main
#bind ^A mark main
#bind ^P location main
#bind ^T gotoline main
#bind ^T gotodir browser
#bind ^T cutrestoffile execute
#bind ^L linter execute
#bind ^E execute main
#bind ^K "{mark}{end}{zap}" main
#bind ^U "{mark}{home}{zap}" main
#bind ^Z undo main
#bind ^Y redo main
Host [REDACTED]
User [REDACTED]
ForwardAgent yes
IdentityFile ~/.ssh/[REDACTED]
ProxyCommand none
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
Host 192.168.1.* localhost
ProxyCommand none
ForwardAgent yes
Host *
AddKeysToAgent yes
VisualHostKey yes
Ciphers chacha20-poly1305@openssh.com,aes256-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-512
IdentityFile ~/.ssh/[REDACTED]
# ForwardAgent no # agent shoud not be forwarded to everyone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment