Wikia

Vim Tips Wiki

Changes: Script:2775

Edit

Back to page

(adjust Template:ScriptComments to remove id as no longer needed; minor tweaks)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 21: Line 21:
   
 
===Enable/Disable the plug-in===
 
===Enable/Disable the plug-in===
*<tt>let LogpadEnabled = ''value''</tt>
+
*<code>let LogpadEnabled = ''value''</code>
 
**enables/disables logpad
 
**enables/disables logpad
 
**default value: 1
 
**default value: 1
Line 28: Line 28:
   
 
===Automatically switch to insert mode===
 
===Automatically switch to insert mode===
*<tt>let LogpadInsert = ''value''</tt>
+
*<code>let LogpadInsert = ''value''</code>
 
**automatically enables ''&insertmode'' when a new log entry is created
 
**automatically enables ''&insertmode'' when a new log entry is created
 
**default value: 0
 
**default value: 0
Line 35: Line 35:
   
 
===Add more line breaks===
 
===Add more line breaks===
*<tt>let LogpadLineBreak = ''value''</tt>
+
*<code>let LogpadLineBreak = ''value''</code>
 
**adds an empty line before a new log entry
 
**adds an empty line before a new log entry
 
**default value: 0 (Windows Notepad behavior)
 
**default value: 0 (Windows Notepad behavior)
Line 42: Line 42:
   
 
===Enable me to write some intro===
 
===Enable me to write some intro===
*<tt>let LogpadIgnoreNotes = ''value''</tt>
+
*<code>let LogpadIgnoreNotes = ''value''</code>
 
**allows adding notes before the first log entry
 
**allows adding notes before the first log entry
 
**default value: 0
 
**default value: 0
Line 49: Line 49:
   
 
===Ignore a log file's read-only state===
 
===Ignore a log file's read-only state===
*<tt>let LogpadIgnoreReadOnly = ''value''</tt>
+
*<code>let LogpadIgnoreReadOnly = ''value''</code>
 
**allows logpad to ignore a file's read-only flag
 
**allows logpad to ignore a file's read-only flag
 
**default value: 0
 
**default value: 0

Latest revision as of 09:47, July 14, 2012

Use this page to discuss script 2775 logpad: emulate Notepad's logging functionality

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

logpad.vim is a plug-in that adds Notepad.exe's logging functionality to Vim. It was inspired by this German weblog posting.

What does it do?Edit

Let me explain what is actually meant by using notepad.exe:

Imagine you want to, let's say, log some things happening outside, UFOs flying by or something. Open notepad.exe, write .LOG as the first line and save it.

Logpad.notepad.1

Now reopen the file. The editor added a time stamp with a new line where you can take your notes, like "another UFO! THEY COME! SCREEEEAAAAAM!", and it adds a new one every time you open the file again:

Logpad.notepad.2

And this is exactly what logpad.vim does!

ConfigurationEdit

This plug-in has some options you can tweak by setting them in your Vim configuration files. Allowed values for value are 0 and 1.

Enable/Disable the plug-inEdit

  • let LogpadEnabled = value
    • enables/disables logpad
    • default value: 1

If you set this option to "0", logpad.vim will do nothing at all.

Automatically switch to insert modeEdit

  • let LogpadInsert = value
    • automatically enables &insertmode when a new log entry is created
    • default value: 0

Given that you only want to add new entries when using logpad.vim, you may want to enable this option. Note that you will have to use C-o then in order to use Vim's mighty input key bindings.

Add more line breaksEdit

  • let LogpadLineBreak = value
    • adds an empty line before a new log entry
    • default value: 0 (Windows Notepad behavior)

By default, no line breaks are added, so your log might look a bit confusing after adding a few entries. If you enable this option, you will get a new line break before all entries (even before the first one).

Enable me to write some introEdit

  • let LogpadIgnoreNotes = value
    • allows adding notes before the first log entry
    • default value: 0

Logpad.vim allows you to write some introductional text before your actual log, so everything between .LOG and the first time stamp is considered valid. You can also use this option to stop the plug-in from processing certain files by just writing some dummy text below the first line and not changing this option to 1.

Ignore a log file's read-only stateEdit

  • let LogpadIgnoreReadOnly = value
    • allows logpad to ignore a file's read-only flag
    • default value: 0

Under certain conditions it might be possible that your log file is read-only even if you actually have write access to it. If this happens, set this option to 1, so logpad.vim does not care about the read-only flag.

Known issuesEdit

Logpad.vim's timestamps are not "portable", so it won't recognize German timestamps on an English system. For now you'd better avoid sharing them.

CommentsEdit

Around Wikia's network

Random Wiki