TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Some things beginners might not know about Sublime Text

226 点作者 ashamedlion将近 13 年前

34 条评论

po将近 13 年前
Also a must-have: Sublime Package Control<p><a href="http://wbond.net/sublime_packages/package_control" rel="nofollow">http://wbond.net/sublime_packages/package_control</a><p>Useful for installing things like themes, syntax awareness, code linters, etc...
评论 #4247566 未加载
JonnieCache将近 13 年前
You guys know that you can go to the Default Keymaps file and get all of these tips in one list right? You can even change them...<p>EDIT: Just for fun, here is that file on OS X: <a href="https://gist.github.com/3117613" rel="nofollow">https://gist.github.com/3117613</a> Notice the "context" definitions. Also check out how the auto-pairing functionality is defined in terms of the key binding DSL. And how you can define nonstandard layouts for the panes. And so on.<p>Sublime is great. It reminds me of a less insane version of Foobar2000.
评论 #4247547 未加载
评论 #4252064 未加载
评论 #4247646 未加载
siodine将近 13 年前
Ctrl+Alt+P to get a dialog for opening all your Sublime projects.<p>Ctrl+R for navigating to functions or classes within the current file.<p>SublimeClang gives you Visual Studio-style Intellisense, static analysis, and jump to definition/implementation.<p>When setting up Vim emulation, you'll need to install VintageEx and change some of the default bindings (Ctrl+Shift+P+"key" to see the binding files). You'll also want SublimeBlockCursor.<p>For example, put the following in the user defined keymap to override the defaults: [ { "keys": ["ctrl+f"], "command": "move", "args": {"by": "pages", "forward": true} }, { "keys": ["ctrl+b"], "command": "move", "args": {"by": "pages", "forward": false} }, { "keys": ["ctrl+shift+f"], "command": "move", "args": {"by": "pages", "forward": true, "extend": true} }, { "keys": ["ctrl+shift+b"], "command": "move", "args": {"by": "pages", "forward": false, "extend": true} } ]
hebejebelus将近 13 年前
Further to point F: if you hold down control, you move by word segment - this is camel-case (and underscore) aware. So, if I am at the front of the word "cakeParty", I can move to between 'e' and 'P' by holding control and pressing the right arrow key.<p>(This is in ST2 for Mac OS X - I'm sure there's an equivalent feature in ST2 for other systems.)
评论 #4246841 未加载
评论 #4246968 未加载
haasted将近 13 年前
Cmd + d selects the current word.<p>Subsequent Cmd + d presses will select the following instance of the word for editing. Makes it easy to do things such as renaming a local variable or changing both the opening and closing element of a HTML tag.
评论 #4247022 未加载
评论 #4247067 未加载
评论 #4247244 未加载
评论 #4249390 未加载
Osmose将近 13 年前
Cmd-P is useful for opening existing files, but what's the preferred way for creating them?<p>I eventually had to get an extension and modify it to replicate emacs' c-x c-f to create files.
评论 #4247191 未加载
评论 #4247215 未加载
mef将近 13 年前
One of my favorite features is the flexibility of the Goto Anything dialog (CMD+T or CMD+P) e.g.:<p>- Goto file: "con pos" -&#62; app/controllers/posts_controller.rb<p>- Goto line in file: "con pos:100" -&#62; app/controllers/posts_controller.rb line 100<p>- Goto function in file: "con pos@foo" function foo in app/controllers/posts_controller.rb<p>Also one that came up recently is CMD+ALT+Q to auto-wrap long comments to your ruler (e.g. 80 columns).
评论 #4247135 未加载
Tloewald将近 13 年前
Something else you might not know -- multiple selection via command clicking (also implemented in Excel, for example) was in the original (1985ish) Apple Humn Interface Guidelines.
评论 #4247054 未加载
toran1302将近 13 年前
Another one i've found useful is CMD+D / CMD+K+D. CMD+D finds the next instance of the current selection and creates another cursor there (and selects it as well). CMD+K+D skips the current selection and finds the next one.<p>A fine grained find+replace/modify :)
draftable将近 13 年前
You can also move the curent line up and down the page using Ctrl + Cmd + Up/Down
评论 #4246934 未加载
评论 #4247238 未加载
LocalPCGuy将近 13 年前
For those that like/need to print their code, there is a plugin that does that: <a href="https://github.com/joelpt/sublimetext-print-to-html" rel="nofollow">https://github.com/joelpt/sublimetext-print-to-html</a>
Dunkirk将近 13 年前
I've been using {g}vi{m} for 20 years now, but just bought ST2. I like how this whole discussion revolves around finding keystrokes in ST2 that yield the convenience of doing things I took for granted in vim. Maybe I should just yield to the wisdom of the crowd, go back to VIM, forget about having a file explorer on the left side (NERDtree's wonkiness drove me to ST2), and learn to use Ctrl-P. It's what people keep suggesting to use in ST2.
评论 #4248057 未加载
评论 #4247639 未加载
评论 #4248014 未加载
mixmastamyk将近 13 年前
I tried out Sublime for a day or two, and think it does a lot of things right. However a few small things also bugged me right off the bat, may be someone can help.<p>- Code folding: No fold level 1 option, would like a hotkey. No line at the fold, just an icon at end of line.<p>- No GUI for options or syntax/theme editing. I give geany a pass on this (has options but not theme editing) because it is free. Many other free choices have this (N++, Programer's Ed.) but not Sublime. I don't wanna dig through docs for hours (again) to get another editor set up. It's a shame this stuff isn't standardized by now.<p>This might be because they made their own widget set and haven't finished yet. If so, it was a mistake. QT, wx, or native would have been fine. No need to reinvent the wheel.<p>Configuration: The mess of weird filenames and extensions in the config folder was a turnoff also. Json is nicer in many respects than xml, but I can't say it's optimal for config files.
评论 #4247630 未加载
ohgodthecat3将近 13 年前
You can also get multiple cursors from the keyboard with ctrl+alt+(uparrow or downarrow) not the most convenient of keybindings but can be rebound if you look for "select_line" in the default keybindings. (Linux and Windows)
nottombrown将近 13 年前
Cmd-Shift-P is incredibly useful. It lets you intelligently search all the commands.<p>Want to Save-all? Cmd-Shift-P, type 'save' and hit enter. Plus it takes into account any customizations or add-ons you might have put together.
eogas将近 13 年前
You can also search and do multiple selection with a regular expression, which is awesome. I've used this heavily in the past few weeks. The only problem I've had is that all searches appear to run on the main thread, so when working on a sufficiently large file, the whole application blocks like hell. And to make it even worse, they update search results on the fly, meaning that for every new character you enter it blocks. I've taken to writing my expressions fully in a random textfield elsewhere, and pasting them in all at once.
JulianMorrison将近 13 年前
Things sublime text lacks that bug me: drag and drop of selections. It would be even better if it could do what nedit can do with drag and drop, or drag and clone of both normal and block selections.
dt7将近 13 年前
You can also use your middle mouse button to make block selections, or doing things like making a long vertical line of multiple cursors (handy if you have an HTML list of varying line lengths, you can draw a long vertical line of multiple cursors, then use the left and right arrow keys and home and end keys to make changes to all of the lines quickly).
aviraldg将近 13 年前
I hadn't noticed this before, but you can create a new file by (double?) clicking anywhere in the empty area in the tab bar.
评论 #4249712 未加载
pastr将近 13 年前
For more ST keyboard shortcuts: <a href="https://gist.github.com/1736542" rel="nofollow">https://gist.github.com/1736542</a>
noiv将近 13 年前
Despite ST2 is great and everyday there is a new surprising feature to detect - what is the shortcut for 'save all'?
评论 #4247265 未加载
评论 #4247346 未加载
rockzapper将近 13 年前
The shortcut to quickly open Files is Ctrl + P (or Cmd + P on Mac) as opposed to Ctrl + T mentioned in the article.
draftable将近 13 年前
To quickly get multiple cursors on many lines at once, you can also select what you need and hit Cmd + Shift + L
tixzdk将近 13 年前
I've kept my favorite shortcuts open in a panel for about a week, so I could learn them by heart: <a href="http://pastebin.com/hQtYKzhN" rel="nofollow">http://pastebin.com/hQtYKzhN</a> Favorites include: Expand selection (to various levels), close tag, block commenting and splitting lines!
madprops将近 13 年前
ctrl + t swaps text, for example foo(bar) if you place the cursor before the parenthesis and press ctrl + t it will become bar(foo).<p>ctrl + m when in a bracket sets the cursor to it's matching bracket.<p>ctrl + up or ctrl + down scrolls the document up or down.<p>ctrl + g goes to a line.
taylorbuley将近 13 年前
Is it possible to do multi-line editing like Sublime Text but in Vim? I use both, and this was the feature that got me out of Terminal, but besides this I can't think of anything else offhand for what ST2 can do that Vim can't do.
评论 #4246995 未加载
评论 #4248226 未加载
B-Scan将近 13 年前
Ctrl+Shift+D duplicates line
mise将近 13 年前
Here's a (PC-oriented) cheat sheet of some keyboard shortcuts:<p><a href="https://gist.github.com/1958143" rel="nofollow">https://gist.github.com/1958143</a>
trebor将近 13 年前
CMD/CTRL + R will take you immediately to the find by symbol/definition. This is the same as CMD/CTRL + P and then typing @.
deviarte将近 13 年前
I am pretty sure that "Quick file opening" is CTRL+P on Windows. Since CTRL+T opens a new tab for me..
评论 #4246940 未加载
评论 #4247180 未加载
prisonguard将近 13 年前
switched to sublime from np++ 3 months's ago, happy bunny! but i miss the np++ file explorer that allowed me to perform cut/paste/rename file &#38; folder actions and even access the top level OS explorer menu within the editor so i had ,svn,archive,properties and send to<p>[edit] typo
davidlumley将近 13 年前
When you mention cursor, I assume you mean caret? Similar to Textmate?
baby将近 13 年前
&#62; ctrl + T on Windows<p>doesn't work on my ST2.
评论 #4248048 未加载
dr42将近 13 年前
Still doesn't seem to have 'correct indentation' which I would use often, especially for 'data' files like XML or JSON.
评论 #4247078 未加载