aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-18 10:14:59 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-18 10:14:59 +1200
commit091dd758d03098ed5e291274fa1a5e6bef4f16a2 (patch)
tree273dd0a135f6a581485340768656994643b5da3b /vim
parentMerge branch 'release/v1.33.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-091dd758d03098ed5e291274fa1a5e6bef4f16a2.tar.gz
dotfiles-091dd758d03098ed5e291274fa1a5e6bef4f16a2.zip
Merge branch 'release/v1.34.0'v1.34.0
* release/v1.34.0: Bump VERSION Scrap auto_cache_dirs plugin for a new approach Check b:is_posix existence not value Spin shebang_create_exec.vim into own distribution Adjust formatting of .gitmodules Separate shebang_create_exec into autoload funcs
Diffstat (limited to 'vim')
-rw-r--r--vim/after/ftplugin/sh.vim3
m---------vim/bundle/auto_cache_dirs0
m---------vim/bundle/shebang_create_exec0
-rw-r--r--vim/plugin/shebang_create_exec.vim35
-rw-r--r--vim/vimrc40
5 files changed, 42 insertions, 36 deletions
diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim
index 88254ea6..475527b9 100644
--- a/vim/after/ftplugin/sh.vim
+++ b/vim/after/ftplugin/sh.vim
@@ -27,7 +27,8 @@ let b:undo_ftplugin .= '|unlet b:current_compiler b:sh_check_compiler'
\ . '|setlocal errorformat< makeprg<'
" Resort to g:is_posix for correct syntax on older runtime files
-if b:is_posix && (v:version < 800 || v:version == 800 && !has('patch257'))
+if exists('b:is_posix')
+ \ && (v:version < 800 || v:version == 800 && !has('patch257'))
let g:is_posix = 1
endif
diff --git a/vim/bundle/auto_cache_dirs b/vim/bundle/auto_cache_dirs
deleted file mode 160000
-Subproject 70ce18086dcd84044b307d1481ae8651b9edd4a
diff --git a/vim/bundle/shebang_create_exec b/vim/bundle/shebang_create_exec
new file mode 160000
+Subproject 9adbf4f7e575fe8bbcfb2e1b2b6cd34bf42140a
diff --git a/vim/plugin/shebang_create_exec.vim b/vim/plugin/shebang_create_exec.vim
deleted file mode 100644
index 7fabd8f7..00000000
--- a/vim/plugin/shebang_create_exec.vim
+++ /dev/null
@@ -1,35 +0,0 @@
-"
-" shebang_create_exec.vim: Make a file executable on first save if it starts with a
-" shebang.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_shebang_create_exec') || &compatible
- finish
-endif
-if !has('autocmd') || !has('unix') || !exists('*shellescape')
- finish
-endif
-let g:loaded_shebang_create_exec = 1
-
-" Set up hook for before writes to check the buffer for new shebangs
-augroup shebang_create_exec
- autocmd!
- autocmd BufWritePre * call s:Check(expand('<afile>:p'))
-augroup END
-
-" If the buffer starts with a shebang and the file being saved to doesn't
-" exist yet, set up a hook to make it executable after the write is done
-function! s:Check(filename) abort
- if stridx(getline(1), '#!') == 0 && !filereadable(a:filename)
- autocmd shebang_create_exec BufWritePost <buffer>
- \ call s:Chmod(expand('<afile>:p'))
- endif
-endfunction
-
-" Make the file executable and clear away the hook that called us
-function! s:Chmod(filename) abort
- autocmd! shebang_create_exec BufWritePost <buffer>
- call system('chmod +x '.shellescape(a:filename))
-endfunction
diff --git a/vim/vimrc b/vim/vimrc
index c8e219f1..e6ff3c77 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -50,6 +50,13 @@ set backspace+=eol " Line breaks
set backspace+=indent " Spaces from 'autoindent'
set backspace+=start " The start of current insertion
+" Try to keep swapfiles in one system-appropriate dir
+if has('unix')
+ set directory^=~/.vim/cache/undo
+elseif has('win32') || has('win64')
+ set directory^=~/vimfiles/cache/undo
+endif
+
" How to deal with lines wrapping beyond the last screen row
if v:version > 704 || v:version == 704 && has('patch2109')
set display=truncate " Show '@@@' on the last line, if supported
@@ -105,6 +112,24 @@ set shortmess+=I
" Give me a bit longer to complete mappings
set timeoutlen=3000
+" Backup settings
+if has('backup')
+
+ " Do keep backups
+ set backup
+
+ " Try to keep them all in one system-appropriate dir, with full path
+ if has('unix')
+ set backupdir^=~/.vim/cache/backup//
+ elseif has('win32') || has('win64')
+ set backupdir^=~/vimfiles/cache/backup//
+ endif
+
+ " Don't back up stuff in /dev/shm or /var/tmp
+ set backupskip+=/dev/shm,/var/tmp
+
+endif
+
" Clear default 'comments' value, let the filetype handle it
if has('comments')
set comments=
@@ -142,6 +167,21 @@ if has('mksession')
set sessionoptions-=options
endif
+" Persistent undo settings
+if has('persistent_undo')
+
+ " Do keep undo files
+ set undofile
+
+ " Try to keep them all in one system-appropriate dir
+ if has('unix')
+ set undodir^=~/.vim/cache/undo//
+ elseif has('win32') || has('win64')
+ set undodir^=~/vimfiles/cache/undo//
+ endif
+
+endif
+
" Let me move beyond buffer text in visual block mode
if has('virtualedit')
set virtualedit+=block