Add zsh related dotfiles and update vimrc
This commit is contained in:
70
.vimrc
Executable file → Normal file
70
.vimrc
Executable file → Normal file
@@ -16,8 +16,6 @@ Plugin 'scrooloose/nerdcommenter'
|
||||
" ctrl-p file search
|
||||
Plugin 'kien/ctrlp.vim'
|
||||
|
||||
" To get plugins from vim scripts, reference the plugin by name as it appears
|
||||
" on the site
|
||||
Plugin 'jeetsukumaran/vim-buffergator'
|
||||
|
||||
" git integration
|
||||
@@ -29,9 +27,9 @@ Plugin 'tpope/vim-surround'
|
||||
Plugin 'tpope/vim-repeat'
|
||||
|
||||
" git autocomplete
|
||||
"Plugin 'Valloric/YouCompleteMe'
|
||||
""Plugin 'Valloric/YouCompleteMe'
|
||||
" python autocomplete
|
||||
Plugin 'davidhalter/jedi-vim'
|
||||
"Plugin 'davidhalter/jedi-vim'
|
||||
|
||||
" python folding
|
||||
"Plugin 'tmhedberg/SimpylFold'
|
||||
@@ -47,25 +45,27 @@ Plugin 'flazz/vim-colorschemes'
|
||||
" python syntax
|
||||
Plugin 'hdima/python-syntax'
|
||||
" javascript syntax
|
||||
Plugin 'jelera/vim-javascript-syntax'
|
||||
Plugin 'scrooloose/syntastic'
|
||||
"Plugin 'jelera/vim-javascript-syntax'
|
||||
"Plugin 'scrooloose/syntastic'
|
||||
|
||||
" code tag listing: see methods and members of an object
|
||||
"Plugin 'vim-scripts/taglist-plus'
|
||||
Plugin 'majutsushi/tagbar'
|
||||
"Plugin 'majutsushi/tagbar'
|
||||
|
||||
" status
|
||||
Plugin 'bling/vim-airline'
|
||||
|
||||
" most recently used files
|
||||
Plugin 'vim-scripts/mru.vim'
|
||||
"Plugin 'vim-scripts/mru.vim'
|
||||
|
||||
" aka zencoding:
|
||||
Plugin 'mattn/emmet-vim'
|
||||
"Plugin 'mattn/emmet-vim'
|
||||
|
||||
" Spell check
|
||||
Plugin 'kamykn/spelunker.vim'
|
||||
|
||||
set nospell
|
||||
|
||||
call vundle#end()
|
||||
|
||||
|
||||
@@ -88,6 +88,8 @@ set incsearch
|
||||
" highlight search results
|
||||
set hlsearch
|
||||
" case insensitive IFF search string is all lower case
|
||||
" Need both ignorecase and smartcase to work as expected
|
||||
set ignorecase
|
||||
set smartcase
|
||||
|
||||
" number of lines to keep below/above cursor, ie scroll when cursor gets
|
||||
@@ -98,6 +100,9 @@ set scrolloff=6
|
||||
set autoindent
|
||||
set smartindent
|
||||
|
||||
" make backspace more powerful
|
||||
set backspace=indent,eol,start
|
||||
|
||||
set t_Co=256
|
||||
" color apprentice
|
||||
" color BadWolf
|
||||
@@ -111,17 +116,25 @@ color atom
|
||||
"nnoremap gD :YcmCompleter GoToDeclaration<CR>
|
||||
|
||||
" vim-jedi equivalents of YCM (see above)
|
||||
map gd :call jedi#goto()<CR>
|
||||
map gD :call jedi#goto_assignments()<CR>
|
||||
"map gd :call jedi#goto()<CR>
|
||||
"map gD :call jedi#goto_assignments()<CR>
|
||||
|
||||
" ctags is much faster and more accurate than the above
|
||||
" gd = go definition
|
||||
map gd <C-]>
|
||||
let g:ctrlp_map = '<leader>f'
|
||||
map <leader>f :CtrlP<CR>
|
||||
map <leader>c :CtrlPTag<CR>
|
||||
map <C-p> :echo "do not use"<CR>
|
||||
|
||||
" SimplyIFold plugin keymaps
|
||||
" fold docstrings
|
||||
let g:SimpylFold_docstring_preview = 0
|
||||
"let g:SimpylFold_docstring_preview = 0
|
||||
|
||||
autocmd BufWinEnter *.py setlocal foldexpr=SimpylFold(v:lnum) foldmethod=expr
|
||||
autocmd BufWinLeave *.py setlocal foldexpr< foldmethod<
|
||||
"autocmd BufWinEnter *.py setlocal foldexpr=SimpylFold(v:lnum) foldmethod=expr
|
||||
"autocmd BufWinLeave *.py setlocal foldexpr< foldmethod<
|
||||
|
||||
autocmd BufRead *.py normal zR
|
||||
"autocmd BufRead *.py normal zR
|
||||
|
||||
" ctrlp plugin options
|
||||
" working path always stays in start directory
|
||||
@@ -131,17 +144,16 @@ let g:ctrlp_root_markers = ['']
|
||||
" infinite max files
|
||||
let g:ctrlp_max_files = 0
|
||||
" near-infinite max depth. Whee!
|
||||
"
|
||||
let g:ctrlp_max_depth = 99
|
||||
" sane custom ignore
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|public\/images\|public\/system\|tmp$',
|
||||
\ 'file': '\.exe$\|\.so$\|\.dat$\|\.jar$\|\.pyc$\|\.pdf$\|\.ipynb$\|\.ico$\|\.png$\|\.jpg$\|\.gif$\|\.bmp$\|\.svg$\|\.xcf$\|\.swf$\|\.pst$\|\.swc$\|\.zip$\|\.gz$\|\.tar$'
|
||||
\ }
|
||||
"let g:ctrlp_custom_ignore = {
|
||||
" \ 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|public\/images\|public\/system\|tmp$',
|
||||
" \ 'file': '\.exe$\|\.so$\|\.dat$\|\.jar$\|\.pyc$\|\.pdf$\|\.ipynb$\|\.ico$\|\.png$\|\.jpg$\|\.gif$\|\.bmp$\|\.svg$\|\.xcf$\|\.swf$\|\.pst$\|\.swc$\|\.zip$\|\.gz$\|\.tar$'
|
||||
" \ }
|
||||
|
||||
|
||||
" default indexing root is workspace
|
||||
map <C-p> :CtrlP /home/dev/workspace<CR>
|
||||
"map <C-p> :CtrlP /home/dev/workspace<CR>
|
||||
|
||||
"autocmd ColorScheme * highlight ExtraWhitespace ctermbg=black guibg=black
|
||||
"highlight ExtraWhitespace ctermbg=black guibg=black
|
||||
@@ -178,7 +190,7 @@ map <Leader>nf :NERDTreeToggle<cr>
|
||||
map <Leader>nb :NERDTreeFromBookmark<cr>
|
||||
|
||||
" taglist-plus
|
||||
map <leader>tl :TagbarToggle<cr>
|
||||
"map <leader>tl :TagbarToggle<cr>
|
||||
|
||||
" syntastic options: defaults
|
||||
"set statusline+=%#warningmsg#
|
||||
@@ -229,3 +241,17 @@ map <Leader>a% :Ack <C-r>=expand('%:t')<CR><CR>
|
||||
|
||||
" get rid of marks
|
||||
let g:showmarks_enable = 0
|
||||
|
||||
" Show line on insert mode
|
||||
autocmd InsertEnter * set cursorline
|
||||
autocmd InsertLeave * set nocursorline
|
||||
|
||||
" Change cursor on mode change
|
||||
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
|
||||
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
|
||||
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
|
||||
|
||||
" Change mode fast
|
||||
set ttimeout
|
||||
set ttimeoutlen=1
|
||||
set ttyfast
|
||||
|
||||
103
.zshrc
Normal file
103
.zshrc
Normal file
@@ -0,0 +1,103 @@
|
||||
# If you come from bash you might have to change your $PATH.
|
||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||
|
||||
# Path to your oh-my-zsh installation.
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
# Set name of the theme to load --- if set to "random", it will
|
||||
# load a random theme each time oh-my-zsh is loaded, in which case,
|
||||
# to know which specific one was loaded, run: echo $RANDOM_THEME
|
||||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
||||
ZSH_THEME="cowley"
|
||||
|
||||
# Set list of themes to pick from when loading at random
|
||||
# Setting this variable when ZSH_THEME=random will cause zsh to load
|
||||
# a theme from this variable instead of looking in $ZSH/themes/
|
||||
# If set to an empty array, this variable will have no effect.
|
||||
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
|
||||
# Uncomment the following line to use hyphen-insensitive completion.
|
||||
# Case-sensitive completion must be off. _ and - will be interchangeable.
|
||||
# HYPHEN_INSENSITIVE="true"
|
||||
|
||||
# Uncomment one of the following lines to change the auto-update behavior
|
||||
# zstyle ':omz:update' mode disabled # disable automatic updates
|
||||
# zstyle ':omz:update' mode auto # update automatically without asking
|
||||
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
||||
|
||||
# Uncomment the following line to change how often to auto-update (in days).
|
||||
# zstyle ':omz:update' frequency 13
|
||||
|
||||
# Uncomment the following line if pasting URLs and other text is messed up.
|
||||
# DISABLE_MAGIC_FUNCTIONS="true"
|
||||
|
||||
# Uncomment the following line to disable colors in ls.
|
||||
# DISABLE_LS_COLORS="true"
|
||||
|
||||
# Uncomment the following line to disable auto-setting terminal title.
|
||||
# DISABLE_AUTO_TITLE="true"
|
||||
|
||||
# Uncomment the following line to enable command auto-correction.
|
||||
# ENABLE_CORRECTION="true"
|
||||
|
||||
# Uncomment the following line to display red dots whilst waiting for completion.
|
||||
# You can also set it to another string to have that shown instead of the default red dots.
|
||||
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
|
||||
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
|
||||
# COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Uncomment the following line if you want to disable marking untracked files
|
||||
# under VCS as dirty. This makes repository status check for large repositories
|
||||
# much, much faster.
|
||||
# DISABLE_UNTRACKED_FILES_DIRTY="true"
|
||||
|
||||
# Uncomment the following line if you want to change the command execution time
|
||||
# stamp shown in the history command output.
|
||||
# You can set one of the optional three formats:
|
||||
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
|
||||
# or set a custom format using the strftime function format specifications,
|
||||
# see 'man strftime' for details.
|
||||
# HIST_STAMPS="mm/dd/yyyy"
|
||||
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
# Which plugins would you like to load?
|
||||
# Standard plugins can be found in $ZSH/plugins/
|
||||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(git)
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# User configuration
|
||||
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
# if [[ -n $SSH_CONNECTION ]]; then
|
||||
# export EDITOR='vim'
|
||||
# else
|
||||
# export EDITOR='mvim'
|
||||
# fi
|
||||
|
||||
# Compilation flags
|
||||
# export ARCHFLAGS="-arch x86_64"
|
||||
|
||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
|
||||
set -o vi
|
||||
18
README.md
Normal file
18
README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Erik Cowley's dot files
|
||||
|
||||
Includes my customization related to:
|
||||
* zsh - show Python virtual env info in prompt
|
||||
* vim - lots of plugins and custom shortcuts
|
||||
* ctags
|
||||
|
||||
Recommended workflow:
|
||||
1. Install oh-my-zsh
|
||||
2. Copy cowley.zsh to ~/.oh-my-zsh/custom/
|
||||
3. Copy cowley.zsh-theme to ~/.oh-my-zsh/custom/themes/
|
||||
4. Copy .zshrc to your home directory
|
||||
5. Install vim's Vundle plugin
|
||||
6. Copy .vimrc to your home directory
|
||||
7. Open vim and run :VundleUpdate to install plugins
|
||||
8. Rename vim.py to vim and place it in your path in a higher precedence than
|
||||
the vim executable
|
||||
|
||||
12
cowley.zsh
Normal file
12
cowley.zsh
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copy this file to "$HOME/.oh-my-zsh/custom/" to be usable.
|
||||
# Helper method for showing python virtual env info in the prompt.
|
||||
|
||||
venv_prompt_info() {
|
||||
|
||||
if [[ -z "$VIRTUAL_ENV" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo -e "${ZSH_THEME_VENV_PROMPT_PREFIX}$(basename $VIRTUAL_ENV)${ZSH_THEME_VENV_PROMPT_SUFFIX}"
|
||||
|
||||
}
|
||||
16
cowley.zsh-theme
Normal file
16
cowley.zsh-theme
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copy this file to the "$HOME/.oh-my-zsh/custom/themes/" directory.
|
||||
# This theme includes a python virtual env indicator in the prompt.
|
||||
|
||||
VIRTUAL_ENV_DISABLE_PROMPT=true
|
||||
|
||||
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ ) %{$fg[cyan]%}%c%{$reset_color%} "
|
||||
PROMPT+='$(git_prompt_info)'
|
||||
PROMPT+='$(venv_prompt_info)'
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%}) %{$fg[yellow]%}✗"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[yellow]%})"
|
||||
|
||||
ZSH_THEME_VENV_PROMPT_PREFIX="%{$fg_bold[green]%}("
|
||||
ZSH_THEME_VENV_PROMPT_SUFFIX=")%{$reset_color%} "
|
||||
57
vim.py
Executable file
57
vim.py
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
This file will call `ctags` and then `vim` if called without arguments.
|
||||
It will call `vim` immediately if called with arguments.
|
||||
|
||||
Recommend renaming as just `vim` and placing in your path for convenience.
|
||||
|
||||
Yes I know it would be very easy to implement this as a bash script, but
|
||||
this python implementation works too, so whatever.
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
TAGS_FILE_PATH = os.path.abspath(os.path.join(".", "tags"))
|
||||
CTAGS_PATH = "/usr/bin/ctags"
|
||||
DOT_CTAGS_PATH = "$HOME/.ctags"
|
||||
VIM_PATH = "/usr/bin/vim"
|
||||
|
||||
# call vim directly if we're opening a specific file
|
||||
if len(sys.argv) >= 2:
|
||||
vim_args = [VIM_PATH] + sys.argv[1:]
|
||||
os.execv(VIM_PATH, vim_args)
|
||||
|
||||
# call ctags
|
||||
try:
|
||||
if os.path.exists(TAGS_FILE_PATH):
|
||||
os.rename(TAGS_FILE_PATH, TAGS_FILE_PATH + ".bak")
|
||||
if os.path.exists(DOT_CTAGS_PATH):
|
||||
with open(DOT_CTAGS_PATH, "r") as f:
|
||||
ctags_text = f.read()
|
||||
else:
|
||||
print("Warning: .ctags not found!", file=sys.stderr)
|
||||
ctags_text = ""
|
||||
ctags_cmd = [CTAGS_PATH]
|
||||
for line in ctags_text.split("\n"):
|
||||
line = line.strip()
|
||||
if not line:
|
||||
continue
|
||||
ctags_cmd.append(line)
|
||||
proc = subprocess.Popen(
|
||||
ctags_cmd,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
stdout, stderr = proc.communicate()
|
||||
if stderr:
|
||||
print(stderr, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except PermissionError:
|
||||
pass
|
||||
|
||||
# call vim- if we get here `sys.argv[1:]` is an empty list
|
||||
vim_args = [VIM_PATH] + sys.argv[1:]
|
||||
os.execv(VIM_PATH, vim_args)
|
||||
Reference in New Issue
Block a user