Vim Tips Wiki
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 32: Line 32:
 
endif
 
endif
 
endfunction
 
endfunction
nnoremap di" :call JHStringObject('d','"','i')<CR>
+
nnoremap di" :call JHStringObject('d','"','i')&lt;CR&gt;
nnoremap di' :call JHStringObject('d',"'",'i')<CR>
+
nnoremap di' :call JHStringObject('d',"'",'i')&lt;CR&gt;
nnoremap da" :call JHStringObject('d','"','a')<CR>
+
nnoremap da" :call JHStringObject('d','"','a')&lt;CR&gt;
nnoremap da' :call JHStringObject('d',"'",'a')<CR>
+
nnoremap da' :call JHStringObject('d',"'",'a')&lt;CR&gt;
nnoremap ci" :call JHStringObject('c','"','i')<CR>
+
nnoremap ci" :call JHStringObject('c','"','i')&lt;CR&gt;
nnoremap ci' :call JHStringObject('c',"'",'i')<CR>
+
nnoremap ci' :call JHStringObject('c',"'",'i')&lt;CR&gt;
nnoremap ca" :call JHStringObject('c','"','a')<CR>
+
nnoremap ca" :call JHStringObject('c','"','a')&lt;CR&gt;
nnoremap ca' :call JHStringObject('c',"'",'a')<CR>
+
nnoremap ca' :call JHStringObject('c',"'",'a')&lt;CR&gt;
nnoremap yi" :call JHStringObject('y','"','i')<CR>
+
nnoremap yi" :call JHStringObject('y','"','i')&lt;CR&gt;
nnoremap yi' :call JHStringObject('y',"'",'i')<CR>
+
nnoremap yi' :call JHStringObject('y',"'",'i')&lt;CR&gt;
nnoremap ya" :call JHStringObject('y','"','a')<CR>
+
nnoremap ya" :call JHStringObject('y','"','a')&lt;CR&gt;
nnoremap ya' :call JHStringObject('y',"'",'a')<CR>
+
nnoremap ya' :call JHStringObject('y',"'",'a')&lt;CR&gt;
 
</pre>
 
</pre>
   
Line 61: Line 61:
 
execute c
 
execute c
 
endfunction
 
endfunction
omap a" :call StringObject('"','a')<CR>
+
omap a" :call StringObject('"','a')&lt;cr&gt;
omap i" :call StringObject('"','i')<CR>
+
omap i" :call StringObject('"','i')&lt;cr&gt;
omap a' :call StringObject("'",'a')<CR>
+
omap a' :call StringObject("'",'a')&lt;cr&gt;
omap i' :call StringObject("'",'i')<CR>
+
omap i' :call StringObject("'",'i')&lt;cr&gt;
 
</pre>
 
</pre>
   
 
Using this method allows you to use all the built-in Vim operators on StringObjects without defining four mappings for each operator.
 
Using this method allows you to use all the built-in Vim operators on StringObjects without defining four mappings for each operator.
   
To get equivalent visual mode mappings add <Esc> to the start:
+
To get equivalent visual mode mappings add &lt;esc&gt; to the start:
   
 
<pre>
 
<pre>
vmap a" <Esc>:call StringObject('"','a')<CR>
+
vmap a" &lt;esc&gt;:call StringObject('"','a')&lt;cr&gt;
vmap i" <Esc>:call StringObject('"','i')<CR>
+
vmap i" &lt;esc&gt;:call StringObject('"','i')&lt;cr&gt;
vmap a' <Esc>:call StringObject("'",'a')<CR>
+
vmap a' &lt;esc&gt;:call StringObject("'",'a')&lt;cr&gt;
vmap i' <Esc>:call StringObject("'",'i')<CR>
+
vmap i' &lt;esc&gt;:call StringObject("'",'i')&lt;cr&gt;
 
</pre>
 
</pre>
   
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)