From c33d08a6bef56b3246373c7696c1ff2a4193ab6a Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 6 Dec 2017 15:38:22 -0500 Subject: [PATCH] Update configs and move to methods --- cfg/i3/tools/wallpaper.sh | 11 ++- cfg/ncmpcpp/config | 16 ++-- cfg/nvim/init.vim | 120 +++++++++++++++++++++++++++++ cfg/zshrc | 34 ++++++++- configure.sh | 189 ++++++++++++++++++++-------------------------- packages.txt | 5 +- 6 files changed, 253 insertions(+), 122 deletions(-) create mode 100644 cfg/nvim/init.vim diff --git a/cfg/i3/tools/wallpaper.sh b/cfg/i3/tools/wallpaper.sh index 9353ffe..a0ede73 100755 --- a/cfg/i3/tools/wallpaper.sh +++ b/cfg/i3/tools/wallpaper.sh @@ -1,4 +1,11 @@ #!/bin/bash -idx=$(( (RANDOM % 3) + 1)) -feh --bg-scale /home/lain/Pictures/wallpaper$idx.jpg +killall -q xwinwrap + +idx=$(( (RANDOM % 5) + 1)) +if [[ $idx -eq 5 ]]; +then + xwinwrap -ov -fs -- gifview -w WID -a /home/lain/Pictures/wallpaper.gif 2>/dev/null +else + feh --bg-scale /home/lain/Pictures/wallpaper$idx.jpg +fi diff --git a/cfg/ncmpcpp/config b/cfg/ncmpcpp/config index 21825a6..7949188 100644 --- a/cfg/ncmpcpp/config +++ b/cfg/ncmpcpp/config @@ -18,7 +18,7 @@ ## MPD clients (eg. ncmpc) also use that location. ## # -#lyrics_directory = ~/.lyrics +lyrics_directory = ~/.lyrics # ##### connection settings ##### # @@ -30,7 +30,7 @@ # ## Needed for tag editor and file operations to work. ## -#mpd_music_dir = ~/music +mpd_music_dir = ~/Music/beets # #mpd_crossfade_time = 5 # @@ -192,17 +192,17 @@ visualizer_color = 34, 64, 57, 94, 164, 198 # #alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D} # -current_item_prefix = $(magenta)$r +current_item_prefix = $(magenta)$b # -#current_item_suffix = $/r$(end) +current_item_suffix = $/b$(end) # #current_item_inactive_column_prefix = $(white)$r # #current_item_inactive_column_suffix = $/r$(end) # -#now_playing_prefix = $b +now_playing_prefix = $r # -#now_playing_suffix = $/b +now_playing_suffix = $/r # #browser_playlist_prefix = "$2playlist$9 " # @@ -431,14 +431,14 @@ progressbar_look = ─╼─ ## Note: if below is enabled, ncmpcpp will ignore leading "The" word while ## sorting items in browser, tags in media library, etc. ## -ignore_leading_the = yes +#ignore_leading_the = no # ## ## Note: if below is enabled, ncmpcpp will ignore diacritics while searching and ## filtering lists. This takes an effect only if boost was compiled with ICU ## support. ## -ignore_diacritics = no +#ignore_diacritics = no # #block_search_constraints_change_if_items_found = yes # diff --git a/cfg/nvim/init.vim b/cfg/nvim/init.vim new file mode 100644 index 0000000..6d744d4 --- /dev/null +++ b/cfg/nvim/init.vim @@ -0,0 +1,120 @@ +runtime! archlinux.vim + +let g:python_host_prog = '/usr/bin/python2.7' +let g:python3_host_prog = '/usr/bin/python3' + + +call plug#begin('~/.local/share/nvim/plugged') + +Plug 'xolox/vim-misc' +Plug 'xolox/vim-easytags' +Plug 'jiangmiao/auto-pairs' +Plug 'scrooloose/nerdtree' +Plug 'fidian/hexmode' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'majutsushi/tagbar' + +Plug 'neomake/neomake' +if has('nvim') + Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +else + Plug 'Shougo/deoplete.nvim' + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' +endif + +call plug#end() + + +filetype plugin indent on +syntax enable + +" disable beeping +set noerrorbells visualbell t_vb= +if has('autocmd') + autocmd GUIEnter * set visualbell t_vb= +endif + +set laststatus=2 +set showtabline=1 +set noshowmode +set tabstop=4 +set shiftwidth=4 +set expandtab +set autoindent +set selectmode=mouse +set mouse=a +set nobackup +set nowritebackup +set history=50 +set ruler +set backspace=indent,eol,start +set autoread +set wildmenu + +set number +set encoding=utf-8 + +set incsearch " CTRL-G and CTRL-T keys to move to the next and previous match +" Use to clear the highlighting of :set hlsearch. +if maparg('', 'n') ==# '' + nnoremap :nohlsearch=has('diff')?'diffupdate':'' +endif + +colorscheme SerialExperimentsLain + + +" Plugin configs + +" Tagbar +nmap :TagbarToggle + +" Airline +let g:airline_theme='simple' +let g:airline_powerline_fonts=1 + +" Easytags +let g:easytags_async = 1 " Might not work lmao +set tags=./tags; +let g:easytags_dynamic_files = 1 " Per-project tags files +:let g:easytags_resolve_links = 1 " Resolve hard/soft links in UNIX + +" Hex editor mode +map :Hexmode " ctrl + h +let g:hexmode_patterns = '*.bin,*.exe,*.dat,*.o,*.out' +let g:hexmode_autodetect = 1 + +" Nerd Tree +map :NERDTreeToggle + +" syntastic (unused) +" set statusline+=%#warningmsg# +" set statusline+=%{SyntasticStatuslineFlag()} +" set statusline+=%* +" +" let g:syntastic_always_populate_loc_list = 1 +" let g:syntastic_auto_loc_list = 1 +" let g:syntastic_check_on_open = 1 +" let g:syntastic_check_on_wq = 0 + + +" Neovim specific stuff below + +" Neomake +function! MyOnBattery() + if filereadable('/sys/class/power_supply/AC/online') + return readfile('/sys/class/power_supply/AC/online') == ['0'] + endif + return 0 +endfunction + +if MyOnBattery() + call neomake#configure#automake('w') +else + call neomake#configure#automake('nw', 1000) +endif + +" deoplete +call deoplete#enable() + diff --git a/cfg/zshrc b/cfg/zshrc index 799d44f..e0821f0 100644 --- a/cfg/zshrc +++ b/cfg/zshrc @@ -33,7 +33,7 @@ HIST_STAMPS="yyyy-mm-dd" # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git) +plugins=(git archlinux autojump command-not-found) ### User configuration @@ -43,7 +43,7 @@ export MANPATH="/usr/local/man:$MANPATH" export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions -export EDITOR='vim' +export EDITOR='nvim' # Compilation flags export ARCHFLAGS="-arch x86_64" @@ -66,3 +66,33 @@ if [[ ! -d $ZSH_CACHE_DIR ]]; then fi source $ZSH/oh-my-zsh.sh + +export PATH="$HOME/opt/i686-elf/bin:$PATH" + +alias vpnon="sudo systemctl start openvpn-client@BoltWolf" +alias vpnoff="sudo systemctl stop openvpn-client@BoltWolf" + +alias vim=nvim + +function masm() ( + set -e + export WINEPREFIX=~/.wine-masm + FILENAME="$(basename "$1")" + EXT="${FILENAME##*.}" + if [[ "$EXT" = "asm" ]]; then + FILENAME="${FILENAME%.*}" + fi + + UNIX_PATH="$(dirname "$1")/$FILENAME" + WINDOWS_PATH=$(echo "$UNIX_PATH" | tr '/' '\\') + + wine ml -nologo -c -coff -Zi "$WINDOWS_PATH.asm" + + wine link /NOLOGO /SUBSYSTEM:CONSOLE /ENTRY:main \ + /LIBPATH:'C:\Irvine' \ + irvine32.lib kernel32.lib user32.lib "$WINDOWS_PATH.obj" + + rm $UNIX_PATH.obj + + wine "$WINDOWS_PATH.exe" +) diff --git a/configure.sh b/configure.sh index 0c9024d..01e0f98 100755 --- a/configure.sh +++ b/configure.sh @@ -1,97 +1,78 @@ #!/bin/zsh +# Print Header lnh() { print -Pn '%B%F{green}### ' print -n $1 print -P ' ###%f%b' } -lnf() { - print -Pn '%B%F{yellow}>>>%f%b ' -} - -lnfb() { - print -P '%B%F{yellow}[[[%f%b' -} - -lnfbe() { - print -P '%B%F{yellow}]]]' -} - +# Print subheader ln() { - Print -Pn '%B%F{yellow}>>> ' - Print -n $1 - Print -P '%f%b' + print -Pn '%B%F{yellow}>>> ' + print -n $1 + print -P '%f%b' +} + +pac_install() { + if ! (pacman -Q $1 >/dev/null 2>&1); + then + ln "Installing $1 from Official Repos..." + sudo pacman -S $1 --noconfirm + fi; +} + +aur_install() { + if ! (pacman -Q $1 >/dev/null 2>&1); + then + ln "Installing $1 from AUR..." + yaourt -S $1 --noconfirm + fi; +} + +svc_install() { + sudo cp -v "$1" '/etc/systemd/system' +} + +svc_install_user() { + sudo cp -v "$1" '/etc/systemd/user' +} + +svc_enable() { + sudo systemctl enable $1 +} + +svc_enable_user() { + systemctl --user enable $1 } install_i3() { - # Install Packages - if ! (pacman -Q i3-gaps >/dev/null 2>&1); - then - lnh "Installing i3-gaps from AUR..." - yaourt -S i3-gaps --noconfirm - fi; + lnh "Installing i3" - if ! (pacman -Q i3blocks-gaps-git >/dev/null 2>&1); - then - lnh "Installing i3blocks-gaps-git from AUR..." - yaourt -S i3blocks-gaps-git --noconfirm - fi; + ln "Installing Packages" + aur_install i3-gaps + aur_install i3blocks-gaps-git + aur_install i3lock + aur_install i3lock-fancy-dualmonitors-git + pac_install compton - if ! (pacman -Q i3lock >/dev/null 2>&1); - then - lnh "Installing i3lock" - pacman -S i3lock --noconfirm - fi; + ln "Installing Services" + svc_install cfg/systemd/system/suspend@.service # suspend locker + svc_install_user cfg/systemd/user/locker.service # xautolock - - if ! (pacman -Q i3lock-fancy-dualmonitors-git >/dev/null 2>&1); - then - lnh "Installing i3lock-fancy" - yaourt -S i3lock-fancy-dualmonitors-git --noconfirm - fi; - - if ! (pacman -Q compton >/dev/null 2>&1); - then - lnh "Installing Compton..." - pacman -S compton --noconfirm - fi; - - ### Install Service Files - lnh "Installing Services" - # Suspend locker - lnf - sudo cp -v cfg/systemd/system/suspend@.service /etc/systemd/system/ - # Auto locker - lnf - sudo cp -v cfg/systemd/user/locker.service /etc/systemd/user + ln "Enabling Services" sudo systemctl daemon-reload - lnh "Enabling Services" - lnf - sudo systemctl enable suspend@$USER.service - lnf - systemctl --user enable locker.service + svc_enable suspend@$USER.service + svc_enable_user locker.service - - ### Install Configuration Files - lnh "Installing General Configuration Files" - # Compton - lnf + ln "Installing Configuration Files" cp -v cfg/compton/config ~/.config/compton/config - # NCMPCPP ws10 config - lnf cp -v cfg/termite/ncmpcpp_config ~/.config/termite/ncmpcpp_config - ### Install Tools - lnh "Installing General Tools" - lnf + ln "Installing Tools" mkdir -pv ~/Documents/tools - # Wallpaper Tool - lnf cp -v cfg/i3/tools/wallpaper.sh ~/Documents/tools/ - lnfb cp -v cfg/wallpapers/wallpaper* ~/Pictures/ - lnfbe lnh "Select a Platform" platform_opt=("Desktop" "Laptop") @@ -99,10 +80,11 @@ install_i3() { do case $opt in "Desktop") + lnh "Platform Not Supported with i3" + exit break ;; "Laptop") - lnh "Installing i3" install_i3_laptop break ;; @@ -112,58 +94,47 @@ install_i3() { } install_i3_laptop() { - lnh "Installing Laptop Configuration Files" - # i3blocks - lnf + ln "Installing Laptop Configuration Files" cp -v cfg/i3blocks/laptop/config ~/.config/i3blocks/config - lnfb cp -rv cfg/i3blocks/laptop/blocks ~/.config/i3blocks/blocks - lnfbe } configure_common() { - ### Install Config Files - lnh "Installing Common Configuration Files" + ln "Installing Common Configuration Files" # powerlevel9k sudo git clone https://github.com/bhilburn/powerlevel9k.git /usr/share/oh-my-zsh/themes/powerlevel9k - # ZSH - lnf - cp -v cfg/zshrc ~/.zshrc - # VIM - lnf - cp -v cfg/vimrc ~/.vimrc - vim +PlugInstall +qall - # MPD - awk '{gsub(/lain/,"'$USER'")}1' cfg/mpd/mpd.conf > mpd.conf.temp && mv mpd.conf.temp cfg/mpd/mpd.conf - lnfb - cp -rv cfg/mpd ~/.mpd - lnfbe - lnf - mkdir -pv ~/Music/beets - # NCMPCPP - lnf - cp -v cfg/ncmpcpp ~/.ncmpcpp - # Beets - lnfb + + # zsh + cp -v cfg/zshrc ~/.zshrc + + # neovim + cp -v cfg/nvim/init.vim ~/.config/nvim + nvim +PlugInstall +qall + + # mpd + awk '{gsub(/lain/,"'$USER'")}1' cfg/mpd/mpd.conf > mpd.conf.temp && mv mpd.conf.temp cfg/mpd/mpd.conf + cp -rv cfg/mpd ~/.config/mpd + + # beets + mkdir -pv ~/Music/beets cp -rv cfg/beets ~/.config/beets - lnfbe - ### Install Services - # MPD - systemctl --user enable mpd.service - systemctl --user start mpd.service - # NetworkManager - sudo systemctl enable NetworkManager.service - sudo systemctl start NetworkManager.service + # ncmpcpp + cp -v cfg/ncmpcpp/config ~/.ncmpcpp/ + + ln "Installing Common Services" + svc_enable_user mpd + svc_enable NetworkManager } -echo "Select a Window Manager" +lnh "Select a Window Manager" wm_opt=("Gnome" "i3") select opt in "${wm_opt[@]}" do case $opt in "Gnome") - echo "gnome" + lnh "Window Manager Not Supported" + exit break ;; "i3") @@ -173,3 +144,5 @@ do *) echo "Invalid Option";; esac done + +configure_common diff --git a/packages.txt b/packages.txt index 14354d9..32735d4 100644 --- a/packages.txt +++ b/packages.txt @@ -2,8 +2,9 @@ ttf-vlgothic AUR nerd-fonts-complete AUR termite -vim -vim-plug +nvim +ctags +# vim-plug --- clone from github mpd mpc