Sublime is able to add parentheses, brackets (curly and square), apostrophes, and quotes to highlighted text by default. I've tried but can't seem to find a way to have it remove those as well. What I'd like to be able to do is highlight some text that is surrounded by parentheses and have it remove those. Is there a good way to do that using snippets?
I suspect it can be done with use of allFollowingCharacter and allPrecedingCharacter but it seems those might be from a previous version of Sublime when those were in XML instead of the current JSON...?
Any help would be appreciated!
With surround you can do this. Install it via Package Control. (Package Control Installation)
Open the command palette:
CTRLSHIFTP on Linux and Windows,
CMDSHIFTP on Mac.
Search for Surround: delete surround and type in ( and Enter and you are done!
I'm surprised this question isn't searched more regularly!
BracketHighlighter is an excellent utility that includes convenient deleting of parenthesis. To cut to the chase, install BracketHighlighter and set bh_remove_brackets to whatever shortcut you'd like to be able to delete parentheses. Search up bh_remove_brackets in the example sublime keymap to see an example!
Related
When I'm typing a long line and press Enter in Atom Editor, I get the following:
I would like to know to set it so when I press Enter (or something equivalent) I get something with the following flavor:
Thanks a lot in advance!!
I suggest you install an indentation package for Atom.
Try the python-indent package.
It automatically applies the PEP8 style guide for indentation when you enter a newline.
It also works when splitting method calls with many args same as your example.
Just make sure to configure the pre-included language-python package first to use "soft" tabs.
(Settings > Packages > language-python)
I have been using Notepad++ for Windows when I want to find a certain text across all files in a given folder. This was extremely useful for debugging my MatLab code because one project entails tens of MatLab files.
I could also replace all texts into another across all files in a folder.
I could also replace things like /r/n which means line replacement.
Now I must need to work on a Linux server. Notepad++ couldn't be installed on the university server I am allotted to. And as far as I tried, Sublime Text couldn't find and replace things like /r/n
What option do I have on Linux?
Sublime Text supports replacement of line breaks, but you have to select "regular expression" (Alt+R) and you have to enter the line break correctly (\n, not /r).
The most useful method if find and replace. (Ctrl+H)
However, another possibility is the multiple selection as in the example number one of the official website: https://www.sublimetext.com/
How it works:
You select the word you want to replace, press Ctrl+D (which will select the same word with the same name). Continue pressing Ctrl+D until you selected every word you want to replace.
Once it is done, you will have a multiple selection, which means that every character will be write at each word selected position.
I invite you to check the example on their website, it is a very good illustration.
You can use Kate, it is fine replacement for Notepad++.
Kate "Search and Replace" feature is very powerful.
In my Sublime Text 3 (build 3065), ES6 string interpolation backticks seem to confuse the syntax highlighting in html files. For example
console.log(`"`)
would lead the syntax highlighting to assume we have an unmatched quote here, rather than figuring this is a single quotation mark quoted by backticks - which renders the remainder of the source file useless in terms of code highlighting.
Has this been solved in an updated build or add-on?
Meanwhile I can workaround it by closing the imaginary quotation in a comment.
console.log(`"`) // "
You will need to install a separate package for syntax highlighting in Sublime. There is currently a TextMate/Sublime 2 package for this (which should work for Sublime 3) here: https://github.com/Benvie/JavaScriptNext.tmLanguage
From the Installation and Use heading:
If you haven't already, install Package Control, then select
JavaScript Next from the Package Control: Install Package dropdown
list in the Command Palette.
To set this as your default JavaScript syntax, open a javascript file,
then select View -> Syntax -> Open all with current extension as... ->
JavascriptNext.
You may also need to change the ColorScheme. Pick one from Preferences
-> Color Scheme -> JavaScriptNext.
EDIT: Original Answerer posted a more widely used highlighter in comment below. It is here:
github.com/babel/babel-sublime
I recently upgraded to gvim 7.3 and was pleased to find markdown highlighting. I also noticed that it treats "internal" _(underscore) as a marker. For example:
I want gvim to display emphasis here
but not_here
gvim actually displays the last line in my example as 'but not_here". It looks like SO's markdown interpretation is closer to what I want.
I do not say that gvim is "wrong" because I do not know what the correct markdown implementation is. However, is there a way to configure it so that the markers should be treated as normal text if they are surrounded by non-whitespace?
The runtime files (especially if you use the old Vim 7.3.000 / 046 installer found on vim.org) aren't updated frequently. Most plugin authors publish more recent releases elsewhere, and they are only occasionally picked up by Vim.
In Tim Pope's repository, you'll find a newer version (that you can install into your ~/.vim directory) that doesn't show the problem; instead, it even highlights the single underscore character as an error.
I have found a solution, which works in the things I have tested sofar.
Copy the %vim%/syntax/markdown.vim file into %/.vim/syntax/markdown.vim and change line 63 into:
syn region markdownItalic start="\s_\S\#=" end="\S\#<=_\|_\S\#=" keepend contains=markdownLineStart
Restart vim and it should match *this* and _this_ but not_this.
EDIT: Changed information, thanks to #ZyX
I had these issues when documenting code in markdown files.
The solution I used was to put the offending sections in a codeblock with four spaces or in a code span with surrounding back ticks (`).
Try to use Github flavor markdown: https://github.com/jtratner/vim-flavored-markdown
I am new to VIM, so still learning. The thing I wanna do is instead of using tabs, I wanna to use 2 spaces to replace A tab. I wanna apply this format to my entire java code. How would I do it? Thanks!
Updated I used this following and it worked
:%s/\t/ /
There are many ways of replace tabs with spaces. If you want to use search-and-replace, you need the :s command. Try typing ":help :s" for help. You'll find that the following works:
:%s/<ctrl-v><tab>/ /g
There is a builtin :retab
You can also use gg=G to reindent the entire source file.
You may use the = command to format code, if you indent a line with two spaces, the following lines may be indented with 2 spaces if you use the =<movement> command on them.