Escape filename in buftabline
authorSergey Matveev <stargrave@stargrave.org>
Thu, 13 Aug 2020 09:29:08 +0000 (12:29 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 13 Aug 2020 09:29:08 +0000 (12:29 +0300)
vim/.vim/plugin/buftabline.vim

index 6c4d9336bbdbc1d63ed2c8b52723bb47488d6d5c..47a31da2e97f33fb063cf99bc429d4a92660f5ba 100644 (file)
@@ -6,7 +6,7 @@ function! BufTabline()
     for buf in split(bufsRaw, "\n")[:16]
         let leftIdx = stridx(buf, '"')
         let rightIdx = strridx(buf, '"')
-        let filename = buf[leftIdx + 1 : rightIdx - 1]
+        let filename = substitute(buf[leftIdx + 1 : rightIdx - 1], "%", "%%", "g")
         let linenum = split(buf[rightIdx:], " ")[-1]
         let attrs = split(buf[:leftIdx-1], '\s\+')
         let attrs = map(attrs, 'substitute(v:val, "%", "%%", "g")')