M-^ delete-indentation (or join-line)
C-x C-t transpose-lines
kill-line
M-0 C-k kill to beginning of line
djcb-duplicate-line (not built-in)
M-q fill-paragraph
C-c c comment-uncomment
M-c capitalize-word...
org-move-line-up
C-u M-| sortHandy text manipulation tricks in Sublime Text 2
21–30 of 99 posts
Re: Handy text manipulation tricks in Sublime Text 2
#22Now that I've gotten used to first class refactoring support in the Jetbrains products any other editor just seems archaic. IntelliJ has all the features mentioned in this article and intelligent code restructuring.
Re: Handy text manipulation tricks in Sublime Text 2
#23Vim equivalents if you're feeling jealous (matching the order in the article): J Join line. ddp Swap line with the one below. ddkP Swap line with the one above. dd Delete current line yyp Duplicate line gq} Rewrap a paragraph. Vu Lowercase a line VU Uppercase a line Sort the selection by the Unix `sort` command (eg. sort -rn for reverse numeric order): V :!sort It goes a bit pear-shaped for these ones, though: Title-…
" comentify/uncommentify a line or a visual block"
function! Komment()
if getline(".") =~ '^[ \t]*#'
let hls=@/
s/^\([ \t]*\)#\(.*\)$/\1\2
let @/=hls
else
let hls=@/
s/^\([ \t]*\)\(.*\)$/\1#\2
let @/=hls
endif
endfunction
:vnoremap // :call Komment()
:nnoremap // :call Komment()
If you want to use c style comment :
function! Komment()
if getline(".") =~ '^[ \t]*\/\*'
let hls=@/
s/^\(\s*\)\/\*\(.*\)\*\/\(\s*\)$/\1\2\3/
let @/=hls
else
let hls=@/
s/[ \t]*$//
s/^\(\s*\)\(.*\)\(\s*\)$/\1\/\* \2 \*\//
let @/=hls
endif
endfunction
:vnoremap // :call Komment()
:nnoremap // :call Komment()
edited formattingRe: Handy text manipulation tricks in Sublime Text 2
#24Vim equivalents if you're feeling jealous (matching the order in the article): J Join line. ddp Swap line with the one below. ddkP Swap line with the one above. dd Delete current line yyp Duplicate line gq} Rewrap a paragraph. Vu Lowercase a line VU Uppercase a line Sort the selection by the Unix `sort` command (eg. sort -rn for reverse numeric order): V :!sort It goes a bit pear-shaped for these ones, though: Title-…
Re: Handy text manipulation tricks in Sublime Text 2
#25Vim equivalents if you're feeling jealous (matching the order in the article): J Join line. ddp Swap line with the one below. ddkP Swap line with the one above. dd Delete current line yyp Duplicate line gq} Rewrap a paragraph. Vu Lowercase a line VU Uppercase a line Sort the selection by the Unix `sort` command (eg. sort -rn for reverse numeric order): V :!sort It goes a bit pear-shaped for these ones, though: Title-…
> I'm a bit stumped on toggling comments, though. Any ideas? http://www.vim.org/scripts/script.php?script_id=1218
Re: Handy text manipulation tricks in Sublime Text 2
#26CTRL+SHIFT+P - X - Enter
The first part opens the command palette, the second selects XML syntax, and enter applies it.
Re: Handy text manipulation tricks in Sublime Text 2
#27Vim equivalents if you're feeling jealous (matching the order in the article): J Join line. ddp Swap line with the one below. ddkP Swap line with the one above. dd Delete current line yyp Duplicate line gq} Rewrap a paragraph. Vu Lowercase a line VU Uppercase a line Sort the selection by the Unix `sort` command (eg. sort -rn for reverse numeric order): V :!sort It goes a bit pear-shaped for these ones, though: Title-…
Re: Handy text manipulation tricks in Sublime Text 2
#28My favourite feature is definently multiple cursors; Ctrl+D selects the next occurance of your highlighted word, Alt+F3 selects all occurances.
Re: Handy text manipulation tricks in Sublime Text 2
#29Both are amazing. Both are rock solid. Both are infinitely extensible. Both are free as in beer and as in freedom.
I'm not afraid of paying good money for software. I don't think it is necessary to pay for a closed-source text editor when such good open-source options exist that can do everything the commercial product can do and more.
TextMate (and now Sublime Text) have been popular in the hacker community, particularly with Rails people. The only advantage I can see is eye-candy. They look great on Macs.
I tried TextMate and put it in the trash as soon as I found it had no split windows. Not only that, I couldn't add split windows even if I had the time. If vim or Emacs is missing something, you can add it.
End of rant.
Re: Handy text manipulation tricks in Sublime Text 2
#30My favourite feature is definently multiple cursors; Ctrl+D selects the next occurance of your highlighted word, Alt+F3 selects all occurances.
That's interesting. Can you edit all selected occurrences at once? I don't think there's an immediate analogue in Vim.