diff options
author | ZyX <kp-pav@yandex.ru> | 2015-08-31 21:45:33 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2015-11-01 21:27:28 +0300 |
commit | 9037a180defe3e7344e2eb9843cfa20a43d6f59f (patch) | |
tree | 29173f45a9a3282ab8e4943bbaa8ed791f1aca35 /runtime/plugin | |
parent | 8d9063bb2af76fe196c88cf3dc5a8da15ad9e640 (diff) | |
download | rneovim-9037a180defe3e7344e2eb9843cfa20a43d6f59f.tar.gz rneovim-9037a180defe3e7344e2eb9843cfa20a43d6f59f.tar.bz2 rneovim-9037a180defe3e7344e2eb9843cfa20a43d6f59f.zip |
runtime: Add [ft]plugin/shada.vim files that automatically open .shada
Diffstat (limited to 'runtime/plugin')
-rw-r--r-- | runtime/plugin/shada.vim | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/runtime/plugin/shada.vim b/runtime/plugin/shada.vim new file mode 100644 index 0000000000..ae08e01dcb --- /dev/null +++ b/runtime/plugin/shada.vim @@ -0,0 +1,39 @@ +if exists('g:loaded_shada_plugin') + finish +endif +let g:loaded_shada_plugin = 1 + +augroup ShaDaCommands + autocmd! + autocmd BufReadCmd *.shada,*.shada.tmp.[a-z] + \ :if !empty(v:cmdarg)|throw '++opt not supported'|endif + \ |call setline('.', shada#get_strings(readfile(expand('<afile>'),'b'))) + \ |setlocal filetype=shada + autocmd FileReadCmd *.shada,*.shada.tmp.[a-z] + \ :if !empty(v:cmdarg)|throw '++opt not supported'|endif + \ |call append("'[", shada#get_strings(readfile(expand('<afile>'), 'b'))) + autocmd BufWriteCmd *.shada,*.shada.tmp.[a-z] + \ :if !empty(v:cmdarg)|throw '++opt not supported'|endif + \ |if writefile(shada#get_binstrings(getline(1, '$')), + \expand('<afile>'), 'b') == 0 + \ | let &l:modified = (expand('<afile>') is# bufname(+expand('<abuf>')) + \? 0 + \: stridx(&cpoptions, '+') != -1) + \ |endif + autocmd FileWriteCmd *.shada,*.shada.tmp.[a-z] + \ :if !empty(v:cmdarg)|throw '++opt not supported'|endif + \ |call writefile( + \shada#get_binstrings(getline(min([line("'["), line("']")]), + \max([line("'["), line("']")]))), + \expand('<afile>'), + \'b') + autocmd FileAppendCmd *.shada,*.shada.tmp.[a-z] + \ :if !empty(v:cmdarg)|throw '++opt not supported'|endif + \ |call writefile( + \shada#get_binstrings(getline(min([line("'["), line("']")]), + \max([line("'["), line("']")]))), + \expand('<afile>'), + \'ab') + autocmd SourceCmd *.shada,*.shada.tmp.[a-z] + \ :execute 'rshada' fnameescape(expand('<afile>')) +augroup END |