init commit

main
Artem Dolgiy 2025-01-10 17:29:16 +03:00
commit 7b1fb4b1a5
3 changed files with 320 additions and 0 deletions

88
.config/tmux/tmux.conf Normal file
View File

@ -0,0 +1,88 @@
#########################
### TMUX CLI COMMANDS ###
#########################
# Reload tmux configuration tmux source ~/.config/tmux/tmux.conf
# Attach to an existing session tmux attach -t session_name
# Kill all tmux processes pkill -f tmux
# Install specified plugins via TPM prefix + I
# Run custom shell script at startup run-shell "~/your/command.sh"
# (in tmux.conf)
########################
### GENERAL SETTINGS ###
########################
set -g base-index 1 # Start window numbering at 1
set -g pane-base-index 1 # Start pane numbering at 1
set -g aggressive-resize on # Automatically resize panes on window size change
set -g history-limit 10000 # Keep 10,000 lines in scrollback buffer
set -g set-titles on # Enable automatic title updates
set -g mouse on # Enable mouse support
set -g mode-style "fg=black,bg=blue" # Customize text selection colors in copy mode
#set -g status-position top # Place status bar at top
set -g default-shell /usr/bin/zsh # Set default shell
set -g default-command /usr/bin/zsh # Set default shell command
set-environment -g LC_CTYPE "ru_RU.UTF-8" # Set environment encoding for Russian
####################
### PLUGINS LIST ###
####################
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'dracula/tmux'
# available plugins: battery, cpu-usage, git, gpu-usage, ram-usage, tmux-ram-usage, network, network-bandwidth, network-ping, ssh-session, attached-clients, network-vpn, weather, time, mpc, spotify-tui, kubernetes-context, synchronize-panes
set -g @dracula-plugins "cpu-usage ram-usage time"
# available colors: white, gray, dark_gray, light_purple, dark_purple, cyan, green, orange, red, pink, yellow
# set -g @dracula-[plugin-name]-colors "[background] [foreground]"
# set -g @dracula-cpu-usage-colors "dark_purple white"
set -g @dracula-cpu-usage-colors "green dark_gray"
set -g @dracula-show-timezone false
set -g @dracula-day-month true
set -g @dracula-military-time true
# set -g @dracula-time-format "%F %R"
set -g @dracula-time-format "%H:%M, %d %b %Y г."
set -g @dracula-show-powerline true
# for left
set -g @dracula-show-left-sep 
# for right symbol (can set any symbol you like as separator)
set -g @dracula-show-right-sep 
set -g @dracula-show-flags true
# it can accept `hostname` (full hostname), `session`, `shortname` (short name), `smiley`, `window`, or any character.
set -g @dracula-show-left-icon session
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com:user/plugin'
# set -g @plugin 'git@bitbucket.com:user/plugin'
######################
### PLUGINS CONFIG ###
######################
# Ensure TPM plugin is installed
if "test ! -d ~/.config/tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm'"
# Autoinstall other plugins on new machine
run '~/.config/tmux/plugins/tpm/tpm'
run '~/.config/tmux/plugins/tpm/bin/install_plugins'
# Initialize TPM (keep this line at very bottom of tmux.conf)
run '~/.config/tmux/plugins/tpm/tpm'

185
README.md Normal file
View File

