From 77ac08ea928cc68d283e4bb5d768a9c5d390c585 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Thu, 7 Jan 2016 18:38:30 +0100 Subject: [PATCH] Debugging: verbosity --- CHANGELOG.md | 4 ++++ README.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed0c969..e6a960f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- Debugging: [Verbosity](README.md#verbosity) + ## [1.1] - 2016-01-07 ### Added diff --git a/README.md b/README.md index 7834223..9919ac2 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ added every day. Things about to be added can be found here: - [General tips](#general-tips) - [Profiling startup time](#profiling-startup-time) - [Profiling at runtime](#profiling-at-runtime) +- [Verbosity](#verbosity) #### [Miscellaneous](#miscellaneous-1) @@ -834,6 +835,48 @@ two different sections `FUNCTIONS SORTED ON TOTAL TIME` and `FUNCTIONS SORTED ON SELF TIME` that are worth gold. On a quick glance you can see, if a certain function is taking too long. +#### Verbosity + +Another useful way for observing what Vim is currently doing is increasing the +verbosity level. Currently Vim supports 9 different levels. See `:h 'verbose'` +for the full list. + +```viml +:e /tmp/foo +:set verbose=2 +:w +:set verbose=0 +``` + +This would show all the files that get sourced, e.g. the undo file or various +plugins that act on saving. + +If you only want increase verbosity for a single command, there's also +`:verbose`, which simply gets put in front of any other command. It takes the +verbosity level as count and defaults to 1: + +```viml +:verb set verbose +" verbose=1 +:10verb set verbose +" verbose=10 +``` + +It's very often used with its default verbosity level 1 to show where an option +was set last: + +```viml +:verb set ai? +" Last set from ~/.vim/vimrc +``` + +Naturally, the higher the verbosity level the more overwhelming the output. But +fear no more, you can simply redirect the output to a file: + +```viml +:set verbosefile=/tmp/foo | 15verbose echo "foo" | vsplit /tmp/foo +``` + ## Miscellaneous #### Vim distributions