Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Transferred to Fossil |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | trunk |
Files: | files | file ages | folders |
SHA3-256: |
854628f60b53dcef7b4f23734ac15f04 |
User & Date: | Cthulhux 2019-09-27 20:59:15 |
Context
2019-09-27
| ||
20:59 | Transferred to Fossil Leaf check-in: 854628f60b user: Cthulhux tags: trunk | |
20:55 | initial empty check-in check-in: 83854e750c user: Cthulhux tags: trunk | |
Changes
Added README.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | # logpad.vim That one Notepad feature - for Vim. ## Huh? A couple of years ago, I wrote a plug-in that would allow me to use Microsoft's [Notepad logging](https://www.howtogeek.com/258545/how-to-use-notepad-to-create-a-dated-log-or-journal-file/) from inside Vim. This is it. ## Usage Create a new file, write .LOG as the first line and save it. Every time you reopen the file, a new line with the current timestamp is added, so you can easily maintain a chronologic log of your tasks. By default, this plugin works the same way as the original Notepad. You can modify certain aspects of it by setting the following variables: `let LogpadEnabled = [ 0 / 1 ]` * enables/disables logpad * default value: 1 `let LogpadInsert = [ 0 / 1 ]` * automatically enables &insertmode when a new log entry is created * default value: 0 `let LogpadLineBreak = [ 0 / 1 ]` * adds an empty line before a new log entry * default value: 0 (Windows Notepad behavior) `let LogpadIgnoreNotes = [ 0 / 1 ]` * allows adding notes before the first log entry * default value: 0 `let LogpadIgnoreReadOnly = [ 0 / 1 ]` * allows logpad to ignore a file's read-only flag * default value: 0 ## Installation Download the `logpad.vim` file. Put it into your plugins directory. Use a package manager of your choice to load it. ## Donations (optional) `logpad.vim` is free software by the terms of the [WTFPL](http://www.wtfpl.net/txt/copying/). As some people - including myself - like to contribute money for a good cause anyway, here are two possible options for you: ### Donate money to the nature: Both [Kākāpō Recovery](http://kakaporecovery.org.nz/) and the [WWF](https://support.wwf.org.uk/adopt-a-panda) do a pretty good job at trying to keep species alive. You are invited to join their efforts. ### Donate money to me: Yes, I like money as well. [](https://www.paypal.me/GebtmireuerGeld/) |
Added logpad.vim.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | " ---------[ INFORMATION ]--------- " " Vim plugin for emulating Windows Notepad's logging functionality. " Maintainer: Sven Knurr <der_tuxman@arcor.de> " Version: 1.6 " Last Change: 2013 Jul 14 " " --------[ HOW TO USE IT ]-------- " " Create a new text file. Insert .LOG. Save it. Then reopen it. " Now you have a timestamped log file. :-) " " --------[ CONFIGURATION ]-------- " " Optional values to set in your .vimrc file: " " let LogpadEnabled = [ 0 / 1 ] " >> enables/disables logpad " >> default value: 1 " " let LogpadInsert = [ 0 / 1 ] " >> automatically enables insert mode when a new log entry is created " >> default value: 0 " " let LogpadLineBreak = [ 0 / 1 ] " >> adds an empty line before a new log entry " >> default value: 0 (Windows Notepad behavior) " " let LogpadIgnoreNotes = [ 0 / 1 ] " >> allows adding notes before the first log entry " >> default value: 0 " " let LogpadIgnoreReadOnly = [ 0 / 1 ] " >> allows logpad to ignore a file's read-only flag " >> default value: 0 " " -----------[ CHANGES ]----------- " " v1.6: fix: logpad.vim was not detecting some timestamps correctly " v1.5: insert mode code improvement and using function! now " v1.4: added check and switch for read-only flag " v1.3: added support for GetLatestVimScripts, removed initial cursor() call " v1.2: fix: converted logpad.vim to UNIX format (was not working outside Windows) " v1.1: fix: the LogpadLineBreak setting also affects the single empty line below ".LOG" " v1.0: initial release. " " -----------[ CREDITS ]----------- " " This plugin was inspired by a German weblog posting, available at: " http://schwerdtfegr.wordpress.com/2009/08/27/eine-notepad-funkzjon-die-man-missen-lernt/ " Thanks to the guys in #vim (freenode.net) for basic help. " " Contributors: " . timestamping clues: DHulme @ freenode.net (pre-v1.6) " . various patches: Talha Mansoor " " ---------[ HERE WE GO! ]--------- function! LogpadInit() " check the configuration, set it (and exit) if needed if !exists('g:LogpadEnabled') | let g:LogpadEnabled = 1 | endif if !exists('g:LogpadInsert') | let g:LogpadInsert = 0 | endif if !exists('g:LogpadLineBreak') | let g:LogpadLineBreak = 0 | endif if !exists('g:LogpadIgnoreNotes') | let g:LogpadIgnoreNotes = 0 | endif if !exists('g:LogpadIgnoreReadOnly') | let g:LogpadIgnoreReadOnly = 0 | endif if g:LogpadEnabled == 0 | return | endif if g:LogpadIgnoreReadOnly == 0 && &readonly == 1 | return | endif " main part if getline(1) =~ '^\.LOG$' " 3 letters for day name - space - 3 letters for month - space - an optional space that occurs if day is single digit - one or two digit for day - space - hour:min:seconds - space - year let s:timestampformat = '\(\a\{3}\s\)\{2}\s\{0,1}\d\{1,2}\s\(\d\{2}:\)\{2}\d\{2}\s\d\{4}' if nextnonblank(2) > 0 if getline(nextnonblank(2)) !~ s:timestampformat && g:LogpadIgnoreNotes == 0 " there are following lines, but these aren't timestamps, " obviously the user doesn't want to create a log then... return endif endif " add a new entry let s:failvar = 0 while s:failvar != 1 if g:LogpadLineBreak == 1 " add a single empty divider line if requested let s:failvar = append(line('$'), "") endif let s:failvar = append(line('$'), strftime("%c")) let s:failvar = append(line('$'), "") " go to the last line call cursor(line('$'), 0) " if we're here, everything worked so far; let's exit let s:failvar = 1 endwhile " enter insert mode if enabled if g:LogpadInsert == 1 execute ":startinsert" endif endif endfunction autocmd BufReadPost * call LogpadInit() " -------[ COMPAT COMMENTS ]------- " GetLatestVimScripts: 2775 1 :AutoInstall: logpad.vim " vim:ft=vim:sw=4:sts=4:et |