From e52442ea42d9de6f3db59b644b6bff521dfb41ed Mon Sep 17 00:00:00 2001 From: Corrado Primier Date: Sun, 19 Nov 2023 02:40:04 +0100 Subject: [PATCH] Update configs --- dot_bashrc | 51 +-------- dot_gitconfig | 8 ++ dot_vimrc | 230 +++++++++++++++++++++++++++++++++++++++++ private_dot_ssh/config | 12 ++- 4 files changed, 249 insertions(+), 52 deletions(-) create mode 100644 dot_vimrc diff --git a/dot_bashrc b/dot_bashrc index 253de18..c029d9a 100644 --- a/dot_bashrc +++ b/dot_bashrc @@ -17,47 +17,10 @@ if [[ -n "$DISPLAY" ]] ; then [[ -n "$TMUX" ]] && export TERM=screen-256color || export TERM=xterm-256color fi -export EDITOR="vim" -export GREP_COLOR="1;33" -export GOPATH="$HOME/projects/go" -export HISTCONTROL="ignoredups" -export PATH="$PATH:$HOME/bin:" -export WORKON_HOME="~/.virtualenvs" - -# less colors -export LESS=-R -export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink -export LESS_TERMCAP_md=$'\E[1;36m' # begin bold -export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink -export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video -export LESS_TERMCAP_se=$'\E[0m' # reset reverse video -export LESS_TERMCAP_ue=$'\E[0m' # reset underline -export LESS_TERMCAP_us=$'\E[1;32m' # begin underline - -alias diff="diff --color=auto" -alias grep="grep --color=auto" -alias egrep="egrep --color=auto" -alias gst="git status" -alias ls="ls --color=auto" -alias l="ls" -alias la="ls -a" -alias ll="ls -l" -alias lla="ls -la" -alias mkdir="mkdir -p -v" -alias restricted-vim="rvim -Zi NONE" -alias rot13="tr a-zA-Z n-za-mN-ZA-M" -alias tmux="TERM=screen-256color-bce tmux" -alias updick='/usr/bin/uptime | perl -ne "/(\d+) d/;print 8,q(=)x\$1,\"D\n\""' - -if [[ $(command -v dircolors) ]] ; then - eval $(dircolors -b) +if [[ -f ~/.shrc_common ]] ; then + source ~/.shrc_common fi -function urldecode() { - : "${*//+/ }" - echo -e "${_//%/\\x}" -} - # Arch linux package search if [[ $(command -v aura) ]] ; then function psearch() { @@ -66,15 +29,5 @@ if [[ $(command -v aura) ]] ; then } fi -# Base16 Shell -BASE16_SHELL="$HOME/.config/base16-shell/scripts/base16-monokai.sh" -[[ -s $BASE16_SHELL ]] && source $BASE16_SHELL - -# Virtualenv wrapper -[[ -s /usr/bin/virtualenvwrapper.sh ]] && source /usr/bin/virtualenvwrapper.sh - -# AWS -[[ -f $HOME/.aws ]] && source "$HOME/.aws" - shopt -s autocd shopt -s checkwinsize diff --git a/dot_gitconfig b/dot_gitconfig index e2418ee..1caa690 100644 --- a/dot_gitconfig +++ b/dot_gitconfig @@ -115,7 +115,15 @@ [url "git@github.com:"] insteadOf = github: + [pull] rebase = true + [init] defaultBranch = main + +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true diff --git a/dot_vimrc b/dot_vimrc new file mode 100644 index 0000000..f96b5fb --- /dev/null +++ b/dot_vimrc @@ -0,0 +1,230 @@ +" Set up vim + +" Basic configuration +set nocompatible + +set clipboard=unnamed " Use the OS clipboard by default + +" Encoding +set encoding=utf-8 +set fileencoding=utf-8 +set fileencodings=utf-8 +set binary +set ttyfast " Boost speed by altering character redraw rates to your terminal + +" Presentation settings +set number " Show absolute line numbers on the left. +set numberwidth=3 " Sets width of the 'gutter' column used for numbering to 3 (default 4) +set textwidth=0 " Do not wrap words (insert) +set wrap " Wrap overflowing lines +set showcmd " Show (partial) command in status line. +set showmatch " Show matching brackets when text indicator is over them +set ruler " Line and column number of the cursor position +set wildmenu " Enhanced command completion +set visualbell " Use visual bell instead of beeping +set noerrorbells " Disable the error bells +set laststatus=2 " Always show the status lines +set cursorline " Highligh the cursor line +"set cursorcolumn " Highlight current cursor column +set t_Co=256 " Use 256 colors +set background=dark " Use a dark background +let base16colorspace=256 + +" vim hardcodes background color erase even if the terminfo file does +" not contain bce (not to mention that libvte based terminals +" incorrectly contain bce in their terminfo files). This causes +" incorrect background rendering when using a color theme with a +" background color. +let &t_ut='' + +" Highlight spell errors +hi SpellErrors guibg=red guifg=black ctermbg=red ctermfg=black + +" Toggle spell check with F7 +map :setlocal spell! spell? + +" Behavior +" Ignore these files when completing names and in explorer +set wildignore=.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif +set shell=$SHELL " Use current shell for shell commands +set hidden " Enable multiple modified buffers +set history=1000 " History size +set autoread " Automatically read feil that has been changed on disk and doesn't have changes in vim +set backspace=indent,eol,start +set guioptions-=T " Disable toolbar" +set completeopt=menuone,preview +set cinoptions=:0,(s,u0,U1,g0,t0 " Some indentation options ':h cinoptions' for details +set modelines=5 " Number of lines to check for vim: directives at the start/end of file +set autoindent " AutomaticAlly indent new line + +" Indentation +set ai " Sets auto-indentation +set si " Sets smart-indentation +set tabstop=2 " Tab equal 2 spaces (default 4) +set shiftwidth=2 " Arrow function (>>) creates 2 spaces +set expandtab " Use spaces instead of a tab charater on TAB +set smarttab " Be smart when using tabs + +" Search settings +set incsearch " When searching (/), display results as you type (instead of only upon ENTER) +set nohlsearch " Do not highlight search match +set ignorecase " When searching (/), ignore case entirely +set smartcase " When searching (/), automatically switch to a case-sensitive search if you use any capital letters +set shiftround " Shift to the next round tab stop. Aka When at 3 spaces, hit >> to go to 4, not 5 if your shiftwidth is set to 2. + +" Directory settings +set nobackup " Do not write backup files +set noswapfile " Do not write .swp files + +" Stop here if running in restricted mode +if v:progname =~? "rvim" + finish +endif + +" Backup settings +if has("persistent_undo") + silent !mkdir -vp ~/.backup/vim/undo/ > /dev/null 2>&1 + set backupdir=~/.backup/vim,. " List of directories for the backup file + set directory=~/.backup/vim,~/tmp,. " List of directory names for the swap file + set undofile + set undodir=~/.backup/vim/undo/,~/tmp,. +endif + +" Folding +if has("folding") + set foldcolumn=1 " Place a width 1 margin on the left + set foldmethod=indent + set foldlevel=9 + set nofoldenable " Don't fold by default +endif + +if has("user_commands") + let mapleader = "," + let maplocalleader = "\\" +endif + +" Remember last position in file +if has("autocmd") + autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal g`\"" | + \ endif +endif + +" In this house we obey the laws of airline +let g:airline_powerline_fonts = 1 +let g:airline_enable_fugitive = 1 +"let g:airline_theme = 'base16' + +" Use Q for formatting +map Q gq + +" In many terminal emulators the mouse works just fine, thus enable it. +if has('mouse') + set mouse=a + set mousehide " Hide mouse pointer on insert mode." + if ! has("nvim") + set ttymouse=sgr + set balloonevalterm + endif +endif + +" Styled and colored underline support +let &t_AU = "\e[58:5:%dm" +let &t_8u = "\e[58:2:%lu:%lu:%lum" +let &t_Us = "\e[4:2m" +let &t_Cs = "\e[4:3m" +let &t_ds = "\e[4:4m" +let &t_Ds = "\e[4:5m" +let &t_Ce = "\e[4:0m" +" Strikethrough +let &t_Ts = "\e[9m" +let &t_Te = "\e[29m" +" Truecolor support +let &t_8f = "\e[38:2:%lu:%lu:%lum" +let &t_8b = "\e[48:2:%lu:%lu:%lum" +let &t_RF = "\e]10;?\e\\" +let &t_RB = "\e]11;?\e\\" +" Bracketed paste +let &t_BE = "\e[?2004h" +let &t_BD = "\e[?2004l" +let &t_PS = "\e[200~" +let &t_PE = "\e[201~" +" Cursor control +let &t_RC = "\e[?12$p" +let &t_SH = "\e[%d q" +let &t_RS = "\eP$q q\e\\" +let &t_SI = "\e[5 q" +let &t_SR = "\e[3 q" +let &t_EI = "\e[1 q" +let &t_VS = "\e[?12l" +" Focus tracking +let &t_fe = "\e[?1004h" +let &t_fd = "\e[?1004l" +if ! has("nvim") + execute "set =\[I" + execute "set =\[O" +endif +" Window title +let &t_ST = "\e[22;2t" +let &t_RT = "\e[23;2t" + +if has("autocmd") + " Put these in an autocmd group, so that we can delete them easily. + augroup vimrcEx + au! + + " For all text files set 'textwidth' to 78 characters. + autocmd FileType text setlocal textwidth=78 + + " When editing a file, always jump to the last known cursor position. + " Don't do it when the position is invalid or when inside an event handler + " (happens when dropping a file on gvim). + " Also don't do it when the mark is in the first line, that is the default + " position when opening a file. + autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + + augroup END + + " Makefile sanity + autocmd BufEnter ?akefile* set noet ts=8 sw=8 + autocmd BufEnter */debian/rules set noet ts=8 sw=8 +endif " has("autocmd") + +" Various options +set shortmess+=I " Don't show the intro message when starting vim +set complete+=k " Scan files with the 'dictionary' option +set completeopt+=longest +set scrolloff=15 " Minimal number of screen lines above/below the cursor +set linebreak " Wrap long lines at a blank + + +if has("syntax") + syntax on " Enable syntax highlighting + filetype plugin indent on +endif + +:noremap k gk +:noremap j gj + +"" Take care of screen/tmux settings +if &term =~ '^screen' + " tmux will send xterm-style keys when its xterm-keys option is on + execute "set =\e[1;*A" + execute "set =\e[1;*B" + execute "set =\e[1;*C" + execute "set =\e[1;*D" +endif + +" Python-black +if has("python3") + packadd black +endif + +" ALE conflicts with typescript-vim at the moment +if ! &ft=="typescript" + packadd ale +endif diff --git a/private_dot_ssh/config b/private_dot_ssh/config index 07fa3d3..9cffdd3 100644 --- a/private_dot_ssh/config +++ b/private_dot_ssh/config @@ -7,7 +7,7 @@ Host * !*.home Compression yes # This is only for git repo access -Match Originalhost git.corradoprimier.it Exec "dig +short git.corradoprimier.it | grep '^192\.168\.0\.50$'" +Match Originalhost git.corradoprimier.it Exec "dig +short git.corradoprimier.it | grep '^192\.168\.178\.50$'" Hostname 192.168.20.6 ProxyJump jump@jump.home Host git.corradoprimier.it @@ -29,15 +29,16 @@ Host tenar IdentityFile ~/.ssh/id_ed25519 Host jump.home - Hostname 192.168.0.50 + Hostname 192.168.178.50 Port 4222 User root IdentityFile ~/.ssh/id_ed25519 Host random.home - Hostname 192.168.0.217 + Hostname 192.168.178.248 User root IdentityFile ~/.ssh/id_ed25519 + SetEnv TERM=xterm-256color Host reverse.home Hostname 192.168.10.2 @@ -70,6 +71,11 @@ Host web-my.home User root ProxyJump jump@jump.home +Host wireguard.home + Hostname 192.168.30.2 + User root + ProxyJump jump@jump.home + Host decodificador-dev.home Hostname 192.168.20.9 User root