Fix some issues with fzy integration in vim
3903e85fa40777c3363b632be36d77ad8797531d
1 parent
1f607f80
.vimrc
+9 -3
| 165 | 165 | let tmp = tempname() |
|
| 166 | 166 | let command = "ag -g '' | fzy -l " . lines . " > " . tmp |
|
| 167 | 167 | let opts = { 'tmp': tmp } |
|
| 168 | 168 | ||
| 169 | 169 | function! opts.on_exit(id, code) |
|
| 170 | - | close |
|
| 171 | - | let result = readfile(self.tmp) |
|
| 172 | - | execute 'edit' fnameescape(join(result)) |
|
| 170 | + | bdelete! |
|
| 171 | + | if a:code == 0 |
|
| 172 | + | if filereadable(self.tmp) |
|
| 173 | + | let result = readfile(self.tmp) |
|
| 174 | + | if !empty(result) |
|
| 175 | + | execute 'edit' fnameescape(join(result)) |
|
| 176 | + | endif |
|
| 177 | + | endif |
|
| 178 | + | endif |
|
| 173 | 179 | endfunction |
|
| 174 | 180 | ||
| 175 | 181 | below new |
|
| 176 | 182 | execute 'resize' lines + 1 |
|
| 177 | 183 | call termopen(command, opts) |