Nikola Brežnjak blog - Tackling software development with a dose of humor
  • Home
  • About me
Home
About me
  • Nikola Brežnjak blog
  • Home
  • About me
Stack Overflow

How to replace text between quotes in vi or vim?

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

So, my question was if for example we have this line of code:

$query = "SELECT * FROM table";

is there a command in vi/vim which can instantly delete everything between quotes and position the cursor between them so I can start typing immediatelly?

The answer, by user eugene y, was:

Use ci", which means: change what’s inside the double quotes.

You can also manipulate other text objects in a similar way, e.g.:

  • ciw – change inside a word
  • ci( – change inside parentheses
  • dit – delete inside an HTML tag, etc.

More about different vim text objects here.

Stack Overflow

What is disableSelection used for in jQuery sortable?

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

So, my question was whether someone could help me understand why is disableSelection useful and when to use it. The simple usage example of disableSelection is this:

$("#sortable").disableSelection();

The answer, by user kba, was that:

It’s useful if you want to make text unselectable. If, for instance, you want to make drag-and-drop elements with text on, it’d be annoying to the user if the text on the box accidentally would get selected when trying to drag the box.

Page 9 of 9« First...«6789

Recent posts

  • Productivity tip: rate things 1-10 without 7
  • Productivity: Paper, Pomodoro, Kanban, Tracking, and actually showing up
  • The Keyboard Layout That’s Making Us Type Slower
  • Stop Tabbing. Start Using Your Monitor
  • StackOverflow – Was It Worth It?

Categories

  • Android (3)
  • Books (114)
    • Programming (22)
  • CodeProject (36)
  • Daily Thoughts (78)
  • DevThink (2)
  • Go (3)
  • iOS (5)
  • JavaScript (128)
    • Angular (4)
    • Angular 2 (3)
    • Ionic (61)
    • Ionic2 (2)
    • Ionic3 (8)
    • MEAN (3)
    • NodeJS (27)
    • Phaser (1)
    • React (1)
    • Three.js (1)
    • Vue.js (3)
  • Leadership (1)
  • Meetups (8)
  • Miscellaneou$ (83)
    • Breaking News (8)
    • CodeSchool (2)
    • Hacker Games (3)
    • Pluralsight (7)
    • Projects (2)
    • Sublime Text (2)
  • PHP (6)
  • Quick tips (44)
  • Servers (8)
    • Heroku (1)
    • Linux (3)
  • Stack Overflow (82)
  • Unity3D (9)
  • VibeCoding (2)
  • Windows (8)
    • C# (2)
    • WPF (3)
  • Wordpress (2)

"There's no short-term solution for a long-term result." ~ Greg Plitt

"Everything around you that you call life was made up by people that were no smarter than you." ~ S. Jobs

"Hard work beats talent when talent doesn't work hard." ~ Tim Notke

© since 2016 - Nikola Brežnjak