├── CHANGELOG.md ├── file_changed.png ├── nice_message.png ├── README.md ├── plugin └── no_conflict.vim └── LICENSE.md /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### master 4 | - plugin working 5 | - change plugin name 6 | -------------------------------------------------------------------------------- /file_changed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vim-utils/vim-interruptless/HEAD/file_changed.png -------------------------------------------------------------------------------- /nice_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vim-utils/vim-interruptless/HEAD/nice_message.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # interruptless.vim 2 | 3 | When both file on disk and vim's buffer are changed you'll be presented with 4 | this: 5 | 6 | ![annoying scenario](/file_changed.png) 7 | 8 | Interruption, annoying, not nice. 9 | 10 | This plugin will make the situation better by preventing the interruption, and 11 | instead you'll be presented with just a message: 12 | 13 | ![nice message](/nice_message.png) 14 | 15 | ### Licence 16 | 17 | [MIT](LICENSE.md) 18 | -------------------------------------------------------------------------------- /plugin/no_conflict.vim: -------------------------------------------------------------------------------- 1 | if exists('g:loaded_interruptless') && g:loaded_interruptless 2 | finish 3 | endif 4 | let g:loaded_interruptless = 1 5 | 6 | let s:save_cpo = &cpo 7 | set cpo&vim 8 | 9 | function! s:file_changed() 10 | let v:fcs_choice = 'just do nothing' 11 | let filename = expand("") 12 | " how to detect file created event? 13 | if v:fcs_reason ==# 'conflict' 14 | echohl WarningMsg 15 | echo 'Warning: File "'.filename.'" has changed and the buffer was changed in Vim as well' 16 | echohl None 17 | endif 18 | endfunction 19 | 20 | au FileChangedShell * call file_changed() 21 | 22 | let &cpo = s:save_cpo 23 | unlet s:save_cpo 24 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (C) Bruno Sutic 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included 11 | in all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 19 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | --------------------------------------------------------------------------------