File: shada.vim

package info (click to toggle)
neovim 0.1.7-4%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 39,060 kB
  • sloc: ansic: 176,052; python: 2,091; awk: 709; sh: 528; perl: 374; makefile: 295; exp: 33; ruby: 8
file content (39 lines) | stat: -rw-r--r-- 1,778 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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