Updating to latest
This commit is contained in:
parent
d7febed2af
commit
510b51bc9c
|
@ -1,4 +1,64 @@
|
||||||
|
" Load plugins
|
||||||
|
call plug#begin()
|
||||||
|
|
||||||
|
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||||
|
Plug 'https://gitlab.com/code-stats/code-stats-vim.git', {'do': ':TSUpdate'}
|
||||||
|
Plug 'vim-airline/vim-airline', {'do': ':TSUpdate'}
|
||||||
|
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
" Python plugins, needed for CodeStats
|
||||||
|
" let g:python3_host_prog = '/usr/bin/python'
|
||||||
|
|
||||||
|
" CodeStats
|
||||||
|
let g:codestats_api_key = $CODESTATS_API_KEY
|
||||||
|
|
||||||
|
" Main configuration
|
||||||
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab smarttab autoindent
|
set tabstop=2 softtabstop=2 shiftwidth=2 expandtab smarttab autoindent
|
||||||
set mouse-=a
|
set mouse=
|
||||||
set laststatus=2
|
set laststatus=2
|
||||||
set t_Co=256
|
set t_Co=256
|
||||||
|
|
||||||
|
lua <<EOF
|
||||||
|
require 'nvim-treesitter.configs'.setup {
|
||||||
|
ensure_installed = {
|
||||||
|
"bash", "vim", "regex",
|
||||||
|
"cpp", "go", "rust",
|
||||||
|
"diff", "make",
|
||||||
|
"dockerfile",
|
||||||
|
"elixir", "erlang",
|
||||||
|
"godot_resource", "gdscript",
|
||||||
|
"git_rebase", "gitattributes", "gitcommit", "gitignore",
|
||||||
|
"html", "scss",
|
||||||
|
"http", "sql",
|
||||||
|
"javascript", "jsdoc", "typescript", "vue",
|
||||||
|
"json", "json5", "jq",
|
||||||
|
"lua", "php", "phpdoc",
|
||||||
|
"markdown", "markdown_inline",
|
||||||
|
"rst", "yaml",
|
||||||
|
},
|
||||||
|
highlight = {
|
||||||
|
enable = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local parser_config = require'nvim-treesitter.parsers'.get_parser_configs()
|
||||||
|
parser_config.dfraw = {
|
||||||
|
install_info = {
|
||||||
|
url = 'https://code.criminallycute.fi/github-mirror/tree-sitter-dfraw',
|
||||||
|
files = { 'src/parser.c' },
|
||||||
|
branch = 'main'
|
||||||
|
},
|
||||||
|
filetype = 'text',
|
||||||
|
used_by = { 'dfraw' }
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
" disable dfraw for text files
|
||||||
|
if did_filetype()
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
if getline(1) =~# '[a-z_]'
|
||||||
|
setfiletype dfraw
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
// This file is automatically generated, do not edit
|
// This file is automatically generated, do not edit
|
||||||
|
|
||||||
// ChatView Font
|
// ChatView Font
|
||||||
ChatLine { font: normal 400 10pt "Cascadia Code"; }
|
ChatLine { font: normal 400 10pt "Hack"; }
|
||||||
|
|
3
link.sh
3
link.sh
|
@ -16,3 +16,6 @@ mkdir -p $HOME/.config/zsh/{plugins,zprompts}
|
||||||
git clone https://github.com/xylous/gitstatus $HOME/Projects/gitstatus
|
git clone https://github.com/xylous/gitstatus $HOME/Projects/gitstatus
|
||||||
ln -sf $HOME/Projects/gitstatus/gitstatus.plugin.zsh $HOME/.config/zsh/plugins/gitstatus.zsh
|
ln -sf $HOME/Projects/gitstatus/gitstatus.plugin.zsh $HOME/.config/zsh/plugins/gitstatus.zsh
|
||||||
ln -sf $PWD/zprompts/bunni.zsh $HOME/.config/zsh/zprompts/prompt_bunni_setup
|
ln -sf $PWD/zprompts/bunni.zsh $HOME/.config/zsh/zprompts/prompt_bunni_setup
|
||||||
|
|
||||||
|
git clone https://gitlab.com/code-stats/code-stats-zsh $HOME/Projects/code-stats-zsh
|
||||||
|
ln -sf $HOME/Projects/code-stats-zsh/codestats.plugin.zsh $HOME/.config/zsh/plugins/codestats.zsh
|
||||||
|
|
1
profile
1
profile
|
@ -20,5 +20,6 @@ LESSHISTFILE=-
|
||||||
|
|
||||||
alias ls="ls -h --color=auto"
|
alias ls="ls -h --color=auto"
|
||||||
alias myip="curl https://ifconfig.co"
|
alias myip="curl https://ifconfig.co"
|
||||||
|
alias vim="nvim $@"
|
||||||
alias wget="wget --hsts-file $HOME/.cache/wget/hsts"
|
alias wget="wget --hsts-file $HOME/.cache/wget/hsts"
|
||||||
alias woodpecker="$HOME/.local/bin/woodpecker --log-level=''"
|
alias woodpecker="$HOME/.local/bin/woodpecker --log-level=''"
|
||||||
|
|
|
@ -127,7 +127,7 @@ prompt_bunni_setup () {
|
||||||
local lbra="$parens"'['"$text"
|
local lbra="$parens"'['"$text"
|
||||||
local rbra="$parens"']'"$text"
|
local rbra="$parens"']'"$text"
|
||||||
|
|
||||||
source $HOME/Projects/dotfiles/zprompts/gitstatus.plugin.zsh
|
source $HOME/.config/zsh/plugins/gitstatus.zsh
|
||||||
setopt PROMPT_SUBST
|
setopt PROMPT_SUBST
|
||||||
|
|
||||||
local gitstatus=' $(gitstatus -i)'
|
local gitstatus=' $(gitstatus -i)'
|
||||||
|
|
|
@ -1,172 +0,0 @@
|
||||||
###
|
|
||||||
# Print the final gitstatus prompt to stdout
|
|
||||||
# Arguments: $1 -i, if it's an inline prompt => add a whitespace at the end, if
|
|
||||||
# not empty
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Original: https://github.com/xylous/gitstatus
|
|
||||||
###
|
|
||||||
function gitstatus()
|
|
||||||
{
|
|
||||||
is_in_git_repository || return 1
|
|
||||||
|
|
||||||
parse_git_status
|
|
||||||
local modified="${STATUS[1]}"
|
|
||||||
local staged="${STATUS[2]}"
|
|
||||||
local deleted="${STATUS[3]}"
|
|
||||||
local untracked="${STATUS[4]}"
|
|
||||||
unset STATUS
|
|
||||||
|
|
||||||
git_grab_current_branch
|
|
||||||
local branch="$REPLY"
|
|
||||||
|
|
||||||
git_grab_remote_branch
|
|
||||||
local remote="$REPLY"
|
|
||||||
|
|
||||||
[[ ! -z "$remote" ]] \
|
|
||||||
&& git_local_remote_diffs "$branch" "$remote" \
|
|
||||||
&& local commit_diffs="$REPLY"
|
|
||||||
|
|
||||||
git_determine_color $modified $staged $deleted $untracked
|
|
||||||
local color="$REPLY"
|
|
||||||
|
|
||||||
(( modified > 0 )) \
|
|
||||||
&& modified="!$modified "
|
|
||||||
(( staged > 0 )) \
|
|
||||||
&& staged="+$staged "
|
|
||||||
(( deleted > 0 )) \
|
|
||||||
&& deleted="-$deleted "
|
|
||||||
(( untracked > 0 )) \
|
|
||||||
&& untracked="?$untracked "
|
|
||||||
|
|
||||||
local output="$color"
|
|
||||||
output+=" $branch "
|
|
||||||
output+="$commit_diffs"
|
|
||||||
output+="$modified"
|
|
||||||
output+="$staged"
|
|
||||||
output+="$deleted"
|
|
||||||
output+="$untracked"
|
|
||||||
|
|
||||||
local true_output="$(sed 's/[ \t]*$//' <<<"$output")" # remove trailing whitespace
|
|
||||||
|
|
||||||
if [[ "$1" == "-i" ]]; then
|
|
||||||
true_output+=" "
|
|
||||||
fi
|
|
||||||
|
|
||||||
true_output+=$'%F{default}'
|
|
||||||
echo "${true_output}"
|
|
||||||
|
|
||||||
unset REPLY
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
||||||
# Check if we're in a git repository
|
|
||||||
# Arguments: none
|
|
||||||
# Returns: 0 if in a git repo, 1 otherwise
|
|
||||||
###
|
|
||||||
function is_in_git_repository()
|
|
||||||
{
|
|
||||||
git rev-parse --git-dir &>/dev/null || return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
||||||
# Return current branch we're on
|
|
||||||
# Arguments: none
|
|
||||||
###
|
|
||||||
function git_grab_current_branch()
|
|
||||||
{
|
|
||||||
typeset -g REPLY="$(git branch --show-current)"
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
||||||
# Return remote branch that the local one is tracking
|
|
||||||
# Arguemnts: none
|
|
||||||
###
|
|
||||||
function git_grab_remote_branch()
|
|
||||||
{
|
|
||||||
local symbolic_ref="$(git symbolic-ref -q HEAD)"
|
|
||||||
typeset -g REPLY="$(git for-each-ref --format='%(upstream:short)' "$symbolic_ref")"
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
||||||
# Find how many things have changed since last git commit
|
|
||||||
# Arguments: none
|
|
||||||
###
|
|
||||||
function parse_git_status()
|
|
||||||
{
|
|
||||||
git status --porcelain=v1 | while IFS= read -r status_line; do
|
|
||||||
case "$status_line" in
|
|
||||||
' M '*)
|
|
||||||
((modified++))
|
|
||||||
;;
|
|
||||||
'A '*|'M '*)
|
|
||||||
((staged++))
|
|
||||||
;;
|
|
||||||
' D '*)
|
|
||||||
((deleted++))
|
|
||||||
;;
|
|
||||||
'?? '*)
|
|
||||||
((untracked++))
|
|
||||||
;;
|
|
||||||
'MM '*)
|
|
||||||
((staged++))
|
|
||||||
((modified++))
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
typeset -g STATUS=("$modified" "$staged" "$deleted" "$untracked")
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
||||||
# Look at how many commits a local branch is ahead/behind of remote branch
|
|
||||||
# Arguments: $1 local branch
|
|
||||||
# $2 remote branch
|
|
||||||
###
|
|
||||||
function git_local_remote_diffs()
|
|
||||||
{
|
|
||||||
local local_branch="$1"
|
|
||||||
local remote_branch="$2"
|
|
||||||
|
|
||||||
local differences="$(git rev-list --left-right --count $local_branch...$remote_branch)"
|
|
||||||
local commits_ahead=$(echo -n "$differences" | awk '{print $1}')
|
|
||||||
local commits_behind=$(echo -n "$differences" | awk '{print $2}')
|
|
||||||
local ahead="" behind=""
|
|
||||||
|
|
||||||
local result=""
|
|
||||||
|
|
||||||
(( $commits_ahead > 0 )) \
|
|
||||||
&& ahead="↑$commits_ahead"
|
|
||||||
(( $commits_behind > 0 )) \
|
|
||||||
&& behind="↓$commits_behind"
|
|
||||||
|
|
||||||
if [[ ! -z "${ahead}" ]]; then
|
|
||||||
result="${ahead} "
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -z "${behind}" ]]; then
|
|
||||||
result="${behind} "
|
|
||||||
fi
|
|
||||||
|
|
||||||
typeset -g REPLY="${result}"
|
|
||||||
}
|
|
||||||
|
|
||||||
###
|
|
||||||
# If there is anything that changed from the past commit, return yellow.
|
|
||||||
# Otherwise, green.
|
|
||||||
# Arguments: list of how many things changed
|
|
||||||
###
|
|
||||||
function git_determine_color()
|
|
||||||
{
|
|
||||||
local green=$'%F{yellow}'
|
|
||||||
local yellow=$'%F{green}'
|
|
||||||
for i in "$@"; do
|
|
||||||
if (( $i > 0 )); then
|
|
||||||
typeset -g REPLY="$green"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
typeset -g REPLY="$yellow"
|
|
||||||
return 0
|
|
||||||
}
|
|
7
zshrc
7
zshrc
|
@ -61,5 +61,8 @@ if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
|
||||||
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zstyle :omz:plugins:ssh-agent identities id_ed25519
|
#zstyle :omz:plugins:ssh-agent identities id_ed25519
|
||||||
plugins=(git ssh-agent)
|
#plugins=(git ssh-agent)
|
||||||
|
|
||||||
|
# Load codestats if interactive shell
|
||||||
|
[[ $- == *i* ]] && source $HOME/.config/zsh/plugins/codestats.zsh
|
||||||
|
|
Loading…
Reference in New Issue