Compare commits
13 Commits
c253b61fb0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bfd36644c | ||
|
|
fa74d1c802 | ||
|
|
6748e2ee7b | ||
|
|
4dd974484f | ||
|
|
ffd0ae92d3 | ||
| bc42a3f8ef | |||
| a9ec765b5d | |||
| 4bdd001fb1 | |||
| d02733bff1 | |||
|
|
815f54be68 | ||
| f452ff65ac | |||
| 56f3fbac81 | |||
| 5dcd2cf0d2 |
@@ -65,10 +65,6 @@ function parse_git_branch {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f `brew --prefix`/etc/bash_completion ]; then
|
|
||||||
. `brew --prefix`/etc/bash_completion
|
|
||||||
fi
|
|
||||||
|
|
||||||
export TERM="xterm-color"
|
export TERM="xterm-color"
|
||||||
alias ls="ls -G"
|
alias ls="ls -G"
|
||||||
export PS1="$PURPLE\u@\h$WHITE:$BLUE\w$YELLOW\$(parse_git_branch)$WHITE\$ "
|
export PS1="$PURPLE\u@\h$WHITE:$BLUE\w$YELLOW\$(parse_git_branch)$WHITE\$ "
|
||||||
|
|||||||
@@ -1,11 +1,30 @@
|
|||||||
|
# be sure to install delta and vim
|
||||||
|
[user]
|
||||||
|
[init]
|
||||||
|
defaultBranch = main
|
||||||
|
[core]
|
||||||
|
pager = delta
|
||||||
|
editor=vim
|
||||||
[diff]
|
[diff]
|
||||||
[color]
|
[color]
|
||||||
ui = auto
|
ui = auto
|
||||||
|
[merge]
|
||||||
|
tool = vimdiff
|
||||||
|
ff = true
|
||||||
|
[push]
|
||||||
|
default = current
|
||||||
|
followTags = true
|
||||||
|
[branch]
|
||||||
|
autosetuprebase = always
|
||||||
|
[rebase]
|
||||||
|
autosquash = true
|
||||||
[alias]
|
[alias]
|
||||||
st = status
|
st = status
|
||||||
bi = bisect
|
bi = bisect
|
||||||
ci = commit
|
ci = commit
|
||||||
co = checkout
|
co = checkout
|
||||||
|
fu = commit --fixup
|
||||||
|
cp = cherry-pick
|
||||||
di = diff
|
di = diff
|
||||||
dc = diff --cached
|
dc = diff --cached
|
||||||
amend = commit --amend
|
amend = commit --amend
|
||||||
@@ -18,33 +37,48 @@
|
|||||||
gnc = goodness --cached
|
gnc = goodness --cached
|
||||||
fa = fetch --all
|
fa = fetch --all
|
||||||
pom = push origin master
|
pom = push origin master
|
||||||
b = branch
|
b = "!git for-each-ref --sort=-committerdate refs/heads --format='%(authordate:short) %(color:red)%(objectname:short) %(color:yellow)%(refname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))'"
|
||||||
|
ll = log --pretty='%C(yellow)%h %C(cyan)%cd %Cblue%aN%C(auto)%d %Creset%s' --graph --date=relative --topo-order --decorate
|
||||||
ds = diff --stat=160,120
|
ds = diff --stat=160,120
|
||||||
dh1 = diff HEAD~1
|
dh1 = diff HEAD~1
|
||||||
|
|
||||||
head = !git l -1
|
head = !git l -1
|
||||||
h = !git head
|
h = !git head
|
||||||
hp = "!source ~/.githelpers && show_git_head"
|
hs = !git head --show-signature
|
||||||
r = !git l -30
|
r = !git l -30
|
||||||
ra = !git r --all
|
ra = !git r --all
|
||||||
l = "!source ~/.githelpers && pretty_git_log"
|
rs = !git log --oneline --show-signature
|
||||||
|
l = "!. ~/.githelpers && pretty_git_log"
|
||||||
la = !git l --all
|
la = !git l --all
|
||||||
sync = "!source ~/.githelpers && sync_to_remote"
|
sync = "!. ~/.githelpers && sync_to_remote"
|
||||||
bsync = "!source ~/.githelpers && update_branch"
|
bsync = "!. ~/.githelpers && update_branch"
|
||||||
bp = !git backport
|
bp = !git backport
|
||||||
backport = "!source ~/.githelpers && backport_pr"
|
backport = "!. ~/.githelpers && backport_pr"
|
||||||
track = "!source ~/.githelpers && track_remote"
|
track = "!. ~/.githelpers && track_remote"
|
||||||
|
sign = "!git commit -S --amend --no-edit"
|
||||||
|
|
||||||
todo = grep --heading --break --ignore-case -e ' FIX: *' -e ' TODO: *'
|
todo = grep --heading --break --ignore-case -e ' FIX: *' -e ' TODO: *'
|
||||||
pr = "!source ~/.githelpers && get_pr"
|
pr = "!. ~/.githelpers && get_pr"
|
||||||
prd = "!source ~/.githelpers && del_pr"
|
prx = "!. ~/.githelpers && del_pr"
|
||||||
brc = "!source ~/.githelpers && clean_branches"
|
brx = "!. ~/.githelpers && clean_branches"
|
||||||
lbr = for-each-ref --sort='-committerdate:iso8601' --format=' %(committerdate:iso8601)%09%(refname)' refs/heads
|
lbr = for-each-ref --sort='-committerdate:iso8601' --format=' %(committerdate:iso8601)%09%(refname)' refs/heads
|
||||||
[merge]
|
snc = "!source ~/.githelpers && create_snap"
|
||||||
tool = vimdiff
|
sna = "!source ~/.githelpers && apply_snap"
|
||||||
ff = true
|
snl = "!source ~/.githelpers && list_snaps"
|
||||||
[push]
|
snS = "!source ~/.githelpers && show_snap"
|
||||||
default = current
|
snr = "!source ~/.githelpers && revert_snap"
|
||||||
followTags = true
|
snx = "!source ~/.githelpers && remove_snap"
|
||||||
[branch]
|
[interactive]
|
||||||
autosetuprebase = always
|
diffFilter = delta --color-only
|
||||||
|
[delta]
|
||||||
|
navigate = true # use n and N to move between diff sections
|
||||||
|
#dark = true # or light = true, or omit for auto-detection
|
||||||
|
detect-dark-light = true
|
||||||
|
relative-paths = true
|
||||||
|
side-by-side = true
|
||||||
|
line-numbers = true
|
||||||
|
hunk-header-style = file line-number syntax
|
||||||
|
hunk-header-file-style = cyan
|
||||||
|
hunk-header-line-number-style = yellow
|
||||||
|
hunk-header-decoration-style = box
|
||||||
|
diff-so-fancy = false
|
||||||
|
|||||||
240
git/githelpers
240
git/githelpers
@@ -18,18 +18,21 @@ RELATIVE_TIME="%Cgreen(%ar)%Creset"
|
|||||||
AUTHOR="%C(bold blue)<%an>%Creset"
|
AUTHOR="%C(bold blue)<%an>%Creset"
|
||||||
REFS="%C(red)%d%Creset"
|
REFS="%C(red)%d%Creset"
|
||||||
SUBJECT="%s"
|
SUBJECT="%s"
|
||||||
DEFAULT_REMOTE="upstream"
|
DEFAULT_REMOTE="origin"
|
||||||
ROOT_BRANCH="master"
|
ROOT_BRANCH="master"
|
||||||
|
MAIN_BRANCH="main"
|
||||||
|
DEVELOP_BRANCH="development"
|
||||||
|
|
||||||
FORMAT="$HASH}$RELATIVE_TIME}$AUTHOR}$REFS $SUBJECT"
|
FORMAT="$HASH}$RELATIVE_TIME}$AUTHOR}$REFS $SUBJECT"
|
||||||
|
|
||||||
show_git_head() {
|
RED="\033[0;31m"
|
||||||
pretty_git_log -1
|
GREEN="\033[0;32m"
|
||||||
git show -p --pretty="tformat:"
|
YELLOW="\033[0;33m"
|
||||||
}
|
CYAN="\033[0;36m"
|
||||||
|
CRESET="\033[0m"
|
||||||
|
|
||||||
pretty_git_log() {
|
pretty_git_log() {
|
||||||
git log --graph --pretty="tformat:${FORMAT}" $* |
|
git log --graph --pretty="tformat:${FORMAT}" "$@" |
|
||||||
# Replace (2 years ago) with (2 years)
|
# Replace (2 years ago) with (2 years)
|
||||||
#sed -Ee 's/(^[^<]*) ago)/\1)/' |
|
#sed -Ee 's/(^[^<]*) ago)/\1)/' |
|
||||||
sed -e 's/ ago//' |
|
sed -e 's/ ago//' |
|
||||||
@@ -43,92 +46,207 @@ pretty_git_log() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sync_to_remote() {
|
sync_to_remote() {
|
||||||
REMOTE=$1
|
REMOTE="${1:-${DEFAULT_REMOTE}}"
|
||||||
: ${REMOTE:=$DEFAULT_REMOTE}
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
echo "Synching with ${REMOTE}"
|
echo "Synching with ${YELLOW}${REMOTE}/${BRANCH}${CRESET}"
|
||||||
git fetch ${REMOTE} && git rebase ${REMOTE}/${BRANCH};
|
git fetch "${REMOTE}" && git rebase "${REMOTE}/${BRANCH}";
|
||||||
}
|
}
|
||||||
|
|
||||||
update_branch() {
|
update_branch() {
|
||||||
BRANCH=$1
|
BRANCH="${1:-${MAIN_BRANCH}}"
|
||||||
: ${BRANCH:=$ROOT_BRANCH}
|
REMOTE="${2:-${DEFAULT_REMOTE}}"
|
||||||
REMOTE=$2
|
|
||||||
: ${REMOTE:=$DEFAULT_REMOTE}
|
echo "Fetching ${YELLOW}${REMOTE}/${BRANCH}${CRESET} and rebasing with autostash"
|
||||||
echo Updating ${BRANCH} from ${REMOTE}
|
|
||||||
# check stash stack before and after
|
# 1. Update the local ref for the target branch (worktree-safe)
|
||||||
old_stash=$(git rev-parse -q --verify refs/stash)
|
git fetch "$REMOTE" "$BRANCH"
|
||||||
git stash
|
|
||||||
new_stash=$(git rev-parse -q --verify refs/stash)
|
# 2. Rebase with integrated stash management
|
||||||
# checkout branch and sync to remote, then come back
|
# --autostash: hides dirty files, rebases, then pops them back
|
||||||
git checkout ${BRANCH} && git sync ${REMOTE} && git checkout -
|
if git rebase --autostash "$REMOTE/$BRANCH"; then
|
||||||
# if the stash added to the stack, pop it back off
|
echo "${GREEN}Successfully updated and reapplied changes${CRESET}"
|
||||||
[ "$old_stash" != "$new_stash" ] && git stash pop
|
git status --short
|
||||||
|
else
|
||||||
|
echo "${RED}Rebase conflict detected!${CRESET}"
|
||||||
|
echo "1. Fix conflicts -> git rebase --continue"
|
||||||
|
echo "2. Or abort -> git rebase --abort"
|
||||||
|
echo " If aborting, don't forget your stashed changes in the stash list"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_pr() {
|
get_pr() {
|
||||||
PR=$1
|
PR=$1
|
||||||
REMOTE=$2
|
REMOTE="${2:-${DEFAULT_REMOTE}}"
|
||||||
: ${REMOTE:=$DEFAULT_REMOTE}
|
|
||||||
|
|
||||||
if [ -z "$PR" ]; then
|
if [ -z "$PR" ]; then
|
||||||
echo "Please specify a PR to checkout"
|
echo "${RED}Please specify a PR to checkout${CRESET}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Checking out PR ${PR} from ${REMOTE}
|
echo Checking out PR "${CYAN}${PR}${CRESET}" from "${YELLOW}${REMOTE}${CRESET}"
|
||||||
git fetch ${REMOTE} pull/${PR}/head:pr/${PR}
|
git fetch "${REMOTE}" "pull/${PR}/head:pr/${PR}"
|
||||||
git checkout pr/${PR}
|
|
||||||
|
# Optimized count using grep -c
|
||||||
|
WT_COUNT=$(git worktree list --porcelain | grep -c "^worktree")
|
||||||
|
|
||||||
|
if [ "$WT_COUNT" -gt 1 ]; then
|
||||||
|
WT_NAME="PR-$PR"
|
||||||
|
echo "Worktrees detected. ${CYAN}Creating ${WT_NAME}${CRESET}"
|
||||||
|
git worktree add "PR-$PR" "pr/${PR}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback to normal checkout if no worktrees or user opts out
|
||||||
|
git checkout "pr/$PR"
|
||||||
}
|
}
|
||||||
|
|
||||||
del_pr() {
|
del_pr() {
|
||||||
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
if [[ ! ${BRANCH} =~ ^pr\/ ]]; then
|
if [[ ! ${BRANCH} =~ ^pr\/ ]]; then
|
||||||
echo "Not a PR branch, aborting!"
|
echo "${RED}Not a PR branch, aborting!${CRESET}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
git checkout - && git branch -D ${BRANCH}
|
|
||||||
|
if [ "$(git worktree list --porcelain | grep -c "^worktree")" -gt 1 ]; then
|
||||||
|
WT_PATH=$(git rev-parse --show-toplevel)
|
||||||
|
# echo "Worktrees detected. ${CYAN}Removing ${WT_PATH}${CRESET}"
|
||||||
|
git worktree remove "$WT_PATH" --force && git branch -D "$BRANCH"
|
||||||
|
|
||||||
|
echo "PR branch ${CYAN}${BRANCH}${CRESET} deleted and worktree ${CYAN}$(basename "$WT_PATH")${CRESET} removed"
|
||||||
|
echo "** ${GREEN}'cd ..' to return to the main repo${CRESET} **"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fallback to normal branch deletion if no worktrees or user opts out
|
||||||
|
git checkout - && git branch -D "${BRANCH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_branches() {
|
clean_branches() {
|
||||||
BRANCHES=`git branch | grep -v 'master\|develop\|\*'`
|
BRANCHES=$(git branch | grep -v "${ROOT_BRANCH}\|${MAIN_BRANCH}\|${DEVELOP_BRANCH}\|\*")
|
||||||
for i in ${BRANCHES}; do
|
for i in ${BRANCHES}; do
|
||||||
git branch -d $i
|
git branch -d "$i"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
backport_pr() {
|
backport_pr() {
|
||||||
PR=$1
|
echo "THIS NEEDS WORK - DO NOT USE YET"
|
||||||
BRANCH=$2
|
return 1
|
||||||
[ -z "$BRANCH" ] && BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
REMOTE=$3
|
|
||||||
: ${REMOTE:=$DEFAULT_REMOTE}
|
|
||||||
THISBRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
URL="https://patch-diff.githubusercontent.com/raw/elastic/kibana/pull/${PR}.patch"
|
|
||||||
|
|
||||||
if [ -z "$PR" ]; then
|
# PR=$1
|
||||||
echo "Please specify a PR to backport"
|
# BRANCH=$2
|
||||||
exit 1
|
# [ -z "$BRANCH" ] && BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
fi
|
# REMOTE="${3:-${DEFAULT_REMOTE}}"
|
||||||
|
|
||||||
echo Backporting ${PR} to ${BRANCH} from ${REMOTE}
|
# THISBRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
git checkout ${BRANCH} && git pull ${REMOTE} ${BRANCH} && curl -L -s "$URL" | git am
|
# URL="https://patch-diff.githubusercontent.com/raw/elastic/kibana/pull/${PR}.patch"
|
||||||
|
|
||||||
# if the backport couldn't be cleanly applied, tell the user and exit
|
# if [ -z "$PR" ]; then
|
||||||
if [ $? -ne 0 ]; then
|
# echo "Please specify a PR to backport"
|
||||||
echo "FAILED - Backport could not be cleanly applied!"
|
# exit 1
|
||||||
echo "FAILED - Fix by hand or run 'git am --abort'"
|
# fi
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# switch back if we didn't start in the target branch
|
# echo "Backporting ${CYAN}${PR}${CRESET} to ${YELLOW}${BRANCH}${CRESET} from ${YELLOW}${REMOTE}${CRESET}"
|
||||||
[ "$THISBRANCH" != "$BRANCH" ] && git checkout -
|
|
||||||
|
|
||||||
|
# # if the backport couldn't be cleanly applied, tell the user and exit
|
||||||
|
# if ! git checkout "${BRANCH}" && git pull "${REMOTE}" "${BRANCH}" && curl -L -s "$URL" | git am
|
||||||
|
# then
|
||||||
|
# echo "FAILED - Backport could not be cleanly applied!"
|
||||||
|
# echo "FAILED - Fix by hand or run 'git am --abort'"
|
||||||
|
# exit 2
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# # switch back if we didn't start in the target branch
|
||||||
|
# [ "$THISBRANCH" != "$BRANCH" ] && git checkout -
|
||||||
}
|
}
|
||||||
|
|
||||||
track_remote() {
|
track_remote() {
|
||||||
REMOTE=$1
|
REMOTE="${1:-${DEFAULT_REMOTE}}"
|
||||||
: ${REMOTE:="origin"}
|
|
||||||
BRANCH=$2
|
BRANCH=$2
|
||||||
[ -z "$BRANCH" ] && BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
git branch --set-upstream-to=${REMOTE}/${BRANCH} ${BRANCH}
|
[ -z "$BRANCH" ] && BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
}
|
echo "Setting ${CYAN}${BRANCH}${CRESET} to track ${YELLOW}${REMOTE}/${BRANCH}${CRESET}"
|
||||||
|
git branch --set-upstream-to="${REMOTE}/${BRANCH}" "${BRANCH}"
|
||||||
|
}
|
||||||
|
|
||||||
|
SNAPSHOT_DIR="$HOME/.git-snapshots"
|
||||||
|
|
||||||
|
create_snap() {
|
||||||
|
NAME=$1
|
||||||
|
if [ -z "$NAME" ]; then
|
||||||
|
echo "${RED}Error: Please specify a name for the snap.${CRESET}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$SNAPSHOT_DIR"
|
||||||
|
FILE="$SNAPSHOT_DIR/${NAME}.patch"
|
||||||
|
|
||||||
|
if [ -f "$FILE" ]; then
|
||||||
|
echo "${RED}Error: Snap '$NAME' already exists.${CRESET}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git diff --cached > "$FILE" && git reset
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_snap() {
|
||||||
|
NAME=$1
|
||||||
|
FILE="$SNAPSHOT_DIR/${NAME}.patch"
|
||||||
|
|
||||||
|
if [ ! -f "$FILE" ]; then
|
||||||
|
echo "${RED}Error: Snap '$NAME' not found.${CRESET}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Applying snap ${CYAN}${NAME}${CRESET}"
|
||||||
|
git apply "$FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
list_snaps() {
|
||||||
|
echo "Snapshots in ${CYAN}$SNAPSHOT_DIR${CRESET}"
|
||||||
|
find "$SNAPSHOT_DIR" -maxdepth 1 -mindepth 1 -print0 | while IFS= read -r -d '' file; do
|
||||||
|
# $file is now safe to use, even with spaces or newlines
|
||||||
|
echo " $(basename "$file" .patch)"
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
revert_snap() {
|
||||||
|
NAME=$1
|
||||||
|
FILE="$SNAPSHOT_DIR/${NAME}.patch"
|
||||||
|
if [ ! -f "$FILE" ]; then
|
||||||
|
echo "${RED}Error: Snap '$NAME' not found.${CRESET}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo "Reverting snap ${CYAN}${NAME}${CRESET}"
|
||||||
|
git apply --reverse "$FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_snap() {
|
||||||
|
NAME=$1
|
||||||
|
FILE="$SNAPSHOT_DIR/${NAME}.patch"
|
||||||
|
if [ ! -f "$FILE" ]; then
|
||||||
|
echo "${RED}Error: Snap '$NAME' not found.${CRESET}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
echo "Remove snap ${CYAN}${NAME}${CRESET} ? (y/n)"
|
||||||
|
read -r a
|
||||||
|
if [[ "$a" == [yY]* ]]; then
|
||||||
|
rm "$FILE"
|
||||||
|
else
|
||||||
|
echo "-- Aborted"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
show_snap() {
|
||||||
|
NAME=$1
|
||||||
|
FILE="$SNAPSHOT_DIR/${NAME}.patch"
|
||||||
|
if [ ! -f "$FILE" ]; then
|
||||||
|
echo "${RED}Error: Snap '$NAME' not found.${CRESET}"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
cat "$FILE"
|
||||||
|
}
|
||||||
|
|||||||
123
install.sh
123
install.sh
@@ -1,97 +1,84 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# configure vim bundles
|
ROOT="$(pwd)"
|
||||||
VIM_BUNDLES=(
|
|
||||||
'git://github.com/msanders/snipmate.vim.git'
|
|
||||||
'git://github.com/scrooloose/syntastic.git'
|
|
||||||
'git://github.com/altercation/vim-colors-solarized.git'
|
|
||||||
'git://github.com/tpope/vim-surround.git'
|
|
||||||
)
|
|
||||||
|
|
||||||
# check for git
|
|
||||||
GIT=$(which git)
|
|
||||||
if [ ! $? == 0 ]; then
|
|
||||||
echo "You must install git and add it to you PATH"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ROOT=`pwd`
|
|
||||||
|
|
||||||
# pre-run cleanup
|
# pre-run cleanup
|
||||||
rm -rf bash/bash_magic vim/bundle/* "${HOME}"/.vimrc
|
rm -rf bash/bash_magic vim/bundle/* "${HOME}"/.vimrc
|
||||||
|
|
||||||
###
|
###
|
||||||
# bash
|
# shell
|
||||||
###
|
###
|
||||||
# clone bash_magic repo
|
|
||||||
if [ ! -d bash/bash_magic ]; then
|
|
||||||
$GIT clone git://github.com/w33ble/bash_magic.git bash/bash_magic
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install select bash magic scripts
|
# check for zsh, perform setup if it exists
|
||||||
mkdir -p "${HOME}/bin" "${HOME}/.bash_aliases.d" "${HOME}/.bash_completion.d" "${HOME}/.bash_functions.d"
|
ZSH="$(which zsh)"
|
||||||
|
if [ ! $? == 0 ]; then
|
||||||
|
echo "Zsh not found, skipping shell setup"
|
||||||
|
else
|
||||||
|
echo "Zsh found, setting it as default shell"
|
||||||
|
chsh -s $ZSH
|
||||||
|
|
||||||
cd "${ROOT}/bash/bash_magic/bash_aliases.d";
|
# install zimfw
|
||||||
for i in color refresh git less brew dev sublime top; do cp "${i}.sh" "${HOME}/.bash_aliases.d"; done
|
echo "Install zimfw?"
|
||||||
cd "${ROOT}/bash/bash_magic/bash_completion.d";
|
read zfw
|
||||||
for i in etc; do cp "${i}.sh" "${HOME}/.bash_completion.d"; done
|
if [ "$zfw" == "y" ]; then
|
||||||
cd "${ROOT}/bash/bash_magic/bash_functions.d";
|
curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh
|
||||||
for i in completion extract lsbytes lsnew vim; do cp "${i}.sh" "${HOME}/.bash_functions.d"; done
|
fi
|
||||||
|
|
||||||
# install custom bash scripts
|
|
||||||
# cp "${ROOT}/bash/bash_aliases.d/"*.sh "${HOME}/.bash_aliases.d"
|
|
||||||
# cp "${ROOT}/bash/bash_completion.d/"*.sh "${HOME}/.bash_completion.d"
|
|
||||||
# cp "${ROOT}/bash/bash_functions.d/"*.sh "${HOME}/.bash_functions.d"
|
|
||||||
|
|
||||||
# set up the bash_profile file
|
|
||||||
cp "${ROOT}/bash/bash_profile" "${HOME}"/.bash_profile
|
|
||||||
|
|
||||||
# add bash_magic logic to bash profile
|
|
||||||
cat "${ROOT}/bash/bash_magic/bashrc" >> "${HOME}"/.bash_profile
|
|
||||||
if [ ! -f "${HOME}"/.bashrc ]; then
|
|
||||||
ln -s "${HOME}"/.bash_profile "${HOME}"/.bashrc
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
# dotfiles
|
# dotfiles
|
||||||
###
|
###
|
||||||
|
|
||||||
cd "${ROOT}/dotfiles"
|
# check for dotfiles, copy them to home
|
||||||
for i in *; do
|
if [ -d "${ROOT}/dotfiles" ]; then
|
||||||
cp "${i}" "${HOME}/.${i}"
|
cd "${ROOT}/dotfiles" || exit
|
||||||
done
|
for i in *; do
|
||||||
cd "${ROOT}"
|
# check if file exists, if so skip the copy
|
||||||
|
if [ -f "${HOME}/.${i}" ]; then
|
||||||
|
echo "File ${HOME}/.${i} already exists, skipping copy"
|
||||||
|
else
|
||||||
|
cp "${i}" "${HOME}/.${i}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cd "${ROOT}" || exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# git
|
# git
|
||||||
###
|
###
|
||||||
|
|
||||||
# collect git user info, create config file
|
# check for git
|
||||||
echo -n "Enter your git name: "
|
GIT=$(which git)
|
||||||
read NAME
|
if [ ! $? == 0 ]; then
|
||||||
echo -n "Enter you git email: "
|
echo "git not found, skipping git setup"
|
||||||
read EMAIL
|
else
|
||||||
echo -e "[user]\n\tname = ${NAME}\n\temail = ${EMAIL}" > "${HOME}"/.gitconfig
|
# add custom config and helpers
|
||||||
|
cat "${ROOT}"/git/gitconfig >> "${HOME}"/.gitconfig
|
||||||
|
cp "${ROOT}"/git/githelpers "${HOME}"/.githelpers
|
||||||
|
|
||||||
# add custom config and helpers
|
# collect git user info, create config file
|
||||||
cat "${ROOT}"/git/gitconfig >> "${HOME}"/.gitconfig
|
echo "Enter you git auth details?"
|
||||||
cp "${ROOT}"/git/githelpers "${HOME}"/.githelpers
|
read GIT_AUTH
|
||||||
|
if [ "$GIT_AUTH" == "y" ]; then
|
||||||
|
echo -n "Enter your git name: "
|
||||||
|
read NAME
|
||||||
|
echo -n "Enter you git email: "
|
||||||
|
read EMAIL
|
||||||
|
git config --global user.name "${NAME}"
|
||||||
|
git config --global user.email "${EMAIL}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
# vim
|
# vim
|
||||||
###
|
###
|
||||||
|
|
||||||
# clone bundle repos
|
|
||||||
echo "${ROOT}/vim/bundle"
|
|
||||||
cd "${ROOT}/vim/bundle"
|
|
||||||
pwd
|
|
||||||
|
|
||||||
for b in ${VIM_BUNDLES[@]}; do
|
|
||||||
$GIT clone "${b}"
|
|
||||||
done
|
|
||||||
cd "${ROOT}"
|
|
||||||
|
|
||||||
# install
|
# install
|
||||||
cp -R vim "${HOME}"/.vim
|
if [ -d "${HOME}/.vimrc" ]; then
|
||||||
ln -s "${HOME}"/.vim/vimrc "${HOME}"/.vimrc
|
echo "Vim config already exists, skipping copy"
|
||||||
|
else
|
||||||
|
cp "${HOME}"/.vim/vimrc "${HOME}"/.vimrc
|
||||||
|
fi
|
||||||
|
|
||||||
echo Install complete, run the following: source \"${HOME}\"/.bashrc
|
echo Install complete, restart your terminal
|
||||||
|
|||||||
5
lazygit/config.yml
Normal file
5
lazygit/config.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
gui:
|
||||||
|
showFileTree: false
|
||||||
|
git:
|
||||||
|
pagers:
|
||||||
|
- pager: delta --side-by-side=false --detect-dark-light=auto --paging=never
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
|
|
||||||
What is this?
|
|
||||||
===
|
|
||||||
|
|
||||||
My personal vim scripts and settings. Nothing too mind-blowing, but I
|
|
||||||
find it useful having it online and maybe someone will learn something
|
|
||||||
or find out about a vim script they never heard of before.
|
|
||||||
|
|
||||||
This uses [pathogen](http://www.vim.org/scripts/script.php?script_id=2332),
|
|
||||||
which is probably the greatest thing since sliced bread.
|
|
||||||
|
|
||||||
Under bundle, you'll find custom, which is just some custom stuff I added.
|
|
||||||
Nothing too magical, just some indenting rules settings, aliases and other
|
|
||||||
jazz that I didn't want mucking up my vimrc.
|
|
||||||
|
|
||||||
|
|
||||||
Usage
|
|
||||||
===
|
|
||||||
|
|
||||||
Clone the repo to ~/.vim and symlink ~/.vim/vimrc to ~/.vimrc and you'll see what I see.
|
|
||||||
|
|
||||||
|
|
||||||
Included Scripts
|
|
||||||
===
|
|
||||||
|
|
||||||
- [phpfolding.vim](https://github.com/vim-scripts/phpfolding.vim)
|
|
||||||
- [snipmate.vim](https://github.com/msanders/snipmate.vim)
|
|
||||||
- [syntastic](https://github.com/scrooloose/syntastic)
|
|
||||||
- [vim-coffee-script](https://github.com/kchmck/vim-coffee-script)
|
|
||||||
- [vim-colors-solarized](https://github.com/altercation/vim-colors-solarized)
|
|
||||||
- [vim-jade](https://github.com/digitaltoad/vim-jade)
|
|
||||||
- [vim-stylus](https://github.com/wavded/vim-stylus)
|
|
||||||
- [vim-surround](https://github.com/tpope/vim-surround)
|
|
||||||
@@ -1,230 +0,0 @@
|
|||||||
" pathogen.vim - path option manipulation
|
|
||||||
" Maintainer: Tim Pope <http://tpo.pe/>
|
|
||||||
" Version: 2.0
|
|
||||||
|
|
||||||
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
|
|
||||||
"
|
|
||||||
" For management of individually installed plugins in ~/.vim/bundle (or
|
|
||||||
" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc
|
|
||||||
" prior to `fileype plugin indent on` is the only other setup necessary.
|
|
||||||
"
|
|
||||||
" The API is documented inline below. For maximum ease of reading,
|
|
||||||
" :set foldmethod=marker
|
|
||||||
|
|
||||||
if exists("g:loaded_pathogen") || &cp
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
let g:loaded_pathogen = 1
|
|
||||||
|
|
||||||
" Point of entry for basic default usage. Give a directory name to invoke
|
|
||||||
" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path
|
|
||||||
" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards,
|
|
||||||
" pathogen#cycle_filetype() is invoked.
|
|
||||||
function! pathogen#infect(...) abort " {{{1
|
|
||||||
let source_path = a:0 ? a:1 : 'bundle'
|
|
||||||
if source_path =~# '[\\/]'
|
|
||||||
call pathogen#runtime_prepend_subdirectories(source_path)
|
|
||||||
else
|
|
||||||
call pathogen#runtime_append_all_bundles(source_path)
|
|
||||||
endif
|
|
||||||
call pathogen#cycle_filetype()
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Split a path into a list.
|
|
||||||
function! pathogen#split(path) abort " {{{1
|
|
||||||
if type(a:path) == type([]) | return a:path | endif
|
|
||||||
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
|
|
||||||
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Convert a list to a path.
|
|
||||||
function! pathogen#join(...) abort " {{{1
|
|
||||||
if type(a:1) == type(1) && a:1
|
|
||||||
let i = 1
|
|
||||||
let space = ' '
|
|
||||||
else
|
|
||||||
let i = 0
|
|
||||||
let space = ''
|
|
||||||
endif
|
|
||||||
let path = ""
|
|
||||||
while i < a:0
|
|
||||||
if type(a:000[i]) == type([])
|
|
||||||
let list = a:000[i]
|
|
||||||
let j = 0
|
|
||||||
while j < len(list)
|
|
||||||
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
|
|
||||||
let path .= ',' . escaped
|
|
||||||
let j += 1
|
|
||||||
endwhile
|
|
||||||
else
|
|
||||||
let path .= "," . a:000[i]
|
|
||||||
endif
|
|
||||||
let i += 1
|
|
||||||
endwhile
|
|
||||||
return substitute(path,'^,','','')
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
|
|
||||||
function! pathogen#legacyjoin(...) abort " {{{1
|
|
||||||
return call('pathogen#join',[1] + a:000)
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Remove duplicates from a list.
|
|
||||||
function! pathogen#uniq(list) abort " {{{1
|
|
||||||
let i = 0
|
|
||||||
let seen = {}
|
|
||||||
while i < len(a:list)
|
|
||||||
if has_key(seen,a:list[i])
|
|
||||||
call remove(a:list,i)
|
|
||||||
else
|
|
||||||
let seen[a:list[i]] = 1
|
|
||||||
let i += 1
|
|
||||||
endif
|
|
||||||
endwhile
|
|
||||||
return a:list
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" \ on Windows unless shellslash is set, / everywhere else.
|
|
||||||
function! pathogen#separator() abort " {{{1
|
|
||||||
return !exists("+shellslash") || &shellslash ? '/' : '\'
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Convenience wrapper around glob() which returns a list.
|
|
||||||
function! pathogen#glob(pattern) abort " {{{1
|
|
||||||
let files = split(glob(a:pattern),"\n")
|
|
||||||
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
|
|
||||||
endfunction "}}}1
|
|
||||||
|
|
||||||
" Like pathogen#glob(), only limit the results to directories.
|
|
||||||
function! pathogen#glob_directories(pattern) abort " {{{1
|
|
||||||
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
|
|
||||||
endfunction "}}}1
|
|
||||||
|
|
||||||
" Turn filetype detection off and back on again if it was already enabled.
|
|
||||||
function! pathogen#cycle_filetype() " {{{1
|
|
||||||
if exists('g:did_load_filetypes')
|
|
||||||
filetype off
|
|
||||||
filetype on
|
|
||||||
endif
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
|
|
||||||
" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde.
|
|
||||||
function! pathogen#is_disabled(path) " {{{1
|
|
||||||
if a:path =~# '\~$'
|
|
||||||
return 1
|
|
||||||
elseif !exists("g:pathogen_disabled")
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1
|
|
||||||
endfunction "}}}1
|
|
||||||
|
|
||||||
" Prepend all subdirectories of path to the rtp, and append all 'after'
|
|
||||||
" directories in those subdirectories.
|
|
||||||
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
let before = filter(pathogen#glob_directories(a:path.sep."*"), '!pathogen#is_disabled(v:val)')
|
|
||||||
let after = filter(pathogen#glob_directories(a:path.sep."*".sep."after"), '!pathogen#is_disabled(v:val[0:-7])')
|
|
||||||
let rtp = pathogen#split(&rtp)
|
|
||||||
let path = expand(a:path)
|
|
||||||
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
|
|
||||||
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
|
|
||||||
return &rtp
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
" For each directory in rtp, check for a subdirectory named dir. If it
|
|
||||||
" exists, add all subdirectories of that subdirectory to the rtp, immediately
|
|
||||||
" after the original directory. If no argument is given, 'bundle' is used.
|
|
||||||
" Repeated calls with the same arguments are ignored.
|
|
||||||
function! pathogen#runtime_append_all_bundles(...) " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
let name = a:0 ? a:1 : 'bundle'
|
|
||||||
if "\n".s:done_bundles =~# "\\M\n".name."\n"
|
|
||||||
return ""
|
|
||||||
endif
|
|
||||||
let s:done_bundles .= name . "\n"
|
|
||||||
let list = []
|
|
||||||
for dir in pathogen#split(&rtp)
|
|
||||||
if dir =~# '\<after$'
|
|
||||||
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
|
|
||||||
else
|
|
||||||
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
let &rtp = pathogen#join(pathogen#uniq(list))
|
|
||||||
return 1
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
let s:done_bundles = ''
|
|
||||||
" }}}1
|
|
||||||
|
|
||||||
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
|
|
||||||
function! pathogen#helptags() " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
for dir in pathogen#split(&rtp)
|
|
||||||
if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.'/doc') == 2 && !empty(glob(dir.'/doc/*')) && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags'))
|
|
||||||
helptags `=dir.'/doc'`
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
command! -bar Helptags :call pathogen#helptags()
|
|
||||||
|
|
||||||
" Like findfile(), but hardcoded to use the runtimepath.
|
|
||||||
function! pathogen#rtpfindfile(file,count) "{{{1
|
|
||||||
let rtp = pathogen#join(1,pathogen#split(&rtp))
|
|
||||||
return fnamemodify(findfile(a:file,rtp,a:count),':p')
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
function! s:find(count,cmd,file,...) " {{{1
|
|
||||||
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
|
|
||||||
let file = pathogen#rtpfindfile(a:file,a:count)
|
|
||||||
if file ==# ''
|
|
||||||
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
|
|
||||||
elseif a:0
|
|
||||||
let path = file[0:-strlen(a:file)-2]
|
|
||||||
execute a:1.' `=path`'
|
|
||||||
return a:cmd.' '.fnameescape(a:file)
|
|
||||||
else
|
|
||||||
return a:cmd.' '.fnameescape(file)
|
|
||||||
endif
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
function! s:Findcomplete(A,L,P) " {{{1
|
|
||||||
let sep = pathogen#separator()
|
|
||||||
let cheats = {
|
|
||||||
\'a': 'autoload',
|
|
||||||
\'d': 'doc',
|
|
||||||
\'f': 'ftplugin',
|
|
||||||
\'i': 'indent',
|
|
||||||
\'p': 'plugin',
|
|
||||||
\'s': 'syntax'}
|
|
||||||
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
|
|
||||||
let request = cheats[a:A[0]].a:A[1:-1]
|
|
||||||
else
|
|
||||||
let request = a:A
|
|
||||||
endif
|
|
||||||
let pattern = substitute(request,'\'.sep,'*'.sep,'g').'*'
|
|
||||||
let found = {}
|
|
||||||
for path in pathogen#split(&runtimepath)
|
|
||||||
let matches = split(glob(path.sep.pattern),"\n")
|
|
||||||
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
|
|
||||||
call map(matches,'v:val[strlen(path)+1:-1]')
|
|
||||||
for match in matches
|
|
||||||
let found[match] = 1
|
|
||||||
endfor
|
|
||||||
endfor
|
|
||||||
return sort(keys(found))
|
|
||||||
endfunction " }}}1
|
|
||||||
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read<bang>',<q-args>)
|
|
||||||
command! -bar -bang -count=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,'lcd')
|
|
||||||
|
|
||||||
" vim:set ft=vim ts=8 sw=2 sts=2:
|
|
||||||
123
vim/vimrc
123
vim/vimrc
@@ -1,123 +0,0 @@
|
|||||||
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
|
|
||||||
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
|
|
||||||
" you can find below. If you wish to change any of those settings, you should
|
|
||||||
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
|
|
||||||
" everytime an upgrade of the vim packages is performed. It is recommended to
|
|
||||||
" make changes after sourcing debian.vim since it alters the value of the
|
|
||||||
" 'compatible' option.
|
|
||||||
|
|
||||||
" This line should not be removed as it ensures that various options are
|
|
||||||
" properly set to work with the Vim-related packages available in Debian.
|
|
||||||
" runtime! debian.vim
|
|
||||||
|
|
||||||
" Uncomment the next line to make Vim more Vi-compatible
|
|
||||||
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
|
|
||||||
" options, so any other options should be set AFTER setting 'compatible'.
|
|
||||||
"set nocompatible
|
|
||||||
|
|
||||||
" Vim5 and later versions support syntax highlighting. Uncommenting the next
|
|
||||||
" line enables syntax highlighting by default.
|
|
||||||
syntax enable
|
|
||||||
|
|
||||||
" Start Pathogen
|
|
||||||
call pathogen#infect()
|
|
||||||
" Enable filetype plugins
|
|
||||||
filetype plugin on
|
|
||||||
|
|
||||||
" Some custom highlighting rules
|
|
||||||
" au BufNewFile,BufRead *.ctp setfiletype php
|
|
||||||
|
|
||||||
" If using a dark background within the editing area and syntax highlighting
|
|
||||||
" turn on this option as well
|
|
||||||
set background=dark
|
|
||||||
|
|
||||||
" The following are commands that change the default colors of the syntax
|
|
||||||
" highlighting. Comment of change them to meet your needs
|
|
||||||
hi Comment ctermfg=DarkGreen
|
|
||||||
hi Search ctermbg=red
|
|
||||||
hi String ctermfg=grey
|
|
||||||
|
|
||||||
" Load the solarized color theme
|
|
||||||
"colorscheme solarized
|
|
||||||
|
|
||||||
" Uncomment the following to have Vim jump to the last position when
|
|
||||||
" reopening a file
|
|
||||||
"if has("autocmd")
|
|
||||||
" au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
|
|
||||||
" \| exe "normal g'\"" | endif
|
|
||||||
"endif
|
|
||||||
|
|
||||||
" Uncomment the following to have Vim load indentation rules according to the
|
|
||||||
" detected filetype. Per default Debian Vim only load filetype specific
|
|
||||||
" plugins.
|
|
||||||
if has("autocmd")
|
|
||||||
filetype indent on
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Allow indenting to be toggled by pressing F8
|
|
||||||
nnoremap <F8> :setl noai! nocin! nosi!
|
|
||||||
|
|
||||||
" Allow quick paste toggle
|
|
||||||
nnoremap <F2> :set invpaste paste?<CR>
|
|
||||||
set pastetoggle=<F2>
|
|
||||||
set showmode
|
|
||||||
|
|
||||||
" The following are commented out as they cause vim to behave a lot
|
|
||||||
" differently from regular Vi. They are highly recommended though.
|
|
||||||
set showcmd " Show (partial) command in status line.
|
|
||||||
set showmatch " Show matching brackets.
|
|
||||||
set ignorecase " Do case insensitive matching
|
|
||||||
set smartcase " Do smart case matching
|
|
||||||
set incsearch " Incremental search as you type it
|
|
||||||
set hlsearch " Highlight search phrases
|
|
||||||
"set autowrite " Automatically save before commands like :next and :make
|
|
||||||
"set hidden " Hide buffers when they are abandoned
|
|
||||||
"set mouse=a " Enable mouse usage (all modes) in terminals
|
|
||||||
set visualbell " Enable visual bell
|
|
||||||
set ruler " Always show a ruler
|
|
||||||
set laststatus=2 " Always shows the last status menu
|
|
||||||
set statusline=%F%m%r%h%w\ (%{&ff})\ %=\ [%l,%v\ %L\ (%p%%)]
|
|
||||||
set noerrorbells " Don't ring the bell for errors
|
|
||||||
set nostartofline " Don't move cursor to the start of the line
|
|
||||||
set shortmess=at " Avoid the 'press enter' with error messages
|
|
||||||
|
|
||||||
"set expandtab " insert spaces instead of tabs
|
|
||||||
set tabstop=4 " use X spaces when tab is pressed
|
|
||||||
set shiftwidth=4 " shifttabs are also X spaces
|
|
||||||
set smarttab " make delete remove X spaces
|
|
||||||
set smartindent " allow vim to do intelligent indenting
|
|
||||||
|
|
||||||
" Syntastic settings
|
|
||||||
let g:syntastic_check_on_open=1
|
|
||||||
" Status line settings
|
|
||||||
set statusline+=%#warningmsg#
|
|
||||||
set statusline+=%{SyntasticStatuslineFlag()}
|
|
||||||
set statusline+=%*
|
|
||||||
|
|
||||||
|
|
||||||
" On some systems, it may be nesseccary to re-map the arrow keys. Uncomment
|
|
||||||
" these next lines if that is the case.
|
|
||||||
"map <up> gk
|
|
||||||
"map <down> gj
|
|
||||||
"map <left> gh
|
|
||||||
"map <right> gl
|
|
||||||
|
|
||||||
" Disable the 'auto commenting' crap
|
|
||||||
au FileType * setlocal comments=
|
|
||||||
|
|
||||||
" Source a global configuration file if available
|
|
||||||
" XXX Deprecated, please move your changes here in /etc/vim/vimrc
|
|
||||||
"if filereadable("/etc/vim/vimrc.local")
|
|
||||||
" source /etc/vim/vimrc.local
|
|
||||||
"endif
|
|
||||||
|
|
||||||
" Omnifunc stuff
|
|
||||||
"autocmd FileType python set omnifunc=pythoncomplete#Complete
|
|
||||||
"autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
|
|
||||||
"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
|
|
||||||
"autocmd FileType css set omnifunc=csscomplete#CompleteCSS
|
|
||||||
"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
|
|
||||||
"autocmd FileType php set omnifunc=phpcomplete#CompletePHP
|
|
||||||
"autocmd FileType c set omnifunc=ccomplete#Complete
|
|
||||||
"autocmd FileType coffee set omnifunc=coffeecomplete#Complete
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user