refactor structur
This commit is contained in:
parent
7dd816c2f6
commit
168f4be245
25
.gitignore
vendored
25
.gitignore
vendored
@ -1,12 +1,19 @@
|
|||||||
sub/vim/bundle
|
home/user/.subzsh/plugins
|
||||||
sub/zsh/plugins
|
|
||||||
sub/bash/bashrc.d/*
|
|
||||||
!sub/bash/bashrc.d/00_test.sh
|
|
||||||
sub/zsh/zshrc.d/*
|
|
||||||
!sub/zsh/zshrc.d/00_test.sh
|
|
||||||
sub/vim/tmp/
|
|
||||||
|
|
||||||
sub/nvim/plugin
|
home/user/.config/nvim/plugin
|
||||||
sub/nvim/tmp/
|
|
||||||
|
home/user/.subbash/bashrc.d/*
|
||||||
|
!home/user/.subbash/bashrc.d/00_test.sh
|
||||||
|
home/user/.subzsh/zshrc.d/*
|
||||||
|
!home/user/.subzsh/zshrc.d/00_test.sh
|
||||||
|
|
||||||
*.zwc
|
*.zwc
|
||||||
|
|
||||||
|
home/user/.ssh/*
|
||||||
|
!home/user/.ssh/config
|
||||||
|
|
||||||
|
home/user/.ipython/profile_default/*
|
||||||
|
!home/user/.ipython/profile_default/ipython_config.py
|
||||||
|
|
||||||
|
home/user/.gnupg/*
|
||||||
|
!home/user/.gnupg/gpg.conf
|
||||||
|
|||||||
92
home/bashrc
92
home/bashrc
@ -1,92 +0,0 @@
|
|||||||
|
|
||||||
if [ -x "$(which dircolors)" ]; then
|
|
||||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
|
||||||
|
|
||||||
alias dir='dir --color=auto'
|
|
||||||
alias vdir='vdir --color=auto'
|
|
||||||
alias grep='grep --color=auto'
|
|
||||||
alias egrep='egrep --color=auto'
|
|
||||||
alias fgrep='fgrep --color=auto'
|
|
||||||
|
|
||||||
alias ls='ls --color=auto'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# these aliases use the "ls" alias, which was defined earlier
|
|
||||||
alias l.='ls -AF --ignore="*"'
|
|
||||||
alias ll='ls -lhF'
|
|
||||||
alias la='ls -AF'
|
|
||||||
|
|
||||||
alias lt='du -sh * | sort -h'
|
|
||||||
|
|
||||||
alias rm='rm -r'
|
|
||||||
alias mkdir='mkdir -pv'
|
|
||||||
|
|
||||||
alias cd..='cd ..'
|
|
||||||
alias ..='cd ..'
|
|
||||||
alias ...='cd ../..'
|
|
||||||
alias .3='cd ../../..'
|
|
||||||
|
|
||||||
alias path='echo -e ${PATH//:/\\n}'
|
|
||||||
|
|
||||||
# shorts
|
|
||||||
alias c='clear'
|
|
||||||
alias q='exit'
|
|
||||||
alias h='history | less'
|
|
||||||
alias j='jobs -l'
|
|
||||||
alias hg='history|grep'
|
|
||||||
|
|
||||||
# utils
|
|
||||||
alias sha='shasum -a 256'
|
|
||||||
alias getpass="openssl rand -base64 12"
|
|
||||||
alias diff='colordiff'
|
|
||||||
alias mount='mount | column -t'
|
|
||||||
alias upgrade_all='sudo apt update && sudo apt upgrade'
|
|
||||||
alias tar-it='tar -czf "../${PWD##*/}.tar.gz" .'
|
|
||||||
|
|
||||||
|
|
||||||
# time
|
|
||||||
alias now='date +"%T"'
|
|
||||||
alias nowdate='date +"%d-%m-%Y"'
|
|
||||||
|
|
||||||
# vim
|
|
||||||
alias vi=vim
|
|
||||||
alias svi="sudo -E vim"
|
|
||||||
alias vis='vim "+set si"'
|
|
||||||
alias edit=vim
|
|
||||||
|
|
||||||
# net
|
|
||||||
alias ports='netstat -tulanp'
|
|
||||||
alias wget='wget -c'
|
|
||||||
alias ping='ping -c 5'
|
|
||||||
alias myip='curl ipinfo.io/ip'
|
|
||||||
|
|
||||||
# starts web server
|
|
||||||
alias www='python3 -m http.server 8000'
|
|
||||||
|
|
||||||
# hard
|
|
||||||
alias reboot='sudo /sbin/reboot'
|
|
||||||
alias poweroff='sudo /sbin/poweroff'
|
|
||||||
alias halt='sudo /sbin/halt'
|
|
||||||
alias shutdown='sudo /sbin/shutdown'
|
|
||||||
|
|
||||||
alias meminfo='free -mlth'
|
|
||||||
alias psmem='ps auxf | sort -nr -k 4 | less -R'
|
|
||||||
alias wake="echo $'\a'" # command; wake &
|
|
||||||
|
|
||||||
alias music='mplayer -shuffle ~/Music/*'
|
|
||||||
|
|
||||||
|
|
||||||
# initializes first ./*/*/activate
|
|
||||||
# alias va='source "$(find -P . -maxdepth 3 -type f -name activate | sort | head -n 1)" &>/dev/null || echo "error: virtual env not found, use python3 -m virtualenv venv" >&2'
|
|
||||||
alias ve='python3 -m virtualenv venv && . venv/bin/activate'
|
|
||||||
alias vd='deactivate'
|
|
||||||
|
|
||||||
|
|
||||||
# python
|
|
||||||
alias pipir='python3 -m pip install -r requirements.txt'
|
|
||||||
|
|
||||||
# git
|
|
||||||
alias watch-diff='watch --color "git diff --color=always"'
|
|
||||||
|
|
||||||
PS1="\n┌──(\u@\H)-[\w]\n└─\$ "
|
|
||||||
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
excludesfile = ~/.gitignore
|
excludesfile = ~/.gitignore
|
||||||
editor = nvim
|
editor = nvim
|
||||||
fileMode = false
|
fileMode = false
|
||||||
hooksPath = /home/kan/.githooks
|
hooksPath = ~/.githooks
|
||||||
|
|
||||||
[init]
|
[init]
|
||||||
defaultBranch = master
|
defaultBranch = master
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
_nvim() {
|
_nvim() {
|
||||||
subcmds=($(git diff --name-only --relative 2>/dev/null))
|
subcmds=($(git diff --name-only --relative --diff-filter=d 2>/dev/null) $(git diff --name-only --relative --staged --diff-filter=d 2>/dev/null))
|
||||||
if [[ -z "$subcmds" ]]; then
|
if [[ -z "$subcmds" ]]; then
|
||||||
_files
|
_files
|
||||||
else
|
else
|
||||||
132
install.sh
132
install.sh
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
SUB="$(pwd)/sub"
|
SUB="$(pwd)/home/user/"
|
||||||
|
|
||||||
|
|
||||||
_die() {
|
_die() {
|
||||||
@ -29,120 +29,123 @@ cmd_backup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_bash() {
|
cmd_bash() {
|
||||||
local subbash="$HOME/.subbash"
|
local sub=".subbash"
|
||||||
_die_if_installed "$subbash"
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
ln -s "$SUB"/bash "$subbash"
|
ln -s "$SUB/$sub" "$HOME/$sub"
|
||||||
ln -s "$subbash"/bashrc ~/.bashrc
|
ln -s "$SUB/.bashrc" "$HOME/.bashrc"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_zsh() {
|
cmd_zsh() {
|
||||||
local subzsh="$HOME/.subzsh"
|
local sub=".subzsh"
|
||||||
_die_if_installed "$subzsh"
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
ln -s "$SUB"/zsh "$subzsh"
|
ln -s "$SUB/$sub" "$HOME/$sub"
|
||||||
ln -s "$subzsh"/zshrc ~/.zshrc
|
ln -s "$SUB/.zshrc" "$HOME/.zshrc"
|
||||||
mkdir "$subzsh"/plugins
|
ln -s "$SUB/.zfunc" "$HOME/.zfunc"
|
||||||
git clone https://github.com/zsh-users/zsh-autosuggestions "$subzsh"/plugins/zsh-autosuggestions
|
mkdir "$SUB/$sub/plugins"
|
||||||
git clone https://github.com/zsh-users/zsh-syntax-highlighting "$subzsh"/plugins/zsh-syntax-highlighting
|
git clone https://github.com/zsh-users/zsh-autosuggestions "$SUB/$sub/plugins/zsh-autosuggestions"
|
||||||
git clone https://github.com/hlissner/zsh-autopair "$subzsh"/plugins/hlissner/zsh-autopair
|
git clone https://github.com/zsh-users/zsh-syntax-highlighting "$SUB/$sub/plugins/zsh-syntax-highlighting"
|
||||||
git clone https://github.com/unixorn/fzf-zsh-plugin.git "$subzsh"/plugins/unixorn/fzf-zsh-plugin && \
|
git clone https://github.com/hlissner/zsh-autopair "$SUB/$sub/plugins/hlissner/zsh-autopair"
|
||||||
|
git clone https://github.com/unixorn/fzf-zsh-plugin.git "$SUB/$sub/plugins/unixorn/fzf-zsh-plugin" && \
|
||||||
ln -s ~/.subzsh/plugins/unixorn/fzf-zsh-plugin/bin/* ~/.local/bin/
|
ln -s ~/.subzsh/plugins/unixorn/fzf-zsh-plugin/bin/* ~/.local/bin/
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_tmux() {
|
cmd_tmux() {
|
||||||
ln -s "$SUB"/tmux/tmux.conf ~/.tmux.conf
|
ln -s "$SUB/.tmux.conf" "$HOME/.tmux.conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_alacritty() {
|
cmd_alacritty() {
|
||||||
local subalacritty="$HOME/.config/alacritty"
|
local sub=".config/alacritty"
|
||||||
_die_if_installed "$subalacritty"
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
mkdir -p "$subalacritty"
|
ln -s "$SUB/$sub" "$HOME/$sub"
|
||||||
ln -s "$SUB"/alacritty/alacritty.yml "$subalacritty"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_nvim() {
|
cmd_nvim() {
|
||||||
echo "sudo pacman -S npm ctags fzf glow; mkdir ~/.npm-global; npm config set prefix '~/.npm-global'"
|
echo "sudo pacman -S npm ctags fzf glow; mkdir ~/.npm-global; npm config set prefix '~/.npm-global'"
|
||||||
|
|
||||||
ln -s "$SUB/nvim" "$HOME/.config/nvim"
|
ln -s "$SUB/.config/nvim" "$HOME/.config/nvim"
|
||||||
ln -s "$(dirname "$SUB")/functions/vim_askpass_helper" "$HOME/.local/bin"
|
mkdir -p "$HOME/.local/bin"
|
||||||
|
ln -s "$SUB"/.local/bin/* "$HOME/.local/bin"
|
||||||
git clone --depth 1 https://github.com/wbthomason/packer.nvim "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
git clone --depth 1 https://github.com/wbthomason/packer.nvim "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim"
|
||||||
nvim +PackerCompile +PackerSync +PackerSync
|
nvim +PackerCompile +PackerSync +PackerSync
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_ssh() {
|
cmd_ssh() {
|
||||||
cat "$SUB"/ssh/config >> ~/.ssh/config
|
cat "$SUB/.ssh/config" >> "$HOME/.ssh/config"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_git() {
|
cmd_git() {
|
||||||
ln -s "$SUB"/git/gitconfig ~/.gitconfig
|
ln -s "$SUB/.gitconfig" "$HOME/.gitconfig"
|
||||||
ln -s "$SUB"/git/gitignore ~/.gitignore
|
ln -s "$SUB/.gitignore" "$HOME/.gitignore"
|
||||||
ln -s "$SUB"/git/hooks ~/.githooks
|
ln -s "$SUB/.githooks" "$HOME/.githooks"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_ranger() {
|
cmd_ranger() {
|
||||||
echo "sudo pacman -S highlight ttf-joypixels noto-fonts-emoji ueberzug poppler"
|
echo "sudo pacman -S highlight ttf-joypixels noto-fonts-emoji ueberzug poppler"
|
||||||
|
|
||||||
local subranger="$HOME/.config/ranger"
|
local sub=".config/ranger"
|
||||||
_die_if_installed "$subranger"
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
|
ln -s "$SUB/$sub" "$HOME/$sub"
|
||||||
mkdir -p "$subranger"
|
mkdir -p "$SUB/$sub/plugins"
|
||||||
ln -s "$SUB"/ranger/rc.conf "$subranger"
|
git clone https://github.com/alexanderjeurissen/ranger_devicons "$SUB/$sub/plugins/ranger_devicons"
|
||||||
mkdir -p "$subranger"/plugins
|
|
||||||
git clone https://github.com/alexanderjeurissen/ranger_devicons "$subranger"/plugins/ranger_devicons
|
|
||||||
ranger --copy-config=all
|
ranger --copy-config=all
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_gpg() {
|
cmd_gpg() {
|
||||||
local subgpg="$HOME/.gnupg"
|
_die_if_installed "$HOME/.gnupg"
|
||||||
|
|
||||||
_die_if_installed "$subgpg"
|
cat "$SUB/.gnupg/gpg.conf" >> "$HOME/.gnupg/gpg.conf"
|
||||||
|
echo -e "default-cache-ttl 1\nmax-cache-ttl 1" > "$HOME/.gnupg/gpg-agent.conf"; echo RELOADAGENT | gpg-connect-agent
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -p "$subgpg"
|
_install_i3status() {
|
||||||
cat "$SUB"/gpg/gpg.conf >> "$subgpg"/gpg.conf
|
local sub=".config/i3status"
|
||||||
echo -e "default-cache-ttl 1\nmax-cache-ttl 1" > "$subgpg"/gpg-agent.conf; echo RELOADAGENT | gpg-connect-agent
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
|
ln -s "$SUB/$sub" "$HOME/$sub"
|
||||||
|
}
|
||||||
|
|
||||||
|
_install_i3() {
|
||||||
|
local sub=".config/i3"
|
||||||
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
|
ln -s "$SUB/$sub" "$HOME/$sub"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_i3() {
|
cmd_i3() {
|
||||||
echo "sudo pacman -S nitrogen picom compton ttf-font-awesome xdotool xclip maim"
|
echo "sudo pacman -S nitrogen picom compton ttf-font-awesome xdotool xclip maim"
|
||||||
|
|
||||||
local subi3="$HOME/.config/i3" subi3status="$HOME/.config/i3status"
|
_install_i3
|
||||||
_die_if_installed "$subi3"
|
_install_i3status
|
||||||
_die_if_installed "$subi3status"
|
|
||||||
|
|
||||||
mkdir -p "$subi3"
|
|
||||||
mkdir -p "$subi3status"
|
|
||||||
ln -s "$SUB"/i3/config "$subi3"/config
|
|
||||||
ln -s "$SUB"/i3/statusconfig "$subi3status"/config
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_bat() {
|
cmd_bat() {
|
||||||
local subbat="$HOME/.config/bat"
|
local sub=".config/bat"
|
||||||
|
|
||||||
_die_if_installed "$subbat"
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
mkdir -p "$subbat"
|
ln -s "$SUB/$sub" "$HOME/$sub"
|
||||||
ln -s "$SUB"/bat/config "$subbat"/config
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_ipython() {
|
cmd_ipython() {
|
||||||
local subipython="$HOME/.ipython"
|
local sub=".ipython"
|
||||||
|
|
||||||
_die_if_installed "$subipython"
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
mkdir -p "$subipython"/profile_default
|
mkdir -p "$HOME/$sub/profile_default"
|
||||||
ln -s "$SUB"/ipython/ipython_config.py "$subipython"/profile_default/ipython_config.py
|
ln -s "$SUB/$sub/profile_default/ipython_config.py" "$HOME/$sub/profile_default/ipython_config.py"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_font() {
|
cmd_font() {
|
||||||
local subfont="$HOME/.local/share/fonts"
|
local sub="$HOME/.local/share/fonts"
|
||||||
|
|
||||||
mkdir -p "$subfont"
|
mkdir -p "$sub"
|
||||||
cd "$subfont"
|
cd "$sub"
|
||||||
wget 'https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip'
|
wget 'https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/FiraCode.zip'
|
||||||
unzip FiraCode.zip -d "$subfont"
|
unzip FiraCode.zip -d "$sub"
|
||||||
git clone 'https://github.com/powerline/fonts.git' --depth=1
|
git clone 'https://github.com/powerline/fonts.git' --depth=1
|
||||||
cd fonts
|
cd fonts
|
||||||
./install.sh
|
./install.sh
|
||||||
@ -157,7 +160,11 @@ cmd_arch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd_psql() {
|
cmd_psql() {
|
||||||
ln -s "$SUB/psql/psqlrc" "$HOME/.psqlrc"
|
local sub=".psqlrc"
|
||||||
|
|
||||||
|
_die_if_installed "$HOME/$sub"
|
||||||
|
|
||||||
|
ln -s "$SUB/$sub" "$HOME/$sub"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_unlink() {
|
cmd_unlink() {
|
||||||
@ -165,14 +172,6 @@ cmd_unlink() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_install_functions() {
|
|
||||||
for func in $(find functions -maxdepth 1 -type f)
|
|
||||||
do
|
|
||||||
chmod 755 "$func"
|
|
||||||
ln -s "$func" "$HOME/.local/bin"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd_install() {
|
cmd_install() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
bash) shift; cmd_bash "$@" ;;
|
bash) shift; cmd_bash "$@" ;;
|
||||||
@ -225,7 +224,6 @@ case "$1" in
|
|||||||
help) shift; cmd_help "$@" ;;
|
help) shift; cmd_help "$@" ;;
|
||||||
install) shift; cmd_install "$@" ;;
|
install) shift; cmd_install "$@" ;;
|
||||||
unlink) shift; cmd_unlink "$@" ;;
|
unlink) shift; cmd_unlink "$@" ;;
|
||||||
install-functions) shift; cmd_install_functions "$@" ;;
|
|
||||||
esac
|
esac
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
272
sub/vim/vimrc
272
sub/vim/vimrc
@ -1,272 +0,0 @@
|
|||||||
|
|
||||||
set ruler
|
|
||||||
set laststatus=2
|
|
||||||
|
|
||||||
" xclip requiered
|
|
||||||
set clipboard=unnamedplus
|
|
||||||
|
|
||||||
|
|
||||||
set shell=zsh
|
|
||||||
|
|
||||||
" <Leader>
|
|
||||||
let g:mapleader = ","
|
|
||||||
|
|
||||||
set cursorline
|
|
||||||
|
|
||||||
" like tabdo but restore the current tab
|
|
||||||
function! TabDo(command)
|
|
||||||
let currTab=tabpagenr()
|
|
||||||
execute 'tabdo ' . a:command
|
|
||||||
execute 'tabn ' . currTab
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" like bufdo but restore the current buffer
|
|
||||||
function! BufDo(command)
|
|
||||||
let currBuff=bufnr("%")
|
|
||||||
execute 'bufdo ' . a:command
|
|
||||||
execute 'buffer ' . currBuff
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" like windo but restore the current window
|
|
||||||
function! WinDo(command)
|
|
||||||
let currwin=winnr()
|
|
||||||
execute 'windo ' . a:command
|
|
||||||
execute currwin . 'wincmd w'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
nnoremap <silent> <Leader>c :call TabDo('set cursorline!') <CR>
|
|
||||||
inoremap jk <esc>
|
|
||||||
inoremap ол <esc>
|
|
||||||
|
|
||||||
let g:airline_powerline_fonts = 1 "Включить поддержку Powerline шрифтов
|
|
||||||
let g:airline#extensions#keymap#enabled = 0 "Не показывать текущий маппинг
|
|
||||||
let g:airline_section_z = "\ue0a1:%l/%L Col:%c" "Кастомная графа положения курсора
|
|
||||||
let g:Powerline_symbols='unicode' "Поддержка unicode
|
|
||||||
let g:airline#extensions#xkblayout#enabled = 0
|
|
||||||
let g:airline#extensions#branch#enabled=1
|
|
||||||
|
|
||||||
nnoremap <Tab> :bnext<CR>
|
|
||||||
nnoremap <S-Tab> :bprevious<CR>
|
|
||||||
|
|
||||||
let g:netrw_banner = 0 " hide banner
|
|
||||||
let g:netrw_liststyle = 3 " tree instead of plain view
|
|
||||||
let g:netrw_browse_split = 0
|
|
||||||
let g:netrw_winsize = 15
|
|
||||||
let g:netrw_keepdir = 0
|
|
||||||
|
|
||||||
|
|
||||||
set ttimeoutlen=0 "Понижаем задержку ввода escape последовательностей
|
|
||||||
let &t_SI.="\e[5 q" "SI = режим вставки
|
|
||||||
let &t_SR.="\e[3 q" "SR = режим замены
|
|
||||||
let &t_EI.="\e[1 q" "EI = нормальный режим
|
|
||||||
|
|
||||||
set encoding=utf-8 "Ставит кодировку UTF-8
|
|
||||||
set nocompatible "Отключает обратную совместимость с Vi
|
|
||||||
syntax on "Включает подсветку синтаксиса
|
|
||||||
|
|
||||||
set expandtab
|
|
||||||
set smarttab
|
|
||||||
set tabstop=4
|
|
||||||
set softtabstop=4
|
|
||||||
set shiftwidth=4
|
|
||||||
set autoindent
|
|
||||||
set smartindent
|
|
||||||
set nowrap
|
|
||||||
|
|
||||||
set ttyfast
|
|
||||||
set autoread
|
|
||||||
|
|
||||||
set history=1000
|
|
||||||
set undofile
|
|
||||||
set undoreload=1000
|
|
||||||
|
|
||||||
set noerrorbells
|
|
||||||
set novisualbell
|
|
||||||
set showcmd
|
|
||||||
set showtabline=2
|
|
||||||
|
|
||||||
set smartcase
|
|
||||||
set incsearch
|
|
||||||
|
|
||||||
set mousehide
|
|
||||||
set mouse=a
|
|
||||||
|
|
||||||
set colorcolumn=81
|
|
||||||
set scrolloff=7
|
|
||||||
|
|
||||||
set backup
|
|
||||||
set noswapfile
|
|
||||||
set backupdir=$HOME/.vim/tmp/backup/
|
|
||||||
set undodir=$HOME/.vim/tmp/undo/
|
|
||||||
set directory=$HOME/.vim/tmp/swap/
|
|
||||||
set viminfo+=n$HOME/.vim/tmp/viminfo
|
|
||||||
|
|
||||||
|
|
||||||
function! MakeDirIfNoExists(path)
|
|
||||||
if !isdirectory(expand(a:path))
|
|
||||||
call mkdir(expand(a:path), "p")
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
|
||||||
" make this dirs if no exists previously
|
|
||||||
silent! call MakeDirIfNoExists(&undodir)
|
|
||||||
silent! call MakeDirIfNoExists(&backupdir)
|
|
||||||
silent! call MakeDirIfNoExists(&directory)
|
|
||||||
set virtualedit=onemore " allow for cursor beyond last character
|
|
||||||
|
|
||||||
" toggle hlsearch
|
|
||||||
nnoremap <silent> <Leader>/ :set invhlsearch<CR>
|
|
||||||
|
|
||||||
cnoremap <C-p> <Up>
|
|
||||||
cnoremap <C-n> <Down>
|
|
||||||
|
|
||||||
nnoremap <up> <nop>
|
|
||||||
nnoremap <down> <nop>
|
|
||||||
nnoremap <left> <nop>
|
|
||||||
nnoremap <right> <nop>
|
|
||||||
inoremap <up> <nop>
|
|
||||||
inoremap <down> <nop>
|
|
||||||
inoremap <left> <nop>
|
|
||||||
inoremap <right> <nop>
|
|
||||||
|
|
||||||
set ffs=unix,mac
|
|
||||||
set encoding=utf8
|
|
||||||
|
|
||||||
" tabs
|
|
||||||
nnoremap <silent> <C-l> :tabnext<CR>
|
|
||||||
nnoremap <silent> <C-h> :tabprev<CR>
|
|
||||||
|
|
||||||
|
|
||||||
" hiden chars
|
|
||||||
nmap <silent> <Leader>eh :set list!<CR>
|
|
||||||
set listchars=tab:→\ ,eol:↵,trail:·,extends:↷,precedes:↶
|
|
||||||
|
|
||||||
|
|
||||||
" Autoload configuration when this file changes ($MYVIMRC)
|
|
||||||
autocmd! BufWritePost init.vim source %
|
|
||||||
|
|
||||||
|
|
||||||
" Plugins
|
|
||||||
set rtp+=~/.vim/bundle/Vundle.vim
|
|
||||||
|
|
||||||
call vundle#begin()
|
|
||||||
|
|
||||||
Plugin 'VundleVim/Vundle.vim'
|
|
||||||
Plugin 'vim-airline/vim-airline'
|
|
||||||
Plugin 'morhetz/gruvbox'
|
|
||||||
Plugin 'tpope/vim-surround'
|
|
||||||
Plugin 'tpope/vim-commentary'
|
|
||||||
Plugin 'ap/vim-css-color'
|
|
||||||
Plugin 'preservim/tagbar'
|
|
||||||
Plugin 'preservim/vimux'
|
|
||||||
Plugin 'rbgrouleff/bclose.vim'
|
|
||||||
Plugin 'frazrepo/vim-rainbow'
|
|
||||||
Plugin 'Pocco81/auto-save.nvim'
|
|
||||||
" requiered patch your font
|
|
||||||
Plugin 'ryanoasis/vim-devicons'
|
|
||||||
Plugin 'windwp/nvim-autopairs'
|
|
||||||
|
|
||||||
Plugin 'powerman/vim-plugin-ruscmd' " Russian navigation
|
|
||||||
|
|
||||||
call vundle#end()
|
|
||||||
|
|
||||||
filetype plugin indent on
|
|
||||||
|
|
||||||
" Python
|
|
||||||
let python_highlight_all = 1
|
|
||||||
set t_Co=256
|
|
||||||
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,match,case
|
|
||||||
|
|
||||||
|
|
||||||
nnoremap <silent> <Leader>rm :tabnew % <CR> :terminal make run <CR>
|
|
||||||
" run file by filetype
|
|
||||||
autocmd BufEnter * if (expand('%:t')=='manpage') | nnoremap <silent> <Leader>rr :tabnew % <CR> :terminal man -P cat -l % <CR> :set nocursorline number norelativenumber <CR> | endif
|
|
||||||
autocmd BufEnter * if (&filetype=='python') | nnoremap <silent> <Leader>rr :tabnew % <CR> :terminal python3 % <CR> :set nocursorline number norelativenumber <CR> G <CR> | endif
|
|
||||||
autocmd BufEnter * if (&filetype=='go') | nnoremap <silent> <Leader>rr :tabnew % <CR> :terminal go run % <CR> :set nocursorline number norelativenumber <CR> G <CR> | endif
|
|
||||||
autocmd BufEnter * if (&filetype=='go') | nnoremap <silent> <Leader>rf :!go fmt % <CR> | endif
|
|
||||||
autocmd BufEnter * if (&filetype=='rust') | nnoremap <silent> <Leader>rr :tabnew % <CR> :terminal cargo run % <CR> :set nocursorline number norelativenumber <CR> G <CR> | endif
|
|
||||||
autocmd BufEnter * if (&filetype=='rust') | nnoremap <silent> <Leader>rf :!cargo fmt % <CR> | endif
|
|
||||||
autocmd BufEnter * if (&filetype=='markdown') | nnoremap <silent> <Leader>rr :let g:buf_curline=line(".") <CR> :tabnew % <CR> :terminal glow % <CR> :set nocursorline number norelativenumber <CR> :exe buf_curline <CR> | endif
|
|
||||||
autocmd BufEnter * if (&filetype=='vim') | nnoremap <silent> <Leader>rr :so % <CR>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
" ctags required
|
|
||||||
nnoremap <silent> <Leader>t :TagbarToggle <CR>
|
|
||||||
|
|
||||||
nnoremap <silent> <Leader>ve :tabnew $MYVIMRC<CR>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set laststatus=2
|
|
||||||
let g:lightline = {
|
|
||||||
\ 'colorscheme': 'iceberg',
|
|
||||||
\ 'active': {
|
|
||||||
\ 'left': [ [ 'mode', 'paste' ],
|
|
||||||
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
|
|
||||||
\ },
|
|
||||||
\ 'component_function': {
|
|
||||||
\ 'gitbranch': 'fugitive#head'
|
|
||||||
\ },
|
|
||||||
\ }
|
|
||||||
|
|
||||||
|
|
||||||
" Colorscheme
|
|
||||||
colorscheme gruvbox
|
|
||||||
set bg=dark
|
|
||||||
|
|
||||||
|
|
||||||
au FileType py,go,c,cpp,objc,js,rs call rainbow#load()
|
|
||||||
let g:rainbow_active = 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set termguicolors
|
|
||||||
hi DiagnosticError guifg=Grey
|
|
||||||
hi DiagnosticWarn guifg=Grey
|
|
||||||
hi DiagnosticInfo guifg=Grey
|
|
||||||
hi DiagnosticHint guifg=Grey
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nnoremap <Leader>ff <cmd>Telescope find_files<cr>
|
|
||||||
nnoremap <Leader>fg <cmd>Telescope live_grep<cr>
|
|
||||||
|
|
||||||
|
|
||||||
luafile ~/.config/nvim/lua/init.lua
|
|
||||||
|
|
||||||
|
|
||||||
set number
|
|
||||||
set relativenumber
|
|
||||||
|
|
||||||
|
|
||||||
function! ToggleRelativeAbsoluteNumber()
|
|
||||||
if !&number && !&relativenumber
|
|
||||||
set number
|
|
||||||
set norelativenumber
|
|
||||||
elseif &number && !&relativenumber
|
|
||||||
set nonumber
|
|
||||||
set relativenumber
|
|
||||||
elseif !&number && &relativenumber
|
|
||||||
set number
|
|
||||||
set relativenumber
|
|
||||||
elseif &number && &relativenumber
|
|
||||||
set nonumber
|
|
||||||
set norelativenumber
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
nnoremap <silent> <Leader>l :call TabDo('call ToggleRelativeAbsoluteNumber()') <CR>
|
|
||||||
|
|
||||||
nnoremap <silent> <Leader>qq :bd!<CR>
|
|
||||||
" Quick exiting without save
|
|
||||||
nnoremap <silent> <Leader>qa :qa!<CR>
|
|
||||||
|
|
||||||
" expand %% to dirname of cur file in commandline
|
|
||||||
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
" :Sw to save file by root
|
|
||||||
command Sw execute 'silent! write !SUDO_ASKPASS=$(which vim_askpass_helper) sudo -A tee % >/dev/null'
|
|
||||||
Loading…
x
Reference in New Issue
Block a user