From 4ef9e937c0ec1f5e6da95ad6df3e5343c326f9df Mon Sep 17 00:00:00 2001 From: Chiel ten Brinke Date: Thu, 10 Mar 2016 17:18:15 +0100 Subject: [PATCH] Don't touch &formatprg. Makes sure that gq can always be used in its default fashion. --- README.md | 2 +- plugin/autoformat.vim | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7687593..8ac8355 100644 --- a/README.md +++ b/README.md @@ -245,7 +245,7 @@ If you have any suggestions on this plugin or on this readme, if you have some n * *Backward incompatible patch!* * Multiple formatters per filetype are now supported. * Configuration variable names changed. -* `gq` is no longer supported. +* Using `gq` as alias for `:Autoformat` is no longer supported. * `:Autoformat` now suppports ranges. * Composite filetypes are fully supported. diff --git a/plugin/autoformat.vim b/plugin/autoformat.vim index d95244c..96edfce 100644 --- a/plugin/autoformat.vim +++ b/plugin/autoformat.vim @@ -97,7 +97,7 @@ function! s:TryAllFormatters(...) range " Eval twice, once for getting definition content, " once for getting the final expression - let &formatprg = eval(eval(formatdef_var)) + let b:formatprg = eval(eval(formatdef_var)) " Detect if +python or +python3 is available, and call the corresponding function if !has("python") && !has("python3") @@ -156,7 +156,7 @@ import vim, subprocess, os from subprocess import Popen, PIPE text = os.linesep.join(vim.current.buffer[:]) + os.linesep -formatprg = vim.eval('&formatprg') +formatprg = vim.eval('b:formatprg') verbose = bool(int(vim.eval('verbose'))) env = os.environ.copy() if int(vim.eval('exists("g:formatterpath")')): @@ -204,7 +204,7 @@ import vim, subprocess, os from subprocess import Popen, PIPE text = bytes(os.linesep.join(vim.current.buffer[:]) + os.linesep, 'utf-8') -formatprg = vim.eval('&formatprg') +formatprg = vim.eval('b:formatprg') verbose = bool(int(vim.eval('verbose'))) env = os.environ.copy() if int(vim.eval('exists("g:formatterpath")')):