Its really annoying when Sublime Text selects the entire word in Javascript which is actually delimitated by "dots". How to fix this?
In Preferences.sublime-settings, change "word_separators" to the following line
"word_separators": "./\\()\"'-:,.;<>~!##$%^&*|+=[]{}`~?\\.",
Notice that I added "\\." in the end of the word_separators strings.
Hope it helps someone.
Related
It happens many times when we need to remove line end and unnecessary space between the HTML element. So this could be proven as a time-saving technique.
open Search and replace (CTRL+H)
enable "Regular Expression" (circled in red)
enter \n\s+ in the search field, clear the replace field
press "Replace all"
This will remove all newlines (\n+) followed by all whitespace (\s+) in the next line.
In your Sublime Text user settings, you can specify the following to trim trailing white space.
"trim_trailing_white_space_on_save": true
You might want to have a look at the Trimmer that has a couple of options to trim whitespace.
you can also use \n+ to remove all the unwanted space , if you want to use a single line then replace with \n online
I know i can select a block of lines, and then split it into many selections, one per line, using Ctrl+Shift+L then just typing a quote it will wrap the line automatically or to wrap each line with htlm tags I know I can use ctrl+shift+w
The problem is that I would like to skip the initial whitespaces of each line and just adding a quote or a html tag at the begging of the first word.
ps: Im using SublimeText 2 with Vintage
Select a block, then press:
Ctrl+Shift+L, Home, Shift+End
Is that what you are looking for?
Select a block, then press:
Command+Shift+L, right-arrow, Command+Shift+left-arrow
(Note: I'm on a mac.)
This should not be that hard but I can't seem to find information on it. How do you get line breaks to appear inside a text area when you are echoing it from the server? In other words what is <some code> in line below?
<text area>first line <some code> second line <some code> third line</text area>
I know how to write out <some code>. I just need to know what it should be. I have tried \n, \r\n, '\n', "\n", \N and variations but cannot get the line breaks to display.
Note: This is not about displaying in HTML so <br> is not what I want. This is not about getting it to display if you are typing it yourself where you can type a carriage return, i.e. :
<textarea>first line
second line </textarea>
When you are outputting from server you cannot use keyboard. This is what code to accomplish above.
Thanks for any suggestions
This is a super old question, but I ran into the same issue ajaxing content into a text area.
Thanks to this answer I used the html code for a new line,
and that worked for me. So basically:
<textarea> Here's my returned text
And it gets two lines </textarea>
which (at least for me) comes out as
Here's my returned text
And it gets two lines
try this
<'p'>firstline<'/p'>
<'p'>secondline<'/p'>
remove comma from p and /p
for display \n in html you should use nl2br() php function .
otherwise you should using "\n" (not "/n") for break the line inside your text ;
You should try \r\n instead of /r/n.
You need to use "\r\n" (with double quotes) when echoing it out from PHP.
I like to keep my lines below 80 columns, so I often want to refactor a line that looks like this:
object.function(a_long_argument, another_long_argument, and_a_third)
to this:
object.function(a_long_argument,
another_long_argument,
and_a_third)
But when I press Enter after the first "," in Sublime it just linebreaks and indents the cursor a few spaces. I want it to align to the paranthesis or [] or {} that I am in, like Emacs does so beautifully.
Is there an option for this? Is there a plugin for this? Do I have to write my own?
I have tried searching for it, but I have not found anything.
EDIT:
Even better would be a shortcut or plugin or something for selecting a few rows, or the entire buffer, and let it try to auto-linebreak at good spots. Refactor comments too. If it has to be language specific, I want it primarily for Python and C++.
Sublime's indent_to_bracket will wrap the cursor for you. Just add the following line to either your User/Preferences.sublime-settings or User/Python.sublime-settings file:
"indent_to_bracket": true
Unfortunately this currently only seems to work with parentheses, curly braces and square brackets still wrap to the previous line indent.
I have a big html file (87000+ lines) and want to delete all occurrences of onclick from all elements. Two examples of what I want to catch are:
1. onclick="fnSelectNode('name2',2, true);"
2. onclick="fnExpandNode('img3','node3','/include/format_DB.asp?Index2=3');"
The problem is that both function names and parameters passed to them are not the same. So I need a Regular expression that matches onclick= + anything + );"
And I need one that works in Notepad++
Thanks for helping ;-)
Not familiar with notepad++, but what I use in vim is:
onclick="[^"]+"
Of course this depends on there being double quotes around the onclick in every case...
This regular expression will fail if you have a " or ' character included within quotes escaped by a \. Other than that, this should do it.
(onclick="[^"]+")|(onclick='[^"]+')
onclick="[^"]+" works for me, for that 2 strings.
If you want to go with a regex:
/onclick=".*?"/
You could also use something which is DOM-aware, such as a HTML/XML parser, or even just load up jQuery:
$("[onclick]").removeAttr("onclick");
... and then copy the body HTML into a new file.
Could
onclick=\".+;\"
Work?
onclick=\".*\);\"
This regex should do the trick.
(\s+onclick=(?:"[^"]+")|(?:'[^']+'))
Open your file on dreamweaver, choose edit from the toolbar, select find and replace,
put onclick="[^"]+" in find field and keep replace blank
this will do the whole thing.
Enjoy