diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 723c8be40..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule ".vim/vundle.git"] - path = .vim/vundle.git - url = https://github.com/gmarik/vundle.git diff --git a/.vimrc b/.vimrc index 8a5cc5b16..a255017fa 100644 --- a/.vimrc +++ b/.vimrc @@ -118,13 +118,11 @@ endif " Setting up the directories { - if !exists('g:spf13_initialize_directories') - set backup " Backups are nice ... - if has('persistent_undo') - set undofile " So is persistent undo ... - set undolevels=1000 " Maximum number of changes that can be undone - set undoreload=10000 " Maximum number lines to save for undo on a buffer reload - endif + set backup " Backups are nice ... + if has('persistent_undo') + set undofile " So is persistent undo ... + set undolevels=1000 " Maximum number of changes that can be undone + set undoreload=10000 " Maximum number lines to save for undo on a buffer reload endif " To disable views add the following to your .vimrc.before.local file: @@ -265,33 +263,44 @@ noremap j gj noremap k gk - " Same for 0, home, end, etc - function! WrapRelativeMotion(key, ...) - let vis_sel="" - if a:0 - let vis_sel="gv" - endif - if &wrap - execute "normal!" vis_sel . "g" . a:key - else - execute "normal!" vis_sel . a:key - endif - endfunction + " End/Start of line motion keys act relative to row/wrap width in the + " presence of `:set wrap`, and relative to line for `:set nowrap`. + " Default vim behaviour is to act relative to text line in both cases + " If you prefer the default behaviour, add the following to your + " .vimrc.before.local file: + " let g:spf13_no_wrapRelMotion = 1 + if !exists('g:spf13_no_wrapRelMotion') + " Same for 0, home, end, etc + function! WrapRelativeMotion(key, ...) + let vis_sel="" + if a:0 + let vis_sel="gv" + endif + if &wrap + execute "normal!" vis_sel . "g" . a:key + else + execute "normal!" vis_sel . a:key + endif + endfunction - " Map g* keys in Normal, Operator-pending, and Visual+select (over written - " below) modes - noremap $ :call WrapRelativeMotion("$") - noremap :call WrapRelativeMotion("$") - noremap 0 :call WrapRelativeMotion("0") - noremap :call WrapRelativeMotion("0") - noremap ^ :call WrapRelativeMotion("^") - " Over write the Visual+Select mode mappings to ensure correct mode is - " passed to WrapRelativeMotion - vnoremap $ :call WrapRelativeMotion("$", 1) - vnoremap :call WrapRelativeMotion("$", 1) - vnoremap 0 :call WrapRelativeMotion("0", 1) - vnoremap :call WrapRelativeMotion("0", 1) - vnoremap ^ :call WrapRelativeMotion("^", 1) + " Map g* keys in Normal, Operator-pending, and Visual+select + noremap $ :call WrapRelativeMotion("$") + noremap :call WrapRelativeMotion("$") + noremap 0 :call WrapRelativeMotion("0") + noremap :call WrapRelativeMotion("0") + noremap ^ :call WrapRelativeMotion("^") + " Overwrite the operator pending $/ mappings from above + " to force inclusive motion with :execute normal! + onoremap $ v:call WrapRelativeMotion("$") + onoremap v:call WrapRelativeMotion("$") + " Overwrite the Visual+select mode mappings from above + " to ensure the correct vis_sel flag is passed to function + vnoremap $ :call WrapRelativeMotion("$", 1) + vnoremap :call WrapRelativeMotion("$", 1) + vnoremap 0 :call WrapRelativeMotion("0", 1) + vnoremap :call WrapRelativeMotion("0", 1) + vnoremap ^ :call WrapRelativeMotion("^", 1) + endif " The following two lines conflict with moving to top and " bottom of the screen @@ -362,13 +371,6 @@ " http://stackoverflow.com/a/8064607/127816 vnoremap . :normal . - " Fix home and end keybindings for screen, particularly on mac - " - for some reason this fixes the arrow keys too. huh. - "map  $ - "imap  $ - "map  g0 - "imap  g0 - " For when you forget to sudo.. Really Write the file. cmap w!! w !sudo tee % >/dev/null @@ -410,28 +412,32 @@ " } " OmniComplete { - if has("autocmd") && exists("+omnifunc") - autocmd Filetype * - \if &omnifunc == "" | - \setlocal omnifunc=syntaxcomplete#Complete | - \endif - endif + " To disable omni complete, add the following to your .vimrc.before.local file: + " let g:spf13_no_omni_complete = 1 + if !exists('g:spf13_no_omni_complete') + if has("autocmd") && exists("+omnifunc") + autocmd Filetype * + \if &omnifunc == "" | + \setlocal omnifunc=syntaxcomplete#Complete | + \endif + endif - hi Pmenu guifg=#000000 guibg=#F8F8F8 ctermfg=black ctermbg=Lightgray - hi PmenuSbar guifg=#8A95A7 guibg=#F8F8F8 gui=NONE ctermfg=darkcyan ctermbg=lightgray cterm=NONE - hi PmenuThumb guifg=#F8F8F8 guibg=#8A95A7 gui=NONE ctermfg=lightgray ctermbg=darkcyan cterm=NONE - - " Some convenient mappings - inoremap pumvisible() ? "\" : "\" - inoremap pumvisible() ? "\" : "\" - inoremap pumvisible() ? "\" : "\" - inoremap pumvisible() ? "\" : "\" - inoremap pumvisible() ? "\\\" : "\" - inoremap pumvisible() ? "\\\" : "\" - - " Automatically open and close the popup menu / preview window - au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif - set completeopt=menu,preview,longest + hi Pmenu guifg=#000000 guibg=#F8F8F8 ctermfg=black ctermbg=Lightgray + hi PmenuSbar guifg=#8A95A7 guibg=#F8F8F8 gui=NONE ctermfg=darkcyan ctermbg=lightgray cterm=NONE + hi PmenuThumb guifg=#F8F8F8 guibg=#8A95A7 gui=NONE ctermfg=lightgray ctermbg=darkcyan cterm=NONE + + " Some convenient mappings + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\\\" : "\" + inoremap pumvisible() ? "\\\" : "\" + + " Automatically open and close the popup menu / preview window + au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif + set completeopt=menu,preview,longest + endif " } " Ctags { @@ -457,7 +463,7 @@ " } " NerdTree { - map :NERDTreeToggle:NERDTreeMirror + map NERDTreeTabsToggle map e :NERDTreeFind nmap nt :NERDTreeFind @@ -572,7 +578,7 @@ nnoremap gi :Git add -p % nnoremap gg :SignifyToggle "} - + " YouCompleteMe { if count(g:spf13_bundle_groups, 'youcompleteme') let g:acp_enableAtStartup = 0 @@ -584,7 +590,7 @@ let g:UltiSnipsExpandTrigger = '' let g:UltiSnipsJumpForwardTrigger = '' let g:UltiSnipsJumpBackwardTrigger = '' - + " Enable omni completion. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags @@ -602,8 +608,10 @@ endif " For snippet_complete marker. - if has('conceal') - set conceallevel=2 concealcursor=i + if !exists("g:spf13_no_conceal") + if has('conceal') + set conceallevel=2 concealcursor=i + endif endif " Disable the neosnippet preview candidate window @@ -772,7 +780,9 @@ let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\h\w*\|\h\w*::' " } " Normal Vim omni-completion { - else + " To disable omni complete, add the following to your .vimrc.before.local file: + " let g:spf13_no_omni_complete = 1 + elseif !exists('g:spf13_no_omni_complete') " Enable omni-completion. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags @@ -879,7 +889,6 @@ " Functions { " Initialize directories { - if !exists('g:spf13_initialize_directories') function! InitializeDirectories() let parent = $HOME let prefix = 'vim' @@ -920,7 +929,6 @@ endfor endfunction call InitializeDirectories() - endif " } " Initialize NERDTree as needed { diff --git a/.vimrc.before b/.vimrc.before index 8253ab53f..20ebeac4d 100644 --- a/.vimrc.before +++ b/.vimrc.before @@ -34,6 +34,9 @@ " Disable easier moving in tabs and windows " let g:spf13_no_easyWindows = 1 + " Disable wrap relative motion for start/end line motions + " let g:spf13_no_wrapRelMotion = 1 + " Disable fast tab navigation " let g:spf13_no_fastTabs = 1 @@ -76,6 +79,9 @@ " To set your own font, do it from ~/.vimrc.local " let g:spf13_no_big_font = 1 + " Disable omni complete + " let g:spf13_no_omni_complete = 1 + " Don't create default mappings for multicursors " See :help multiple-cursors-mappings " let g:multi_cursor_use_default_mapping=0 @@ -85,6 +91,7 @@ " let g:multi_cursor_quit_key='' " Require a special keypress to enter multiple cursors mode " let g:multi_cursor_start_key='+' + " } " Use fork before if available { diff --git a/.vimrc.bundles b/.vimrc.bundles index d13b08af8..bf5ef6e3f 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -163,10 +163,12 @@ elseif count(g:spf13_bundle_groups, 'neocomplcache') Bundle 'Shougo/neocomplcache' Bundle 'Shougo/neosnippet' + Bundle 'Shougo/neosnippet-snippets' Bundle 'honza/vim-snippets' elseif count(g:spf13_bundle_groups, 'neocomplete') Bundle 'Shougo/neocomplete.vim.git' Bundle 'Shougo/neosnippet' + Bundle 'Shougo/neosnippet-snippets' Bundle 'honza/vim-snippets' endif " } diff --git a/README.markdown b/README.markdown index 0ceffc50f..932cc4f05 100644 --- a/README.markdown +++ b/README.markdown @@ -53,7 +53,17 @@ If you have a bash-compatible shell you can run the script directly: ## Installing on Windows -On Windows and \*nix [Git] and [Curl] are required. Also, if you haven't already, you'll need to install [Vim]. +On Windows and \*nix [Git] and [Curl] are required. Also, if you haven't already, you'll need to install [Vim]. +The quickest option to install all three dependencies ([Git], [Curl], [Vim] and [spf13-vim]) via [Chocolatey] NuGet and the [spf13.vim package]. After running the [Chocolatey] install, execute the following commands on the _command prompt_: + + cinst git + cinst curl + cinst ctags + cinst spf13.vim + +_Note: The spf13.vim package will install Vim also! _ + +If you want to install [msysgit], [Curl] and [spf13-vim] individually, follow the directions below. ### Installing dependencies @@ -169,11 +179,12 @@ There is an additional tier of customization available to those who want to main fork of spf13-vim specialized for a particular group. These users can create `.vimrc.fork` and `.vimrc.bundles.fork` files in the root of their fork. The load order for the configuration is: -1. `.vimrc.before.local` - before user configuration +1. `.vimrc.before` - spf13-vim before configuration 2. `.vimrc.before.fork` - fork before configuration -3. `.vimrc.bundles.local` - local user bundle configuration -4. `.vimrc.bundles.fork` - fork bundle configuration -5. `.vimrc.bundles` - spf13-vim bundle configuration +3. `.vimrc.before.local` - before user configuration +4. `.vimrc.bundles` - spf13-vim bundle configuration +5. `.vimrc.bundles.fork` - fork bundle configuration +6. `.vimrc.bundles.local` - local user bundle configuration 6. `.vimrc` - spf13-vim vim configuration 7. `.vimrc.fork` - fork vim configuration 8. `.vimrc.local` - local user configuration @@ -297,7 +308,7 @@ NeoComplCache is an amazing autocomplete plugin with additional support for snip YouCompleteMe is another amazing completion engine. It is slightly more involved to set up as it contains a binary component that the user needs to compile before it will work. As a result of this however it is very fast. -To enable YouCompleteMe add `YouCompleteMe` to your list of groups by overriding it in your `.vimrc.bundles.local` like so: `let g:spf13_bundle_groups=['general', 'programming', 'misc', 'scala', 'YouCompleteMe']` This is just an example. Remember to choose the other groups you want here. +To enable YouCompleteMe add `youcompleteme` to your list of groups by overriding it in your `.vimrc.before.local` like so: `let g:spf13_bundle_groups=['general', 'programming', 'misc', 'scala', 'youcompleteme']` This is just an example. Remember to choose the other groups you want here. Once you have done this you will need to get Vundle to grab the latest code from git. You can do this by calling `:BundleInstall!`. You should see YouCompleteMe in the list. @@ -491,6 +502,8 @@ Here's some tips if you've never used VIM before: [Curl]:http://curl.haxx.se [Vim]:http://www.vim.org/download.php#pc [msysgit]:http://code.google.com/p/msysgit +[Chocolatey]: http://chocolatey.org/ +[spf13.vim package]: http://chocolatey.org/packages/spf13.vim [MacVim]:http://code.google.com/p/macvim/ [spf13-vim]:https://github.com/spf13/spf13-vim [contributors]:https://github.com/spf13/spf13-vim/contributors @@ -515,6 +528,7 @@ Here's some tips if you've never used VIM before: [Airline]:https://github.com/bling/vim-airline [Powerline]:https://github.com/lokaltog/powerline [Powerline Fonts]:https://github.com/Lokaltog/powerline-fonts +[AutoClose]:https://github.com/spf13/vim-autoclose [spf13-vim-img]:https://i.imgur.com/UKToY.png [spf13-vimrc-img]:https://i.imgur.com/kZWj1.png diff --git a/bootstrap.sh b/bootstrap.sh index 71e924930..fb7cc0990 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,10 +1,12 @@ #!/usr/bin/env bash ############################ SETUP PARAMETERS app_name='spf13-vim' -git_uri='https://github.com/raffone/spf13-vim.git' +app_dir="$HOME/.spf13-vim-3" +[ -z "$git_uri" ] && git_uri='https://github.com/spf13/spf13-vim.git' git_branch='3.0' debug_mode='0' fork_maintainer='0' +[ -z "$VUNDLE_URI" ] && VUNDLE_URI="https://github.com/gmarik/vundle.git" ############################ BASIC SETUP TOOLS msg() { @@ -24,7 +26,7 @@ error() { debug() { if [ "$debug_mode" -eq '1' ] && [ "$ret" -gt '1' ]; then - msg "An error occured in function \"${FUNCNAME[$i+1]}\" on line ${BASH_LINENO[$i+1]}, we're sorry for that." + msg "An error occurred in function \"${FUNCNAME[$i+1]}\" on line ${BASH_LINENO[$i+1]}, we're sorry for that." fi } @@ -63,7 +65,7 @@ upgrade_repo() { msg "trying to update $1" if [ "$1" = "$app_name" ]; then - cd "$HOME/.$app_name-3" && + cd "$app_dir" && git pull origin "$git_branch" fi @@ -79,10 +81,9 @@ upgrade_repo() { clone_repo() { program_exists "git" "Sorry, we cannot continue without GIT, please install it first." - endpath="$HOME/.$app_name-3" - if [ ! -e "$endpath/.git" ]; then - git clone --recursive -b "$git_branch" "$git_uri" "$endpath" + if [ ! -e "$app_dir" ]; then + git clone --recursive -b "$git_branch" "$git_uri" "$app_dir" ret="$?" success "$1" debug @@ -93,7 +94,7 @@ clone_repo() { clone_vundle() { if [ ! -e "$HOME/.vim/bundle/vundle" ]; then - git clone https://github.com/gmarik/vundle.git "$HOME/.vim/bundle/vundle" + git clone $VUNDLE_URI "$HOME/.vim/bundle/vundle" else upgrade_repo "vundle" "Successfully updated vundle" fi @@ -103,7 +104,7 @@ clone_vundle() { } create_symlinks() { - endpath="$HOME/.$app_name-3" + endpath="$app_dir" if [ ! -d "$endpath/.vim/bundle" ]; then mkdir -p "$endpath/.vim/bundle" diff --git a/spf13-vim-windows-install.cmd b/spf13-vim-windows-install.cmd index c30d4e3fa..af8d86a69 100644 --- a/spf13-vim-windows-install.cmd +++ b/spf13-vim-windows-install.cmd @@ -1,33 +1,33 @@ @if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% @if not exist "%HOME%" @set HOME=%USERPROFILE% -@set BASE_DIR=%HOME%\.spf13-vim-3 -IF NOT EXIST "%BASE_DIR%" ( - call git clone --recursive -b 3.0 https://github.com/spf13/spf13-vim.git "%BASE_DIR%" +@set APP_DIR=%HOME%\.spf13-vim-3 +IF NOT EXIST "%APP_DIR%" ( + call git clone --recursive -b 3.0 https://github.com/spf13/spf13-vim.git "%APP_DIR%" ) ELSE ( @set ORIGINAL_DIR=%CD% echo updating spf13-vim - chdir /d "%BASE_DIR%" + chdir /d "%APP_DIR%" call git pull chdir /d "%ORIGINAL_DIR%" - call cd "%BASE_DIR%" + call cd "%APP_DIR%" ) -call mklink "%HOME%\.vimrc" "%BASE_DIR%\.vimrc" -call mklink "%HOME%\_vimrc" "%BASE_DIR%\.vimrc" -call mklink "%HOME%\.vimrc.fork" "%BASE_DIR%\.vimrc.fork" -call mklink "%HOME%\.vimrc.bundles" "%BASE_DIR%\.vimrc.bundles" -call mklink "%HOME%\.vimrc.bundles.fork" "%BASE_DIR%\.vimrc.bundles.fork" -call mklink "%HOME%\.vimrc.before" "%BASE_DIR%\.vimrc.before" -call mklink "%HOME%\.vimrc.before.fork" "%BASE_DIR%\.vimrc.before.fork" -call mklink /J "%HOME%\.vim" "%BASE_DIR%\.vim" +call mklink "%HOME%\.vimrc" "%APP_DIR%\.vimrc" +call mklink "%HOME%\_vimrc" "%APP_DIR%\.vimrc" +call mklink "%HOME%\.vimrc.fork" "%APP_DIR%\.vimrc.fork" +call mklink "%HOME%\.vimrc.bundles" "%APP_DIR%\.vimrc.bundles" +call mklink "%HOME%\.vimrc.bundles.fork" "%APP_DIR%\.vimrc.bundles.fork" +call mklink "%HOME%\.vimrc.before" "%APP_DIR%\.vimrc.before" +call mklink "%HOME%\.vimrc.before.fork" "%APP_DIR%\.vimrc.before.fork" +call mklink /J "%HOME%\.vim" "%APP_DIR%\.vim" -IF NOT EXIST "%BASE_DIR%\.vim\bundle" ( - call mkdir "%BASE_DIR%\.vim\bundle" +IF NOT EXIST "%APP_DIR%\.vim\bundle" ( + call mkdir "%APP_DIR%\.vim\bundle" ) IF NOT EXIST "%HOME%/.vim/bundle/vundle" ( call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle" ) -call vim -u "%BASE_DIR%/.vimrc.bundles" +BundleInstall! +BundleClean +qall +call vim -u "%APP_DIR%/.vimrc.bundles" +BundleInstall! +BundleClean +qall diff --git a/spf13-vim-windows-xp-install.cmd b/spf13-vim-windows-xp-install.cmd index 800dc38b0..57aa62e98 100644 --- a/spf13-vim-windows-xp-install.cmd +++ b/spf13-vim-windows-xp-install.cmd @@ -1,9 +1,9 @@ @if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% @if not exist "%HOME%" @set HOME=%USERPROFILE% -@set BASE_DIR=%HOME%\.spf13-vim-3 +@set APP_DIR=%HOME%\.spf13-vim-3 -@if not exist "%BASE_DIR%" ( +@if not exist "%APP_DIR%" ( echo backing up existing vim config @set today=%DATE% @if exist "%HOME%\.vim" call xcopy /s/e/h/y/r/q/i "%HOME%\.vim" "%HOME%\.vim.%today%" @@ -12,25 +12,25 @@ @if exist "%HOME%\.gvimrc" call copy "%HOME%\.gvimrc" "%HOME%\.gvimrc.%today%" ) -@if exist "%BASE_DIR%" ( +@if exist "%APP_DIR%" ( @set ORIGINAL_DIR=%CD% echo updating spf13-vim - chdir /d "%BASE_DIR%" && git pull + chdir /d "%APP_DIR%" && git pull chdir /d "%ORIGINAL_DIR%" ) else ( echo cloning spf13-vim - call git clone --recursive -b 3.0 git://github.com/spf13/spf13-vim.git "%BASE_DIR%" + call git clone --recursive -b 3.0 git://github.com/spf13/spf13-vim.git "%APP_DIR%" ) -@if not exist "%BASE_DIR%\.vim\bundle" call mkdir "%BASE_DIR%\.vim\bundle" -call xcopy /s/e/h/y/r/q/i "%BASE_DIR%\.vim" "%HOME%\.vim" -call copy "%BASE_DIR%\.vimrc" "%HOME%\.vimrc" -call copy "%BASE_DIR%\.vimrc" "%HOME%\_vimrc" -call copy "%BASE_DIR%\.vimrc.fork" "%HOME%\.vimrc.fork" -call copy "%BASE_DIR%\.vimrc.bundles" "%HOME%\.vimrc.bundles" -call copy "%BASE_DIR%\.vimrc.bundles.fork" "%HOME%\.vimrc.bundles.fork" -call copy "%BASE_DIR%\.vimrc.before" "%HOME%\.vimrc.before" -call copy "%BASE_DIR%\.vimrc.before.fork" "%HOME%\.vimrc.before.fork" +@if not exist "%APP_DIR%\.vim\bundle" call mkdir "%APP_DIR%\.vim\bundle" +call xcopy /s/e/h/y/r/q/i "%APP_DIR%\.vim" "%HOME%\.vim" +call copy "%APP_DIR%\.vimrc" "%HOME%\.vimrc" +call copy "%APP_DIR%\.vimrc" "%HOME%\_vimrc" +call copy "%APP_DIR%\.vimrc.fork" "%HOME%\.vimrc.fork" +call copy "%APP_DIR%\.vimrc.bundles" "%HOME%\.vimrc.bundles" +call copy "%APP_DIR%\.vimrc.bundles.fork" "%HOME%\.vimrc.bundles.fork" +call copy "%APP_DIR%\.vimrc.before" "%HOME%\.vimrc.before" +call copy "%APP_DIR%\.vimrc.before.fork" "%HOME%\.vimrc.before.fork" @if not exist "%HOME%/.vim/bundle/vundle" call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle" -call vim -u "%BASE_DIR%/.vimrc.bundles" - +BundleInstall! +BundleClean +qall +call vim -u "%APP_DIR%/.vimrc.bundles" - +BundleInstall! +BundleClean +qall diff --git a/uninstall.sh b/uninstall.sh index c410db030..5fd9a6d8a 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -endpath="$HOME/.spf13-vim-3" +app_dir="$HOME/.spf13-vim-3" warn() { echo "$1" >&2 @@ -15,4 +15,4 @@ rm $HOME/.vimrc rm $HOME/.vimrc.bundles rm $HOME/.vim -rm -rf $endpath +rm -rf $app_dir