@ -0,0 +1,185 @@
# Первоначальная настройка GNU Linux после установки
В репозитории собраны некоторые конфигурационные файлы для комфортной работы в консоли GNU Linux
Для упрощения процесса настройки можно воспользоваться [установочным скриптом](install.sh)
- [Первоначальная настройка GNU Linux после установки](#первоначальная-настройка-gnu-linux-после-установки)
- [Автонастройка](#автонастройка)
- [Ручная настройка](#ручная-настройка)
- [Tmux](#tmux)
- [Установка tmux](#установка-tmux)
- [Скачивание конфига и запуск](#скачивание-конфига-и-запуск)
- [Оболочка zsh](#оболочка-zsh)
- [Oh-My-Zsh — популярный и активно развивающийся фреймворк Zsh, который позволяет гибко настроить оболочку терминала](#oh-my-zsh--популярный-и-активно-развивающийся-фреймворк-zsh-который-позволяет-гибко-настроить-оболочку-терминала)
- [Подсветка синтаксиса в консоли при вводе - `zsh-syntax-highlighting`](#подсветка-синтаксиса-в-консоли-при-вводе---zsh-syntax-highlighting)
- [Автодополнение команд из истории](#автодополнение-команд-из-истории)
- [Внешний вид - плагин PowerLevel10K](#внешний-вид---плагин-powerlevel10k)
- [Установить шрифт с поддержкой иконок](#установить-шрифт-с-поддержкой-иконок)
- [Установить непосредственно плагин PowerLevel10K для Oh My Zsh](#установить-непосредственно-плагин-powerlevel10k-для-oh-my-zsh)
- [Настройка](#настройка)
- [Aliases](#aliases)
## Автонастройка
Для упрощения процесса настройки можно воспользоваться [установочным скриптом](install.sh)
- выполнится установка `tmux`, из репозитория будет скопирован конфигурационный файл с настройками. Первый запуск будет долгим, т.к. будут скачаны темы и плагины
- выполнится установка `zsh` и плагинов `zsh-syntax-highlighting` (подсветка известных команд) `zsh-autosuggestions` (автодополнение команд из истории)
- выполнится установка и настройка фреймворка для `zsh` - [Oh-My-Zsh](https://ohmyz.sh/)
- для пользователя произойдёт смена оболочки на `zsh`
- [PowerLevel10K](https://github.com/romkatv/powerlevel10k) установлен НЕ БУДЕТ, т.к. требует интерактивной настройки при первом запуске
```shell
wget https://git.da2001.ru/da2001/dots/raw/branch/main/tmux_zsh_install.sh
```
Скрипт необходимо запукать от имени текущего пользователя. Пользователь должен имень привилегии `sudo`, в процессе выполнения скрипт попросит ввести пароль для установки пакетов и смены консоли пользователя.
```shell
bash install.sh
```
## Ручная настройка
### Tmux
#### Установка tmux
```shell
sudo apt-get update && sudo apt-get install -y curl git tmux
```
#### Скачивание конфига и запуск
Плагины установятся автоматически
```shell
curl --create-dirs -fLo \
~/.config/tmux/tmux.conf \
https://git.da2001.ru/da2001/dots/raw/branch/main/.config/tmux/tmux.conf
```
После скачивания конфига можно запускать tmux, первый запуск будет долгим, т.к. потребуется скачать плагины
```shell
tmux
```
### Оболочка zsh
```shell
sudo apt-get update && sudo apt-get install -y zsh zsh-syntax-highlighting
```
#### [Oh-My-Zsh](https://ohmyz.sh/) — популярный и активно развивающийся фреймворк Zsh, который позволяет гибко настроить оболочку терминала
Установка - [тыц](https://ohmyz.sh/#install)
```sh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```
#### Подсветка синтаксиса в консоли при вводе - `zsh-syntax-highlighting`
<https://github.com/zsh-users/zsh-syntax-highlighting>
```shell
sudo apt-get update && sudo apt-get install -y zsh-syntax-highlighting
```
Для активации подсветки синтаксиса необходимо добавить путь к скрипту в настройки `.zshrc`
```shell
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
```
#### Автодополнение команд из истории
<https://github.com/zsh-users/zsh-autosuggestions>
Установка в Oh My Zsh
```shell
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
```
Добавить плагин к списку плагинов Oh My Zsh `~/.zshrc`:
```shell
plugins=(
# other plugins...
zsh-autosuggestions
)
```
Для дефолтного zsh
```sh
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
```
Перезагрузить оболочку
```sh
source ~/.zshrc
```
#### Внешний вид - плагин PowerLevel10K
Тема [PowerLevel10K](https://github.com/romkatv/powerlevel10k)
##### Установить шрифт с поддержкой иконок
```shell
https://github.com/ryanoasis/nerd-fonts?tab=readme-ov-file#font-installation
```
если кратко:
```shell
apt-get install -y fontconfig
mkdir -p ~/.local/share/fonts
curl -OL https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.tar.xz
tar -xvf JetBrainsMono.tar.xz -C ~/.local/share/fonts
rm JetBrainsMono.tar.xz
fc-cache
```
##### Установить непосредственно плагин PowerLevel10K для Oh My Zsh
```shell
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
```
В настройках `~/.zshrc` заменить значение темы на
```shell
ZSH_THEME="powerlevel10k/powerlevel10k"
```
##### Настройка
После первого запуска консоли будет запущен мастер настройки внешнего вида PowerLevel10K
### Aliases
При переключении между `bash` и `zsh` удобнее иметь единый файл для псевдонимов (aliases) - `.aliases` и связать его с `.bashrc` и `.zshrc`:
```shell
.bashrc
if [ -f ~/.aliases ]; then
. ~/.aliases
fi
```
```shell
.zshrc
source $HOME/.aliases
```
```shell
.aliases
alias ip='ip --color=auto'
alias ssht='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
```

47
tmux_zsh_install.sh Normal file
View File

@ -0,0 +1,47 @@
#!/bin/bash
#set -x
sudo apt-get update
sudo apt-get install -y curl git tmux zsh zsh-syntax-highlighting
# Tmux config
curl --create-dirs -fLo \
~/.config/tmux/tmux.conf \
https://git.da2001.ru/da2001/dots/raw/branch/main/.config/tmux/tmux.conf
# Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="tjkirch"/g' ~/.zshrc
# Install zsh-syntax-highlighting
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
# Install zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sed -i 's/^plugins=.*[^\)]/& zsh-autosuggestions/g' ~/.zshrc
# Aliases
echo "Create => .aliases"
cat << EOF >> ~/.aliases
alias ip='ip --color=auto'
alias ssht='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
EOF
echo "Add link .aliases to .bashrc"
cat << EOF >> ~/.bashrc
if [ -f ~/.aliases ]; then
. ~/.aliases
fi
EOF
echo "Add link .aliases to .zshrc"
cat << EOF >> ~/.zshrc
source ~/.aliases
EOF
# Shell to zsh
echo "Change sheel for $USER"
sudo -k chsh -s "$(which zsh)" "$USER" # -k forces the password prompt
echo "ALL Done. Relogin for apply settings."