- Notifications
You must be signed in to change notification settings - Fork5
Turn lines into printf statements
License
mptre/vim-printf
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Turn a line consisting of tokens separated by commas into a printf statement.A token is recognized as a sequence of any characters except for whitespace andcomma but with respect to balanced brackets and parentheses.
Use the package feature introduced in Vim 8.0 or do what you did for the otherplugins you have installed.
How do I change the pattern for a filetype?
The pattern used,specified byb:printf_pattern,can be altered for a given filetype.Below is a list of sensible patterns for different filetypes.If your favorite filetype is missing,feel free to submit a pull request.
auFileTypeawkletb:printf_pattern='printf "%s\n", %s'auFileTypecletb:printf_pattern='printf("%%s: %d\n", __func__, %s);'auFileTypegoletb:printf_pattern='fmt.Printf("%+v\n", %s)'auFileTypejavaletb:printf_pattern='System.out.format("%d%%n", %s);'auFileTypepythonletb:printf_pattern='print("%s" %% (%s))'auFileTyperubyletb:printf_pattern='printf("%p\n", %s)'auFileTypeshletb:printf_pattern='printf''%s\n'' %s'auFileTypevimletb:printf_pattern='echom printf("%s", %s)'
See thedocumentation for further reference on how the pattern is interpreted.
How do I map the
:Printfcommand to a key?
Add this to your vimrc and replace<Leader>p with your desired key:
nnoremap<Leader>p :Printf<CR>
Copyright (c) 2018 Anton Lindqvist.Distributed under the MIT license.
About
Turn lines into printf statements
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors2
Uh oh!
There was an error while loading.Please reload this page.
