Move some private vim undo/backup paths out of vimrc and into a sourced file
This commit is contained in:
parent
f0d80c41d6
commit
70a9fe5aa6
|
@ -7,5 +7,7 @@ Various dotfiles and misc configs. Some of it is customized around my system set
|
||||||
Installing
|
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.
|
||||||
|
|
||||||
|
|
42
install
42
install
|
@ -1,32 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if which tput >/dev/null 2>&1; then
|
source "script_helpers/all.sh"
|
||||||
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
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cwd=$PWD
|
cwd=$PWD
|
||||||
platform=`uname`
|
platform=`uname`
|
||||||
|
|
||||||
if [[ $platform != 'Linux' && $platform != 'Darwin' ]]; then
|
os_is_windows is_windows
|
||||||
printf "${RED}This is only supported on Linux or OS X.${NORMAL}\n"
|
if [[ $is_windows -eq 0 ]]; then
|
||||||
exit
|
error "This is only supported on Linux or MacOS.\n"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setup_dotfile_repo() {
|
setup_dotfile_repo() {
|
||||||
|
@ -39,13 +23,9 @@ setup_dotfile_repo() {
|
||||||
mkdir -p $HOME/tmp
|
mkdir -p $HOME/tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
link_file() {
|
link() {
|
||||||
file=$1
|
file=$1
|
||||||
dest="$HOME/.$file"
|
link_file "$HOME/.dotfiles/$file" "$HOME/.$file" 0
|
||||||
if [ ! -e $dest ]; then
|
|
||||||
printf "${YELLOW}Creating ${file} symlink${NORMAL}\n"
|
|
||||||
ln -s "$HOME/.dotfiles/$file" $dest
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_git() {
|
setup_git() {
|
||||||
|
@ -57,7 +37,7 @@ setup_git() {
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
for file in "${FILES[@]}"
|
||||||
do
|
do
|
||||||
link_file "$file"
|
link "$file"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +63,7 @@ setup_zsh() {
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
for file in "${FILES[@]}"
|
||||||
do
|
do
|
||||||
link_file "$file"
|
link "$file"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +76,7 @@ setup_vim() {
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
for file in "${FILES[@]}"
|
||||||
do
|
do
|
||||||
link_file "$file"
|
link "$file"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +89,7 @@ setup_misc() {
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
for file in "${FILES[@]}"
|
||||||
do
|
do
|
||||||
link_file "$file"
|
link "$file"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if which tput >/dev/null 2>&1; then
|
source "../script_helpers/printing.sh"
|
||||||
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
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
|
@ -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 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 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 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 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 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
|
hi CursorColumn cterm=NONE ctermfg=NONE ctermbg=233 gui=NONE guifg=NONE guibg=#dddddd
|
||||||
|
|
55
vimrc
55
vimrc
|
@ -1,10 +1,4 @@
|
||||||
" @fixme i'm now experiencing end of file history more often after the big
|
" @incomplete Move all leader definitions to the bottom, so that it's easier to see them.
|
||||||
" 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 Add setup steps (plugins, cache setup, search tool, etc).
|
" @incomplete Add setup steps (plugins, cache setup, search tool, etc).
|
||||||
|
|
||||||
"###################################################################################################
|
"###################################################################################################
|
||||||
|
@ -45,6 +39,8 @@ endfunction
|
||||||
|
|
||||||
let mapleader=","
|
let mapleader=","
|
||||||
|
|
||||||
|
source ~/.vimrc.private
|
||||||
|
|
||||||
"################################################################
|
"################################################################
|
||||||
"################################################################
|
"################################################################
|
||||||
"################################################################
|
"################################################################
|
||||||
|
@ -54,9 +50,11 @@ let mapleader=","
|
||||||
"################################################################
|
"################################################################
|
||||||
|
|
||||||
let s:max_line_length = 100
|
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:default_bg = 'dark'
|
||||||
let s:rainbow_theme = s:default_bg
|
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 'mh21/errormarker.vim' " Build error highlighting (requires skywind3000/asyncrun.vim).
|
||||||
Plug 'skywind3000/asyncrun.vim' " Async commands.
|
Plug 'skywind3000/asyncrun.vim' " Async commands.
|
||||||
Plug 'nelstrom/vim-qargs' " For the GlobalReplaceIt function (i.e. search and replace).
|
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()
|
if IsWindows()
|
||||||
Plug 'suxpert/vimcaps' " Disable capslock (useful if the OS isn't configured to do so).
|
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 cursorline
|
||||||
set cursorcolumn
|
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 backup
|
||||||
set backupcopy=yes
|
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'
|
: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=<path>`
|
||||||
|
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.
|
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.
|
" 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 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
|
" Fix vim's background colour erase - http://snk.tuxfamily.org/log/vim-256color-bce.html
|
||||||
if &term =~ '256color'
|
if &term =~ '256color'
|
||||||
" Disable Background Color Erase (BCE) so that color schemes
|
" Disable Background Color Erase (BCE) so that color schemes
|
||||||
|
@ -653,14 +644,6 @@ endfunction
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
set tags+=tags;$HOME
|
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:dark_theme . " call ReloadRainbow()"
|
||||||
execute "autocmd ColorScheme " . s:light_theme . " call ReloadRainbow()"
|
execute "autocmd ColorScheme " . s:light_theme . " call ReloadRainbow()"
|
||||||
|
|
||||||
" Switch between light and dark
|
" Switch between light and dark themes.
|
||||||
map <leader>l :call ChangeBgTheme('light', 0)<cr>
|
map <leader>l :call ChangeBgTheme('light', 0)<cr>
|
||||||
map <leader>ll :call ChangeBgTheme('dark', 0)<cr>
|
map <leader>ll :call ChangeBgTheme('dark', 0)<cr>
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
# For Windows setup
|
# For Windows setup
|
||||||
test -f ~/.functions && . ~/.functions
|
test -f ~/.functions && . ~/.functions
|
||||||
test -f ~/.aliases && . ~/.aliases
|
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 ~/.private-dotfiles/env && . ~/.private-dotfiles/env
|
||||||
test -f ~/.env.platform && . ~/.env.platform
|
|
||||||
|
|
||||||
# Unbreak broken, non-colored terminal
|
# Unbreak broken, non-colored terminal
|
||||||
export TERM=xterm-256color
|
export TERM=xterm-256color
|
||||||
|
|
|
@ -51,7 +51,7 @@ processor time and is generally useless.
|
||||||
* Open `C:\msys64\mingw64.exe`
|
* Open `C:\msys64\mingw64.exe`
|
||||||
* Run `pacman -Syu`, then restart the terminal and run `pacman -Su`.
|
* Run `pacman -Syu`, then restart the terminal and run `pacman -Su`.
|
||||||
* Run `pacman -S base-devel mingw-w64-x86_64-toolchain git bc`
|
* Run `pacman -S base-devel mingw-w64-x86_64-toolchain git bc`
|
||||||
* Use `C:\Users\<user>` as the terminal $HOME by editting `C:\msys64\etc\nsswitch.conf` and
|
* Use `C:\Users\<user>` as the terminal $HOME by editing `C:\msys64\etc\nsswitch.conf` and
|
||||||
changing the `db_home` value to `windows`.
|
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
|
* 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`.
|
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/
|
* Map caps to left-ctrl using https://sharpkeys.codeplex.com/
|
||||||
* Setup git completions for bash:
|
* Setup git completions for bash:
|
||||||
* `curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.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'`.
|
* Use symlink command `cmd //c 'mklink .name-of-dotfile drive:\path\to\file'`.
|
||||||
* Symlink `~/.private-files` to the root directory containing `dev/`.
|
* Symlink `~/.private-files` to the root directory containing `dev/`.
|
||||||
|
@ -121,7 +122,9 @@ processor time and is generally useless.
|
||||||
### Configuring
|
### Configuring
|
||||||
|
|
||||||
1. Open Vim and run `:PlugInstall` to fetch all plugins.
|
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
|
### 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`.
|
* You can now add the platform-tools dir to your path if you want, or just symlink `adb` to `~/bin`.
|
||||||
|
|
||||||
### Youtube-DL
|
### Youtube-DL
|
||||||
|
|
||||||
* In order to combine audio and video files you need ffmpeg. Download from https://ffmpeg.zeranoe.com/builds/
|
* 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`.
|
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
|
`gfx.font_rendering.cleartype_params.rendering_mode`. Mine was -1 by default. Setting it to 5
|
||||||
removed the bad font rendering.
|
removed the bad font rendering.
|
||||||
|
|
||||||
|
### Spotify
|
||||||
|
* Spotify caches song data in `C:\Users\<user>\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.
|
||||||
|
|
||||||
|
|
4
zshenv
4
zshenv
|
@ -1,8 +1,10 @@
|
||||||
platform=`uname -s`
|
platform=`uname -s`
|
||||||
kernel_release=`uname -r`
|
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 ~/.private-dotfiles/env && . ~/.private-dotfiles/env
|
||||||
test -f ~/.env.platform && . ~/.env.platform
|
|
||||||
|
|
||||||
# Unbreak broken, non-colored terminal
|
# Unbreak broken, non-colored terminal
|
||||||
export TERM=xterm-256color
|
export TERM=xterm-256color
|
||||||
|
|
Loading…
Reference in New Issue
Block a user