https://github.com/karlin/mintty-colors-solarized https://github.com/amix/vimrc https://drivy.engineering/setting-up-vim-for-react/
Last active
December 17, 2018 03:43
-
-
Save brianyang/052d8a9acad1652d8752c88c6421ce09 to your computer and use it in GitHub Desktop.
setup vim on windows 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To the extent possible under law, the author(s) have dedicated all | |
# copyright and related and neighboring rights to this software to the | |
# public domain worldwide. This software is distributed without any warranty. | |
# You should have received a copy of the CC0 Public Domain Dedication along | |
# with this software. | |
# If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. | |
# base-files version 4.2-3 | |
# ~/.bash_profile: executed by bash(1) for login shells. | |
# The latest version as installed by the Cygwin Setup program can | |
# always be found at /etc/defaults/etc/skel/.bash_profile | |
# Modifying /etc/skel/.bash_profile directly will prevent | |
# setup from updating it. | |
# The copy in your home directory (~/.bash_profile) is yours, please | |
# feel free to customise it to create a shell | |
# environment to your liking. If you feel a change | |
# would be benifitial to all, please feel free to send | |
# a patch to the cygwin mailing list. | |
# User dependent .bash_profile file | |
# source the users bashrc if it exists | |
if [ -f "${HOME}/.bashrc" ] ; then | |
source "${HOME}/.bashrc" | |
fi | |
# Set PATH so it includes user's private bin if it exists | |
# if [ -d "${HOME}/bin" ] ; then | |
# PATH="${HOME}/bin:${PATH}" | |
# fi | |
# Set MANPATH so it includes users' private man if it exists | |
# if [ -d "${HOME}/man" ]; then | |
# MANPATH="${HOME}/man:${MANPATH}" | |
# fi | |
# Set INFOPATH so it includes users' private info if it exists | |
# if [ -d "${HOME}/info" ]; then | |
# INFOPATH="${HOME}/info:${INFOPATH}" | |
# fi | |
# Git Aliases | |
alias gs='git status' | |
alias gstsh='git stash' | |
alias gst='git stash' | |
alias gsp='git stash pop' | |
alias gsa='git stash apply' | |
alias gsh='git show' | |
alias gshw='git show' | |
alias gshow='git show' | |
alias gi='vim .gitignore' | |
alias gcm='git ci -m' | |
alias gcim='git ci -m' | |
alias gci='git ci' | |
alias gco='git co' | |
alias gcp='git cp' | |
alias ga='git add -A' | |
alias gap='git add -p' | |
alias guns='git unstage' | |
alias gunc='git uncommit' | |
alias gm='git merge' | |
alias gms='git merge --squash' | |
alias gam='git amend --reset-author' | |
alias grv='git remote -v' | |
alias grr='git remote rm' | |
alias grad='git remote add' | |
alias gr='git rebase' | |
alias gra='git rebase --abort' | |
alias ggrc='git rebase --continue' | |
alias gbi='git rebase --interactive' | |
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
alias glg='git l' | |
alias glog='git l' | |
alias co='git co' | |
alias gf='git fetch' | |
alias gfp='git fetch --prune' | |
alias gfa='git fetch --all' | |
alias gfap='git fetch --all --prune' | |
alias gfch='git fetch' | |
alias gd='git diff' | |
alias gb='git b' | |
# Staged and cached are the same thing | |
alias gdc='git diff --cached -w' | |
alias gds='git diff --staged -w' | |
alias gpub='grb publish' | |
alias gtr='grb track' | |
alias gpl='git pull' | |
alias gplr='git pull --rebase' | |
alias gps='git push' | |
alias gpsh='git push -u origin `git rev-parse --abbrev-ref HEAD`' | |
alias gnb='git nb' # new branch aka checkout -b | |
alias grs='git reset' | |
alias grsh='git reset --hard' | |
alias gcln='git clean' | |
alias gclndf='git clean -df' | |
alias gclndfx='git clean -dfx' | |
alias gsm='git submodule' | |
alias gsmi='git submodule init' | |
alias gsmu='git submodule update' | |
alias gt='git t' | |
alias gbg='git bisect good' | |
alias gbb='git bisect bad' | |
alias gdmb='git branch --merged | grep -v "\*" | xargs -n 1 git branch -d' | |
alias vi="/usr/bin/vim" | |
if [[ $platform == 'linux' ]]; then | |
alias ll='ls -alh --color=auto' | |
alias ls='ls --color=auto' | |
elif [[ $platform == 'darwin' ]]; then | |
alias ll='ls -alGh' | |
alias ls='ls -Gh' | |
fi | |
alias vi="/usr/bin/vim" | |
source ~/mintty-solarized-dark.sh | |
# source ~/z.sh | |
export TERM=xterm-256color | |
alias ls="ls --color" | |
alias ll="ls -l" | |
# export PS1=\[\e${usercolor}\][\u]\[\e${gitcolor}\]${gitbranch}\[\e${cwdcolor}\][$PWD]\[\e${inputcolor}\]\$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:go_version_warning = 0 | |
set nu! | |
" Next Tab | |
nnoremap <silent> <C-Right> :tabnext<CR> | |
nnoremap <F7> :tabn <CR> | |
" Previous Tab | |
nnoremap <silent> <C-Left> :tabprevious<CR> | |
nnoremap <F6> :tabp <CR> | |
" New Tab | |
nnoremap <silent> <C-t> :tabnew<CR> | |
" Swap ; and : Convenient. | |
nnoremap ; : | |
nnoremap : ; | |
" map w to open files while staying in NERDTree | |
map w go | |
set tabstop=2 | |
set shiftwidth=2 | |
" Move the current window to the right of the main Vim window | |
noremap <silent> <leader>ml <C-W>L | |
" Move the current window to the top of the main Vim window | |
noremap <silent> <leader>mj <C-W>K | |
" Move the current window to the left of the main Vim window | |
noremap <silent> <leader>mh <C-W>H | |
" Move the current window to the bottom of the main Vim window | |
noremap <silent> <leader>mk <C-W>J | |
" Space will toggle folds! | |
nnoremap <space> za | |
set nowrap "Don't wrap lines" | |
" ==== NERD tree | |
" Open the project tree and expose current file in the nerdtree with Ctrl-\ | |
" " calls NERDTreeFind iff NERDTree is active, current window contains a modifiable file, and we're not in vimdiff | |
function! OpenNerdTree() | |
if &modifiable && strlen(expand('%')) > 0 && !&diff | |
NERDTreeFind | |
else | |
NERDTreeToggle | |
endif | |
endfunction | |
nnoremap <silent> <C-\> :call OpenNerdTree()<CR> | |
" Create window splits easier. The default | |
" way is Ctrl-w,v and Ctrl-w,s. I remap | |
" this to vv and ss | |
nnoremap <silent> vv <C-w>v | |
nnoremap <silent> ss <C-w>s | |
" Shortcuts for everyday tasks | |
" ============================ | |
" copy current filename into system clipboard - mnemonic: (c)urrent(f)ilename | |
" this is helpful to paste someone the path you're looking at | |
nnoremap <silent> <leader>cf :let @* = expand("%:~")<CR> | |
nnoremap <silent> <leader>cr :let @* = expand("%")<CR> | |
nnoremap <silent> <leader>cn :let @* = expand("%:t")<CR> | |
" Use Q to intelligently close a window | |
" (if there are multiple windows into the same buffer) | |
" or kill the buffer entirely if it's the last window looking into that buffer | |
function! CloseWindowOrKillBuffer() | |
let number_of_windows_to_this_buffer = len(filter(range(1, winnr('$')), "winbufnr(v:val) == bufnr('%')")) | |
" We should never bdelete a nerd tree | |
if matchstr(expand("%"), 'NERD') == 'NERD' | |
wincmd c | |
return | |
endif | |
if number_of_windows_to_this_buffer > 1 | |
wincmd c | |
else | |
bdelete | |
endif | |
endfunction | |
nnoremap <silent> Q :call CloseWindowOrKillBuffer()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment