Move Vim files to separate repo

This removes the Vim plugins from the dotfiles repo, and updates the
vimrc and install scripts accordingly, since the vimfiles repo now uses
Git submodules to keep the plugins in sync.
master
nirenjan 2014-12-24 17:15:31 -08:00
parent 34e2aa2593
commit 745e6b6b46
15 changed files with 18 additions and 398 deletions

143
install
View File

@ -94,88 +94,12 @@ lnfile()
fi
}
# Install/update vim bundles
vim_update_bundle()
{
BUNDLE=$(echo $1 | sed 's:^.*/::' | sed 's:\.git$::')
# If the bundle already exists, update it (if possible)
if [[ -d "$HOME/.vim/bundle/$BUNDLE" ]]
then
# Don't update the bundle if BUNDLE_NO_UPDATE is set
if [[ -d "$HOME/.vim/bundle/$BUNDLE/.git" ]]
then
if [[ -z $BUNDLE_NO_UPDATE ]]; then
echo "Updating bundle $BUNDLE..."
pushd "$HOME/.vim/bundle/$BUNDLE" >/dev/null
git pull
popd >/dev/null
echo
fi
else
echo "$BUNDLE is not a Git repository. Skipping update."
fi
else
echo "Installing bundle $BUNDLE..."
pushd "$HOME/.vim/bundle/" >/dev/null
git clone $1
popd >/dev/null
echo
fi
}
# Wrapper to vim_update_bundle
# Let's you specify the bundle repo in a short form if it resides on GitHub
# (and perhaps one of the repos in vim-scripts). You can still specify a full
# URL if necessary. However, that will not allow you to dynamically choose a
# transport layer at runtime
Bundle()
{
# Get the prefix ready
if [[ "$BUNDLE_TRANSPORT" == "ssh" ]]; then
# If the user specifies to use ssh as the transport
URL="git@github.com:"
elif [[ "$BUNDLE_TRANSPORT" == "https" ]]; then
# Use https as the transport
URL="https://github.com/"
elif [[ "$BUNDLE_TRANSPORT" == "git" ]]; then
# Use git as the transport
URL="git://github.com/"
else
echo "Invalid transport layer! Aborting!!!"
exit 1
fi
# Check the bundle format
if [[ $(echo $1 | grep "^[A-Za-z0-9-]\+\/[A-Za-z0-9._-]\+$") == $1 ]]; then
# Username/repo combo
URL="${URL}${1}.git"
elif [[ $(echo $1 | grep "^[A-Za-z0-9._-]\+$") == $1 ]]; then
# Bare repo name - must be from the vim-scripts user
URL="${URL}vim-scripts/${1}.git"
else
# I don't care, I'm specifying the URL directly
URL=$1
fi
vim_update_bundle "$URL"
}
#######################################################################
# Verify command line switches
#######################################################################
while getopts "nht:" OPTION
while getopts "h" OPTION
do
case "$OPTION" in
n)
echo "Skipping bundle updates"
BUNDLE_NO_UPDATE=1
;;
t)
echo "Using transport $OPTARG"
BUNDLE_TRANSPORT=$OPTARG
;;
h)
echo '
This script installs the dotfiles into various locations using symbolic
@ -183,13 +107,6 @@ links.
Options:
--------
-n Will not update existing bundles, but will install new
bundles.
-t<option> Specify the transport for downloading bundles. Can be
one of git, https or ssh. ssh transport requires you to
have set up the necessary keys at GitHub
-h Displays this help message
'
exit 0
@ -269,52 +186,24 @@ fi
# Create VIM folders
mkfolder ~/.vim
mkfolder ~/.vim/autoload
mkfolder ~/.vim/bundle
mkfolder ~/.vim/colors
mkfolder ~/.vim/ftdetect
mkfolder ~/.vim/ftplugin
mkfolder ~/.vim/plugin
mkfolder ~/.vim/syntax
# Install vim files
# Update the Git repository at ~/.vim, if it exists, clone otherwise
pushd ~/.vim &>/dev/null
if [[ -d .git ]]
then
git pull
else
git clone git@github.com:nirenjan/vimfiles.git .
fi
git submodule init
git submodule update
popd &>/dev/null
# Install the basic vimrc file from this repo
lnfile vimrc ~/.vimrc
# Install my plugins
lnfile vim/plugin/long-lines.vim ~/.vim/plugin/
lnfile vim/plugin/match-brackets.vim ~/.vim/plugin/
lnfile vim/plugin/airline-settings.vim ~/.vim/plugin/
lnfile vim/plugin/bufferline-settings.vim ~/.vim/plugin/
lnfile vim/plugin/ultisnips-settings.vim ~/.vim/plugin/
lnfile vim/plugin/nerdtree-settings.vim ~/.vim/plugin/
# Install my ftdetect plugins
lnfile vim/ftdetect/swig.vim ~/.vim/ftdetect/
lnfile vim/ftdetect/markdown.vim ~/.vim/ftdetect/
# Install my filetype plugins
lnfile vim/ftplugin/make.vim ~/.vim/ftplugin/
lnfile vim/ftplugin/perl.vim ~/.vim/ftplugin/
lnfile vim/ftplugin/ruby.vim ~/.vim/ftplugin/
lnfile vim/ftplugin/changelog.vim ~/.vim/ftplugin/
lnfile vim/ftplugin/markdown.vim ~/.vim/ftplugin/
#######################################################################
# Install/update Vim bundles
#######################################################################
Bundle tpope/vim-pathogen # pathogen
Bundle tpope/vim-fugitive # A Git wrapper so awesome, it
# should be illegal!
Bundle zaiste/tmux.vim # tmux config file syntax
Bundle altercation/vim-colors-solarized # Solarized
Bundle vimwiki # Vimwiki
Bundle tomtom/tcomment_vim # tComment
Bundle bling/vim-airline # Airline is awesome!
Bundle bling/vim-bufferline # Display buffers in Airline
Bundle SirVer/ultisnips # UltiSnips
Bundle honza/vim-snippets # The actual snippets
Bundle scrooloose/nerdtree # NERDTree
#######################################################################
# Install tmux & screen config files
#######################################################################

View File

@ -1,6 +0,0 @@
" File: markdown.vim
" Author: Nirenjan Krishnan
" Description: Syntax detection for Markdown files
" Last Modified: July 31, 2013
autocmd BufNewFile,BufRead *.md setlocal filetype=markdown

View File

@ -1,6 +0,0 @@
" File: swig.vim
" Author: Nirenjan Krishnan
" Description: Syntax detection for SWIG files
" Last Modified: July 17, 2013
autocmd BufNewFile,BufRead *.swg setlocal filetype=swig

View File

@ -1,10 +0,0 @@
" File: changelog.vim
" Author: Nirenjan Krishnan
" Description: ChangeLog editing settings
" Last Modified: July 3, 2013
setlocal tabstop=8
setlocal softtabstop=8
setlocal shiftwidth=8
setlocal noexpandtab

View File

@ -1,10 +0,0 @@
" File: make.vim
" Author: Nirenjan Krishnan
" Description: Makefile editing settings
" Last Modified: May 15, 2013
setlocal tabstop=4
setlocal softtabstop=4
setlocal shiftwidth=4
setlocal noexpandtab

View File

@ -1,6 +0,0 @@
" File: markdown.vim
" Author: Nirenjan Krishnan
" Description: Markdown editing settings
" Last Modified: July 31, 2013
setlocal textwidth=80

View File

@ -1,21 +0,0 @@
" File: perl.vim
" Author: Nirenjan Krishnan
" Description: Perl syntax folding
" Last Modified: May 14, 2013
" Perl folding
let perl_include_pod = 1
let perl_no_scope_in_variables = 1
let perl_no_extended_vars = 1
let perl_string_as_statement = 1
let perl_no_sync_on_sub = 1
let perl_no_sync_on_global_var = 1
let perl_sync_dist = 100
let perl_fold = 1
let perl_fold_blocks = 1
let perl_nofold_packages = 1
let perl_nofold_subs = 1
" Repeat Perl syntax, since setting them doesn't take effect immediately
set syntax=perl

View File

@ -1,10 +0,0 @@
" File: ruby.vim
" Author: Nirenjan Krishnan
" Description: Ruby editing settings
" Last Modified: May 15, 2013
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal expandtab

View File

@ -1,10 +0,0 @@
" File: airline-settings.vim
" Author: Nirenjan Krishnan
" Description: Base settings for vim-airline plugin
" Last Modified: August 15, 2013
set ttm=50
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_theme='solarized'
let g:airline_detect_whitespace=0

View File

@ -1,11 +0,0 @@
" File: bufferline-settings.vim
" Author: Nirenjan Krishnan
" Description: Settings for the bufferline plugin
" Last Modified: March 17, 2014
" Do not echo to the command bar (It's already showing up in airline)
let g:bufferline_echo = 0
" Allow scrolling, place the active buffer at the end
let g:bufferline_rotate = 1
let g:bufferline_fixed_index = -1

View File

@ -1,27 +0,0 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Long line indicator for vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This plugin marks the characters which exceed the 80 character line
" limitation
"
" USAGE:
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
" 'plugin' directory in some other directory that is in your
" 'runtimepath'.
"
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
" your ~/.vimrc file (or cut and paste it into your .vimrc).
"
" NOTE:
" This file will highlight all characters from column 81 onwards
"
" Nirenjan Krishnan nirenjan@gmail.com 2013/01/19
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if exists('+colorcolumn')
set colorcolumn=81
else
autocmd BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1)
endif

View File

@ -1,40 +0,0 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Brackets plugin for vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" This plugin inserts corresponding closing braces when the user enters an
" opening brace in insert mode.
"
" USAGE:
" -- vim 6: Stick this file in your ~/.vim/plugin directory (or in a
" 'plugin' directory in some other directory that is in your
" 'runtimepath'.
"
" -- vim 5: Stick this file somewhere and 'source cscope.vim' it from
" your ~/.vimrc file (or cut and paste it into your .vimrc).
"
" NOTE:
" On pressing {, ( or [ in insert mode, this plugin will insert a corresponding
" closing }, ) or ] and will place the cursor on the closing brace in insert
" mode.
"
" Nirenjan Krishnan nirenjan@gmail.com 2013/05/16
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Braces {}
" Typing { in insert mode will automatically insert a closing
" curly brace as well and place the curser on the closing brace
inoremap { {}<Left>
" Parantheses ()
" Typing ( in insert mode will automatically insert a closing
" paranthesis as well and place the cursor on the closing paranthesis
" in insert mode.
inoremap ( ()<Left>
" Brackets []
" Typing [ in insert mode will automatically insert a closing
" bracket as well and place the cursor on the closing bracket
" in insert mode.
inoremap [ []<Left>

View File

@ -1,8 +0,0 @@
" File: nerdtree-settings.vim
" Author: Nirenjan Krishnan
" Description: Base settings for NERDTree plugin
" Last Modified: May 21, 2014
" Don't try to display Unicode characters for the tree
let g:NERDTreeDirArrows = 0

View File

@ -1,16 +0,0 @@
" File: ultisnips-settings.vim
" Author: Nirenjan Krishnan
" Description: Base settings for UltiSnips plugin
" Last Modified: May 21, 2014
" Go with TextMate style triggers
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsListSnips="<c-tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
" Edit splits in a vertical split
let g:UltiSnipsEditSplit='vertical'
" Ignore the no python warning if Vim doesn't have python support enabled
let g:UltiSnipsNoPythonWarning=1

92
vimrc
View File

@ -1,90 +1,2 @@
" Don't enable vi compatibility
set nocompatible
" Pathogen
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
call pathogen#helptags()
" Editing options
" May be overridden by ftplugin
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
" Disable Ex mode
nnoremap Q <nop>
" Make record macro command use leader - saves annoyances
nnoremap q <nop>
nnoremap <Leader>q q
" Automatic indentation of code blocks
set autoindent
" Allow backspace to delete charaters, indentation & lines
set backspace=indent,eol,start
" Enable syntax highlighting
syntax enable
" Filetype plugins
filetype plugin on
" Search options
" Enable search highlighting
set hlsearch
" Miscellaneous options
" Show status line
set laststatus=2
" Enable hidden buffers
set hidden
" Show tab line
set showtabline=2
" Set the cursorline option
" This (by default shows up as underlining)
set cursorline
" Show line number + relativenumber
" Some older vim versions don't support relative numbering. Check first.
if exists("&relativenumber")
set relativenumber
endif
" Fallback to normal line numbering. If the version of Vim is recent enough,
" it will display the line number on the current line and use relative
" numbering on other lines. However, if the Vim version doesn't support
" simultaneous use of both relativenumber and number, then it will fallback to
" using just number.
set number
" xterm title inherited from vim
set title
" Folding
set foldenable
set foldmethod=syntax
set foldlevel=99
" Menus
set wildmenu
set wildmode=longest,full
" Colorscheme
colorscheme solarized
if has("gui_running")
set background=light
else
set background=dark
end
" Mouse support
if has("mouse")
set mouse=a
set mousehide
endif
" Source from the ~/.vim folder
source ~/.vim/vimrc