Questions tagged [editing]

Editing is a generic term for updating a file, document, or page.

927 questions
651
votes
7 answers

"Find next" in Vim

To search forward in Vim for cake, I'd type /cake, but the cursor jumps to the first match when I press return. Is there a Vim command analogous to "find next"?
Yktula
  • 14,179
  • 14
  • 48
  • 71
501
votes
14 answers

How to insert text at beginning of a multi-line selection in vi/Vim

In Vim, how do I insert characters at the beginning of each line in a selection? For instance, I want to comment out a block of code by prepending // at the beginning of each line assuming my language's comment system doesn't allow block…
Jordan Parmer
  • 36,042
  • 30
  • 97
  • 119
388
votes
9 answers

vim line numbers - how to have them on by default?

I can :set number from within a file I'm editing but how can I have them always be on by default?
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
175
votes
34 answers

How do I duplicate a whole line in Emacs?

I saw this same question for VIM and it has been something that I myself wanted to know how to do for Emacs. In ReSharper I use CTRL-D for this action. What is the least number of commands to perform this in Emacs?
Ray
  • 187,153
  • 97
  • 222
  • 204
138
votes
5 answers

How to swap files between windows in VIM?

When I work with VIM, I always have multiple windows visible. Sometimes I would like to have an easy way, to swap those windows in places. Is there any Plugin, Macro, etc to make this more easy? BTW, I use MiniBufExplorer.
mdrozdziel
  • 5,528
  • 6
  • 39
  • 55
124
votes
5 answers

Delete from the current cursor position to a given line number in vi editor

How do I delete a block of text from the current cursor row to a given line number in vi? For example: 49 <----- delete from here (cursor position) 50 51 …
seanhodges
  • 17,426
  • 15
  • 71
  • 93
91
votes
2 answers

Editable ComboBox with binding to value not in list

I have editable combobox where not always the preferred item is in the drop-down list. I would like to have the possibility of manually entering text in the textbox which is propagated to the string bound to SelectedValue. Right now the string…
ronag
  • 49,529
  • 25
  • 126
  • 221
76
votes
9 answers

Disabling user input for UITextfield in swift

pretty trivial question, I know. But I can not find anything online. I need to disable the user from being able to edit the text inside of a text field. So that when the click on the text, a keyboard doesn't show up. Any ideas? A programmatic…
Matt Spoon
  • 2,760
  • 5
  • 25
  • 41
72
votes
17 answers

Find a line in a file and remove it

I'm looking for a small code snippet that will find a line in file and remove that line (not content but line) but could not find. So for example I have in a file following: myFile.txt: aaa bbb ccc ddd Need to have a function like this: public void…
Narek
  • 38,779
  • 79
  • 233
  • 389
70
votes
6 answers

Editing multiple lines of code in Netbeans

Is there a way to select and edit multiple rows of code in netbeans? Visual Studio allows a similar operation where you press alt and select multiple lines using the dragging motion (left click) of mouse ?
Shashank Shekhar
  • 3,958
  • 2
  • 40
  • 52
69
votes
4 answers

More efficient movements editing python files in vim

Given a python file with the following repeated endlessly: def myFunction(a, b, c): if a: print b elif c: print 'hello' I'd like to move around and edit this file using familiar vim movements. For instance, using (, ), [[,…
Astronomer
64
votes
3 answers

How to prevent Sublime Text 2 from swallowing closing brackets, quotes and parentheses?

Sublime has this behaviour which is really annoying sometimes when you have to type in constructions with lots of brackets. When you type ( it adds () and puts the cursor in the middle, all fine, if you however will type ) it will silently swallow…
firedev
  • 20,898
  • 20
  • 64
  • 94
58
votes
5 answers

What ways are there to edit a function in R?

Let's say we have the following function: foo <- function(x) { line1 <- x line2 <- 0 line3 <- line1 + line2 return(line3) } And that we want to change the second line to be: line2 <- 2 How would you do that? One way is to…
Tal Galili
  • 24,605
  • 44
  • 129
  • 187
54
votes
10 answers

Commenting out a set of lines in a shell script

I was wondering if there is a way to comment out a set of lines in a shell script. How could I do that? We can use /* */ in other programming languages. This is most useful when I am converting/using/modifying another script and I want to keep the…
Vijay
  • 65,327
  • 90
  • 227
  • 319
51
votes
5 answers

Javascript syntax highlighting in vim

Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes I need to scroll around in order to get the syntax highlighting adjusted, as sometimes it mysteriously drops all highlighting. Are there any…
Steve M
  • 10,517
  • 12
  • 52
  • 63
1
2 3
61 62