Improve OSX setup
This commit is contained in:
parent
ee11695dee
commit
e2f40a7be7
2
aliases
2
aliases
|
@ -39,7 +39,6 @@ abort() {
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
if [[ $platform == 'Linux' || $platform == 'Darwin' ]]; then
|
if [[ $platform == 'Linux' || $platform == 'Darwin' ]]; then
|
||||||
#source ~/.zshrc
|
|
||||||
test -f ~/.aliases && . ~/.aliases
|
test -f ~/.aliases && . ~/.aliases
|
||||||
else
|
else
|
||||||
test -f ~/.aliases && . ~/.aliases
|
test -f ~/.aliases && . ~/.aliases
|
||||||
|
@ -445,6 +444,7 @@ alias pdot='cd ~/.private-dotfiles'
|
||||||
alias duh='du -csh'
|
alias duh='du -csh'
|
||||||
alias exp='explorer .'
|
alias exp='explorer .'
|
||||||
alias f='fg'
|
alias f='fg'
|
||||||
|
alias grep='grep -n --color '
|
||||||
alias history='fc -l 1'
|
alias history='fc -l 1'
|
||||||
alias histroy='history'
|
alias histroy='history'
|
||||||
alias irb='irb --readline -r irb/completion'
|
alias irb='irb --readline -r irb/completion'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if which tput >/dev/null 2>&1; then
|
if which tput >/dev/null 2>&1; then
|
||||||
ncolors=$(tput colors)
|
ncolors=$(tput colors)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
source "$HOME/.dotfiles/script_helpers/all.sh"
|
source "$HOME/.dotfiles/script_helpers/all.sh"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if which tput >/dev/null 2>&1; then
|
if which tput >/dev/null 2>&1; then
|
||||||
ncolors=$(tput colors)
|
ncolors=$(tput colors)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
source "$HOME/.dotfiles/script_helpers/printing.sh"
|
source "$HOME/.dotfiles/script_helpers/printing.sh"
|
||||||
source "$HOME/.dotfiles/script_helpers/platform.sh"
|
source "$HOME/.dotfiles/script_helpers/platform.sh"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copies vim data from the home directory to the dotfiles repo.
|
# Copies vim data from the home directory to the dotfiles repo.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copies vim data from the dotfiles repo to the home directory.
|
# Copies vim data from the dotfiles repo to the home directory.
|
||||||
|
|
||||||
|
|
30
install
Normal file → Executable file
30
install
Normal file → Executable file
|
@ -1,4 +1,15 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
platform=`uname`
|
||||||
|
|
||||||
|
if [[ $platform == 'Darwin' ]]; then
|
||||||
|
if ! command -v brew &>/dev/null
|
||||||
|
then
|
||||||
|
# We need to update bash, so we'll start with setting up homebrew.
|
||||||
|
./osx/pre_install
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
source "script_helpers/printing.sh"
|
source "script_helpers/printing.sh"
|
||||||
source "script_helpers/core.sh"
|
source "script_helpers/core.sh"
|
||||||
|
@ -6,9 +17,10 @@ source "script_helpers/platform.sh"
|
||||||
source "script_helpers/file_ops.sh"
|
source "script_helpers/file_ops.sh"
|
||||||
|
|
||||||
cwd=$PWD
|
cwd=$PWD
|
||||||
platform=`uname`
|
|
||||||
confirm_link=0
|
confirm_link=0
|
||||||
os_is_windows is_windows
|
os_is_windows is_windows
|
||||||
|
os_is_macos is_macos
|
||||||
|
os_is_linux is_linux
|
||||||
|
|
||||||
if [[ $is_windows -eq 1 ]]; then
|
if [[ $is_windows -eq 1 ]]; then
|
||||||
# Check for admin permissions.
|
# Check for admin permissions.
|
||||||
|
@ -28,7 +40,9 @@ set -e
|
||||||
setup_zsh() {
|
setup_zsh() {
|
||||||
printf "Setting up zsh...\n"
|
printf "Setting up zsh...\n"
|
||||||
|
|
||||||
|
if [[ $is_linux -eq 1 ]]; then
|
||||||
sudo apt install zsh
|
sudo apt install zsh
|
||||||
|
fi
|
||||||
|
|
||||||
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
|
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
|
||||||
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
|
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
|
||||||
|
@ -41,16 +55,16 @@ setup_zsh() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setup_dir .dotfiles/zsh .zsh
|
||||||
|
|
||||||
FILES=()
|
FILES=()
|
||||||
FILES+=('zsh')
|
|
||||||
FILES+=('zshrc')
|
FILES+=('zshrc')
|
||||||
FILES+=('zshenv')
|
FILES+=('zshenv')
|
||||||
FILES+=('zlogin')
|
FILES+=('zlogin')
|
||||||
FILES+=('zprofile')
|
|
||||||
|
|
||||||
for file in "${FILES[@]}"
|
for file in "${FILES[@]}"
|
||||||
do
|
do
|
||||||
setup_file "$file"
|
setup_file .dotfiles/$file .$file
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,9 +110,9 @@ if [[ $is_windows -eq 0 ]]; then
|
||||||
setup_zsh
|
setup_zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $platform == 'Darwin' ]]; then
|
if [[ $is_macos -eq 1 ]]; then
|
||||||
printf "\n${BOLD}Running the OS X installer${NORMAL}\n"
|
printf "\n${BOLD}Running the MacOS installer${NORMAL}\n"
|
||||||
./osx/install.sh
|
$cwd/osx/install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd "$HOME" &>/dev/null
|
popd "$HOME" &>/dev/null
|
||||||
|
|
75
osx/install
Executable file
75
osx/install
Executable file
|
@ -0,0 +1,75 @@
|
||||||
|
#!/usr/bin/env 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
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
printf "Installing env...\n"
|
||||||
|
ln -sf $HOME/.dotfiles/osx/env.platform $HOME/.env.platform
|
||||||
|
|
||||||
|
printf "Installing Git customizations...\n"
|
||||||
|
ln -sf $HOME/.dotfiles/osx/gitconfig.platform $HOME/.gitconfig.platform
|
||||||
|
|
||||||
|
#-----------------------------------
|
||||||
|
# Homebrew packages
|
||||||
|
#-----------------------------------
|
||||||
|
|
||||||
|
printf "Installing Homebrew...\n"
|
||||||
|
|
||||||
|
brew_packages=(
|
||||||
|
'openssl'
|
||||||
|
'wget'
|
||||||
|
'git'
|
||||||
|
'rlwrap'
|
||||||
|
'cmake'
|
||||||
|
'vim'
|
||||||
|
'sdl'
|
||||||
|
'tree'
|
||||||
|
)
|
||||||
|
brew tap homebrew/core
|
||||||
|
for package in "${brew_packages[@]}"
|
||||||
|
do
|
||||||
|
printf "Installing $package...\n"
|
||||||
|
ret=$(brew list | awk /$package/)
|
||||||
|
if [[ $ret == $package ]]; then
|
||||||
|
printf "${YELLOW}Already installed!${NORMAL}\n"
|
||||||
|
else
|
||||||
|
eval "brew install $package"
|
||||||
|
printf \n
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# We have issues downloading Rust on 10.11 with the patched Homebrew checkout
|
||||||
|
# so we'll install it using their script.
|
||||||
|
bash -c "$(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs)"
|
||||||
|
|
||||||
|
# For Vim search
|
||||||
|
cargo install ripgrep
|
||||||
|
|
||||||
|
# The homebrew core ctags package is very old.
|
||||||
|
brew install --HEAD universal-ctags/universal-ctags/universal-ctags
|
||||||
|
|
||||||
|
printf "\n${YELLOW}If you haven't already installed the Xcode dev tools then do so now by installing Xcode from the App Store:${NORMAL}\n"
|
||||||
|
printf "When that finishes open a terminal and run the following:\n"
|
||||||
|
printf " 1. ${YELLOW}sudo xcode-select --install${NORMAL}\n"
|
||||||
|
printf " 2. ${YELLOW}sudo xcodebuild -license${NORMAL}\n"
|
||||||
|
printf " 3. ${YELLOW}sudo xcode-select -s /Applications/Xcode.app/Contents/Developer${NORMAL}\n"
|
||||||
|
|
||||||
|
printf "\n${BOLD}Finished setting up OS X${NORMAL}\n"
|
|
@ -1,52 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source "../script_helpers/printing.sh"
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
printf "Installing env...\n"
|
|
||||||
ln -sf $HOME/.dotfiles/osx/env.platform $HOME/.env.platform
|
|
||||||
|
|
||||||
printf "Installing git customizations...\n"
|
|
||||||
ln -sf $HOME/.dotfiles/osx/gitconfig.platform $HOME/.gitconfig.platform
|
|
||||||
|
|
||||||
brew tap homebrew/core
|
|
||||||
|
|
||||||
printf "Installing xquartz..."
|
|
||||||
#brew cask install xquartz
|
|
||||||
|
|
||||||
brew_packages=(
|
|
||||||
'tree'
|
|
||||||
'openssl'
|
|
||||||
'git'
|
|
||||||
# 'xclip'
|
|
||||||
'rlwrap'
|
|
||||||
'cmake'
|
|
||||||
'pkg-config'
|
|
||||||
'vim'
|
|
||||||
'the_silver_searcher'
|
|
||||||
'selecta'
|
|
||||||
# 'rust'
|
|
||||||
# 'go'
|
|
||||||
'sdl')
|
|
||||||
|
|
||||||
for package in "${brew_packages[@]}"
|
|
||||||
do
|
|
||||||
printf "Installing $package..."
|
|
||||||
ret=$(brew list | awk /$package/)
|
|
||||||
if [[ $ret == $package ]]; then
|
|
||||||
printf "${YELLOW}already installed!${NORMAL}\n"
|
|
||||||
else
|
|
||||||
eval "brew install $package"
|
|
||||||
printf \n
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
printf "\n${YELLOW}Now you must install Xcode.${NORMAL}\n"
|
|
||||||
printf "Open the App Store and install the software.\n"
|
|
||||||
printf "When that finishes open a terminal and run the following:\n"
|
|
||||||
printf " 1. ${YELLOW}sudo xcode-select --install${NORMAL}\n"
|
|
||||||
printf " 2. ${YELLOW}sudo xcodebuild -license${NORMAL}\n"
|
|
||||||
printf " 3. ${YELLOW}sudo xcode-select -s /Applications/Xcode.app/Contents/Developer${NORMAL}\n"
|
|
||||||
|
|
||||||
printf "\n${BOLD}Finished setting up OS X${NORMAL}\n"
|
|
54
osx/pre_install
Executable file
54
osx/pre_install
Executable file
|
@ -0,0 +1,54 @@
|
||||||
|
#!/usr/bin/env 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
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
printf "Installing Homebrew...\n"
|
||||||
|
|
||||||
|
# OSX 10.11 and earlier will issue certificate errors when Homebrew attempts to download packages
|
||||||
|
# with curl. Detect if we're running on 10.11 or earlier and if so use a fork that passes the
|
||||||
|
# --insecure option to curl.
|
||||||
|
kernel_major="$(uname -r | sed 's/\..*//')"
|
||||||
|
case $kernel_major in
|
||||||
|
15 | 14 | 13) download_patched_homebrew=1 ;;
|
||||||
|
*) download_patched_homebrew=0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [[ $download_patched_homebrew -eq 1 ]]; then
|
||||||
|
printf "${BOLD}Current MacOS kernel ${NORMAL}${YELLOW}$(uname -r)${NORMAL}${BOLD} requires a patched version of Homebrew...${NORMAL}\n"
|
||||||
|
bash -c "$(curl -fsSL https://raw.githubusercontent.com/sir-pinecone/brew/master/install.sh)"
|
||||||
|
else
|
||||||
|
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
brew tap homebrew/core
|
||||||
|
|
||||||
|
printf "\nInstalling bash...\n"
|
||||||
|
ret=$(brew list | awk /$package/)
|
||||||
|
if [[ $ret == $package ]]; then
|
||||||
|
printf "${YELLOW}Already installed!${NORMAL}\n"
|
||||||
|
else
|
||||||
|
eval "brew install bash"
|
||||||
|
printf "\n${YELLOW}Finished installing updated version of bash.\nYou must now enable it. Run:${NORMAL}\n"
|
||||||
|
printf " ${BOLD}sudo vim /etc/shells${NORMAL}\n"
|
||||||
|
printf "${YELLOW}And add ${NORMAL}${BOLD}/usr/local/bin/bash${NORMAL}${YELLOW} to the end of the list. After that close your terminal and re-run the dotfiles install script.${NORMAL}\n"
|
||||||
|
fi
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
# OSX
|
|
||||||
|
|
||||||
## Setting up Ruby
|
|
||||||
|
|
||||||
* Install rvm
|
|
||||||
* Install bundler
|
|
||||||
* Install Ruby Docs
|
|
||||||
gem install rdoc-data
|
|
||||||
rdoc-data --install
|
|
||||||
gem rdoc --all --overwrite
|
|
||||||
|
|
||||||
## Setup Keyboard
|
|
||||||
|
|
||||||
Map <CapsLock> to <Ctrl> in System Preferences -> Keyboard -> Modifier Keys. Now <caps-c> can leave insert mode.
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
source_helpers="$HOME/.dotfiles/script_helpers"
|
source_helpers="$HOME/.dotfiles/script_helpers"
|
||||||
source "$source_helpers/printing.sh"
|
source "$source_helpers/printing.sh"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------------------
|
||||||
# API
|
# API
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Requires the printing.sh helper to be sourced.
|
# Requires the printing.sh helper to be sourced.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Requires the printing.sh helper to be sourced.
|
# Requires the printing.sh helper to be sourced.
|
||||||
# Requires the platform.sh helper to be sourced.
|
# Requires the platform.sh helper to be sourced.
|
||||||
|
@ -165,6 +165,7 @@ link_file() {
|
||||||
echo "expand_symlinks? $expand_symlinks"
|
echo "expand_symlinks? $expand_symlinks"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $is_windows -eq 1 ]]; then
|
||||||
if [[ $expand_symlinks -eq 1 ]]; then
|
if [[ $expand_symlinks -eq 1 ]]; then
|
||||||
source_path=$(expand_path "$source_path")
|
source_path=$(expand_path "$source_path")
|
||||||
dest_path=$(expand_path "$dest_path")
|
dest_path=$(expand_path "$dest_path")
|
||||||
|
@ -172,6 +173,7 @@ link_file() {
|
||||||
source_path=$(_clean_link_file_path "$source_path")
|
source_path=$(_clean_link_file_path "$source_path")
|
||||||
dest_path=$(_clean_link_file_path "$dest_path")
|
dest_path=$(_clean_link_file_path "$dest_path")
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $debug -eq 1 ]]; then
|
if [[ $debug -eq 1 ]]; then
|
||||||
echo "after source: $source_path"
|
echo "after source: $source_path"
|
||||||
|
@ -210,6 +212,7 @@ link_file() {
|
||||||
echo Link cmd:: $link_cmd
|
echo Link cmd:: $link_cmd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "${BOLD}*${NORMAL} ${YELLOW}Linking '$source_path'${NORMAL} to ${YELLOW}'$dest_path'${NORMAL}\n"
|
||||||
eval $link_cmd
|
eval $link_cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------------------
|
||||||
# API
|
# API
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
uname_s="$(uname -s)"
|
uname_s="$(uname -s)"
|
||||||
case "${uname_s}" in
|
case "${uname_s}" in
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if which tput >/dev/null 2>&1; then
|
if which tput >/dev/null 2>&1; then
|
||||||
ncolors=$(tput colors)
|
ncolors=$(tput colors)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if which tput >/dev/null 2>&1; then
|
if which tput >/dev/null 2>&1; then
|
||||||
ncolors=$(tput colors)
|
ncolors=$(tput colors)
|
||||||
|
|
34
vimrc
34
vimrc
|
@ -134,11 +134,6 @@ Plug 'nelstrom/vim-qargs' " For the GlobalReplaceIt function (i.e. s
|
||||||
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).
|
||||||
else
|
else
|
||||||
" Fuzzy search
|
|
||||||
" @incomplete Test out ctrlp for non-Windows setup.
|
|
||||||
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
|
||||||
" Plug 'junegunn/fzf.vim'
|
|
||||||
|
|
||||||
" @fixme Doesn't do anything under Windows...
|
" @fixme Doesn't do anything under Windows...
|
||||||
" Plug 'ervandew/supertab' " Improved autocompletion.
|
" Plug 'ervandew/supertab' " Improved autocompletion.
|
||||||
endif
|
endif
|
||||||
|
@ -731,14 +726,14 @@ set tags+=tags;$HOME
|
||||||
" CENTER THE BUFFER
|
" CENTER THE BUFFER
|
||||||
"////////////////////////////////////////////////////////////////
|
"////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
function! CenterPane()
|
function! CenterPane()
|
||||||
" centers the current pane as the middle 2 of 4 imaginary columns
|
" centers the current pane as the middle 2 of 4 imaginary columns
|
||||||
" should be called in a window with a single pane
|
" should be called in a window with a single pane
|
||||||
" Taken from https://dev.to/vinneycavallo/easily-center-content-in-vim
|
" Taken from https://dev.to/vinneycavallo/easily-center-content-in-vim
|
||||||
lefta vnew
|
lefta vnew
|
||||||
wincmd w
|
wincmd w
|
||||||
exec 'vertical resize '. string(&columns * 0.75)
|
exec 'vertical resize '. string(&columns * 0.75)
|
||||||
endfunction
|
endfunction
|
||||||
nnoremap <leader>c :call CenterPane()<cr>
|
nnoremap <leader>c :call CenterPane()<cr>
|
||||||
|
|
||||||
function! RemoveCenterPane()
|
function! RemoveCenterPane()
|
||||||
|
@ -939,35 +934,23 @@ nnoremap <C-p> :cp<CR>
|
||||||
" SEARCH
|
" SEARCH
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
||||||
" @incomplete
|
|
||||||
if !IsWindows()
|
|
||||||
let rg_args = "--column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --pretty \"always\" " . g:campo_custom_search_args
|
|
||||||
let cmd = "command! -bang -nargs=* Find call fzf#vim#grep('rg " . rg_args . "'.shellescape(<q-args>), 1, <bang>0)"
|
|
||||||
exec cmd
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Search using ripgrep (first install with Rust: cargo install ripgrep).
|
" Search using ripgrep (first install with Rust: cargo install ripgrep).
|
||||||
function! Search(case_sensitive)
|
function! Search(case_sensitive)
|
||||||
let helper = "[" . (a:case_sensitive ? "case-sensitive" : "case-insensitive") . "] search: "
|
let l:helper = "[" . (a:case_sensitive ? "case-sensitive" : "case-insensitive") . "] search: "
|
||||||
let term = input(helper)
|
let l:term = input(l:helper)
|
||||||
if empty(term)
|
if empty(l:term)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"@note --pretty (i.e. colors) is not enabled in vim-ripgrep because the
|
"@note --pretty (i.e. colors) is not enabled in vim-ripgrep because the
|
||||||
"quickfix window doesn't seem to parse the ansi color codes.
|
"quickfix window doesn't seem to parse the ansi color codes.
|
||||||
let rg_args = "--trim -g \"!tags\" " . g:campo_custom_search_args
|
let l:rg_args = "--column --line-number --no-heading --fixed-strings --no-ignore --hidden --follow --trim -g \"!tags\" " . g:campo_custom_search_args
|
||||||
|
|
||||||
if !a:case_sensitive
|
if !a:case_sensitive
|
||||||
let rg_args .= " --ignore-case"
|
let l:rg_args .= " --ignore-case"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if IsWindows()
|
exec 'Rg ' . l:rg_args . ' "' . l:term . '"'
|
||||||
exec 'Rg ' . rg_args . ' "' . term . '"'
|
|
||||||
else
|
|
||||||
" @incomplete Test out ripgrep on non-Windows OS
|
|
||||||
echo "Not implemented"
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
map <leader>s :call Search(0)<cr>
|
map <leader>s :call Search(0)<cr>
|
||||||
map <leader>ss :call Search(1)<cr>
|
map <leader>ss :call Search(1)<cr>
|
||||||
|
@ -978,7 +961,6 @@ map <leader>ss :call Search(1)<cr>
|
||||||
nnoremap <expr> o (&buftype is# "quickfix" ? "<CR>\|:lopen<CR>" : "o")
|
nnoremap <expr> o (&buftype is# "quickfix" ? "<CR>\|:lopen<CR>" : "o")
|
||||||
nnoremap <expr> p (&buftype is# "quickfix" ? "<CR>\|:copen<CR>" : "p")
|
nnoremap <expr> p (&buftype is# "quickfix" ? "<CR>\|:copen<CR>" : "p")
|
||||||
|
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" SEARCH & REPLACE
|
" SEARCH & REPLACE
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
|
|
|
@ -159,7 +159,7 @@ processor time and is generally useless.
|
||||||
|
|
||||||
### Setting up Custom Search
|
### Setting up Custom Search
|
||||||
|
|
||||||
* First install Rusto. See `Setting up Rust` below.
|
* First install Rust. See `Setting up Rust` below.
|
||||||
* Setup `ripgrep`:
|
* Setup `ripgrep`:
|
||||||
* Open an `msvc x64` shell and run `cargo install ripgrep`. **Note** the last time I did this
|
* Open an `msvc x64` shell and run `cargo install ripgrep`. **Note** the last time I did this
|
||||||
I got linker errors saying that it was trying to link an x86 exe in a 64-bit env. I had to run
|
I got linker errors saying that it was trying to link an x86 exe in a 64-bit env. I had to run
|
||||||
|
|
18
zlogin
18
zlogin
|
@ -1,11 +1,7 @@
|
||||||
# go to saved path if there is one
|
# Need to edit the path again here so that we can get the homebrew bin folder
|
||||||
if [[ -f ~/.current_path~ ]]; then
|
# ahead of everything else. This is necessary because zsh is modifying the path
|
||||||
cd `cat ~/.current_path~`
|
# in zshrc, and that causes us to run out of /usr/bin for programs that we want
|
||||||
rm ~/.current_path~
|
# to use from homebrew's bin
|
||||||
fi
|
#
|
||||||
|
# Update 2020-07-25: This no longer seems to be an issue.
|
||||||
# Need to edit the path again here so that we can get the homebrew bin folder ahead of
|
#path=(/usr/local/bin /usr/local/sbin /usr/local/opt/openssl/bin $path)
|
||||||
# everything else. This is necessary because zsh is modifying the path in zshrc, and
|
|
||||||
# that causes us to run out of /usr/bin for programs that we want to use from homebrew's
|
|
||||||
# bin
|
|
||||||
path=($HOME/homebrew/opt/openssl/bin $HOME/homebrew/sbin $HOME/homebrew/bin $path)
|
|
||||||
|
|
21
zshenv
21
zshenv
|
@ -1,10 +1,4 @@
|
||||||
platform=`uname -s`
|
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
|
|
||||||
|
|
||||||
# Unbreak broken, non-colored terminal
|
# Unbreak broken, non-colored terminal
|
||||||
export TERM=xterm-256color
|
export TERM=xterm-256color
|
||||||
|
@ -17,11 +11,10 @@ export HOMEBREW_NO_ANALYTICS=1
|
||||||
export HOMEBREW_NO_INSECURE_REDIRECT=1
|
export HOMEBREW_NO_INSECURE_REDIRECT=1
|
||||||
export HOMEBREW_CASK_OPTS=--require-sha
|
export HOMEBREW_CASK_OPTS=--require-sha
|
||||||
|
|
||||||
# Grep tweaks
|
# Ruby
|
||||||
export GREP_OPTIONS="-nRi --color --exclude-dir=.git --exclude-dir=tmp --exclude-dir=log --exclude-dir=node_modules --exclude-dir=bower_components --exclude-dir=coverage --exclude-dir=.bundle --exclude=*.csv --exclude=*.pdf --exclude-dir=vendor --exclude-dir=rdoc --exclude-dir=target --exclude-dir=personal --exclude-dir=resources/public/js/*.*" # --exclude-dir=images --exclude-dir=coverage
|
|
||||||
|
|
||||||
export RBENV_PATH="$HOME/.rbenv"
|
export RBENV_PATH="$HOME/.rbenv"
|
||||||
|
|
||||||
|
# Clojure
|
||||||
export LEIN_FAST_TRAMPOLINE=y
|
export LEIN_FAST_TRAMPOLINE=y
|
||||||
|
|
||||||
if [[ $platform == 'Linux' ]]; then
|
if [[ $platform == 'Linux' ]]; then
|
||||||
|
@ -32,16 +25,6 @@ if [[ $platform == 'Linux' ]]; then
|
||||||
export LOLCOMMITS_DIR="/shared/Dev/lolcommits"
|
export LOLCOMMITS_DIR="/shared/Dev/lolcommits"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
path=($HOME/bin $HOME/.dotfiles/bin ${RBENV_PATH}/bin $HOME/.vim/scripts $path)
|
|
||||||
|
|
||||||
if [[ $platform == 'Darwin' ]]; then
|
|
||||||
test -f $HOME/.cargo && source $HOME/.cargo/env
|
|
||||||
# TODO: test for qt
|
|
||||||
if [ -d "$HOME/Qt" ]; then
|
|
||||||
path=($HOME/Qt/5.8/clang_64/bin $path)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d "$HOME/.rbenv" ]; then
|
if [ -d "$HOME/.rbenv" ]; then
|
||||||
# Start rbenv
|
# Start rbenv
|
||||||
eval "$(rbenv init -)"
|
eval "$(rbenv init -)"
|
||||||
|
|
15
zshrc
15
zshrc
|
@ -90,8 +90,19 @@ bindkey -e
|
||||||
source $ZSH/lib/*.zsh
|
source $ZSH/lib/*.zsh
|
||||||
|
|
||||||
# Source my custom files after oh-my-zsh so I can override things.
|
# Source my custom files after oh-my-zsh so I can override things.
|
||||||
source $HOME/.env.platform
|
test -f $HOME/.aliases && . $HOME/.aliases
|
||||||
source $HOME/.aliases
|
test -f $HOME/.aliases.private && . $HOME/.aliases.private
|
||||||
|
# Common env must come first.
|
||||||
|
test -f $HOME/.private-dotfiles.common/env && . $HOME/.private-dotfiles.common/env
|
||||||
|
test -f $HOME/.private-dotfiles/env && . $HOME/.private-dotfiles/env
|
||||||
|
|
||||||
|
if [[ -d "$HOME/bin" ]]; then
|
||||||
|
export PATH=$HOME/bin/:$PATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "$HOME/.dotfiles/bin" ]]; then
|
||||||
|
export PATH=$HOME/.dotfiles/bin/:$PATH
|
||||||
|
fi
|
||||||
|
|
||||||
# Fix <c-h> in neovim
|
# Fix <c-h> in neovim
|
||||||
infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $HOME/.$TERM.ti
|
infocmp $TERM | sed 's/kbs=^[hH]/kbs=\\177/' > $HOME/.$TERM.ti
|
||||||
|
|
Loading…
Reference in New Issue
Block a user