Browse Source

2020-05-04

Gogs 5 years ago
parent
commit
cdb2ddbc4e
3 changed files with 76 additions and 1 deletions
  1. 29 1
      .bashrc
  2. 2 0
      .profile
  3. 45 0
      .vimrc

+ 29 - 1
.bashrc

@@ -1,6 +1,9 @@
 # ~/.bashrc: executed by bash(1) for non-login shells.
 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
 # for examples
+parse_git_branch() {
+     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
+}
 
 # If not running interactively, don't do anything
 case $- in
@@ -57,7 +60,9 @@ if [ -n "$force_color_prompt" ]; then
 fi
 
 if [ "$color_prompt" = yes ]; then
-    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+    #PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
+    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[33m\]$(parse_git_branch)\[\033[00m\] \$ '
+
     # Also do color ls
     export CLICOLOR=true
 else
@@ -145,6 +150,29 @@ source ~/.bash/git-completion.bash
 [ -d ~/terraform ] && export PATH="~/terraform:$PATH"
 [ -d ~/esp/crosstool-NG/builds/xtensa-esp32-elf ] && export PATH="~/esp/crosstool-NG/builds/xtensa-esp32-elf:$PATH"
 
+# We want SSH keys to have passwords, so load the ssh agent
+SSH_ENV="$HOME/.ssh/environment"
+
+function start_agent {
+    echo "Initialising new SSH agent..."
+    /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
+    echo succeeded
+    chmod 600 "${SSH_ENV}"
+    . "${SSH_ENV}" > /dev/null
+    /usr/bin/ssh-add;
+}
+
+# Source SSH settings, if applicable
+if [ -f "${SSH_ENV}" ]; then
+    . "${SSH_ENV}" > /dev/null
+    #ps ${SSH_AGENT_PID} doesn't work under cywgin
+    ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
+        start_agent;
+    }
+else
+    start_agent;
+fi
+
 # Make less allow colors
 export LESS="-R"
 

+ 2 - 0
.profile

@@ -20,3 +20,5 @@ fi
 if [ -d "$HOME/bin" ] ; then
     PATH="$HOME/bin:$PATH"
 fi
+[ -d /opt/gcc-arm-none-eabi-6-2017-q2-update/bin ] && export PATH=/opt/gcc-arm-none-eabi-6-2017-q2-update/bin:$PATH
+[ -d /home/fdamstra/ardupilot/Tools/autotest ] && export PATH=/home/fdamstra/ardupilot/Tools/autotest:$PATH

+ 45 - 0
.vimrc

@@ -5,6 +5,51 @@ syntax on
 " Accomodate a dark background
 set background=dark
 
+if empty(glob('~/.vim/autoload/plug.vim'))
+  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
+      \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
+  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
+endif
+
+call plug#begin('~/.vim/plugged')
+
+" (Optinal) for Tag Sidebar
+" Plug 'majutsushi/tagbar'
+
+Plug 'hashivim/vim-terraform'
+"Plug 'vim-syntastic/syntastic'
+"Plug 'juliosueiras/vim-terraform-completion'
+Plug 'hashivim/vim-terraform'
+call plug#end()
+
+" Syntastic Config
+set statusline+=%#warningmsg#
+set statusline+=%{SyntasticStatuslineFlag()}
+set statusline+=%*
+
+let g:syntastic_always_populate_loc_list = 1
+let g:syntastic_auto_loc_list = 1
+let g:syntastic_check_on_open = 1
+let g:syntastic_check_on_wq = 0
+
+" (Optional)Remove Info(Preview) window
+set completeopt-=preview
+
+" (Optional)Hide Info(Preview) window after completions
+autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
+autocmd InsertLeave * if pumvisible() == 0|pclose|endif
+
+" (Optional) Enable terraform plan to be include in filter
+let g:syntastic_terraform_tffilter_plan = 1
+
+" (Optional) Default: 0, enable(1)/disable(0) plugin's keymapping
+let g:terraform_completion_keys = 1
+
+" (Optional) Default: 1, enable(1)/disable(0) terraform module registry completion
+let g:terraform_registry_module_completion = 0
+
+" let g:pymode_python = 'python3'
+
 " set the runtime path to include Vundle and initialize
 "set rtp+=~/.vim/bundle/Vundle.vim
 "call vundle#begin()