Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Turn lines into printf statements

License

NotificationsYou must be signed in to change notification settings

mptre/vim-printf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-printf

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.

Installation

Use the package feature introduced in Vim 8.0 or do what you did for the otherplugins you have installed.

FAQ

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:Printf command to a key?

Add this to your vimrc and replace<Leader>p with your desired key:

nnoremap<Leader>p :Printf<CR>

License

Copyright (c) 2018 Anton Lindqvist.Distributed under the MIT license.

About

Turn lines into printf statements

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp