From 4a02a80e7687eefb4ed8b88fa8581df44cdc18df Mon Sep 17 00:00:00 2001 From: D4VIDB2 Date: Wed, 3 Feb 2021 08:47:54 +0100 Subject: [PATCH] desktop archlinux --- .bash_aliases | 6 -- .bashrc | 118 ------------------------- .init.nvim | 228 +++++++++++++++++++++++++++++++++++++++++++++++++ .shell_aliases | 37 ++++++++ .tmux.conf | 46 ++++++++-- .vimrc | 100 ---------------------- .zshrc | 137 ++++++++++++++++++++++++++--- setup.sh | 8 ++ sync.sh | 6 ++ 9 files changed, 442 insertions(+), 244 deletions(-) delete mode 100644 .bash_aliases delete mode 100644 .bashrc create mode 100644 .init.nvim create mode 100644 .shell_aliases delete mode 100644 .vimrc create mode 100755 setup.sh create mode 100755 sync.sh diff --git a/.bash_aliases b/.bash_aliases deleted file mode 100644 index e569b65..0000000 --- a/.bash_aliases +++ /dev/null @@ -1,6 +0,0 @@ -alias la='ls -lahF' -alias xclip='xclip -selection clipboard' -alias xpaste='xclip -o -selection clipboard' -alias nano='vim' -alias more='less' -alias ..='cd ..' diff --git a/.bashrc b/.bashrc deleted file mode 100644 index a39f053..0000000 --- a/.bashrc +++ /dev/null @@ -1,118 +0,0 @@ -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples - -# If not running interactively, don't do anything -case $- in - *i*) ;; - *) return;; -esac - -# don't put duplicate lines or lines starting with space in the history. -# See bash(1) for more options -HISTCONTROL=ignoreboth - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=500 -HISTFILESIZE=1000 - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# If set, the pattern "**" used in a pathname expansion context will -# match all files and zero or more directories and subdirectories. -#shopt -s globstar - -# make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color|*-256color) color_prompt=yes;; -esac - -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='\n${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ ' -else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' -fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' -fi - -# colored GCC warnings and errors -#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' - -# Add an "alert" alias for long running commands. Use like so: -# sleep 10; alert -alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -# enable programmable completion features (you don't need to enable -# this, if it's already enabled in /etc/bash.bashrc and /etc/profile -# sources /etc/bash.bashrc). -if ! shopt -oq posix; then - if [ -f /usr/share/bash-completion/bash_completion ]; then - . /usr/share/bash-completion/bash_completion - elif [ -f /etc/bash_completion ]; then - . /etc/bash_completion - fi -fi - -if [ -f ~/.todo ]; then - echo " === TODO: === " - cat ~/.todo - echo -e "=======================\n" -fi diff --git a/.init.nvim b/.init.nvim new file mode 100644 index 0000000..c3106f7 --- /dev/null +++ b/.init.nvim @@ -0,0 +1,228 @@ + +let mapleader=" " + +set mouse= +syntax on + +set noerrorbells +set number +set relativenumber +set incsearch +set ignorecase +set ruler +set noswapfile +set splitright +set splitbelow +set tabstop=4 softtabstop=4 +set shiftwidth=4 +set expandtab +set smartindent +set noswapfile +set nobackup +set undodir=~/.vim/undodir +set undofile +set nohlsearch + + +call plug#begin('~/.config/nvim/autoload/plugged') +Plug 'scrooloose/nerdcommenter' +Plug 'preservim/nerdtree' + +Plug 'morhetz/gruvbox' " themes +Plug 'sonph/onehalf' + +" Plug 'ThePrimeagen/vim-be-good', {'do': './install.sh'} " vim training game + +" Fuzzy file search +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " fuzzy file finder +Plug 'junegunn/fzf.vim' +Plug 'airblade/vim-rooter' " addon for fzf, for git projects + +" Plug 'ycm-core/YouCompleteMe' " YEET! +Plug 'neoclide/coc.nvim', {'branch': 'release'} + +" Python syntax highlight +Plug 'numirias/semshi', {'do': ':UpdateRemotePlugins'} + +" Coc Snippets +Plug 'sirver/ultisnips' +Plug 'honza/vim-snippets' + +" Show git modifications to file +Plug 'vim-scripts/vim-gitgutter' + +Plug 'jremmen/vim-ripgrep' " Rg uses word under cursor + +" run current file +Plug 'sbdchd/vim-run' + +" HTTP +Plug 'nicwest/vim-http' + +call plug#end() + +" disable spacebar (don't move forward) +nnoremap + +" quickly move through panes +nnoremap +nnoremap +nnoremap +nnoremap + +" resize panes +nnoremap + :vertical resize +5 +nnoremap - :vertical resize -5 + +nnoremap ff :GFiles + +vnoremap p "_dP + +" noremap gf :GitFiles + +colorscheme gruvbox +"colorscheme onehalfdark let g:airline_theme='onehalfdark' +set background=dark + +:set inccommand=nosplit " highlight substitude + + +" run current file plugin +let g:run_cmd_python = ['python3'] +let g:run_split = 'right' + + +"fun! SetupYCM() + "nnoremap gd :YcmCompleter GoTo + "nnoremap gr :YcmCompleter GoToReferences + "nnoremap rr :YcmCompleter RefactorRename + "let g:UltiSnipsExpandTrigger="" +"endfun + + + + +" CoC + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +fun! SetupCoC() + inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() + inoremap pumvisible() ? "\" : "\" + inoremap coc#refresh() + + nmap gd (coc-definition) + nmap gr (coc-references) + nmap gy (coc-type-definition) + nmap gi (coc-implementation) + nmap rn (coc-rename) +endfun + +let g:coc_global_extensions = [ + \ 'coc-snippets', + \ 'coc-pairs', + \ 'coc-prettier', + \ 'coc-json', + \ 'coc-python', + \ 'coc-html', + \ 'coc-css', + \ 'coc-xml', + \ 'coc-yaml', + \ ] + +autocmd BufNewFile,BufRead *.pde set syntax=java +autocmd BufNewFile,BufRead *.pde set filetype=java +autocmd BufNewFile,BufRead *.ino set syntax=arduino +autocmd BufNewFile,BufRead *.ino set filetype=arduino +" autocmd FileType java,typescript,go :call SetupYCM() +" autocmd FileType cpp,h,c :call SetupCoC() + +" run python script +" autocmd BufNewFile,BufRead *.py nnoremap :vs :term python % + +nnoremap rr :Run + +call SetupCoC() + + + +" CoC snippet tab completion +inoremap + \ pumvisible() ? coc#_select_confirm() : + \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : + \ check_back_space() ? "\" : + \ coc#refresh() + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +let g:coc_snippet_next = '' +"let g:UltiSnipsExpandTrigger="" +"let g:UltiSnipsJumpForwardTrigger=">" +"let g:UltiSnipsJumpBackwardTrigger="" + + + + +" Shebang line +function! Hashbang(portable, permission, RemExt) +let shells = { + \ 'awk': "awk", + \ 'sh': "bash", + \ 'hs': "runhaskell", + \ 'jl': "julia", + \ 'lua': "lua", + \ 'mak': "make", + \ 'js': "node", + \ 'm': "octave", + \ 'pl': "perl", + \ 'php': "php", + \ 'py': "python", + \ 'r': "Rscript", + \ 'rb': "ruby", + \ 'scala': "scala", + \ 'tcl': "tclsh", + \ 'tk': "wish" + \ } + +let extension = expand("%:e") + +if has_key(shells,extension) + let fileshell = shells[extension] + + if a:portable + let line = "#! /usr/bin/env " . fileshell + else + let line = "#! " . system("which " . fileshell) + endif + + 0put = line + + if a:permission + :autocmd BufWritePost * :autocmd VimLeave * :!chmod u+x % + endif + + + if a:RemExt + :autocmd BufWritePost * :autocmd VimLeave * :!mv % "%:p:r" + endif + +endif + +endfunction + +:autocmd BufNewFile *.* :call Hashbang(1,1,0) + + + + +" HTTP +let g:vim_http_split_vertically = 1 diff --git a/.shell_aliases b/.shell_aliases new file mode 100644 index 0000000..775ada3 --- /dev/null +++ b/.shell_aliases @@ -0,0 +1,37 @@ +# color +alias ls='ls --color=auto --group-directories-first' +alias grep='grep --color=auto' +alias ip='ip -color=auto' + +#alias la='ls -lahF' +alias xclip='xclip -selection clipboard' +alias xpaste='xclip -o -selection clipboard' +alias more='less' +alias ..='cd ..' +alias cp='cp -iv' +alias mv='mv -iv' + +#alias ccat="highlight --out-format=ansi" +alias p="sudo pacman" +alias sc="sudo systemctl" +alias psg="ps aux | grep" +alias nv='nvim' +#alias suod='sudo' + +# git +alias g='git' +alias gst='git status' +alias gdiff='git diff' +alias gl='git pull' +alias gp='git push' +alias gc='git commit -v' +alias gca='git commit -v -a' +alias gcm='git commit -m' +alias gcam='git commit -a -m' +alias gco='git checkout' +alias gb='git branch' +alias ga='git add' + + +alias batman="MANPAGER=\"sh -c 'col -bx | bat -l man -p'\" man" +alias la='exa -laag --group-directories-first' diff --git a/.tmux.conf b/.tmux.conf index 4695475..2b4409a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,9 +1,43 @@ -# Improve colors -set -g default-terminal 'screen-256color' +# Send prefix +set-option -g prefix C-a +unbind-key C-a +bind-key C-a send-prefix + +# Use Alt-arrow keys to switch panes +bind -n M-h select-pane -L +bind -n M-l select-pane -R +bind -n M-k select-pane -U +bind -n M-j select-pane -D + +# prefix + j/k to switch windows +bind-key j previous-window +bind-key k next-window + +# Mouse mode +setw -g mouse off + +# set vim-like keybidings in buffer mode +setw -g mode-keys vi + +# fix escape key delay in vim +set -s escape-time 0 -# Set scrollback buffer to 10000 set -g history-limit 10000 +set -g default-terminal screen-256color +set-option -g default-shell /usr/bin/zsh + +set-option -sa terminal-overrides ',xterm-256color:RGB' + +# Set easier window split keys +bind-key h split-window -v +bind-key v split-window -h + +# Easy config reload +bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded." + +# yank to clipboard +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' -# Customize the status line -set -g status-fg green -set -g status-bg black +# Start window and pane indexes from 1 and not 0 +set -g base-index 1 +setw -g pane-base-index 1 diff --git a/.vimrc b/.vimrc deleted file mode 100644 index a0bdd9d..0000000 --- a/.vimrc +++ /dev/null @@ -1,100 +0,0 @@ - -" An example for a vimrc file. -" -" Maintainer: Bram Moolenaar -" Last change: 2017 Sep 20 -" -" To use it, copy it to -" for Unix and OS/2: ~/.vimrc -" for Amiga: s:.vimrc -" for MS-DOS and Win32: $VIM\_vimrc -" for OpenVMS: sys$login:.vimrc - -" When started as "evim", evim.vim will already have done these settings. -if v:progname =~? "evim" - finish -endif - -" Get the defaults that most users want. -source $VIMRUNTIME/defaults.vim - -if has("vms") - set nobackup " do not keep a backup file, use versions instead -else - set backup " keep a backup file (restore to previous version) - if has('persistent_undo') - set undofile " keep an undo file (undo changes after closing) - endif -endif - -" Only do this part when compiled with support for autocommands. -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 - - augroup END - -else - - set autoindent " always set autoindenting on - -endif " has("autocmd") - -" Add optional packages. -" -" The matchit plugin makes the % command work better, but it is not backwards -" compatible. -" The ! means the package won't be loaded right away but when plugins are -" loaded during initialization. -if has('syntax') && has('eval') - packadd! matchit -endif - -call plug#begin() -Plug 'scrooloose/nerdcommenter' -"Plug 'preservim/nerdtree' -call plug#end() - -let mapleader = "," - -" My custom commands -syntax on -set number -set relativenumber -set incsearch -set ignorecase -set ruler -set noswapfile - -nnoremap -nnoremap -nnoremap -nnoremap - - -autocmd StdinReadPre * let s:std_in=1 -"autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif -"autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif - - -autocmd Filetype c setlocal tabstop=4 -set shiftwidth=0 - - -" A nerdtree like setup with netrw. -let g:netrw_banner = 0 -let g:netrw_liststyle = 3 -let g:netrw_browse_split = 4 -let g:netrw_altv = 1 -let g:netrw_winsize = 20 -augroup ProjectDrawer - autocmd! - autocmd VimEnter * :Vexplore -augroup END - - diff --git a/.zshrc b/.zshrc index 724ebf8..7279cc7 100644 --- a/.zshrc +++ b/.zshrc @@ -1,14 +1,123 @@ -# Lines configured by zsh-newuser-install -HISTFILE=~/.zsh_history -HISTSIZE=1000 -SAVEHIST=250 -setopt appendhistory nomatch -unsetopt beep -bindkey -e -# End of lines configured by zsh-newuser-install -# The following lines were added by compinstall -zstyle :compinstall filename '/home/david/.zshrc' - -autoload -Uz compinit -compinit -# End of lines added by compinstall +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="/home/david/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +ZSH_THEME="intheloop" +#gentoo - jako bash +#essembeh - jako bash +#dpoggi - jako bash, ale barevnejsi +#kennethreitz - pwd na prave strane +#bira - $ na nove radce pod pwd +#rkj - old tech style +#intheloop - $ na nove radce, mezera mezi prikazy + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment the following line to disable bi-weekly auto-update checks. +# DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to automatically update without prompting. +# DISABLE_UPDATE_PROMPT="true" + +# Uncomment the following line to change how often to auto-update (in days). +# export UPDATE_ZSH_DAYS=13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS=true + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git zsh-autosuggestions zsh-syntax-highlighting) + +source $ZSH/oh-my-zsh.sh + +# User configuration + +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#666666,underline" + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" +# + +export EDITOR='nvim' + +if [ -f ~/.config/shell_aliases ]; then + source ~/.config/shell_aliases +fi + +PATH=$PATH:$HOME/.local/bin + +# setopt GLOBdots # wildcard match files starting with . + +eval $(thefuck --alias) + +bindkey '^ ' autosuggest-accept # accept suggestion with ctrl-space diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..6b95563 --- /dev/null +++ b/setup.sh @@ -0,0 +1,8 @@ +#! /usr/bin/env bash + +cp .zshrc ~/.zshrc +cp .tmux.conf ~/.tmux.conf +cp .shell_aliases ~/.config/shell_aliases +cp .init.nvim ~/.config/nvim/init.vim + + diff --git a/sync.sh b/sync.sh new file mode 100755 index 0000000..050bd4a --- /dev/null +++ b/sync.sh @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +cp ~/.zshrc ./.zshrc +cp ~/.tmux.conf ./.tmux.conf +cp ~/.config/shell_aliases ./.shell_aliases +cp ~/.config/nvim/init.vim ./.init.nvim