About: Simple Macros to quote and unquote a word   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

The tip doesn't work for single character words, but this does: nnoremap qw :silent! normal "zyiw:let @z="'".@z."'"cwzb nnoremap qd :silent! normal "zyiw:let @z="\"".@z."\""cwzb Blows away the "z" register, though. I use the following for quoting visual selections (keeps all registers intact) vmap qs :call Quote("'") vmap qd :call Quote('"') function! Quote(quote) let save = @" silent normal gvy let @" = a:quote . @" . a:quote silent normal gvp let @" = save endfunction Here is what I think is the nicest solution for a word-quoting macro. nnoremap " ciw""" vnoremap " c"""

AttributesValues
rdfs:label
  • Simple Macros to quote and unquote a word
rdfs:comment
  • The tip doesn't work for single character words, but this does: nnoremap qw :silent! normal "zyiw:let @z="'".@z."'"cwzb nnoremap qd :silent! normal "zyiw:let @z="\"".@z."\""cwzb Blows away the "z" register, though. I use the following for quoting visual selections (keeps all registers intact) vmap qs :call Quote("'") vmap qd :call Quote('"') function! Quote(quote) let save = @" silent normal gvy let @" = a:quote . @" . a:quote silent normal gvp let @" = save endfunction Here is what I think is the nicest solution for a word-quoting macro. nnoremap " ciw""" vnoremap " c"""
Version
  • 6(xsd:integer)
dbkwik:vim/property/wikiPageUsesTemplate
Previous
  • 843(xsd:integer)
Text
  • surround.vim
Author
  • Anders Thøgersen
Complexity
  • basic
Created
  • 2005(xsd:integer)
ID
  • 844(xsd:integer)
  • 1697(xsd:integer)
NEXT
  • 846(xsd:integer)
Rating
  • 1(xsd:integer)
abstract
  • The tip doesn't work for single character words, but this does: nnoremap qw :silent! normal "zyiw:let @z="'".@z."'"cwzb nnoremap qd :silent! normal "zyiw:let @z="\"".@z."\""cwzb Blows away the "z" register, though. I use the following for quoting visual selections (keeps all registers intact) vmap qs :call Quote("'") vmap qd :call Quote('"') function! Quote(quote) let save = @" silent normal gvy let @" = a:quote . @" . a:quote silent normal gvp let @" = save endfunction Here is what I think is the nicest solution for a word-quoting macro. " Quote a word consisting of letters from iskeyword. nnoremap qw :call Quote('"') nnoremap qs :call Quote("'") nnoremap wq :call UnQuote() function! Quote(quote) normal mz exe 's/\(\k*\%#\k*\)/' . a:quote . '\1' . a:quote . '/' normal `zl endfunction function! UnQuote() normal mz exe 's/["' . "'" . ']\(\k*\%#\k*\)[' . "'" . '"]/\1/' normal `z endfunction Surround current word or visually selected text with double quotes: nnoremap " ciw""" vnoremap " c"""
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software