diff options
| author | Michiel van den Heuvel <michielvdnheuvel@gmail.com> | 2023-07-13 15:10:50 +0200 |
|---|---|---|
| committer | Michiel van den Heuvel <michielvdnheuvel@gmail.com> | 2023-07-20 15:58:11 +0200 |
| commit | dcbe70a0cb96639f402f3d7982547906a6dcf82a (patch) | |
| tree | 33af6eddfa820b314f6dbf36b76aec728d0a3378 | |
| parent | 7f8410ff4b0de20caeb240a40ae80588d1a6e538 (diff) | |
| download | vis-lspc-dcbe70a0cb96639f402f3d7982547906a6dcf82a.tar.gz vis-lspc-dcbe70a0cb96639f402f3d7982547906a6dcf82a.zip | |
Offer to save current file before opening new one
| -rw-r--r-- | init.lua | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -406,6 +406,14 @@ local function vis_open_doc_pos(doc_pos, cmd, win) end assert(cmd) if vis.win.file.path ~= doc_pos.file then + if vis.win.file.modified and cmd == 'e' then + if lspc_confirm('Save currently open file:') then + vis:command('w') + else + vis:info('Not opening new file, current file has unsaved changes') + return + end + end vis:command(string.format('%s \'%s\'', cmd, doc_pos.file)) vis.win.selection:to(doc_pos.line, doc_pos.col) vis:command('lspc-open') |
