Compare commits
3 Commits
6263513f71
...
63e090edb4
Author | SHA1 | Date |
---|---|---|
Patrick Cao Huu Thien | 63e090edb4 | |
Patrick Cao Huu Thien | 400aa1e374 | |
Patrick Cao Huu Thien | a22f336245 |
58
.bashrc
58
.bashrc
|
@ -26,6 +26,12 @@ shopt -s checkwinsize
|
|||
## autocd
|
||||
shopt -s autocd
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
|
||||
|
||||
# LESS options
|
||||
export LESS="-FRX"
|
||||
|
||||
# very basic prompt -- more in .bash_prompt
|
||||
PROMPT_COMMAND='PS1="[\u@\h] -- \w "; echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
|
||||
|
||||
|
@ -39,7 +45,6 @@ export BROWSER=w3m
|
|||
export EDITOR=vim
|
||||
|
||||
export PAGER=less
|
||||
|
||||
# very min bash aliases
|
||||
alias ls='ls -F --color'
|
||||
alias l='ls -l'
|
||||
|
@ -51,7 +56,7 @@ alias wa='ssh warhol'
|
|||
#
|
||||
test -f ~/.bash_aliases && source ~/.bash_aliases
|
||||
test -f ~/.bash_prompt && source ~/.bash_prompt
|
||||
eval $(dircolors ~/.dircolors)
|
||||
eval "$(dircolors ~/.dircolors)"
|
||||
# shellcheck disable=SC2046
|
||||
test -f ~/.dircolors && eval $(dircolors ~/.dircolors)
|
||||
test -d ~/dotfiles/bash_completion && {
|
||||
|
@ -62,26 +67,12 @@ test -d ~/dotfiles/bash_completion && {
|
|||
done;
|
||||
}
|
||||
|
||||
# man in color with less
|
||||
# from https://unix.stackexchange.com/questions/108699/documentation-on-less-termcap-variables
|
||||
# export LESS_TERMCAP_mb=$'\e[5;31m' # blink
|
||||
# export LESS_TERMCAP_md=$'\e[1;33m' # bold
|
||||
# export LESS_TERMCAP_me=$'\e[0m' # no bold, blink, underline
|
||||
# export LESS_TERMCAP_so=$'\e[7m' # reverse
|
||||
# export LESS_TERMCAP_se=$'\e[27m' # no reverse
|
||||
# export LESS_TERMCAP_us=$'\e[4;32m' # underline
|
||||
# export LESS_TERMCAP_ue=$'\e[24m' # no underline
|
||||
|
||||
# https://wiki.archlinux.org/title/Color_output_in_console#Using_less
|
||||
export MANPAGER="less -R --use-color -Dsc -Dk+r -Dd+g -Du+c -DPgb -DEbR"
|
||||
export MANROFFOPT="-P -c"
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
[ -x /usr/bin/lesspipe.sh ] && eval "$(lesspipe.sh)"
|
||||
|
||||
# LESS options
|
||||
#export LESS="-FRX"
|
||||
|
||||
# startship
|
||||
# https://starship.rs/
|
||||
type -t starship >/dev/null && {
|
||||
|
@ -171,24 +162,9 @@ function _prepend_path() { _append_path -r "$1" "$2"; }
|
|||
### rust
|
||||
test -d "$HOME/.cargo/bin" && PATH=$(_prepend_path "$PATH" "$HOME/.cargo/bin")
|
||||
|
||||
### nodejs
|
||||
# test -d "$HOME/download/nodejs/latest/bin" && PATH=$(_prepend_path "$PATH" "$HOME/download/nodejs/latest/bin")
|
||||
# test -d "$HOME/src/node/current/bin" && PATH=$(_prepend_path "$PATH" "$HOME/src/node/current/bin")
|
||||
|
||||
### npm in user mode
|
||||
test -d "${HOME}/.npm-packages" || mkdir "${HOME}/.npm-packages"
|
||||
export NPM_PACKAGES="${HOME}/.npm-packages"
|
||||
PATH=$(_prepend_path "$PATH" "$NPM_PACKAGES/bin")
|
||||
MANPATH=$(_append_path "$MANPATH" "$NPM_PACKAGES/share/man")
|
||||
|
||||
### yarn
|
||||
# test -d "$HOME/src/yarn/latest/bin" && PATH=$(_prepend_path "$PATH" "$HOME/src/yarn/latest/bin")
|
||||
|
||||
### golang - default is $HOME/go/bin
|
||||
export GOPATH="$HOME/go"
|
||||
test -d "$HOME"/go/bin && PATH=$(_prepend_path "$PATH" "$HOME/go/bin")
|
||||
|
||||
### gobuffalo
|
||||
type -t buffalo > /dev/null 2>&1 && eval "$(buffalo completion bash)"
|
||||
|
||||
function bt {
|
||||
|
@ -343,7 +319,7 @@ function faint () {
|
|||
function openssl_check_all {
|
||||
local file="$1"
|
||||
__openssl_check_all "$file"
|
||||
# local file2;file2=$(sed 's/\./_/g' <<<"$file")
|
||||
|
||||
local file2;file2=${file//./_}
|
||||
test "$file" = "$file2" && return 0
|
||||
file="$file2"
|
||||
|
@ -362,7 +338,7 @@ __openssl_check_all () {
|
|||
# check Certificate Signing Request file
|
||||
function openssl_check_csr {
|
||||
test -f "$1" || { echo "Usage: $(basename "$0") <csr_file>"; return 1; }
|
||||
faint "# openssl req -noout -text -verify -in $1 | grep Subject:"
|
||||
faint "# openssl req -noout -text -verify -in $1"
|
||||
openssl req -noout -text -verify -in "$1" | grep Subject:
|
||||
faint "# openssl req -noout -modulus -in $1 | openssl md5 "
|
||||
openssl req -noout -modulus -in "$1" | openssl md5
|
||||
|
@ -400,7 +376,7 @@ function openssl_check_protocol {
|
|||
# check certificat file dates
|
||||
function openssl_check_cert_validity {
|
||||
test -n "$1" || { echo "Usage: $(basename "$0") mon.site.example.com:443"; return 1; }
|
||||
faint "# openssl s_client -servername ${1%:*} -connect $1 < /dev/null 2>/dev/null | openssl x509 -noout -dates"
|
||||
faint "# openssl s_client -servername ${1%:*} -connect '$1' < /dev/null 2>/dev/null | openssl x509 -noout -dates"
|
||||
openssl s_client -servername "${1%:*}" -connect "$1" < /dev/null 2>/dev/null | openssl x509 -noout -dates
|
||||
|
||||
#
|
||||
|
@ -429,8 +405,6 @@ function openssl_check_cert_validity {
|
|||
|
||||
faint "# openssl ocsp -issuer $onlychain_cert -cert $dest_cert -text -url $ocsp"
|
||||
openssl ocsp -issuer "$onlychain_cert" -cert "$dest_cert" -url "$ocsp" -text 2>/dev/null | grep "$dest_cert" 2>/dev/null | awk -F " " '{print $2}'
|
||||
|
||||
# rm -rf "$dest_cert" "$chain_cert" "$onlychain_cert"
|
||||
|
||||
}
|
||||
|
||||
|
@ -451,14 +425,14 @@ function vf {
|
|||
}
|
||||
|
||||
function vfb {
|
||||
pushd ~/bin > /dev/null
|
||||
pushd ~/bin > /dev/null || exit
|
||||
if test -n "$1"
|
||||
then
|
||||
edit "$(fzf --multi --preview="cat {}" -q "$1")"
|
||||
else
|
||||
edit "$(fzf --multi --preview="cat {}" )"
|
||||
fi
|
||||
popd > /dev/null
|
||||
popd > /dev/null || exit
|
||||
}
|
||||
|
||||
function of {
|
||||
|
@ -471,14 +445,14 @@ function of {
|
|||
}
|
||||
|
||||
function odoc {
|
||||
pushd ~/docs > /dev/null
|
||||
pushd ~/docs > /dev/null || exit
|
||||
if test -n "$1"
|
||||
then
|
||||
see "$(fzf --preview="cat {}" -q "$1")"
|
||||
else
|
||||
see "$(fzf --preview="cat {}")"
|
||||
fi
|
||||
popd > /dev/null
|
||||
popd > /dev/null || exit
|
||||
}
|
||||
|
||||
# Lorem ipsum
|
||||
|
@ -567,8 +541,7 @@ then
|
|||
PATH="/home/patrick/perl5/bin${PATH:+:${PATH}}"; export PATH;
|
||||
PERL5LIB="/home/patrick/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
|
||||
PERL_LOCAL_LIB_ROOT="/home/patrick/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
|
||||
# shellcheck disable=2089
|
||||
PERL_MB_OPT='--install_base "/home/patrick/perl5"'
|
||||
PERL_MB_OPT='--install_base /home/patrick/perl5'
|
||||
# shellcheck disable=2090
|
||||
export PERL_MB_OPT;
|
||||
fi
|
||||
|
@ -588,3 +561,4 @@ export SHELLCHECK_OPTS="-x"
|
|||
|
||||
echo "<< .bashrc"
|
||||
# end .bashrc
|
||||
|
||||
|
|
|
@ -246,6 +246,40 @@ let g:ycm_language_server +=
|
|||
" online deeplearning all language sementic completion system
|
||||
" Plugin 'zxqfl/tabnine-vim'
|
||||
|
||||
" Codeium - « free » coding assistant
|
||||
" https://github.com/Exafunction/codeium.vim
|
||||
Plugin 'Exafunction/codeium.vim'
|
||||
|
||||
|
||||
|
||||
|
||||
" Ollama Support for Vim
|
||||
" https://github.com/gergap/vim-ollama
|
||||
" Plugin 'gergap/vim-ollama'
|
||||
" Default chat model
|
||||
let g:ollama_chat_model = 'llama3.2:1b'
|
||||
|
||||
" Codellama models
|
||||
" let g:ollama_model = 'codellama:7b'
|
||||
|
||||
" " Codegemma (small and fast)
|
||||
" let g:ollama_model = 'codegemma:2b'
|
||||
" let g:ollama_fim_prefix = '<|fim_prefix|>'
|
||||
" let g:ollama_fim_middle = '<|fim_middle|>'
|
||||
" let g:ollama_fim_suffix = '<|fim_suffix|>'
|
||||
|
||||
" " Deepseek-coder-v2
|
||||
let g:ollama_model = 'deepseek-coder:1.3b'
|
||||
" let g:ollama_fim_prefix = '<|fim▁begin|>'
|
||||
" let g:ollama_fim_suffix = '<|fim▁hole|>'
|
||||
" let g:ollama_fim_middle = '<|fim▁end|>'
|
||||
|
||||
" " activate debug
|
||||
let g:ollama_debug = 1
|
||||
let g:ollama_logfile = '/home/patrick/vim-ollama.log'
|
||||
|
||||
|
||||
|
||||
" ansible
|
||||
" Plugin 'pearofducks/ansible-vim'
|
||||
" enable YAML for hosts.yml
|
||||
|
@ -688,12 +722,12 @@ nmap <leader>, :cprevious<cr>
|
|||
imap <leader>, <esc>:cprevious<cr>i
|
||||
nmap <leader>. :cnext<cr>
|
||||
imap <leader>. <esc>:cnext<cr>i
|
||||
" edit alternative
|
||||
" change alternative
|
||||
nmap <leader>/ :e#<cr>
|
||||
" auto indent
|
||||
nmap <leader>i m`gg=G``
|
||||
" try ; as :
|
||||
nmap ; :
|
||||
|
||||
|
||||
|
||||
" translate with trans (https://github.com/soimort/translate-shell)
|
||||
vmap <leader>fr :!trans -b :fr<cr>
|
||||
vmap <leader>en :!trans -b :en<cr>
|
||||
|
|
Loading…
Reference in New Issue