diff --git a/README.md b/README.md index aeb3570..1eda2ab 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,8 @@ These are my personal dotfiles. Free for personal use. Thanks to [@bebehei](http * sway (wayland: window manager) * i3 (xorg: window manager) (maybe outdated) -* neovim (nvim) - * replaces `vim` completely * vim - * used as fallback, in case neovim is not available + * forked off [vimrc](https://github.com/bebehei/vimrc/) * NerdTree, autocompletion * colored * [git diff integration](https://github.com/mhinz/vim-signify) diff --git a/bash/bashrc b/bash/bashrc index c803ba1..b065281 100755 --- a/bash/bashrc +++ b/bash/bashrc @@ -20,7 +20,7 @@ export NEWT_COLORS='root=black,black;window=black,black;border=white,black;listb alias reload=". ~/.bashrc" # Bind PageUp and PageDown to history search -if [ -n "$BASH_VERSION" ] && [ -n "$PS1" ]; then +if [ -n "$BASH_VERSION" -a -n "$PS1" ]; then bind '"\e[5~": history-search-backward' bind '"\e[6~": history-search-forward' fi diff --git a/git/gitconfig b/git/gitconfig index 8fe190e..735bded 100644 --- a/git/gitconfig +++ b/git/gitconfig @@ -8,9 +8,10 @@ email = account@buehler.rocks [merge] defaultToUpstream = true - tool = nvim -d + tool = vimdiff conflictstyle = zdiff3 [core] + editor = vim eol = native pager = delta || (diff-so-fancy | less --tabs=4 -RFX) quotepath = false @@ -31,7 +32,6 @@ ri = rebase --interactive rc = rebase --continue ra = rebase --abort - stauts = status [rerere] enabled = true autoupdate = true @@ -46,8 +46,8 @@ fetch = +refs/pull/*/head:refs/remotes/upstream/pull/* fetch = +refs/merge-requests/*/head:refs/remotes/upstream/merge-requests/* [diff] - tool = nvim -d - colorMoved = default + tool = vimdiff + colorMoved = plain algorithm = histogram mnemonicPrefix = true renames = true diff --git a/install.conf.yaml b/install.conf.yaml index 6823f1a..188ef43 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -41,6 +41,9 @@ ~/.profile.d/10-liquidprompt.sh: shell/liquidprompt.sh ~/.profile.d/20-aliases.sh: shell/aliases.sh ~/.profile.d/20-cd.sh: shell/cd.sh + ~/.profile.d/40-extract.sh: shell/extract.sh + ~/.profile.d/40-mysqlpw.sh: shell/mysqlpw.sh + ~/.profile.d/80-command-not-found.sh: shell/command-not-found.sh ~/.profile.d/81-fzf.sh: shell/fzf.sh ~/.profile.d/82-direnv.sh: shell/direnv.sh ~/.profile.d/90-keychain.sh: shell/keychain.sh diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 09f1e06..5ada03b 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,14 +1,13 @@ { "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, - "gitsigns.nvim": { "branch": "main", "commit": "abf82a65f185bd54adc0679f74b7d6e1ada690c9" }, + "gitsigns.nvim": { "branch": "main", "commit": "42d6aed4e94e0f0bbced16bbdcc42f57673bd75e" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, "nvim-treesitter": { "branch": "main", "commit": "d19def46c112c26c17adeef88dd1253cc6d623a1" }, "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, + "onedark.nvim": { "branch": "master", "commit": "213c23ae45a04797572242568d5d51937181792d" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "remember.nvim": { "branch": "master", "commit": "85aff6dc0a5adab088ef6b9210585ded31c32c7b" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, - "telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" }, - "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, - "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" } + "telescope.nvim": { "branch": "master", "commit": "a8c2223ea6b185701090ccb1ebc7f4e41c4c9784" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" } } diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua index 429b59a..e7b591e 100644 --- a/nvim/lua/config/lazy.lua +++ b/nvim/lua/config/lazy.lua @@ -18,10 +18,12 @@ require("lazy").setup({ -- import your plugins { import = "plugins" }, }, - -- Check for plugin updates once a week + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "onedark" } }, + -- automatically check for plugin updates checker = { enabled = true, - frequency = 3600 * 24 * 7, notify = false, }, -- disable luarocks diff --git a/nvim/lua/config/lualine.lua b/nvim/lua/config/lualine.lua index 34e080e..8a17d9b 100644 --- a/nvim/lua/config/lualine.lua +++ b/nvim/lua/config/lualine.lua @@ -1,5 +1,6 @@ require('lualine').setup { options = { icons_enabled = true, + theme = 'onedark' } } diff --git a/nvim/lua/plugins/onedark.lua b/nvim/lua/plugins/onedark.lua new file mode 100644 index 0000000..f70dbdd --- /dev/null +++ b/nvim/lua/plugins/onedark.lua @@ -0,0 +1,10 @@ +return { + "navarasu/onedark.nvim", + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require('onedark').setup { + style = 'warmer' + } + require('onedark').load() + end +} diff --git a/nvim/lua/plugins/remember.lua b/nvim/lua/plugins/remember.lua deleted file mode 100644 index 1abcaea..0000000 --- a/nvim/lua/plugins/remember.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - 'vladdoster/remember.nvim', - opts = {}, -} diff --git a/nvim/lua/plugins/tokyonight.lua b/nvim/lua/plugins/tokyonight.lua deleted file mode 100644 index 93d87dd..0000000 --- a/nvim/lua/plugins/tokyonight.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - config = function() - vim.cmd([[colorscheme tokyonight-moon]]) - end, -} diff --git a/shell/aliases.sh b/shell/aliases.sh index 1534ac7..183a59e 100755 --- a/shell/aliases.sh +++ b/shell/aliases.sh @@ -12,14 +12,8 @@ alias :qa="exit" alias :q!="exit" alias :qw="exit" -if [ -n "$(type nvim 2>/dev/null)" ]; then - alias vimdiff='nvim -d' - alias vim="nvim -p" - alias vi="nvim -p" -else - alias vim="vim -p" - alias vi="vim -p" -fi +alias vim="vim -p" +alias vi="vim -p" alias yt-dlp='yt-dlp -o "%(title)s.%(ext)s"' alias yt-audio='yt-dlp -o "%(title)s.%(ext)s" --extract-audio' @@ -54,6 +48,13 @@ if [ -n "$(type sudo 2>/dev/null)" ] && [ "$USER" != 'root' ]; then done unset sudo + #create sudo aliases WITH leading s + for sudo in ps vim chown chmod; + do + type $sudo > /dev/null 2>&1 && alias s$sudo="sudo $sudo"; + done + unset sudo + type pacman >/dev/null 2>&1 && pacman(){ local sudo_needed # Check if pacman has -S, -R or -U option diff --git a/shell/command-not-found.sh b/shell/command-not-found.sh new file mode 100755 index 0000000..13cd193 --- /dev/null +++ b/shell/command-not-found.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# arch +if [ "${BASH_VERSION}" ] && [ -r /usr/share/doc/pkgfile/command-not-found.bash ]; then + # shellcheck source=/dev/null + . /usr/share/doc/pkgfile/command-not-found.bash +fi + +if [ "${ZSH_VERSION}" ] && [ -r /usr/share/doc/pkgfile/command-not-found.zsh ]; then + # shellcheck source=/dev/null + . /usr/share/doc/pkgfile/command-not-found.zsh +fi + diff --git a/shell/extract.sh b/shell/extract.sh new file mode 100755 index 0000000..d3f3f19 --- /dev/null +++ b/shell/extract.sh @@ -0,0 +1,62 @@ +#!/bin/sh + +x() { + for zipfile in "$@"; do + _x_extractor + if [ -f "$zipfile" ]; then + case "$zipfile" in + *.deb) + _x_extractor="ar x" ;; + *.tar.lrz) + _x_extractor="lrztar -d" ;; + *.lrz) + _x_extractor="lrunzip" ;; + *.tar.bz2) + _x_extractor="bsdtar xjf" ;; + *.bz2) + _x_extractor="bunzip2" ;; + *.tar.gz) + _x_extractor="bsdtar xzf" ;; + *.gz) + _x_extractor="gunzip" ;; + *.tar.xz) + _x_extractor="bsdtar Jxf" ;; + *.xz) + _x_extractor="xz -d" ;; + *.rar) + _x_extractor="unrar e" ;; + *.tar) + _x_extractor="bsdtar xf" ;; + *.tbz2) + _x_extractor="bsdtar xjf" ;; + *.tgz) + _x_extractor="bsdtar xzf" ;; + *.zip) + _x_extractor="unzip" ;; + *.Z) + _x_extractor="uncompress" ;; + *.7z) + _x_extractor="7z x" ;; + *) + echo "Cannot extract '$zipfile': No extractor for filetype known ..." >&2 + return 1 + ;; + esac + + if ! command -v "$(echo "$_x_extractor" | awk '{print $1}')" >/dev/null 2>/dev/null; then + echo "Cannot extract '$zipfile': Cannot find extractor '$(echo "$_x_extractor" | awk '{print $1}')'." >&2 + return 1 + fi + + echo "Extracting '$zipfile'..." >&2 + eval "$_x_extractor" "$zipfile" + + elif [ ! -e "$zipfile" ]; then + echo "Cannot extract '$zipfile': File does not exist!" + return 1 + else + echo "Cannot extract '$zipfile': Not a valid file!" + return 1 + fi + done +} diff --git a/shell/mysqlpw.sh b/shell/mysqlpw.sh new file mode 100755 index 0000000..9701e11 --- /dev/null +++ b/shell/mysqlpw.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +#The function will find the given user and search for a mysql-password +#in the home-directory, which will get printed out! +#arg1: user where to find a config-file +# if not given, it uses the current user in the $HOME and $USER-Variable + +mysqlpw() { + _mysqlpw_H=$HOME + _mysqlpw_U=$USER + + # use different user, if arg1 given + if [ -n "$1" ]; then + + # check if given user is even existing + if ! id "$1" >/dev/null 2>/dev/null; then + echo user "$1" not existing >&2 + return 1 + fi + + _mysqlpw_U=$1 + _mysqlpw_H=$(grep ^"$1": /etc/passwd | cut -d ":" -f 6) + + fi; + + _mysqlpw_cnf="$_mysqlpw_H/.my.cnf" + + if [ ! -e "$_mysqlpw_cnf" ]; then + echo "$_mysqlpw_cnf" not existing >&2 && return 1 + fi + + if [ ! -r "$_mysqlpw_cnf" ]; then + echo "$_mysqlpw_cnf" not readable >&2 && return 1 + fi + + _mysqlpw_PW=$( (grep "password=" "$_mysqlpw_cnf" || echo undefined) | cut -d "=" -f 2) + + echo MySQL-Password for user "$_mysqlpw_U" is "$_mysqlpw_PW" +} diff --git a/shell/paths.sh b/shell/paths.sh index cd86352..052e1b2 100755 --- a/shell/paths.sh +++ b/shell/paths.sh @@ -15,6 +15,17 @@ appendpath () { appendpath ~/.local/bin appendpath ~/.bin +if which ruby >/dev/null 2>&1 && which gem >/dev/null 2>&1; then + appendpath "$(ruby -r rubygems -e 'puts Gem.user_dir')"/bin +fi + +# PERL cpan modules +appendpath "$HOME"/.perl/5/bin +export PERL5LIB="$HOME/.perl/5/lib/perl5:$PERL5LIB" +export PERL_LOCAL_LIB_ROOT="$HOME/.perl/5:$PERL_LOCAL_LIB_ROOT" +export PERL_MB_OPT="--install_base \"$HOME/.perl/5\"" +export PERL_MM_OPT="INSTALL_BASE=$HOME/.perl/5" + export GOPATH=$HOME/.go export GOBIN=$HOME/.gobin appendpath "$GOPATH"/bin diff --git a/shell/vars.sh b/shell/vars.sh index 49180d9..8c6116e 100755 --- a/shell/vars.sh +++ b/shell/vars.sh @@ -1,10 +1,5 @@ #!/bin/sh -if [ -n "$(type nvim 2>/dev/null)" ]; then - export EDITOR=nvim - export VISUAL=nvim -else - export EDITOR=vim - export VISUAL=vim -fi +export EDITOR=vim +export VISUAL=vim export BROWSER=firefox diff --git a/zsh/zshrc b/zsh/zshrc index 0919c53..ccf96a7 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,5 +1,3 @@ -#!/usr/bin/env zsh - # Path to your oh-my-zsh installation. export ZSH=~/.oh-my-zsh fpath=( ~/.zcomplete "${fpath[@]}" )