mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] Setup vim folding in the logfile automatically
@ 2012-01-22  9:12 Bernhard Walle
  2012-01-22  9:34 ` Michael Olbrich
  0 siblings, 1 reply; 3+ messages in thread
From: Bernhard Walle @ 2012-01-22  9:12 UTC (permalink / raw)
  To: ptxdist

This patch adds the modeline

        # vim: set fdm=markers fdl=1:

to the Logfile. There's already a modeline for Emacs in the file, so it
shouldn't be too annoying for users that don't use vim.

The first setting tells vim to recognize the fold markers '{{{' and
'}}}' in the logfile (which doesn't have any file type in vim).

However, with this setting vim automatically closes all folds, including
the first '{{{' which only is for Emacs. That's why I add fdl=1, which
results in vim opening the file visible one fold per ptxdist run.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
 bin/ptxdist |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 73235c4..5528a14 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -2270,6 +2270,9 @@ setup_logfile()
 	if [ \! -e "${PTX_LOGFILE}" ]; then
 		# let emacs outline mode be compatible to vi's fold mode
 		echo -e "# -*- mode:outline; outline-regexp:\"{""{{\" -*-\n" > "${PTX_LOGFILE}"
+		# help vim to recognise the fold markers and expand the first level of folding
+		# which in fact is the Emacs setting above
+		echo "# vim: set fdm=markers fdl=1:" > "${PTX_LOGFILE}"
 	fi
 
 	#
-- 
1.7.7.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ptxdist] [PATCH] Setup vim folding in the logfile automatically
  2012-01-22  9:12 [ptxdist] [PATCH] Setup vim folding in the logfile automatically Bernhard Walle
@ 2012-01-22  9:34 ` Michael Olbrich
  2012-01-22 10:02   ` Bernhard Walle
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Olbrich @ 2012-01-22  9:34 UTC (permalink / raw)
  To: ptxdist

On Sun, Jan 22, 2012 at 10:12:29AM +0100, Bernhard Walle wrote:
> This patch adds the modeline
> 
>         # vim: set fdm=markers fdl=1:
> 
> to the Logfile. There's already a modeline for Emacs in the file, so it
> shouldn't be too annoying for users that don't use vim.
> 
> The first setting tells vim to recognize the fold markers '{{{' and
> '}}}' in the logfile (which doesn't have any file type in vim).
> 
> However, with this setting vim automatically closes all folds, including
> the first '{{{' which only is for Emacs. That's why I add fdl=1, which
> results in vim opening the file visible one fold per ptxdist run.

I like it.

> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> ---
>  bin/ptxdist |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index 73235c4..5528a14 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -2270,6 +2270,9 @@ setup_logfile()
>  	if [ \! -e "${PTX_LOGFILE}" ]; then
>  		# let emacs outline mode be compatible to vi's fold mode
>  		echo -e "# -*- mode:outline; outline-regexp:\"{""{{\" -*-\n" > "${PTX_LOGFILE}"
> +		# help vim to recognise the fold markers and expand the first level of folding
> +		# which in fact is the Emacs setting above
> +		echo "# vim: set fdm=markers fdl=1:" > "${PTX_LOGFILE}"

s/markers/marker/

At least with my vim.

Michael

>  	fi
>  
>  	#
> -- 
> 1.7.7.4
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ptxdist] [PATCH] Setup vim folding in the logfile automatically
  2012-01-22  9:34 ` Michael Olbrich
@ 2012-01-22 10:02   ` Bernhard Walle
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Walle @ 2012-01-22 10:02 UTC (permalink / raw)
  To: ptxdist

This patch adds the modeline

        # vim: set fdm=marker fdl=1:

to the Logfile. There's already a modeline for Emacs in the file, so it
shouldn't be too annoying for users that don't use vim.

The first setting tells vim to recognize the fold markers '{{{' and
'}}}' in the logfile (which doesn't have any file type in vim).

However, with this setting vim automatically closes all folds, including
the first '{{{' which only is for Emacs. That's why I add fdl=1, which
results in vim opening the file visible one fold per ptxdist run.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
v2: Use marker, not markers.

 bin/ptxdist |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 73235c4..74a52ad 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -2270,6 +2270,9 @@ setup_logfile()
 	if [ \! -e "${PTX_LOGFILE}" ]; then
 		# let emacs outline mode be compatible to vi's fold mode
 		echo -e "# -*- mode:outline; outline-regexp:\"{""{{\" -*-\n" > "${PTX_LOGFILE}"
+		# help vim to recognise the fold markers and expand the first level of folding
+		# which in fact is the Emacs setting above
+		echo "# vim: set fdm=marker fdl=1:" > "${PTX_LOGFILE}"
 	fi
 
 	#
-- 
1.7.7.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-22 10:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-22  9:12 [ptxdist] [PATCH] Setup vim folding in the logfile automatically Bernhard Walle
2012-01-22  9:34 ` Michael Olbrich
2012-01-22 10:02   ` Bernhard Walle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox