ZyX_I avatar ZyX_I committed f3b2b3a

Delete text before creating commit message

Closes #85

Comments (0)

Files changed (1)


     if empty(message)
         call s:_r.run(((a:0 && a:1 isnot 0)? a:1 : 'silent new'),
                     \ 'commit', a:repo, user, date, cb, a:files)
+        " Workaround problem with templates created on BufNewFile. Namely if you 
+        " try to commit a ebuild (or something that ends with a ".ebuild") you 
+        " will see ebuild template inserted
+        %delete _
         let bvar=s:_r.bufvars[bufnr('%')]
         if a:0>1 && a:2 isnot 0
             call extend(bvar, a:2)
         let bvar.revstatus=revstatus
         "▶2 Add previous message
+        let addedprevmessage=0
         if exists('g:AuPreviousRepoPath') &&
                     \   g:AuPreviousRepoPath is# a:repo.path &&
                     \exists('g:AuPreviousTip') &&
                     \   g:AuPreviousTip is# a:repo.functions.gettiphex(a:repo)&&
+            let addedprevmessage=1
             call setline('.', split(g:AuPreviousCommitMessage, "\n", 1))
             call cursor(line('$'), col([line('$'), '$']))
             unlet g:AuPreviousRepoPath g:AuPreviousTip g:AuPreviousCommitMessage
         call sort(fmessage)
         call append('.', fmessage)
+        if !addedprevmessage
+            setlocal nomodified
+        endif
         "▶2 Open diff
         if s:_f.getoption('commitautoopendiff')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.