Day: October 31, 2021

VIM Basic

VIM Basic

This is not a full guide, but those new functions to me.

Movement

Scrolling

^E - down (End)
^Y - up (Hard to remember and use)

Jumping

H - High (Top)
M - Middle
L - Low (Bottom)

Object

w - words
s - sentences
p - paragraphs
t - tags (in XML/HTML file)

Selection

a -- all (whole + border)
i - in (whole)
t - 'til (find but no border)
f - find
F - find backword

Command

d y v
c i a o

Basic Example

diw
caw
yi)
va"

Macro

Register

q{key}
...
q

Play

@{key}

Register

View

:reg

Paste with number

"<n>p

Plugins

vundle - plugin manager
nerdtree - file drawer
ctrlp - fuzzy file finder
fugitive - git tool
syntastic - systax checker / linter

References

nicknisi / vim-workshop

Systemd services for user in Linux

Systemd services for user in Linux

The traditional way of starting up program after user login, is using user profile. The systemd provides a new way for such tasks.

Usage

The systemd regular services are running as root privileges, unless User value in Service session. They are triggerred as background jobs, no matter user login or not. The systemd user services are running for user and run as that user id, and they are triggered after that user login.

Definition

To define services run as a normal user, they can be defined in user's home directory in ~/.config/systemd/user folder, they will be picked up by systemd as a user service.

Managing

To manage these services, folowing commands can be used.

Check all systemd services for user

systemctl status --user

Enable and start up

systemctl --user enable myuser.service
systemctl --user start myuser.service

Reload all systemd configuration. It is required after service definition files modified.

systemctl --user daemon-reload

For all users

The /etc/systemd/user/ folder is to define services for all users. The default available user services definition files are in /usr/lib/systemd/user/ folder, they can be used to enable systemd user service. For example,

# ls /usr/lib/systemd/user/syncthing.service
syncthing.service
# systemctl --user status syncthing
Unit syncthing.service could not be found.
# systemctl status syncthing
* syncthing.service - Syncthing - Open Source Continuous File Synchronization
...

Other systemd user definition file locations can be defined by administrator

$XDG_RUNTIME_DIR/systemd/user/
~/.local/share/systemd/user/

Common usage

The most common usage of systemd user servers, are X window related processes, they need to be run after user login, running as background services for user, such as reminder, window manager, etc., but not the background services for system.

References

systemd user services and systemctl --user
What does "systemctl daemon-reload" do?