fix circular link creation in installer

master
Jordan Orelli 7 years ago
parent e5701abd63
commit 16d31db208

@ -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 {<cr>}<up><right>
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 <leader>l :set list!<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" tab navigation helpers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" ctrl-k to go to the next tab
noremap <C-k> :tabn<CR>
" ctrl-j to go to the previous tab
@ -186,7 +194,10 @@ noremap <buffer> <silent> $ g$
let g:ctrlp_map = '<c-p>'
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 <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
iabbrev @@ @jordanorelli
noremap <Leader>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( :<c-u>normal! f(ci(<cr>
" new text object: "last paren". means the previous open paren on the current
" line. (using p would shadow the paragraph object)
onoremap il( :<c-u>normal! F)vi(<cr>
" command mode abbreviation :vhelp to open help text in a vertical split
" instead of a horizontal split.
cabbrev vhelp vertical help

@ -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

Loading…
Cancel
Save