Automatic double single quote ' in dreamweaver cs5.5 - dreamweaver

Is there a way to disable automatic write of the second single quote ' when you press the first ' ?
Dreamweaver when you type ' it adds automatically the second '.
Any way to disable this?

Edit, Preferences, Code Hints. Uncheck Jquery code hints.

Never heard that character called 'apex' before, typically heard it called single quote or apostrophe, however, no, you cannot turn this feature off.

Related

Substitute in vim, with special characters

I am trying to use substitute command in vim to enclose all occurences of a particular pattern
\cite{author1}
\cite{author2}
with
(\cite{author1})
(\cite{author2})
Based on other answers in stack exchangeI used the following vim command
%s/\\cite{(\w\+)}/(\\cite{\1})/g
But, no luck. It says "no matches found". I put two back slashes, one of which is supposed to be the escape character. Kindly help.
I know I could use some other editor and finish the job, but I want to know my mistake. Thank you.
please escape ()
%s/\\cite{\(\w\+\)}/(\\cite{\1})/g
You do not need a capture group to get the entire match. You can use \0 or & for the whole match in the replacement portion of your substitution.
:%s/\\cite{\w\+}/(&)/g
If you do want to use a capture group, then you need to escape the capture group/parenthesis.
:%s/\(foo\)/(\1)/g
For more help see:
:h :s%
:h /magic
As mentioned, normally you need escape the parentheses.
You can use very magic mode (\v) to make the regex simpler; removing the need to escape lots of the regex parts, including the parentheses for capturing:
%s/\v(\\cite\{\w+\})/(\1)/g
Knowing what every sign in a regular expression does in vim is sometimes very
difficult, especially for all the modes and configuration variables that this
depends on. For that reason, it is very important to have visual feedback about
what text are we really matching in any moment while crafting regular
expressions.
If you work with neovim, there is a special option called inccommand that you
can enable to live preview the matches and substitution. That way you can figure
out you errors more quickly. This feature is very likely to be included also in
vim in the future, but independently of that, you can also use simple vim to
give you visual feedback if you enable the option incsearch.
With incsearch set, you can watch the matches of / and ? while you write them
just to be sure that the pattern is correct. Later you can exploit a nice
feature from the substitution: if you leave the first section empty, the last
search will be used.
So you could first make the search:
/\\cite{\w\+}/(&)/g
In the meantime, vim will be showing you the matched text visually. Once you
are sure that the pattern is correct press enter, and finally type:
:%s//(\1)<Enter>
Also, in case you want something more powerful than this simple hack, you can go
for my plugin Extend.vim, that can
do that and much more with great visual feedback.

Auto-closing for single quote in vim

I've setup auto-completions for parentheses and double quotes following the directions on this page.
The auto closing for single quotes is a bit more complicated, however. When dealing with single quotes, I have to check if it is used as an apostrophe or as a quote. The criteria for an apostrophe would perhaps be when the single quote is immediately preceded by an alphabet or number.
How do I implement this setting in my vimrc?
Well, the details of that algorithm depend on the type of text (programming languages vs. prose) and individual tradeoffs. I'd recommend to study how the 6+ plugins listed on the mentioned page handle that; the different approaches are probably quite instructive.
Maybe you'll also find information how some popular IDEs implement this (at least for the open Eclipse, this information should be available).
Using this will help
ino ' ''<left>
If you dont't want completion Ctrl-v need to be typed prior to '.
Not exactly what you are looking but a way to work without complex logic at the cost of extra key stroke

Intellij's auto insertion conflicting with vim mode

So Intellij/Eclipse have this nice functionality where typing a ' or ( automatically inserts the closing ' or ).
While this is great in normal operation, using the Vim mode/vim keybindings makes this more of a pain.
So for example I am typing a function which takes 2 strings as an argument:
new MyObject('arg1','arg2');
when I type the opening ', Intellij will automatically insert the closing '. Now when I have to type the second argument, I will have to:
Press Esc to leave insert mode
Use l to move caret after the closing '
Enter back into insert mode.
Not to mention this issue occurs when you have to type the semi colon at the end of the function call (to skip the closing )).
This seems like too many operations. Moving your hand to press escape breaks the flow of typing and the auto completion of intellj here causes more hassle than productivity.
Is there a better way around this or am I stuck with just disabling this particular auto insertion stuff?
Please check if turning Settings/Editor/Smart keys/Insert pair quote off helps

Easily edit formatlistpat?

I'd like to try out different regexes for the formatlistpat option. Any suggestions as to the easiest way to do this?
I know in Insert mode I can use <Ctrl+r> to paste in a register. And that I can use this do edit macros. Is there an equivalent for options? Or something even simpler?
The other idea I had was just sourcing a buffer with the set command in it. But I'm unsure of the way to put an option value into buffer so it can be edited.
Any thoughts? Tips? Suggestions?
When you are editing command-line you have two options here:
Use autocomplete:
set formatlistpat=<Tab>
(not really tab, but rather whatever 'wildchar'/'wildcharm' is set to). This will populate command-line with current option value, properly escaped. I cannot suggest this way for this particular option because double escaping looks ugly and there are lots of escapes in most patterns.
Use expression register (works both in command-line and in insert mode):
let &formatlistpat=<C-r>=string(&formatlistpat)<CR>
Note that in this case escaping is not done automatically. Using :let and string() is easier then do proper escaping for :set.
Based on ZyX's answer, the following is effective for a .vimrc file:
let &formatlistpat="^\s*\d\+[\]:.)}\t ]\s*\|^\s*[-*]\s+"
let &formatlistpat=string(&formatlistpat)

In vim, is there a plugin to use % to match the corresponding double quote (")?

The % key is one of the best features of vim: it lets you jump from { to }, [ to ], and so on.
However, it does not work by default with quotes: Either " or ', probably because the opening and closing quote are the same character, making implementation more difficult.
Thinking a bit more about the problem, I'm convinced that it should be implemented, by counting if the number of preceding quotes is odd or even and jumping to the previous or next quote, accordingly.
Before I try to implement it myself, I'd just like to know if someone already has?
Depending on your reason for needing this, there may be a better way to accomplish what you're looking for. For example, if you have the following code:
foo(bar, "baz quux")
^
and your cursor happens to be at the ^, and you want to replace everything inside the quotes with something else, use ci". This uses the Vim "text objects" to change (c) everything inside (i) the quotes (") and puts you in insert mode like this:
foo(bar, "")
^
Then you can start typing the replacement text. There are many other text objects that are really useful for this kind of shortcut. Learn (and use) one new Vim command per week, and you'll be an expert in no time!
Greg's answer was very useful but i also like the 'f' and 'F' commands that move the cursor forward and backward to the character you press after the command.
So press f" to move to the next " character and F" to move to the previous one.
I have found this technique very useful for going to the start/end of a very long quoted string.
when cursor is inside the string, visually select the whole string using vi" or vi'
go to start/end of the string by pressing o
press escape to exit visual select mode
this actually takes the cursor next to the start/end quote character, but still feels pretty helpful.
Edit
Adding Stefan's excellent comment here which is a better option for anyone who may miss the comment.
If you use va" (and va') then it will actually visually select the quotes itself as well.
– Stefan van den Akker
I'd like to expand on Greg's answer, and introduce the surround.vim plugin.
Suppose that rather than editing the contents of your quotes, you want to modify the " characters themselves. Lets say you want to change from double-quotes to single-quotes.
foo(bar, "baz quux")
^
The surround plugin allows you to change this to
foo(bar, 'baz quux')
^
just by executing the following: cs"' (which reads: "change the surrounding double-quotes to single-quotes").
You could also delete the quote marks simply by running: ds" (which reads: "delete the surrounding double-quotes).
There is a good introduction to the surround plugin here.
I know this question is old but here is a plugin to use % to match the corresponding double quote:
https://github.com/airblade/vim-matchquote

Resources