Skip to content

Commit

Permalink
Merge branch 'language-server-autocompletion'
Browse files Browse the repository at this point in the history
  • Loading branch information
yml committed Oct 28, 2018
2 parents fb0b556 + 3fbb1cf commit bb71916
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 179 deletions.
143 changes: 83 additions & 60 deletions _bashrc
Expand Up @@ -17,7 +17,7 @@ shopt -s checkwinsize
#############################################################################
# GIT prompt in PS1
#############################################################################
function git_prompt_get_git_branch() {
function git_prompt_get_git_branch () {
# On branches, this will return the branch name
# On non-branches, (no branch)
ref="$(git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///')"
Expand All @@ -28,7 +28,7 @@ function git_prompt_get_git_branch() {
fi
}

git_prompt_get_git_info () {
function git_prompt_get_git_info () {
# Grab the branch
branch="$(git_prompt_get_git_branch)"

Expand All @@ -38,7 +38,7 @@ git_prompt_get_git_info () {
fi
}
#############################################################################
# history
# history
#############################################################################
function dedup_bash_history () {
rm -f ~./.unduped_bash_history && \
Expand All @@ -61,75 +61,99 @@ xterm*|rxvt*)
;;
esac

# TODO delete if it is still commented in few months (2018-09-13)
# Set up TERM variables.
# vt100 and xterm have no color in vim (at least on unixs), but if we call them xterm-color, they will.
# (vt100 for F-Secure SSH.)
# This may well be the case for some other terms, so I'm putting them here.
# Also set up a variable to indicate whether to set up the title functions.
# TODO gnome-terminal, or however it reports itself
case $TERM in

screen)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
TERM_CAN_TITLE=true
;;

xterm-color|color_xterm|rxvt|Eterm|screen*) # screen.linux|screen-w
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
TERM_CAN_TITLE=true
;;

linux)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
TERM_CAN_TITLE=false
;;

xterm|vt100)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=true
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
TERM_CAN_TITLE=true
;;

*xterm*|eterm|rxvt*)
TERM_IS_COLOR=true
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=true
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
TERM_CAN_TITLE=true
;;

*)
TERM_IS_COLOR=false
TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
TERM_CAN_TITLE=false
;;
# case $TERM in

# screen)
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
# TERM_CAN_TITLE=true
# ;;

# xterm-color|color_xterm|rxvt|Eterm|screen*) # screen.linux|screen-w
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
# TERM_CAN_TITLE=true
# ;;

# linux)
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
# TERM_CAN_TITLE=false
# ;;

# xterm|vt100)
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=true
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
# TERM_CAN_TITLE=true
# ;;

# *xterm*|eterm|rxvt*)
# TERM_IS_COLOR=true
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=true
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=true
# TERM_CAN_TITLE=true
# ;;

# *)
# TERM_IS_COLOR=false
# TERM_NOT_RECOGNIZED_AS_COLOR_BY_VIM=false
# TERM_NOT_RECOGNIZED_BY_SUN_UTILS=false
# TERM_CAN_TITLE=false
# ;;

# esac
# ----------- End of previous section ----------------

# function to an npm bin to $PATH
function addNpmBinToPath() {
if [[ -d $(npm bin) ]]; then
export PATH=$(npm bin):$PATH
fi
}
#function to use go tip
function useGoTip() {
if [[ -d $HOME/gotip ]]; then
export GOROOT=$HOME/gotip
export PATH=$GOROOT/bin:$PATH
fi
}

esac
function pyclean() {
find . -type d -name "__pycache__" | xargs rm -rf
}

# Default installation path for GOLANG
[[ -d /usr/local/go/bin/ ]] && PATH+=":/usr/local/go/bin/"

# Add env variable to work with GO easier
if [[ -d $HOME/gopath ]]; then
export GOPATH=$HOME/gopath
export PATH=$PATH:$GOPATH/bin
PATH+=":$GOPATH/bin"
fi

if [[ -d $HOME/.local/bin ]]; then
export PATH=$PATH:$HOME/.local/bin
fi
# Starting with go 1.11 GOPATH is not needed anymore
[[ -d $HOME/go/bin ]] && PATH+=":$HOME/go/bin"

if [[ -d $HOME/go ]]; then
export GOROOT=$HOME/go
export PATH=$GOROOT/bin:$PATH
fi
# Interative node js version manager
[[ -d $HOME/n/bin ]] && PATH+=":$HOME/n/bin"

[[ -d $HOME/.local/bin ]] && PATH+=":$HOME/.local/bin"

# if ag is available use it by default for FZF
[[ -x $(command -v ag) ]] && export FZF_DEFAULT_COMMAND='ag --hidden --smart-case --ignore=".git" --ignore="__pycache__" -g ""'

if hash nvim 2>/dev/null; then
if [[ -x $(command -v nvim) ]]; then
# nvim
export EDITOR=nvim
export VISUAL=nvim
Expand All @@ -142,9 +166,7 @@ else
fi

# remap caps lock to escape
if setxkbmap -version >/dev/null 2>&1; then
setxkbmap -option "caps:swapescape"
fi
[[ -x $(command -v setxkbmap) ]] && setxkbmap -option "caps:swapescape"

# Set my GPG key
export GPGKEY=2F74DA04
Expand All @@ -153,7 +175,7 @@ export GPGKEY=2F74DA04
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [[ -f /etc/bash_completion ]] && ! shopt -oq posix; then
. /etc/bash_completion
source /etc/bash_completion
fi

[[ -f ~/.fzf.bash ]] && source ~/.fzf.bash
Expand All @@ -163,3 +185,4 @@ fi

# Local override
[[ -f ~/.bash_local ]] && source ~/.bash_local

1 change: 1 addition & 0 deletions _gitignore
@@ -1,3 +1,4 @@
**/__pycache__/
*.pyc
*.swp
*.swo
Expand Down
4 changes: 1 addition & 3 deletions _tmux.conf
Expand Up @@ -26,7 +26,6 @@ bind s split-window -v
bind v split-window -h

# Use vim motion key while in copy mode
set-window-option -g mode-keys vi
setw -g mode-keys vi

# use the vim motion keys to move between panes
Expand Down Expand Up @@ -63,12 +62,11 @@ setw -g automatic-rename
set -g history-limit 50000

# ESC timeout needs to be tweaked to a low value (10-20ms)
set -g escape-time 10
set -g escape-time 11

if-shell -b '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' \
"bind-key Escape copy-mode; \
bind-key -t vi-copy Escape cancel; \
bind-key p paste-buffer; \
bind-key -t vi-copy v begin-selection; \
bind-key -t vi-copy V select-line; \
bind-key -t vi-copy y copy-selection; \
Expand Down

0 comments on commit bb71916

Please sign in to comment.