Skip to content

Instantly share code, notes, and snippets.

@Nelsonochoam
Last active October 2, 2017 17:20
Show Gist options
  • Save Nelsonochoam/cafa49516d4e3aaa1df45d35710d1617 to your computer and use it in GitHub Desktop.
Save Nelsonochoam/cafa49516d4e3aaa1df45d35710d1617 to your computer and use it in GitHub Desktop.
Dev Setup
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:/usr/local/sbin:$HOME/Library/Python/2.7/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/nelsonochoam/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_DISABLE_RPROMPT=true # Disable the right prompt
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%{%F{249}%}\u250f"
POWERLEVEL9K_MULTILINE_SECOND_PROMPT_PREFIX="%{%F{249}%}\u2517%{%F{default}%} "
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
# Git Autocompletion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# 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 the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# 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.
# 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.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# 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? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-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"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# 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"
blueprints/**/files/**
coverage/**
node_modules/**
dist/**
src/index.html
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"settings": {
"ecmascript": 6,
"jsx": true
},
"plugins": [
"react"
],
"rules": {
"strict": 2,
"semi": 2,
"quotes": 0,
"no-unused-vars": 2,
"camelcase": 2,
"no-underscore-dangle": 0
}
}

NOTES

Key Mappings

Make f keys be fkeys first and fn + fkey media keys sudo echo 2 > /sys/module/hid_apple/parameters/fnmode

Disbale Caps Lock xmodmap -e "keycode 66 = Shift_L NoSymbol Shift_L"

Iterm

Atom sym link

ln -s /Applications/Atom.app/Contents/Resources/app/atom.sh /usr/local/bin/atom

Fix terminal color terminator linux

Add to the ~/.zshrc export TERM="xterm-256color"

" Place under ~/.vim/plugin
function! MoveLineUp()
call MoveLineOrVisualUp(".", "")
endfunction
function! MoveLineDown()
call MoveLineOrVisualDown(".", "")
endfunction
function! MoveVisualUp()
call MoveLineOrVisualUp("'<", "'<,'>")
normal gv
endfunction
function! MoveVisualDown()
call MoveLineOrVisualDown("'>", "'<,'>")
normal gv
endfunction
function! MoveLineOrVisualUp(line_getter, range)
let l_num = line(a:line_getter)
if l_num - v:count1 - 1 < 0
let move_arg = "0"
else
let move_arg = a:line_getter." -".(v:count1 + 1)
endif
call MoveLineOrVisualUpOrDown(a:range."move ".move_arg)
endfunction
function! MoveLineOrVisualDown(line_getter, range)
let l_num = line(a:line_getter)
if l_num + v:count1 > line("$")
let move_arg = "$"
else
let move_arg = a:line_getter." +".v:count1
endif
call MoveLineOrVisualUpOrDown(a:range."move ".move_arg)
endfunction
function! MoveLineOrVisualUpOrDown(move_arg)
let col_num = virtcol(".")
execute "silent! ".a:move_arg
execute "normal! ".col_num."|"
endfunction
#nnoremap <silent> <c-s-k> :<C-u>call MoveLineUp()<CR>
#nnoremap <silent> <c-s-j> :<C-u>call MoveLineDown()<CR>
#xnoremap <silent> <c-s-k> :<C-u>call MoveVisualUp()<CR>
#xnoremap <silent> <c-s-j> :<C-u>call MoveVisualDown()<CR>
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Git inside vim
Plugin 'tpope/vim-fugitive'
" Nerd Tree for checking files while in vim
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
" Solarize color theme
Plugin 'altercation/vim-colors-solarized'
" Text surrounding
Plugin 'tpope/vim-surround'
" Allow to repeat using . the commands from surround
Plugin 'tpope/vim-repeat'
" Power Line fontsfor vim airline bar proper display
Plugin 'powerline/fonts'
" File finder plugin
Plugin 'kien/ctrlp.vim'
" Python Autocomplete plugin
Plugin 'Valloric/YouCompleteMe'
" Syntax highlighting
Plugin 'scrooloose/syntastic'
" Python PEP8
Plugin 'nvie/vim-flake8'
" Status Bar
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" JSX syntax highlighting
Plugin 'mxw/vim-jsx'
" Proper Highlight Json files
Plugin 'elzr/vim-json'
" Closing tags on files
Plugin 'alvan/vim-closetag'
" Indentation lines for code guidance
Plugin 'Yggdroot/indentLine'
" Match tags
Plugin 'gregsexton/MatchTag'
" Quikly switch between buffers
Plugin 'sjbach/lusty'
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" Leade mapping char
let mapleader = ","
" Set UTF-8 encoding
set encoding=utf-8
" Enable airline bar
set laststatus=2
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_theme='solarized'
" Airline bar configuration
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
" Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
" Vim styling
set number
syntax enable
set autochdir
set background=dark
set t_Co=256
let g:solarized_termcolors=256
colorscheme solarized
" Ignore files on MacOSx/Linux
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*/ven*
set hlsearch
set incsearch
" This allows buffers to be hidden if you've modified a buffer.
" This is almost a must if you wish to use buffers in this way.
set hidden
" NERDTree shortcut
nmap <leader>m :NERDTreeToggle<cr>
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
" CtrlP shortcut
nmap <leader>p :CtrlP<cr>
let g:ctrlp_working_path_mode = 'r'
" More natural mapping when jumping between vim screen splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Tabing code short cuts
vnoremap < <gv
vnoremap > >gv
vmap <Tab> >
vmap <S-Tab> <
set wildmenu " turn on tab completion for commands
set wildmode=list:longest,list:full
" python PEP8 indentation
au BufRead,BufNewFile *.py,*.pyw set expandtab
au BufRead,BufNewFile *.py,*.pyw set textwidth=139
au BufRead,BufNewFile *.py,*.pyw set tabstop=4
au BufRead,BufNewFile *.py,*.pyw set softtabstop=4
au BufNewFile *.py,*.pyw set fileformat=unix
au BufRead,BufNewFile *.py,*.pyw set shiftwidth=4
au BufRead,BufNewFile *.py,*.pyw set autoindent
" Auto complete settings
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR> "Go to the definition of whatever I am currently on
" JS HTML & CSS 2 tab indentation
au BufNewFile,BufRead *.js,*.html,*.css set softtabstop=2
au BufNewFile,BufRead *.js,*.html,*.css set softtabstop=2
au BufNewFile,BufRead *.js,*.html,*.css set shiftwidth=2
" Syntastic configuration
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 "Errors window auto open
let g:syntastic_check_on_wq = 0
let g:syntastic_python_checkers = ['flake8'] "Python linter used
let g:syntastic_javascript_checkers = ['eslint'] " Requires global installaiton of eslint
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
" Proper linting for json
au BufRead,BufNewFile *.json set filetype=json
let g:syntastic_json_checkers=['jsonlint']
" CLose tags on the specified file types
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js,*.jsx"
" Disable arrows
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment