diff --git a/.completion.zsh b/.completion.zsh index 3fbfed3..1c5036c 100644 --- a/.completion.zsh +++ b/.completion.zsh @@ -43,7 +43,7 @@ zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters zstyle ':completion:*' verbose yes zstyle ':completion:*:descriptions' format '%B%d%b' zstyle ':completion:*:messages' format '%d' -zstyle ':completion:*:warnings' format 'No matches for: %d' +# zstyle ':completion:*:warnings' format 'No matches for: %d' zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' zstyle ':completion:*' group-name '' diff --git a/.custom.zsh b/.custom.zsh index 546dbbc..3b125d6 100644 --- a/.custom.zsh +++ b/.custom.zsh @@ -3,3 +3,8 @@ # Setup fzf [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +# Always sets the tab title to current dir (requires DISABLE_AUTO_TITLE enabled in oh-my-zsh) +precmd() { + echo -ne "\e]1;${PWD##*/}\a" +} diff --git a/.functions.zsh b/.functions.zsh index a237b81..63deb6b 100644 --- a/.functions.zsh +++ b/.functions.zsh @@ -8,14 +8,6 @@ function e() { fi } -# Switch to subdirectory -function c() { - dir=$(ls | fzf --query="$1") - if [[ -n "$dir" ]]; then - cd $dir - fi -} - # Switch projects function p() { proj=$(ls ~/Projects | fzf --query="$1") diff --git a/.nvimrc b/.nvimrc index d29bd57..bc13055 100644 --- a/.nvimrc +++ b/.nvimrc @@ -64,8 +64,7 @@ Plug 'tpope/vim-fugitive' Plug 'tpope/vim-git' " Building, Linters, Test Runners -" Plug 'benekastah/neomake' -Plug '~/Projects/neomake' +Plug 'benekastah/neomake' Plug 'jaawerth/neomake-local-eslint-first' Plug 'janko-m/vim-test' @@ -93,14 +92,7 @@ Plug 'heavenshell/vim-jsdoc' Plug 'marijnh/tern_for_vim', { 'do': 'npm install' } " Plug 'carlitux/deoplete-ternjs' -" CoffeeScript Integration -Plug 'kchmck/vim-coffee-script' - -" Elm Integration -Plug 'lambdatoast/elm.vim' - " CSS Integration -Plug 'wavded/vim-stylus' Plug 'gorodinskiy/vim-coloresque' " Other Languages @@ -115,10 +107,8 @@ Plug 'xolox/vim-notes' Plug 'kassio/neoterm' " Colorschemes -" Plug 'mikekreeki/mikekreeki-colors.vim' -Plug '~/Projects/mikekreeki-colors.vim' +Plug 'mikekreeki/mikekreeki-colors.vim' -Plug 'vimyum/viske' call plug#end() filetype plugin indent on @@ -128,8 +118,8 @@ set shell=/bin/zsh let mapleader = "," -set encoding=utf-8 -set fileencoding=utf-8 +" set encoding=utf-8 +" set fileencoding=utf-8 set hidden set number set nowrap @@ -232,11 +222,11 @@ vmap ]egv " Jump to previously edited line nnoremap ů g; -" Shorcut to edit .vimrc -nnoremap V :e $MYVIMRC +" Jump to previous cursor position +nnoremap § `` " Press Space to turn off highlighting and clear any message already displayed. -nnoremap :nohlsearch:redraw:echo +nnoremap :nohlsearch:redraw!:echo " Visually select the text that was last edited/pasted nnoremap gV `[v`] @@ -260,6 +250,10 @@ nmap w " Resize splits when the window is resized autocmd VimResized * wincmd = +" Make horizontal scrolling less horrible. +set sidescroll=1 +set sidescrolloff=10 + cnoreabbrev W w cnoreabbrev Q q @@ -270,11 +264,6 @@ set guifont=Monaco:h12 set guicursor+=a:blinkon0 set guicursor+=i:ver10 -" au InsertLeave * hi Cursor guifg=white guibg=steelblue -" au InsertEnter * hi Cursor guibg=grey - -let g:ag_highlight=1 - "Always open help files in a rightward vertical split autocmd FileType help,gitcommit wincmd L @@ -283,6 +272,7 @@ autocmd BufWritePost * :echo nmap ?function:noh(jsdoc) +nnoremap s vip:sort ui vnoremap s :sort ui hi NonText guifg=black ctermfg=black @@ -293,6 +283,18 @@ if bufwinnr(1) map - < endif +function! PreserveCursor(command) + " Preparation: save last search, and cursor position. + let _s=@/ + let l = line(".") + let c = col(".") + " Do the business: + execute a:command + " Clean up: restore previous search history, and cursor position + let @/=_s + call cursor(l, c) +endfunction + augroup easymotion_config autocmd! @@ -392,7 +394,7 @@ augroup nerdtree_config autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft() " Hide NERDTree on small screen - function ToggleNERDTreeOnSmallScreen() + function! ToggleNERDTreeOnSmallScreen() let breakpoint = 200 if &columns == 0 @@ -493,6 +495,8 @@ augroup quickfix_config " Disable line numbers and colorcolumn in quickfix autocmd FileType qf setlocal colorcolumn=0 autocmd FileType qf setlocal nonumber + autocmd Filetype qf setlocal nolist + autocmd Filetype qf setlocal nowrap " Shortcuts for navigating between quickfix results nnoremap ) :cnext @@ -539,20 +543,9 @@ augroup trailing_whitespace_config autocmd! " Remove trailing whitespace before save - function! Preserve(command) - " Preparation: save last search, and cursor position. - let _s=@/ - let l = line(".") - let c = col(".") - " Do the business: - execute a:command - " Clean up: restore previous search history, and cursor position - let @/=_s - call cursor(l, c) - endfunction - nmap _$ :call Preserve("%s/\\s\\+$//e") - nmap _= :call Preserve("normal gg=G") - autocmd BufWritePre * :call Preserve("%s/\\s\\+$//e") + nmap _$ :call PreserveCursor("%s/\\s\\+$//e") + nmap _= :call PreserveCursor("normal gg=G") + autocmd BufWritePre * :call PreserveCursor("%s/\\s\\+$//e") augroup END augroup deoplete_config @@ -577,8 +570,9 @@ augroup END augroup splitjoin_config autocmd! - nnoremap S :SplitjoinJoin - nnoremap s :SplitjoinSplit + " Disable temporarily as I don't use Ruby that much anymore + " nnoremap S :SplitjoinJoin + " nnoremap s :SplitjoinSplit augroup END augroup folding_config @@ -643,7 +637,7 @@ augroup neoterm_config let g:neoterm_position = 'vertical' - autocmd TermOpen * set number + autocmd TermOpen * set nonumber autocmd TermOpen * set wfw function! OpenTerminal() @@ -656,27 +650,6 @@ augroup neoterm_config :command! TT call OpenTerminal() augroup END -augroup quickwrap_config - autocmd! - - vnoremap ' :call QuickWrap("'") - vnoremap " :call QuickWrap('"') - - function! QuickWrap(wrapper) - let b:autopairs_enabled = 0 - - let l:w = a:wrapper - let l:inside_or_around = (&selection == 'exclusive') ? ('i') : ('a') - normal `> - execute "normal " . inside_or_around . escape(w, '\') - normal `< - execute "normal i" . escape(w, '\') - normal `< - - let b:autopairs_enabled = 1 - endfunction -augroup END - augroup closetag_config autocmd! @@ -740,7 +713,7 @@ augroup END augroup zoomwin_config autocmd! - nmap :ZoomWin + nnoremap :ZoomWin augroup END augroup syntax_attr_config @@ -748,3 +721,38 @@ augroup syntax_attr_config map x :call SyntaxAttr() augroup END + +augroup tern_for_vim_config + autocmd! + + nmap D :TernDef + nmap R :TernRename +augroup END + +augroup polyglot_config + autocmd! + + let g:polyglot_disabled = ['javascript', 'jsx', 'ruby'] +augroup END + +augroup reload_vimrc_config + autocmd! + + " Shorcut to edit .vimrc + nnoremap V :e $MYVIMRC + " Reload .vimrc on save + autocmd BufWritePost $MYVIMRC source $MYVIMRC +augroup END + +augroup quickwrap_config + autocmd! + + vnoremap ( `>a)` + vnoremap ) `>a)` + vnoremap [ `>a]` + vnoremap ] `>a]` + vnoremap { `>a}` + vnoremap } `>a}` + vnoremap " `>a"` + vnoremap ' `>a'` +augroup END diff --git a/.oh-my-zsh.zsh b/.oh-my-zsh.zsh index 3a77636..3b9f590 100644 --- a/.oh-my-zsh.zsh +++ b/.oh-my-zsh.zsh @@ -12,7 +12,7 @@ ZSH=$HOME/.oh-my-zsh # CASE_SENSITIVE="true" # Comment this out to disable bi-weekly auto-update checks -# DISABLE_AUTO_UPDATE="true" +DISABLE_AUTO_UPDATE="true" # Uncomment to change how often before auto-updates occur? (in days) # export UPDATE_ZSH_DAYS=13 @@ -21,7 +21,7 @@ ZSH=$HOME/.oh-my-zsh # DISABLE_LS_COLORS="true" # Uncomment following line if you want to disable autosetting terminal title. -# DISABLE_AUTO_TITLE="true" +DISABLE_AUTO_TITLE="true" # Uncomment the following line to enable command auto-correction. ENABLE_CORRECTION="true" @@ -34,7 +34,6 @@ ENABLE_CORRECTION="true" # 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" diff --git a/.setopt.zsh b/.setopt.zsh index 858e691..87e9441 100644 --- a/.setopt.zsh +++ b/.setopt.zsh @@ -26,17 +26,6 @@ setopt HIST_FIND_NO_DUPS # Remove extra blanks from each command line being added to history setopt HIST_REDUCE_BLANKS -# Include more information about when the command was executed, etc -setopt EXTENDED_HISTORY - -# ===== Completion - -# Allow completion from within a word/phrase -setopt COMPLETE_IN_WORD - -# When completing from the middle of a word, move the cursor to the end of the word -setopt ALWAYS_TO_END - # ===== Prompt # Enable parameter expansion, command substitution, and arithmetic expansion in the prompt diff --git a/.tern-config b/.tern-config new file mode 100644 index 0000000..51134a5 --- /dev/null +++ b/.tern-config @@ -0,0 +1,11 @@ +{ + "libs": [ + "browser", + "ecma5", + "ecma6" + ], + "plugins": { + "es_modules": {}, + "node_resolve": {} + } +}