diff --git a/README.md b/README.md index 42c61bd..b2ec9d4 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,7 @@ Various dotfiles and misc configs. Some of it is customized around my system set Installing ========== -There is an `install.sh` script that facilitates the setup, however it's been a while since I did a full system setup and this script may not be fully complete. An alternative method is to manually symlink files in the root directory. OS specific configs are in their respective folders. +There is an `install` script that facilitates the setup, however it's been a while since I did a +full system setup and this script may not be fully complete. An alternative method is to manually +symlink files in the root directory. OS specific configs are in their respective folders. diff --git a/install b/install index 790d838..b142d31 100644 --- a/install +++ b/install @@ -1,32 +1,16 @@ #!/bin/bash -if which tput >/dev/null 2>&1; then - ncolors=$(tput colors) -fi -if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then - RED="$(tput setaf 1)" - GREEN="$(tput setaf 2)" - YELLOW="$(tput setaf 3)" - BLUE="$(tput setaf 4)" - BOLD="$(tput bold)" - NORMAL="$(tput sgr0)" -else - RED="" - GREEN="" - YELLOW="" - BLUE="" - BOLD="" - NORMAL="" -fi +source "script_helpers/all.sh" set -e cwd=$PWD platform=`uname` -if [[ $platform != 'Linux' && $platform != 'Darwin' ]]; then - printf "${RED}This is only supported on Linux or OS X.${NORMAL}\n" - exit +os_is_windows is_windows +if [[ $is_windows -eq 0 ]]; then + error "This is only supported on Linux or MacOS.\n" + exit 1 fi setup_dotfile_repo() { @@ -39,13 +23,9 @@ setup_dotfile_repo() { mkdir -p $HOME/tmp } -link_file() { +link() { file=$1 - dest="$HOME/.$file" - if [ ! -e $dest ]; then - printf "${YELLOW}Creating ${file} symlink${NORMAL}\n" - ln -s "$HOME/.dotfiles/$file" $dest - fi + link_file "$HOME/.dotfiles/$file" "$HOME/.$file" 0 } setup_git() { @@ -57,7 +37,7 @@ setup_git() { for file in "${FILES[@]}" do - link_file "$file" + link "$file" done } @@ -83,7 +63,7 @@ setup_zsh() { for file in "${FILES[@]}" do - link_file "$file" + link "$file" done } @@ -96,7 +76,7 @@ setup_vim() { for file in "${FILES[@]}" do - link_file "$file" + link "$file" done } @@ -109,7 +89,7 @@ setup_misc() { for file in "${FILES[@]}" do - link_file "$file" + link "$file" done } diff --git a/osx/install.sh b/osx/install.sh index 17ead5b..86e0d60 100755 --- a/osx/install.sh +++ b/osx/install.sh @@ -1,23 +1,6 @@ #!/bin/bash -if which tput >/dev/null 2>&1; then - ncolors=$(tput colors) -fi -if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then - RED="$(tput setaf 1)" - GREEN="$(tput setaf 2)" - YELLOW="$(tput setaf 3)" - BLUE="$(tput setaf 4)" - BOLD="$(tput bold)" - NORMAL="$(tput sgr0)" -else - RED="" - GREEN="" - YELLOW="" - BLUE="" - BOLD="" - NORMAL="" -fi +source "../script_helpers/printing.sh" set -e diff --git a/vim/colors/campo-simple-light.vim b/vim/colors/campo-simple-light.vim index 4c9e7f1..573873f 100644 --- a/vim/colors/campo-simple-light.vim +++ b/vim/colors/campo-simple-light.vim @@ -43,7 +43,7 @@ if has("gui_running") || &t_Co == 256 hi PmenuSel cterm=bold ctermfg=255 ctermbg=240 gui=NONE guifg=#eeeeee guibg=#454545 " autocomplete menu selection hi PmenuThumb cterm=NONE ctermfg=232 ctermbg=240 gui=NONE guifg=NONE guibg=#cccccc " autocomplete scroller bar hi PmenuSbar cterm=NONE ctermfg=232 ctermbg=240 gui=NONE guifg=NONE guibg=#454545 " autocomplete scroller background - hi SpecialKey cterm=NONE ctermfg=16 ctermbg=255 gui=NONE guifg=#eeeeee guibg=#fbfbfb + hi SpecialKey cterm=NONE ctermfg=16 ctermbg=255 gui=NONE guifg=#ff00ff guibg=#fbfbfb hi MatchParen cterm=bold ctermfg=white ctermbg=black gui=NONE guifg=#000000 guibg=#dddddd hi CursorLine cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#dddddd hi CursorColumn cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#dddddd diff --git a/vimrc b/vimrc index aa65ec2..212de77 100644 --- a/vimrc +++ b/vimrc @@ -1,10 +1,4 @@ -" @fixme i'm now experiencing end of file history more often after the big -" changes to this file. Coincidence? -" -" Check out https://stackoverflow.com/a/34253629 to change the cursor to a - " @incomplete check for mappings in terminus to verify they don't override anything I used. -" block or whatever depending on the mode. -" @incomplete Move all leader definitions to the bottom, so that it's easier to see them. +" @incomplete Move all leader definitions to the bottom, so that it's easier to see them. " @incomplete Add setup steps (plugins, cache setup, search tool, etc). "################################################################################################### @@ -45,6 +39,8 @@ endfunction let mapleader="," +source ~/.vimrc.private + "################################################################ "################################################################ "################################################################ @@ -54,9 +50,11 @@ let mapleader="," "################################################################ let s:max_line_length = 100 +let g:quickfix_window_height = 16 " in rows +" Start vim with the dark theme. Set to 'light' for the light theme. +" To change the themes see `s:dark_theme` and `s:light_theme`. let s:default_bg = 'dark' let s:rainbow_theme = s:default_bg -let g:quickfix_window_height = 16 " in rows "--------------------------------------------------------------------------------------------------- @@ -91,7 +89,6 @@ Plug 'tommcdo/vim-kangaroo' " Maintain a manually-defined jump stack. Plug 'mh21/errormarker.vim' " Build error highlighting (requires skywind3000/asyncrun.vim). Plug 'skywind3000/asyncrun.vim' " Async commands. Plug 'nelstrom/vim-qargs' " For the GlobalReplaceIt function (i.e. search and replace). -" @fixme Disable the file reloading. Plug 'wincent/terminus' " Enhanced terminal integration for Vim (namely iTerm). Changes the cursor depending on the mode; enhanced pasting; file reloading on external changes. if IsWindows() Plug 'suxpert/vimcaps' " Disable capslock (useful if the OS isn't configured to do so). @@ -215,13 +212,21 @@ set scrolloff=3 " keep more context when scrolling off the end set cursorline set cursorcolumn -" Store temporary files in a central spot. Make sure these directories exist on disk. +" Store temporary files in a central spot. The location of the cache is +" set in the vimrc.private file that is sourced near the top of this file. set backup set backupcopy=yes -set directory=X://cache//vim// " For swap files. -set backupdir=X://cache//vim// :au BufWritePre * let &bex = '.' . strftime("%Y-%m-%d-%T") . '.bak' -set writebackup +set writebackup " Make buckup before overwriting the current buffer. + +" Keep undo history across sessions by storing it in a file. The undo save +" location is set in the vimrc.private file that is sourced near the top of +" this file. Alternatively, you can set it here with `set undodir=` +set undolevels=1000 " Allow undo when going back into a closed file +set undoreload=10000 +if has('persistent_undo') + set undofile +endif set backspace=indent,eol,start " Allow backspacing over everything in insert mode. @@ -247,20 +252,6 @@ set timeoutlen=300 ttimeoutlen=0 " Adding this since the esc remap on the 'i' k " errors related to paren formatting. I think 800 might be the sweet spot. set updatetime=800 " I lowered this to make git-gutter updates faster. -set undolevels=1000 " Allow undo when going back into a closed file -set undoreload=10000 -" Keep undo history across sessions by storing it in a file. -if has('persistent_undo') - let undo_dir = expand(s:vim_dir . '/undo') - " Create directory. - let mkdir = 'mkdir -p ' - :silent call system(mkdir . s:vim_dir) - :silent call system(mkdir . undo_dir) - let &undodir = undo_dir - " Persist undo - set undofile -endif - " Fix vim's background colour erase - http://snk.tuxfamily.org/log/vim-256color-bce.html if &term =~ '256color' " Disable Background Color Erase (BCE) so that color schemes @@ -653,14 +644,6 @@ endfunction """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set tags+=tags;$HOME -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" TERMINUS -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -let g:TerminusMouse=0 " Disable mouse stuff. -let g:TerminusFocusReporting=0 " Disable auto file reloading on external changes. - - "--------------------------------------------------------------------------------------------------- "################################################################ @@ -725,7 +708,7 @@ let s:light_theme = 'campo-simple-light' execute "autocmd ColorScheme " . s:dark_theme . " call ReloadRainbow()" execute "autocmd ColorScheme " . s:light_theme . " call ReloadRainbow()" -" Switch between light and dark +" Switch between light and dark themes. map l :call ChangeBgTheme('light', 0) map ll :call ChangeBgTheme('dark', 0) diff --git a/windows/bashrc b/windows/bashrc index e751fa9..75c16ee 100644 --- a/windows/bashrc +++ b/windows/bashrc @@ -3,8 +3,10 @@ # For Windows setup test -f ~/.functions && . ~/.functions test -f ~/.aliases && . ~/.aliases +test -f ~/.aliases.private && . ~/.aliases.private +# Common env must come first. +test -f ~/.private-dotfiles.common/env && . ~/.private-dotfiles.common/env test -f ~/.private-dotfiles/env && . ~/.private-dotfiles/env -test -f ~/.env.platform && . ~/.env.platform # Unbreak broken, non-colored terminal export TERM=xterm-256color diff --git a/windows/readme.md b/windows/readme.md index 64758c0..6e60be7 100644 --- a/windows/readme.md +++ b/windows/readme.md @@ -51,7 +51,7 @@ processor time and is generally useless. * Open `C:\msys64\mingw64.exe` * Run `pacman -Syu`, then restart the terminal and run `pacman -Su`. * Run `pacman -S base-devel mingw-w64-x86_64-toolchain git bc` - * Use `C:\Users\` as the terminal $HOME by editting `C:\msys64\etc\nsswitch.conf` and + * Use `C:\Users\` as the terminal $HOME by editing `C:\msys64\etc\nsswitch.conf` and changing the `db_home` value to `windows`. * You may need to work around an issue with envsubst.exe - you'll know there's a bug if git displays `not a valid identifier line 89: export: dashless` or rebase complains about `new_count`. @@ -61,6 +61,7 @@ processor time and is generally useless. * Map caps to left-ctrl using https://sharpkeys.codeplex.com/ * Setup git completions for bash: * `curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash` +* In the editor options under the Looks tab, set the cursor to the block type. * Use symlink command `cmd //c 'mklink .name-of-dotfile drive:\path\to\file'`. * Symlink `~/.private-files` to the root directory containing `dev/`. @@ -121,7 +122,9 @@ processor time and is generally useless. ### Configuring 1. Open Vim and run `:PlugInstall` to fetch all plugins. -2. Create tmp folder for swap files. See `set directory` and `set backupdir` paths in `vimrc`. +2. Create a tmp folder for swap files (i.e. `set directory` and `set backupdir`). Place these + at `~/.vimrc.private` so that the main vimrc file can source it. We do it this way so that you + can have a tmp folder path that is specific to your setup. ### Setting up Custom Search @@ -180,7 +183,6 @@ processor time and is generally useless. * You can now add the platform-tools dir to your path if you want, or just symlink `adb` to `~/bin`. ### Youtube-DL - * In order to combine audio and video files you need ffmpeg. Download from https://ffmpeg.zeranoe.com/builds/ and place the exe's in `~/bin`. @@ -189,3 +191,10 @@ and place the exe's in `~/bin`. `gfx.font_rendering.cleartype_params.rendering_mode`. Mine was -1 by default. Setting it to 5 removed the bad font rendering. +### Spotify +* Spotify caches song data in `C:\Users\\AppData\Local\Spotify/Data` and this path cannot be + modified within the app settings. This is an issue if your main drive is an SSD, as you want to + limit the amount of writes to it and you may not have a lot of free space. The simplest way I + found to stop this is to change the `Data` folder's permissions (under the Security tab) and deny + all properties for the user account. + diff --git a/zshenv b/zshenv index 0f20391..db059ff 100644 --- a/zshenv +++ b/zshenv @@ -1,8 +1,10 @@ platform=`uname -s` kernel_release=`uname -r` +test -f ~/.aliases.private && . ~/.aliases.private +# Common env must come first. +test -f ~/.private-dotfiles.common/env && . ~/.private-dotfiles.common/env test -f ~/.private-dotfiles/env && . ~/.private-dotfiles/env -test -f ~/.env.platform && . ~/.env.platform # Unbreak broken, non-colored terminal export TERM=xterm-256color