From 16d31db208f2eaa9d321d594c58d705e5cfbd618 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sun, 28 May 2017 12:55:08 -0500 Subject: [PATCH] fix circular link creation in installer --- .vimrc | 64 +++++++++++++++++++++++++++++++++++++++--------------- install.sh | 26 ++++++++++++---------- 2 files changed, 60 insertions(+), 30 deletions(-) diff --git a/.vimrc b/.vimrc index e2bd0db..3e05e53 100644 --- a/.vimrc +++ b/.vimrc @@ -18,6 +18,7 @@ call vundle#begin() Plugin 'fatih/vim-go' Plugin 'nanotech/jellybeans.vim' Plugin 'ervandew/supertab' + Plugin 'scrooloose/nerdcommenter' Plugin 'scrooloose/nerdtree' Plugin 'Align' Plugin 'tomtom/tlib_vim' " dependency of flashdevelop @@ -64,7 +65,7 @@ set linebreak " soft text wrapping set nobackup " disable temporary files. set nowritebackup set noswapfile -set updatetime=750 " wait 750ms after typing for updates. default is 4000 +set updatetime=750 " wait 750ms after typing for updates " set hidden " hide buffers instead of closing them set visualbell " don't beep @@ -109,11 +110,15 @@ if has("autocmd") " Put these in an autocmd group, so that we can delete them easily. augroup vimrcEx + " delete existing definitions for this group au! " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 + " on some machines md files are thought to be modula2 + autocmd BufNewFile,BufRead *.md set filetype=markdown + " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). @@ -124,24 +129,27 @@ if has("autocmd") \ exe "normal! g`\"" | \ endif - augroup END + autocmd FileType html set omnifunc=htmlcomplete#CompleteTags + autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS + autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags + autocmd FileType php set omnifunc=phpcomplete#CompletePHP + autocmd FileType python set omnifunc=pythoncomplete#Complete + autocmd FileType css set omnifunc=csscomplete#CompleteCSS - autocmd FileType html set omnifunc=htmlcomplete#CompleteTags - autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS - autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags - autocmd FileType php set omnifunc=phpcomplete#CompletePHP - autocmd FileType python set omnifunc=pythoncomplete#Complete - autocmd FileType css set omnifunc=csscomplete#CompleteCSS + " causes VIM to enter the directory of the file being edited to simplify + " finding related files. + autocmd BufEnter * silent! lcd %:p:h - " causes VIM to enter the directory of the file being edited to simplify - " finding related files. - autocmd BufEnter * silent! lcd %:p:h + autocmd FileType go :iabbrev iff if {} + autocmd FileType javascript :iabbrev iff if + autocmd FileType javascript :iabbrev fun function - " add proper coloring for my .localrc file - au BufNewFile,BufRead .localrc call SetFileTypeSH("bash") + " add proper coloring for my .localrc file + au BufNewFile,BufRead .localrc call SetFileTypeSH("bash") - " add Coloring for ChucK source - au! BufNewFile,BufRead *.ck setf ck + " add Coloring for ChucK source + au! BufNewFile,BufRead *.ck setf ck + augroup END else endif " has("autocmd") @@ -155,9 +163,9 @@ endif " Shortcut to show invisible characters nnoremap l :set list! -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " tab navigation helpers -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " ctrl-k to go to the next tab noremap :tabn " ctrl-j to go to the previous tab @@ -186,7 +194,10 @@ noremap $ g$ let g:ctrlp_map = '' let g:ctrlp_cmd = 'CtrlP' -let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] +let g:ctrlp_user_command = [ + \'.git', + \'cd %s && git ls-files -co --exclude-standard' + \] " open up directories with a single click instead of needing to double-click let g:NERDTreeMouseMode = 2 @@ -215,3 +226,20 @@ nnoremap ev :vsplit $MYVIMRC nnoremap sv :source $MYVIMRC iabbrev @@ @jordanorelli + +noremap ci NERDComInvertComment + +let g:NERDDefaultAlign='left' +let g:NERDSpaceDelims=1 + +" new text object: "next paren". means the next open paren on the current +" line. +onoremap in( :normal! f(ci( + +" new text object: "last paren". means the previous open paren on the current +" line. (using p would shadow the paragraph object) +onoremap il( :normal! F)vi( + +" command mode abbreviation :vhelp to open help text in a vertical split +" instead of a horizontal split. +cabbrev vhelp vertical help diff --git a/install.sh b/install.sh index 645a726..38558ea 100755 --- a/install.sh +++ b/install.sh @@ -12,6 +12,7 @@ include=( .tmux.conf .vim/ftplugin/javascript.vim .vim/ftplugin/ruby.vim + .vim/ftplugin/vim.vim .vimrc ) @@ -31,33 +32,34 @@ for filename in ${include[@]}; do echo "dest path: $dest_path" echo "backup path: $backup_path" - # if a file doesn't actually exist in the repo, do nothing. + # if a file doesn't actually exist in the repo, do nothing. if [[ ! -a "$source_path" ]]; then echo "no file found at source path $source_path, skipping" - continue - fi + continue + fi - # back up existing dotfiles, just for safety - if [[ -a "$dest_path" ]]; then + # back up existing dotfiles, just for safety + if [[ -a "$dest_path" ]]; then if [[ -h "$dest_path" ]]; then # existing file is a symlink. delete it. echo "removing old link at $dest_path" rm "$dest_path" else # existing file is an original preferences file. archive it. + echo "archiving existing preferences file at $dest_path" if [[ ! -d $(dirname "$backup_path") ]]; then mkdir -pv $(dirname "$backup_path") fi - echo "archiving old preferences file at $dest_path" mv -v "$dest_path" "$backup_path" - echo "ok we archived it" fi - fi + fi - # symlink in the versioned dotfiles. - echo "linking preferences file" - ln -sv "$source_path" "$dest_path" - echo "ok we linked it" + if [[ ! -d $(dirname "$dest_path") ]]; then + mkdir -p $(dirname "$dest_path") + fi + + # symlink in the versioned dotfiles. + ln -sv "$source_path" "$dest_path" echo "--------------------------------------------------------------------------------" done