qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
138,578 | <p>For example when asking a user what pet they have and it's a required field, a <code>Please select</code> option is included since the pet is currently unknown:</p>
<pre><code><select required>
<option value="">Please select</option>
<option value="dog">Dog</option&... | [
{
"answer_id": 138579,
"author": "musefan",
"author_id": 130560,
"author_profile": "https://ux.stackexchange.com/users/130560",
"pm_score": 4,
"selected": true,
"text": "<p>As you have suggested, I would recommend in the instance of a required field, that you don't have the "please ... | 2021/04/30 | [
"https://ux.stackexchange.com/questions/138578",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/11369/"
] | For example when asking a user what pet they have and it's a required field, a `Please select` option is included since the pet is currently unknown:
```
<select required>
<option value="">Please select</option>
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</... | As you have suggested, I would recommend in the instance of a required field, that you don't have the "please select" option when the user is "editing" the form.
If this is a required field, then the "please select" option is never valid during an edit, and therefore should not be included as it implies that the user ... |
138,872 | <p><a href="https://i.stack.imgur.com/f2VRO.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/f2VRO.jpg" alt="enter image description here" /></a></p>
<p>I'm working on an app that allows users to construct timelines (kind of like events in calendars). But the timeline/sequence is independent of any specific da... | [
{
"answer_id": 138874,
"author": "Danielillo",
"author_id": 115107,
"author_profile": "https://ux.stackexchange.com/users/115107",
"pm_score": 2,
"selected": false,
"text": "<p>I think the problem is that you are putting the numerical information in the way the hours are set.</p>\n<ul>\n... | 2021/05/27 | [
"https://ux.stackexchange.com/questions/138872",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/119116/"
] | [](https://i.stack.imgur.com/f2VRO.jpg)
I'm working on an app that allows users to construct timelines (kind of like events in calendars). But the timeline/sequence is independent of any specific datetime to execute, so all of the times in it are dura... | Instead of, or in addition to, changing the number format, you could add some special labels and other cues.
* Replace "00:00" with "Start" or something like that.
* Once at least one event has been created, place a special label at the end of the *last* event, like “Ends after 3 h" — which conveys that this is "3 hou... |
138,883 | <p>I'm designing a button which when clicked aborts a certain process.
I need an Icon on the button with the text "Abort". The icon will be place on the left and text will be placed right to the icon. But I'm confused which icon to use.<br />
I've listed a few icons below that you may agree are close to symbo... | [
{
"answer_id": 138874,
"author": "Danielillo",
"author_id": 115107,
"author_profile": "https://ux.stackexchange.com/users/115107",
"pm_score": 2,
"selected": false,
"text": "<p>I think the problem is that you are putting the numerical information in the way the hours are set.</p>\n<ul>\n... | 2021/05/28 | [
"https://ux.stackexchange.com/questions/138883",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/145453/"
] | I'm designing a button which when clicked aborts a certain process.
I need an Icon on the button with the text "Abort". The icon will be place on the left and text will be placed right to the icon. But I'm confused which icon to use.
I've listed a few icons below that you may agree are close to symbolizing an "Abort... | Instead of, or in addition to, changing the number format, you could add some special labels and other cues.
* Replace "00:00" with "Start" or something like that.
* Once at least one event has been created, place a special label at the end of the *last* event, like “Ends after 3 h" — which conveys that this is "3 hou... |
139,988 | <p>I'm creating an HTML interface that has an input text field with a label attached. The label has a short name for the input and I want a more detailed description to appear as a popup for visual users, but also to be accessible for screen readers.</p>
<p>This can be done with the <code>title</code> attribute, but if... | [
{
"answer_id": 139986,
"author": "Izquierdo",
"author_id": 109431,
"author_profile": "https://ux.stackexchange.com/users/109431",
"pm_score": 1,
"selected": false,
"text": "<p>Consider a <a href=\"https://material-ui.com/components/autocomplete/\" rel=\"nofollow noreferrer\">combo box wi... | 2021/06/08 | [
"https://ux.stackexchange.com/questions/139988",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/66762/"
] | I'm creating an HTML interface that has an input text field with a label attached. The label has a short name for the input and I want a more detailed description to appear as a popup for visual users, but also to be accessible for screen readers.
This can be done with the `title` attribute, but if I attach the title ... | Consider a [combo box with autocomplete](https://material-ui.com/components/autocomplete/). The user likely doesn't need to depend on browsing a dropdown list to find their specialty, but the dropdown will help in case the term they want to use is slightly different from the system's.
[![Dropdown list with autocomplet... |
140,004 | <p>In the middle of a very complex form used in a meeting booking system, I've been asked to create the following</p>
<pre><code>Field 1: Text Input
Field 2: Yes/No radio
</code></pre>
<p>The project BA is requesting that first field be mandatory, only if the second field is set to 'No', otherwise it should be optiona... | [
{
"answer_id": 140003,
"author": "Luke Sawczak",
"author_id": 101120,
"author_profile": "https://ux.stackexchange.com/users/101120",
"pm_score": 2,
"selected": false,
"text": "<p>Quite simply, because those elements are considered to be of secondary importance. The user is presumed to be... | 2021/06/08 | [
"https://ux.stackexchange.com/questions/140004",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/144519/"
] | In the middle of a very complex form used in a meeting booking system, I've been asked to create the following
```
Field 1: Text Input
Field 2: Yes/No radio
```
The project BA is requesting that first field be mandatory, only if the second field is set to 'No', otherwise it should be optional.
Filling the first fi... | HTML5 consists of structural and presentational elements. Structural elements give meaning to the contents (using semantics) but can also be used as containers for css and javascript (div, span). Pure presentational elements (b, i) are often avoided because css provides a better way to style elements. The `<small>` ele... |
140,062 | <p>I have an app with basic user profile fields editing functionality. Each field presents the field name, the field value, and an edit button (e.g a pencil).</p>
<p>My question regards what I display on those fields when they haven't been filled in yet. I don't care about the exact text inside, but I do care whether t... | [
{
"answer_id": 140060,
"author": "Izquierdo",
"author_id": 109431,
"author_profile": "https://ux.stackexchange.com/users/109431",
"pm_score": 1,
"selected": false,
"text": "<p>The <a href=\"https://gdpr.eu/cookies/\" rel=\"nofollow noreferrer\">language of GDPR</a> (the EU/UK regulation ... | 2021/06/14 | [
"https://ux.stackexchange.com/questions/140062",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/3179/"
] | I have an app with basic user profile fields editing functionality. Each field presents the field name, the field value, and an edit button (e.g a pencil).
My question regards what I display on those fields when they haven't been filled in yet. I don't care about the exact text inside, but I do care whether this text ... | Why are they bugging me with cookie banners? **Business needs**
They are interested in knowing how many people with what content they can convert to one of their paid plans. That's why it is important to them to know as much as possible about potential buyers.
To stay in your cookie metaphor: A baker can see the amou... |
140,079 | <p>I am making a game that has a free demo and a full version. When you are playing the free demo, you can enter an access code to unlock the full version.</p>
<p>My issue is, when users go to the webpage with the access codes on it, I'm getting a lot of messages about how the access codes don't work. Here's a screensh... | [
{
"answer_id": 140074,
"author": "Jos van Weesel",
"author_id": 118587,
"author_profile": "https://ux.stackexchange.com/users/118587",
"pm_score": 1,
"selected": false,
"text": "<p>Based on Nash's comment, I think adding the accumulative amount behind every number would assist in helping... | 2021/06/14 | [
"https://ux.stackexchange.com/questions/140079",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/147771/"
] | I am making a game that has a free demo and a full version. When you are playing the free demo, you can enter an access code to unlock the full version.
My issue is, when users go to the webpage with the access codes on it, I'm getting a lot of messages about how the access codes don't work. Here's a screenshot of the... | I feel like you are trying to solve a problem that doesn't really exist.
Typically, applications that involve displaying grids of data (such as this) are usually used by people that have some understanding of the data they are viewing. They are not going to be totally clueless as to what they are seeing, and should th... |
140,286 | <p>I have a reservation web form. There is a field named "time". It's a select option like:</p>
<pre><code># Select a time:
<select>
<option>09:00 AM</option>
<option>10:00 AM</option>
<option>12:00 PM</option>
<option>02:00 PM</option>
... | [
{
"answer_id": 140287,
"author": "musefan",
"author_id": 130560,
"author_profile": "https://ux.stackexchange.com/users/130560",
"pm_score": 6,
"selected": false,
"text": "<p>It sounds to me like what you really want is for the user to select a one hour time slot instead of a fixed time.<... | 2021/07/07 | [
"https://ux.stackexchange.com/questions/140286",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/90165/"
] | I have a reservation web form. There is a field named "time". It's a select option like:
```
# Select a time:
<select>
<option>09:00 AM</option>
<option>10:00 AM</option>
<option>12:00 PM</option>
<option>02:00 PM</option>
<option>04:00 PM</option>
</select>
```
The user must select one of thos... | It sounds to me like what you really want is for the user to select a one hour time slot instead of a fixed time.
This makes it much clearer that you cannot commit to a specific time and the user must be prepared for an estimated time given a one-hour timeframe.
```
<select>
<option>09:00 AM - 10:00 AM</option>
... |
140,427 | <p>I live in a high-rise apartment building in New York. Our building has four resident elevators which each serve every residential floor. (An additional fifth elevator (physically separated from the four described herein) serves as a freight elevator for movers, contractors, and building staff.)</p>
<p>However, "... | [
{
"answer_id": 140428,
"author": "PhillipW",
"author_id": 4403,
"author_profile": "https://ux.stackexchange.com/users/4403",
"pm_score": 1,
"selected": false,
"text": "<p>I'd put a timer / a usage sensor in the circuits for Elevator 1 during peak periods, so once its been called it will ... | 2021/07/20 | [
"https://ux.stackexchange.com/questions/140427",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/17458/"
] | I live in a high-rise apartment building in New York. Our building has four resident elevators which each serve every residential floor. (An additional fifth elevator (physically separated from the four described herein) serves as a freight elevator for movers, contractors, and building staff.)
However, "elevator #1" ... | Replace the panel A with buttons “to rooftop” and “to garage” instead of “up” and “down”. Now elevator 1 is reserved for special floors and most people use elevators 2-4. |
140,771 | <p>We can show hierarchical relationship either using simple spaces, or using dash lines:</p>
<p><strong>Spaces</strong></p>
<pre><code> parent
child
</code></pre>
<p><strong>Dashes</strong></p>
<pre><code> parent
--- child
</code></pre>
<p>I have seen both of them.</p>
<p>But now that I have to design a hier... | [
{
"answer_id": 140762,
"author": "Mike M",
"author_id": 19214,
"author_profile": "https://ux.stackexchange.com/users/19214",
"pm_score": 2,
"selected": false,
"text": "<p>You have a couple choices here.</p>\n<p><strong>Chips, or lozenges as discreet elements</strong></p>\n<p>Chips can be... | 2021/08/22 | [
"https://ux.stackexchange.com/questions/140771",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/150180/"
] | We can show hierarchical relationship either using simple spaces, or using dash lines:
**Spaces**
```
parent
child
```
**Dashes**
```
parent
--- child
```
I have seen both of them.
But now that I have to design a hierarchical UI in an application, I wonder if we have any standard or research on it. ... | You have a couple choices here.
**Chips, or lozenges as discreet elements**
Chips can be used to represent discreet pieces of data, and you'll start to see this in more modern representations of spreadsheets.
[](https://i.stack.imgur.com/qnXRh.png)
... |
141,101 | <p>I'm working on adding a small piece of functionality to a part of an app that contains 4 settings check boxes. I'd like to make some small tweaks to improve the UX of these checkboxes. There isn't scope for major changes but some copy changes are doable. There isn't time to test these changes.</p>
<p>The app is simi... | [
{
"answer_id": 141103,
"author": "ikartik90",
"author_id": 19173,
"author_profile": "https://ux.stackexchange.com/users/19173",
"pm_score": 2,
"selected": false,
"text": "<p>Instead of thinking of actions as affirmative or negative, the ideal course of action for the series of checkboxes... | 2021/09/23 | [
"https://ux.stackexchange.com/questions/141101",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/151845/"
] | I'm working on adding a small piece of functionality to a part of an app that contains 4 settings check boxes. I'd like to make some small tweaks to improve the UX of these checkboxes. There isn't scope for major changes but some copy changes are doable. There isn't time to test these changes.
The app is similar to a ... | Instead of thinking of actions as affirmative or negative, the ideal course of action for the series of checkboxes would be to identify what the expected natural state of the newly drafted pages on your CMS.
To draw parallels, unless you specify
```
<meta name="robots" content="noindex,nofollow">
```
on a given web... |
141,609 | <p>See example from Outlook.</p>
<p>I know the answer may vary, so I'm looking for an answer which is backed up (not sure if anyone researched it). I want to show my team and try to convince them of the current gap (10 px) is too small
<a href="https://i.stack.imgur.com/8J1c4.png" rel="nofollow noreferrer"><img src="ht... | [
{
"answer_id": 141610,
"author": "Danielillo",
"author_id": 115107,
"author_profile": "https://ux.stackexchange.com/users/115107",
"pm_score": 2,
"selected": true,
"text": "<p>The best way to understand distances in interactive elements is using, or imagining if it doesn't exist, the app... | 2021/11/17 | [
"https://ux.stackexchange.com/questions/141609",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/13204/"
] | See example from Outlook.
I know the answer may vary, so I'm looking for an answer which is backed up (not sure if anyone researched it). I want to show my team and try to convince them of the current gap (10 px) is too small
[](https://i.stack.imgur.... | The best way to understand distances in interactive elements is using, or imagining if it doesn't exist, the application on mobile devices where the minimum distance allowed depends on the necessary space for the user's finger. For this there are several studies, the main conclusion is that it depends on the size of th... |
142,426 | <p>I'm looking for a useful editing UX for large, tree-structured content like this:</p>
<pre><code>Project 1
- Step 1
- Explanation 1
- Explanation 2: could be long paragraphs, too.
- E2.1: Lots of nesting
- with subtask
- yet more nesting
- [an image]
- E2.2 nesting
- S... | [
{
"answer_id": 142533,
"author": "Dxpat",
"author_id": 155755,
"author_profile": "https://ux.stackexchange.com/users/155755",
"pm_score": 1,
"selected": false,
"text": "<p>this is an interesting question I can easily see any designer having a tough time with it.\nI think the main goal fo... | 2022/02/08 | [
"https://ux.stackexchange.com/questions/142426",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/155543/"
] | I'm looking for a useful editing UX for large, tree-structured content like this:
```
Project 1
- Step 1
- Explanation 1
- Explanation 2: could be long paragraphs, too.
- E2.1: Lots of nesting
- with subtask
- yet more nesting
- [an image]
- E2.2 nesting
- Step 2
- m... | Should switching back and forth between items have the focus or the editing itself? What and how much is being edited and how often is as important to know as well. There is a lot going on in your design and it is not clear how it is going to be used. If you want to focus on editing I suggest to show less menu's and mo... |
143,029 | <p>So I have a date range, for example:</p>
<pre><code>21-05-2022 - 27-05-2022
</code></pre>
<p>Bear in mind that the date is in dd-mm-yyyy format. So my user wanted to add the "Start Date" and "Due date" before the date. So it becomes like this:</p>
<pre><code>Start date: 21-05-2022 - Due date: 27-... | [
{
"answer_id": 143030,
"author": "Izquierdo",
"author_id": 109431,
"author_profile": "https://ux.stackexchange.com/users/109431",
"pm_score": 0,
"selected": false,
"text": "<p>Listing labeled individual dates (your example) is correct. Showing a date range with a general label like "... | 2022/04/07 | [
"https://ux.stackexchange.com/questions/143029",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/156748/"
] | So I have a date range, for example:
```
21-05-2022 - 27-05-2022
```
Bear in mind that the date is in dd-mm-yyyy format. So my user wanted to add the "Start Date" and "Due date" before the date. So it becomes like this:
```
Start date: 21-05-2022 - Due date: 27-05-2022
```
I don't think that's right (at least acc... | My assumption here is what users need is to scan, read and compare the dates. To achieve this, in the following example I used alignment, a monospace font for the dates and larger text size for them to make them stand out a bit better opposed to their label. Those are just examples of what you can do to make it more us... |
143,201 | <p>I have a multi-step form with five steps.</p>
<p>At the bottom of each page there is a button to go to the previous step and the next step.</p>
<p>Should the text inside the button have the name of the next / previous step? Or should they say Previous / Next?</p>
<p>Steps are shown to the user at the top of the form... | [
{
"answer_id": 143202,
"author": "Danielillo",
"author_id": 115107,
"author_profile": "https://ux.stackexchange.com/users/115107",
"pm_score": 0,
"selected": false,
"text": "<p>I think it's a design decision. The only problem I see is that by using the standard <kbd>previous</kbd> / <kbd... | 2022/04/25 | [
"https://ux.stackexchange.com/questions/143201",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/133090/"
] | I have a multi-step form with five steps.
At the bottom of each page there is a button to go to the previous step and the next step.
Should the text inside the button have the name of the next / previous step? Or should they say Previous / Next?
Steps are shown to the user at the top of the form and are clickable:
... | I can think of several options.
1. Use [previous topic] and [next topic]. Pros: it's probably clear what the buttons do, especially with the addition of the arrows.
2. Use "previous" and "next". Cons: user might think it will refresh the page and delete/invalidate entries. Perhaps you could indicate the state of the p... |
143,289 | <p>I am breaking down a large number such as <code>1022056271142522954</code> into adding the individual digits, and want to show the process of adding the digits. What I have now is this, which overflows onto multiple lines.</p>
<p><a href="https://i.stack.imgur.com/0e5eQ.png" rel="nofollow noreferrer"><img src="https... | [
{
"answer_id": 143290,
"author": "Danielillo",
"author_id": 115107,
"author_profile": "https://ux.stackexchange.com/users/115107",
"pm_score": 1,
"selected": false,
"text": "<p>Without knowing the context, only generic concepts or tricks can be pointed out:</p>\n<ul>\n<li>Interpret the p... | 2022/05/05 | [
"https://ux.stackexchange.com/questions/143289",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/32186/"
] | I am breaking down a large number such as `1022056271142522954` into adding the individual digits, and want to show the process of adding the digits. What I have now is this, which overflows onto multiple lines.
[](https://i.stack.imgur.com/0e5eQ.png)... | Are animations an option? If you want to show the process, then you could just display the number and add the digits below like this:
Keyframe 1
```
1022056271142522954
1
```
Keyframe 2
```
1022056271142522954
3
```
Keyframe 3
```
1022056271142522954
5
```
...
Keyframe Last
```
1022056271142522954
... |
143,295 | <p>I have a text field that shows matches in a dropdown when the user starts typing. Below the field are buttons. When the dropdown is activated it covers the buttons. However the dropdown will go away before the user will need to select the buttons, because the user will either a) select the desired match from the dro... | [
{
"answer_id": 143290,
"author": "Danielillo",
"author_id": 115107,
"author_profile": "https://ux.stackexchange.com/users/115107",
"pm_score": 1,
"selected": false,
"text": "<p>Without knowing the context, only generic concepts or tricks can be pointed out:</p>\n<ul>\n<li>Interpret the p... | 2022/05/05 | [
"https://ux.stackexchange.com/questions/143295",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/157289/"
] | I have a text field that shows matches in a dropdown when the user starts typing. Below the field are buttons. When the dropdown is activated it covers the buttons. However the dropdown will go away before the user will need to select the buttons, because the user will either a) select the desired match from the dropdo... | Are animations an option? If you want to show the process, then you could just display the number and add the digits below like this:
Keyframe 1
```
1022056271142522954
1
```
Keyframe 2
```
1022056271142522954
3
```
Keyframe 3
```
1022056271142522954
5
```
...
Keyframe Last
```
1022056271142522954
... |
143,623 | <p>I am working on a design for a platform where there are users, and some of them are "managers" so they are able to view data about the team they manage.</p>
<p>The home page shows a dashboard with cards for those items that need an action to be performed.<br />
As a user, they can only see their cards.<br ... | [
{
"answer_id": 143624,
"author": "Chris",
"author_id": 119748,
"author_profile": "https://ux.stackexchange.com/users/119748",
"pm_score": 1,
"selected": false,
"text": "<p>If the experience can't be merged into a single one and have items differentiated between team member and manager th... | 2022/06/16 | [
"https://ux.stackexchange.com/questions/143623",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/86004/"
] | I am working on a design for a platform where there are users, and some of them are "managers" so they are able to view data about the team they manage.
The home page shows a dashboard with cards for those items that need an action to be performed.
As a user, they can only see their cards.
As a manager, they can... | If the experience can't be merged into a single one and have items differentiated between team member and manager then usually the approach is to have a button / knob somewhere visible where the user can make the switch between the roles. If the platform logs out frequently this option can also be presented on login.
... |
143,781 | <p>We have a table with radio button filters and are struggling with logical wording for the labels, or specifically the label for the default option.</p>
<p>The tables are of people, and each person could belong to multiple teams. We have radios to filter by people in each team, as well as people <em>not</em> in them.... | [
{
"answer_id": 143783,
"author": "Devin",
"author_id": 54669,
"author_profile": "https://ux.stackexchange.com/users/54669",
"pm_score": 2,
"selected": false,
"text": "<p>In my opinion, this approach is a bit convoluted, which affects the labels (<strong>N/A</strong> is really confusing, ... | 2022/07/03 | [
"https://ux.stackexchange.com/questions/143781",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/158464/"
] | We have a table with radio button filters and are struggling with logical wording for the labels, or specifically the label for the default option.
The tables are of people, and each person could belong to multiple teams. We have radios to filter by people in each team, as well as people *not* in them. The default sta... | The meaning of Only, None and N/a are not that clear to me. But I believe you want something like this:
```
In the BLUE TEAM? In the RED TEAM?
( ) Only ( ) No (*) Maybe ( ) Only ( ) No (*) Maybe
```
But it would look nicer if you can claim more vertical space:
| Available in | No | Mayb... |
143,786 | <p>So, recently I have encounter a UX challenge. There was a screen I was designing where I need to show some options in a dialog box. When we were handing over the screens to the developers they raised a question -</p>
<p>Q. How to handle a situation where they need to show errors-popups which are generated independen... | [
{
"answer_id": 143783,
"author": "Devin",
"author_id": 54669,
"author_profile": "https://ux.stackexchange.com/users/54669",
"pm_score": 2,
"selected": false,
"text": "<p>In my opinion, this approach is a bit convoluted, which affects the labels (<strong>N/A</strong> is really confusing, ... | 2022/07/05 | [
"https://ux.stackexchange.com/questions/143786",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/50996/"
] | So, recently I have encounter a UX challenge. There was a screen I was designing where I need to show some options in a dialog box. When we were handing over the screens to the developers they raised a question -
Q. How to handle a situation where they need to show errors-popups which are generated independent of the ... | The meaning of Only, None and N/a are not that clear to me. But I believe you want something like this:
```
In the BLUE TEAM? In the RED TEAM?
( ) Only ( ) No (*) Maybe ( ) Only ( ) No (*) Maybe
```
But it would look nicer if you can claim more vertical space:
| Available in | No | Mayb... |
143,787 | <p>Designing a form where the user needs to select 3-4 levels of categorization. for this, I'm looking at using 4 horizontal combo boxes (refer image below).</p>
<p>Depending on what the user selects in box A, the options in box B will populate and so on, in C when box B has an option selected. Box A is the starting po... | [
{
"answer_id": 143783,
"author": "Devin",
"author_id": 54669,
"author_profile": "https://ux.stackexchange.com/users/54669",
"pm_score": 2,
"selected": false,
"text": "<p>In my opinion, this approach is a bit convoluted, which affects the labels (<strong>N/A</strong> is really confusing, ... | 2022/07/05 | [
"https://ux.stackexchange.com/questions/143787",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/51332/"
] | Designing a form where the user needs to select 3-4 levels of categorization. for this, I'm looking at using 4 horizontal combo boxes (refer image below).
Depending on what the user selects in box A, the options in box B will populate and so on, in C when box B has an option selected. Box A is the starting point and o... | The meaning of Only, None and N/a are not that clear to me. But I believe you want something like this:
```
In the BLUE TEAM? In the RED TEAM?
( ) Only ( ) No (*) Maybe ( ) Only ( ) No (*) Maybe
```
But it would look nicer if you can claim more vertical space:
| Available in | No | Mayb... |
143,850 | <p>What is a good user experience for a single web page that allows the user to add and manage 3 related things?</p>
<p>In my case I want the user to see this in the UI:</p>
<pre><code>Property 1
Building 1
Apartment 1
Apartment 2
Property 2
Building 1
Building 2
Apartment 1
</code></pre>
<p>... | [
{
"answer_id": 143859,
"author": "Michael",
"author_id": 155555,
"author_profile": "https://ux.stackexchange.com/users/155555",
"pm_score": 0,
"selected": false,
"text": "<p>not sure if this is considered expandable widget.</p>\n<p>But using multiple level navigation menu should meet you... | 2022/07/09 | [
"https://ux.stackexchange.com/questions/143850",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/158595/"
] | What is a good user experience for a single web page that allows the user to add and manage 3 related things?
In my case I want the user to see this in the UI:
```
Property 1
Building 1
Apartment 1
Apartment 2
Property 2
Building 1
Building 2
Apartment 1
```
I tried showing it like that w... | You mentioned wanting the user to "add and manage" 3 related things. And then your diagram shows a nested list, like in a shopping site.
"Add and manage" sounds like it's probably a different design pattern than a standard navigation for a website. So we'll probably need more details.
What is the total number of item... |
143,881 | <p>Are there existing algorithms that can measure readability colors for text over a background? (on-screen text for e.g.).</p>
<p>Something which could be used (for example) for auto-generating color schemes that don't produce unreadable text.</p>
<p>While I wouldn't mind writing my own, it seems like something there ... | [
{
"answer_id": 143890,
"author": "Devin",
"author_id": 54669,
"author_profile": "https://ux.stackexchange.com/users/54669",
"pm_score": 1,
"selected": false,
"text": "<p>Yes, you can find this in the W3 Accessibility Recommendations under the title "<a href=\"https://www.w3.org/TR/2... | 2022/07/13 | [
"https://ux.stackexchange.com/questions/143881",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/83885/"
] | Are there existing algorithms that can measure readability colors for text over a background? (on-screen text for e.g.).
Something which could be used (for example) for auto-generating color schemes that don't produce unreadable text.
While I wouldn't mind writing my own, it seems like something there may be existing... | Yes, you can find this in the W3 Accessibility Recommendations under the title "[**Relative Luminance**](https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef)". The formula is as follows, but I recommend you look it up in the original link, as the text here has a strange format, so I am just including i... |
143,893 | <p>I write a lot of software tools to simplify tasks. Some of these follow a workflow like this:</p>
<ol>
<li>In the terminal I type the command to invoke the tool</li>
<li>The tool reads some configuration file from disk either from the current workdir or from some provided path.</li>
<li>The tool operates using the c... | [
{
"answer_id": 143887,
"author": "George",
"author_id": 158615,
"author_profile": "https://ux.stackexchange.com/users/158615",
"pm_score": 0,
"selected": false,
"text": "<p>Time on the task itself might not be able to give you much feedback. "if the time by itself seems quick" ... | 2022/07/13 | [
"https://ux.stackexchange.com/questions/143893",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/30294/"
] | I write a lot of software tools to simplify tasks. Some of these follow a workflow like this:
1. In the terminal I type the command to invoke the tool
2. The tool reads some configuration file from disk either from the current workdir or from some provided path.
3. The tool operates using the config it found. Part of ... | **Pair task completion time with another metric or metrics.**
Not all users, under the best circumstances, will complete a task "quickly". People have different motor abilities, reading comprehension skills, and other factors that will affect task completion times. You likely won't be able to gauge how "efficient" a d... |
144,297 | <p>I know it's a good UX practice to make radios/checkboxes labels clickable (because radios/checkboxes are usually a bit small) but I have serious doubts over the practice of also making fields labels clickable.</p>
<p>I can't find reliable references about it (with the exception on one single minor website).</p>
<p>P... | [
{
"answer_id": 144298,
"author": "Joshua Munn",
"author_id": 161276,
"author_profile": "https://ux.stackexchange.com/users/161276",
"pm_score": 0,
"selected": false,
"text": "<p>Your example of Radio / Checkbox labels being clickable could in theory apply to text field labels as you're s... | 2022/08/31 | [
"https://ux.stackexchange.com/questions/144297",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/31968/"
] | I know it's a good UX practice to make radios/checkboxes labels clickable (because radios/checkboxes are usually a bit small) but I have serious doubts over the practice of also making fields labels clickable.
I can't find reliable references about it (with the exception on one single minor website).
Personally I can... | You have a point that when the clickable area is large enough for text fields, expanding the click area by including the label is no longer relevant. But you should consider the following:
1. This is for consistency. All form fields behave the same keeping interaction predictable.
2. This is an accessibilty concern. Y... |
144,326 | <p>so on website I'm building I have these div blocks, one block is for "correct example", and the other is for "Incorrect examples" (like Info & warning kinda thing)</p>
<p>I have the color, I have the "icon" (background image), but I don't know what I should use for screen readers.</... | [
{
"answer_id": 144329,
"author": "slugolicious",
"author_id": 91971,
"author_profile": "https://ux.stackexchange.com/users/91971",
"pm_score": 1,
"selected": false,
"text": "<p>If you're asking for program help (typically when you're asking about specify HTML attributes), that's more of ... | 2022/09/05 | [
"https://ux.stackexchange.com/questions/144326",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/99064/"
] | so on website I'm building I have these div blocks, one block is for "correct example", and the other is for "Incorrect examples" (like Info & warning kinda thing)
I have the color, I have the "icon" (background image), but I don't know what I should use for screen readers.
[, that's more of a stackoverflow.com question rather than this ux.stackexchange.com, but I'll continue on.
Is your correct/incorrect `<div>` an interactive element? It doesn't sound like it but just in case it is and you're *... |
144,340 | <p>If a user wants to "bulk edit" a table and makes some row selections, then changes the filter during selection, should rows that have been previously selected (but can no longer be seen because they've been excluded by the new filter), still be included in the bulk edit, or not?</p>
| [
{
"answer_id": 144329,
"author": "slugolicious",
"author_id": 91971,
"author_profile": "https://ux.stackexchange.com/users/91971",
"pm_score": 1,
"selected": false,
"text": "<p>If you're asking for program help (typically when you're asking about specify HTML attributes), that's more of ... | 2022/09/07 | [
"https://ux.stackexchange.com/questions/144340",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/161814/"
] | If a user wants to "bulk edit" a table and makes some row selections, then changes the filter during selection, should rows that have been previously selected (but can no longer be seen because they've been excluded by the new filter), still be included in the bulk edit, or not? | If you're asking for program help (typically when you're asking about specify HTML attributes), that's more of a stackoverflow.com question rather than this ux.stackexchange.com, but I'll continue on.
Is your correct/incorrect `<div>` an interactive element? It doesn't sound like it but just in case it is and you're *... |
144,415 | <p>Say you have features A and B with following pages:</p>
<pre><code>A: List -> Detail -> Edit
B: List -> Detail -> Edit
</code></pre>
<p>On page Edit (B) you have a dropdown to select a record of type A. You might want to edit that record. So the flow would be:</p>
<pre><code>List (B) -> Detail (B) -&g... | [
{
"answer_id": 144797,
"author": "Jivin Jawanda",
"author_id": 157246,
"author_profile": "https://ux.stackexchange.com/users/157246",
"pm_score": 0,
"selected": false,
"text": "<p>Your best bet here is to see what your users prefer.</p>\n<p>Ask people who would use the pages what they th... | 2022/09/16 | [
"https://ux.stackexchange.com/questions/144415",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/20648/"
] | Say you have features A and B with following pages:
```
A: List -> Detail -> Edit
B: List -> Detail -> Edit
```
On page Edit (B) you have a dropdown to select a record of type A. You might want to edit that record. So the flow would be:
```
List (B) -> Detail (B) -> Edit (B) -> Edit (A)
```
How would you design a... | There are two concepts here:
1. Path taken to arrive at current location (breadcrumb trail), and
2. Relationship of current page to application structure (sitemap).
Both are helpful pieces of information for the user to know. But if both are presented must be cognitively distinct from each other—not to confuse one wi... |
144,535 | <p>Has anyone used the Lostness metric? I'm trying to use it to benchmark a navigation scheme. One of the variables (R) is the minimum number of screens that must be visited to complete a task. I calculated R starting at the homepage for each task. The software we use to run unmoderated testing begins each task (after ... | [
{
"answer_id": 144536,
"author": "jazZRo",
"author_id": 36883,
"author_profile": "https://ux.stackexchange.com/users/36883",
"pm_score": 0,
"selected": false,
"text": "<p>I haven't heard of this metric but this should not be different from any other testing metric or method: You want unb... | 2022/10/03 | [
"https://ux.stackexchange.com/questions/144535",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/162260/"
] | Has anyone used the Lostness metric? I'm trying to use it to benchmark a navigation scheme. One of the variables (R) is the minimum number of screens that must be visited to complete a task. I calculated R starting at the homepage for each task. The software we use to run unmoderated testing begins each task (after the... | Interesting question! I have never used `Lostness` directly myself, but I think it is worth taking a step back and look at the bigger question:
What are we trying to achieve?
------------------------------
Metrics don't exist in a vacuum! **When you use a metric, you are trying to use it as a *shortcut* to measure *s... |
144,589 | <p>I'm currently working on a change request for a search filter we have in our product overview. Our search form has some basic search filters e.g. price range, delivery time,... Our products can also have tags added to them. An example of this would be "coming soon" or "recommended". Each tag curr... | [
{
"answer_id": 144594,
"author": "Nash",
"author_id": 110814,
"author_profile": "https://ux.stackexchange.com/users/110814",
"pm_score": 0,
"selected": false,
"text": "<p>I like the custom selectable buttons of skinflint.co.uk. I agree with you combining behavior of checkboxes and radiob... | 2022/10/06 | [
"https://ux.stackexchange.com/questions/144589",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/154631/"
] | I'm currently working on a change request for a search filter we have in our product overview. Our search form has some basic search filters e.g. price range, delivery time,... Our products can also have tags added to them. An example of this would be "coming soon" or "recommended". Each tag currently has it's own filt... | If you really have the three states:
* Show Only “Coming Soon”
* Exclude “Coming Soon”
* Show Both
Then for clarity you need a control the handles three states, such as three radio buttons. For example, if you have an arbitrary number of binary attributes or “tags” (i.e., either the product has it or not), it could l... |
144,915 | <p>I know people asked this question a decade ago. (<a href="https://ux.stackexchange.com/questions/12512/are-round-check-boxes-confusing-or-an-accepted-standard/12554#12554">Are round check boxes confusing or an accepted standard?</a>)</p>
<p>So, after all these years, has this become a standard in terms of usability?... | [
{
"answer_id": 144982,
"author": "Sooraj MV",
"author_id": 125160,
"author_profile": "https://ux.stackexchange.com/users/125160",
"pm_score": 0,
"selected": false,
"text": "<p>Many map applications, including Google maps, Waze, and Apple maps use icons to indicate a specific type of issu... | 2022/11/16 | [
"https://ux.stackexchange.com/questions/144915",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/125160/"
] | I know people asked this question a decade ago. ([Are round check boxes confusing or an accepted standard?](https://ux.stackexchange.com/questions/12512/are-round-check-boxes-confusing-or-an-accepted-standard/12554#12554))
So, after all these years, has this become a standard in terms of usability? Or is it purely a U... | Mark the task, or if there's no task in the zone, mark the hazard:
[](https://i.stack.imgur.com/jnpbg.png)
Or mark the zone:
[](https://i.stack.imgur.com/vrrA9.png) |
144,987 | <p>I've launched the website <a href="https://gardenerplanet.com/" rel="nofollow noreferrer">https://gardenerplanet.com/</a> a month ago and have now added a landing page to the website to draw more visitors. The landing page consists of four pictures that display different features of the website along with text that ... | [
{
"answer_id": 144989,
"author": "hvid kanin",
"author_id": 158531,
"author_profile": "https://ux.stackexchange.com/users/158531",
"pm_score": 1,
"selected": false,
"text": "<p>It is a lot of text. Two questions that might help you, to judge whether you have the right amount of text are:... | 2022/11/23 | [
"https://ux.stackexchange.com/questions/144987",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/134548/"
] | I've launched the website <https://gardenerplanet.com/> a month ago and have now added a landing page to the website to draw more visitors. The landing page consists of four pictures that display different features of the website along with text that describes each feature. At the bottom is a CTA phrase that prompts th... | The site does not [sizzle](https://millyuns.com/sizzle/).
[](https://i.stack.imgur.com/ZdxAK.png)
(Ignoring the header with the giant banner ad...)
The site describes what the user can do—that's important, but what's missing is the benefit. Feature the benefit—sell the s... |
145,088 | <p>I know that in theory you shouldn't hide active elements... But... What if the link is repeated twice?</p>
<p>To clarify the link is on the picture which has no additional information value. A separate link is on a text and the url is the same as on the picture. The problem is that the picture is a separate componen... | [
{
"answer_id": 145077,
"author": "bloodyKnuckles",
"author_id": 93969,
"author_profile": "https://ux.stackexchange.com/users/93969",
"pm_score": 1,
"selected": false,
"text": "<p>Somewhat similar, there's the follow-the-leader type navigation feature many documentation sites use.</p>\n<p... | 2022/12/04 | [
"https://ux.stackexchange.com/questions/145088",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/162396/"
] | I know that in theory you shouldn't hide active elements... But... What if the link is repeated twice?
To clarify the link is on the picture which has no additional information value. A separate link is on a text and the url is the same as on the picture. The problem is that the picture is a separate component for the... | The Chrome Browser provides a similar interface when you search for a word on a page. On the righthand side of the viewport, it provides users with a map of where that word has been found on the page. Each yellow line represents a result. Moving the scroll indicator to a spot on that map brings that section of the page... |
145,492 | <p>The app I work on has some undocumented but consistent behavior when filtering and sorting a queue.</p>
<p>The formal requirement is that, if the filter returns more than 1000 results, a warning message is displayed and only 1000 results are shown.</p>
<p>As an implementation detail, it so happens that the app in fa... | [
{
"answer_id": 145561,
"author": "Katleho Hadar",
"author_id": 163223,
"author_profile": "https://ux.stackexchange.com/users/163223",
"pm_score": 0,
"selected": false,
"text": "<p>As I understand the question we want to figure out "what is the best of the two ways to present the dat... | 2023/01/30 | [
"https://ux.stackexchange.com/questions/145492",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/164464/"
] | The app I work on has some undocumented but consistent behavior when filtering and sorting a queue.
The formal requirement is that, if the filter returns more than 1000 results, a warning message is displayed and only 1000 results are shown.
As an implementation detail, it so happens that the app in fact displays the... | >
> How to informally test users’ knowledge of app’s undocumented behavior
>
>
>
After the warning, and along with the 1000 partial results, present a somewhat unobtrusive note or easily dismissable popup that asks:
```
Are these the results you expected?
Yes No
```
>
> My current but untested intuition is t... |
145,496 | <p>According to the documentation <a href="https://m3.material.io/foundations/interaction-states" rel="nofollow noreferrer">here</a>, interaction states (hover, focus, pressed etc) are represented by overlaying an additional state layer on top of the container:</p>
<blockquote>
<p>The state layer is an overlay with a f... | [
{
"answer_id": 145561,
"author": "Katleho Hadar",
"author_id": 163223,
"author_profile": "https://ux.stackexchange.com/users/163223",
"pm_score": 0,
"selected": false,
"text": "<p>As I understand the question we want to figure out "what is the best of the two ways to present the dat... | 2023/01/31 | [
"https://ux.stackexchange.com/questions/145496",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/115640/"
] | According to the documentation [here](https://m3.material.io/foundations/interaction-states), interaction states (hover, focus, pressed etc) are represented by overlaying an additional state layer on top of the container:
>
> The state layer is an overlay with a fixed opacity for each state and uses the same color as... | >
> How to informally test users’ knowledge of app’s undocumented behavior
>
>
>
After the warning, and along with the 1000 partial results, present a somewhat unobtrusive note or easily dismissable popup that asks:
```
Are these the results you expected?
Yes No
```
>
> My current but untested intuition is t... |
145,545 | <p>I'm trying to find an argument against adding an extra UI element in one of our form.</p>
<p>We have a URL link and a small "(i)" icon next to it.</p>
<p>Both the URL and the icon can have tooltips.</p>
<p>Something like : (the mockup does not work) ("link to microsoft" is the text to the extern... | [
{
"answer_id": 145546,
"author": "Devin",
"author_id": 54669,
"author_profile": "https://ux.stackexchange.com/users/54669",
"pm_score": 3,
"selected": true,
"text": "<p>I've no logical argument against the use of icons unless they take up space or increase cognitive load.</p>\n<p>However... | 2023/02/02 | [
"https://ux.stackexchange.com/questions/145545",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/10623/"
] | I'm trying to find an argument against adding an extra UI element in one of our form.
We have a URL link and a small "(i)" icon next to it.
Both the URL and the icon can have tooltips.
Something like : (the mockup does not work) ("link to microsoft" is the text to the external website)
```
link to microsoft (i)
``... | I've no logical argument against the use of icons unless they take up space or increase cognitive load.
However, unless you're linking to a tooltip that provides help or information on the topic, the use of the (i) symbol is wrong *(and here we're dealing with cognitive load)*. If it's just a link to an external websi... |
145,694 | <p>Would love to get some thoughts on this: I am working on an app that will allow users to rate their entries, e.g., on a scale from 1 to 5. The UX challenge, however, is that all entries are positive (think "gratitude journal"), so even the lowest rating is positive. Thanks to Amazon, Google Maps and the li... | [
{
"answer_id": 145699,
"author": "Glorfindel",
"author_id": 64458,
"author_profile": "https://ux.stackexchange.com/users/64458",
"pm_score": 2,
"selected": false,
"text": "<p>5 (different, I guess) positive emojis could work, but it may be hard for your users to learn what the actual sca... | 2023/02/17 | [
"https://ux.stackexchange.com/questions/145694",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/164771/"
] | Would love to get some thoughts on this: I am working on an app that will allow users to rate their entries, e.g., on a scale from 1 to 5. The UX challenge, however, is that all entries are positive (think "gratitude journal"), so even the lowest rating is positive. Thanks to Amazon, Google Maps and the like, the feedb... | Well, of course, you have to take out any negative connotation and leave only positive options. Fortunately, there are very well-known (and tested) examples: the original Facebook (only one Like), Netflix, YouTube, and so on.
Facebook [introduced reactions](https://en.wikipedia.org/wiki/Facebook_like_button) to expres... |
145,784 | <p>As the Indeterminate state of a checkbox can only be set programmatically I was wondering what the best approach would be for the following scenario.</p>
<p><strong>1. Starting with a GUI (checkbox and number input) controlled by a higher group.</strong>
<a href="https://i.stack.imgur.com/MUAzb.png" rel="nofollow no... | [
{
"answer_id": 145786,
"author": "Andy",
"author_id": 74823,
"author_profile": "https://ux.stackexchange.com/users/74823",
"pm_score": 2,
"selected": false,
"text": "<p>I suggest radio buttons.</p>\n<pre><code>( ) Same as group (Yes)\n( ) Yes\n( ) No\n</code></pre>\n<p>That pattern is al... | 2023/02/24 | [
"https://ux.stackexchange.com/questions/145784",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/158066/"
] | As the Indeterminate state of a checkbox can only be set programmatically I was wondering what the best approach would be for the following scenario.
**1. Starting with a GUI (checkbox and number input) controlled by a higher group.**
[](https://i.sta... | I suggest radio buttons.
```
( ) Same as group (Yes)
( ) Yes
( ) No
```
That pattern is also used in application settings, that can also be set on system level, like language or theme.
Here’s the example from Figma:
[![A theme input with an expanded menu with three options: Light, Dark, System theme. The last opti... |
145,849 | <p>I'm building a form with several questions and Yes/No options, and I want to make it highly accessible for users with screen readers. However, I don't want to frustrate the user by having the screen reader read the question multiple times when navigating with tab key or even when navigating with arrow up/down keys.<... | [
{
"answer_id": 145836,
"author": "Donald Yotay",
"author_id": 165012,
"author_profile": "https://ux.stackexchange.com/users/165012",
"pm_score": 1,
"selected": false,
"text": "<p>Use the dropdown menu. A modal might see more like a disturbance than an helpful resource. From a users POV t... | 2023/03/01 | [
"https://ux.stackexchange.com/questions/145849",
"https://ux.stackexchange.com",
"https://ux.stackexchange.com/users/100491/"
] | I'm building a form with several questions and Yes/No options, and I want to make it highly accessible for users with screen readers. However, I don't want to frustrate the user by having the screen reader read the question multiple times when navigating with tab key or even when navigating with arrow up/down keys.
Wh... | Use the dropdown menu. A modal might see more like a disturbance than an helpful resource. From a users POV they don't usually have the best experiences with modals popping up. |
357 | <p>As I'm going vegan, I need to replace protein from meat with plant proteins. When I was eating meat, I didn't pay any attention to how much protein I ate. But in a vegan diet, I feel that I would have to look at it a bit more closely.</p>
<p>I'm now wondering, how I can determine how much protein I need in a vegan ... | [
{
"answer_id": 359,
"author": "Ramon Melo",
"author_id": 154,
"author_profile": "https://vegetarianism.stackexchange.com/users/154",
"pm_score": 4,
"selected": true,
"text": "<p>If you are having issues reaching your protein goals, you can supplement your diet with soy protein powder. It... | 2017/02/04 | [
"https://vegetarianism.stackexchange.com/questions/357",
"https://vegetarianism.stackexchange.com",
"https://vegetarianism.stackexchange.com/users/77/"
] | As I'm going vegan, I need to replace protein from meat with plant proteins. When I was eating meat, I didn't pay any attention to how much protein I ate. But in a vegan diet, I feel that I would have to look at it a bit more closely.
I'm now wondering, how I can determine how much protein I need in a vegan diet? | If you are having issues reaching your protein goals, you can supplement your diet with soy protein powder. It's cheap, a source of all 9 essential aminoacids, and it has a bland taste, so you can mix it into smoothies, shakes, salads, or even your lunch.
About "which quantity", we can't get the right number for you ... |
664 | <p>Many recipes for vegan cheese use cashews as a base. I have to avoid these recipes because I am highly allergic to cashews. Due to the nature of the allergy, I also have to avoid most tree nuts.</p>
<p><strong>What properties do cashews have that make them desirable as a base for vegan cheese and how can I replicat... | [
{
"answer_id": 667,
"author": "MatthewMartin",
"author_id": 320,
"author_profile": "https://vegetarianism.stackexchange.com/users/320",
"pm_score": 3,
"selected": false,
"text": "<p>Cashews are used in these recipes because they have little fiber and what fiber they do have dissolves in ... | 2017/03/02 | [
"https://vegetarianism.stackexchange.com/questions/664",
"https://vegetarianism.stackexchange.com",
"https://vegetarianism.stackexchange.com/users/56/"
] | Many recipes for vegan cheese use cashews as a base. I have to avoid these recipes because I am highly allergic to cashews. Due to the nature of the allergy, I also have to avoid most tree nuts.
**What properties do cashews have that make them desirable as a base for vegan cheese and how can I replicate their function... | Cashews are used in these recipes because they are high in fats and so produce a creamy texture, as well as having a nice flavour and mildly sweet taste (which reproduces somewhat the slight sweetness of some dairy cheeses due to the presence of lactose).
As the closest alternative, I suggest using seeds such as pumpk... |
811 | <p>I have a lot of bananas at the moment. I am cooking them, eating them in so many ways it is impossible to explain. However, is it possible to live off bananas in my vegetarian diet? Am I getting enough nutrients? What should I add to my banana diet, if anything?</p>
| [
{
"answer_id": 812,
"author": "Zanna",
"author_id": 74,
"author_profile": "https://vegetarianism.stackexchange.com/users/74",
"pm_score": 3,
"selected": false,
"text": "<p>Here's what's in 100g of banana <a href=\"https://en.wikipedia.org/wiki/Banana\" rel=\"noreferrer\">according to Wik... | 2017/03/20 | [
"https://vegetarianism.stackexchange.com/questions/811",
"https://vegetarianism.stackexchange.com",
"https://vegetarianism.stackexchange.com/users/300/"
] | I have a lot of bananas at the moment. I am cooking them, eating them in so many ways it is impossible to explain. However, is it possible to live off bananas in my vegetarian diet? Am I getting enough nutrients? What should I add to my banana diet, if anything? | Here's what's in 100g of banana [according to Wikipedia](https://en.wikipedia.org/wiki/Banana) (percentages based on recommendations for adults)
```
Nutritional value per 100 g (3.5 oz)
Energy 371 kJ (89 kcal)
Carbohydrates 22.84 g
Sugars 12.23 g
Dietary fiber 2.6 g
Fat 0.33 g
Protein 1.09 g
Thiamine (B1)... |
1,052 | <p>What are the foods with the best price per protein ratio in the UK? I feel that protein is the main obstacle to a vegan diet, and so I would like to learn about possible options from you experienced folk.</p>
| [
{
"answer_id": 1053,
"author": "Zanna",
"author_id": 74,
"author_profile": "https://vegetarianism.stackexchange.com/users/74",
"pm_score": 3,
"selected": false,
"text": "<p>Actually I disagree with you that protein is a major obstacle to going vegan. It's everywhere!</p>\n\n<p>Grains and... | 2017/05/26 | [
"https://vegetarianism.stackexchange.com/questions/1052",
"https://vegetarianism.stackexchange.com",
"https://vegetarianism.stackexchange.com/users/733/"
] | What are the foods with the best price per protein ratio in the UK? I feel that protein is the main obstacle to a vegan diet, and so I would like to learn about possible options from you experienced folk. | Here is a list of foods ranked by grams protein per British pound, which may vary in the US, but not likely by that much (note its a bit of a random selection). The third column is protein per unit of money, and the second column is percent of calories that are from protein. For example, peanut butter is very cost effe... |
1,256 | <p>Eggs maybe considered vegetarian by many since most eggs are unfertilized and do not result in the death of any animals. However, egg farms are usually not cruelty-free since when hens get too old to hatch eggs, they are slaughtered for meat.</p>
<p>Are there any commercial farms that sell cruelty-free eggs i.e. wh... | [
{
"answer_id": 1257,
"author": "Vaelus",
"author_id": 1250,
"author_profile": "https://vegetarianism.stackexchange.com/users/1250",
"pm_score": 5,
"selected": true,
"text": "<p>There are probably not commercial farms that sell cruelty-free eggs as described by you, but it's likely that t... | 2018/01/05 | [
"https://vegetarianism.stackexchange.com/questions/1256",
"https://vegetarianism.stackexchange.com",
"https://vegetarianism.stackexchange.com/users/-1/"
] | Eggs maybe considered vegetarian by many since most eggs are unfertilized and do not result in the death of any animals. However, egg farms are usually not cruelty-free since when hens get too old to hatch eggs, they are slaughtered for meat.
Are there any commercial farms that sell cruelty-free eggs i.e. where hens a... | There are probably not commercial farms that sell cruelty-free eggs as described by you, but it's likely that there are many individuals who keep a few chickens as pets and do not kill them after their egg production slows.
For commercial farms, it's not commercially viable. Some back of the envelope math says farms w... |
1,477 | <p>I’ve heard that it’s important for health to soak beans when cooking them from dry. Some people also soak rice or chickpeas. I don’t think I’ve ever heard of somebody soaking lentils.</p>
<p>Why do we soak some legumes and not others? Which foods benefit from soaking, and what are the reasons some related foods lik... | [
{
"answer_id": 1499,
"author": "tdrsam",
"author_id": 1613,
"author_profile": "https://vegetarianism.stackexchange.com/users/1613",
"pm_score": 1,
"selected": false,
"text": "<p>Soaking foods can help to remove indigestible components of the foods. Things like polysaccharides. These suga... | 2018/05/09 | [
"https://vegetarianism.stackexchange.com/questions/1477",
"https://vegetarianism.stackexchange.com",
"https://vegetarianism.stackexchange.com/users/1236/"
] | I’ve heard that it’s important for health to soak beans when cooking them from dry. Some people also soak rice or chickpeas. I don’t think I’ve ever heard of somebody soaking lentils.
Why do we soak some legumes and not others? Which foods benefit from soaking, and what are the reasons some related foods like lentils ... | While I appreciate the orientation towards an analytical, scientific and health perspective here, I have not ignored culinary considerations where they seemed important.
This post is a work in progress. I will try to keep updating it as I learn more.
General theory
--------------
Beans, legumes, grains, nuts and, uh... |
2,409 | <p><em><sub>I know that nutrition and fast food are usually opposite concepts, but I'm still curious...</sub></em></p>
<p>A&W Canada recently <a href="https://www.globenewswire.com/news-release/2021/08/04/2274494/0/en/Beyond-Meat-Expands-Partnership-With-A-W-Canada-To-Launch-Plant-Based-Chicken-Nuggets-Nationwide-f... | [
{
"answer_id": 2427,
"author": "Nic",
"author_id": 1236,
"author_profile": "https://vegetarianism.stackexchange.com/users/1236",
"pm_score": 2,
"selected": false,
"text": "<p>I found <a href=\"https://foodgressing.com/beyond-meat-nuggets-aw-canada/\" rel=\"nofollow noreferrer\">a post on... | 2021/08/18 | [
"https://vegetarianism.stackexchange.com/questions/2409",
"https://vegetarianism.stackexchange.com",
"https://vegetarianism.stackexchange.com/users/1236/"
] | *I know that nutrition and fast food are usually opposite concepts, but I'm still curious...*
A&W Canada recently [added](https://www.globenewswire.com/news-release/2021/08/04/2274494/0/en/Beyond-Meat-Expands-Partnership-With-A-W-Canada-To-Launch-Plant-Based-Chicken-Nuggets-Nationwide-for-a-Limited-Time-Starting-Augus... | The nutritional info is at <https://web.aw.ca/en/our-menu/chicken/beyond-meat-nuggets>
```
Calories 300
Fat 15.6 g
Protein 18 g
Serving Size 120 g
Nutrition Contents
Sugar 1.44 g
Carbohydrates 22 g
Trans Fat 0.18 g
Saturated Fat 2.40 g
Cholesterol 0 mg
... |
2,431 | <p>Too much boiling (or frying) may destroy the necessary nutrients of vegetables. Is there any rule of thumb or guideline on how much time vegetables should be heated for?</p>
| [
{
"answer_id": 2427,
"author": "Nic",
"author_id": 1236,
"author_profile": "https://vegetarianism.stackexchange.com/users/1236",
"pm_score": 2,
"selected": false,
"text": "<p>I found <a href=\"https://foodgressing.com/beyond-meat-nuggets-aw-canada/\" rel=\"nofollow noreferrer\">a post on... | 2021/08/29 | [
"https://vegetarianism.stackexchange.com/questions/2431",
"https://vegetarianism.stackexchange.com",
"https://vegetarianism.stackexchange.com/users/5015/"
] | Too much boiling (or frying) may destroy the necessary nutrients of vegetables. Is there any rule of thumb or guideline on how much time vegetables should be heated for? | The nutritional info is at <https://web.aw.ca/en/our-menu/chicken/beyond-meat-nuggets>
```
Calories 300
Fat 15.6 g
Protein 18 g
Serving Size 120 g
Nutrition Contents
Sugar 1.44 g
Carbohydrates 22 g
Trans Fat 0.18 g
Saturated Fat 2.40 g
Cholesterol 0 mg
... |
150 | <p>Currently, <a href="https://vi.stackexchange.com/questions/534/folding-fails-vim-cant-find-any-fold">Folding fails: vim can't find any fold</a> is tagged with <a href="https://vi.stackexchange.com/questions/tagged/folding" class="post-tag" title="show questions tagged 'folding'" rel="tag">folding</a> <a ... | [
{
"answer_id": 151,
"author": "200_success",
"author_id": 24,
"author_profile": "https://vi.meta.stackexchange.com/users/24",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, such tags help organize the site. It recognizes that there are concerns that are specific to each programming ... | 2015/02/06 | [
"https://vi.meta.stackexchange.com/questions/150",
"https://vi.meta.stackexchange.com",
"https://vi.meta.stackexchange.com/users/24/"
] | Currently, [Folding fails: vim can't find any fold](https://vi.stackexchange.com/questions/534/folding-fails-vim-cant-find-any-fold) is tagged with [folding](https://vi.stackexchange.com/questions/tagged/folding "show questions tagged 'folding'") [php](https://vi.stackexchange.com/questions/tagged/php "show questions t... | **Yes**, but *only* if the question is specific to a specific filetype, or occurs only with a specific filetype.
Vim ships with a number of support files for many different formats (not just programming languages), for PHP:
```
$ find /usr/share/vim -name php\*
/usr/share/vim/vim74/autoload/phpcomplete.vim
/usr/share... |
1,248 | <p>Many answers (and some questions) include information from vim's builtin documentation. I often find myself on google looking for an HTML version of the vim help, so I can link to it in my answers.</p>
<p>With this in mind, I have two questions:</p>
<ol>
<li>Is there any way to automatically link <code>:help [key... | [
{
"answer_id": 1249,
"author": "Community",
"author_id": -1,
"author_profile": "https://vi.meta.stackexchange.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>Is there any way to automatically link :help [key] in answers to\n online documentation, so the audi... | 2015/02/27 | [
"https://vi.meta.stackexchange.com/questions/1248",
"https://vi.meta.stackexchange.com",
"https://vi.meta.stackexchange.com/users/141/"
] | Many answers (and some questions) include information from vim's builtin documentation. I often find myself on google looking for an HTML version of the vim help, so I can link to it in my answers.
With this in mind, I have two questions:
1. Is there any way to automatically link `:help [key]` in answers to online do... | **Update 20150825**: an improved of this now lives at <http://code.arp242.net/helplink.vim>. It has a number of improvements, and you can install it as a plugin :-)
I will leave the original since it's a lot simpler and might be more helpful to show how this can be done.
---
I've been using this function; it will (b... |
1,486 | <p>I’ve seen <a href="https://vi.stackexchange.com/q/20691/10604">a couple</a> <a href="https://vi.stackexchange.com/q/20612/10604">of QAs</a> lately where the OP’s main issue is a missing execute (they need string interpolation/function return values in commands). </p>
<p>I’ve voted to close one as a dupe of the othe... | [
{
"answer_id": 1489,
"author": "D. Ben Knoble",
"author_id": 10604,
"author_profile": "https://vi.meta.stackexchange.com/users/10604",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p><strike>This is a suggestion for a canonical resource. Please review.</strike>\n I've gone... | 2019/07/22 | [
"https://vi.meta.stackexchange.com/questions/1486",
"https://vi.meta.stackexchange.com",
"https://vi.meta.stackexchange.com/users/10604/"
] | I’ve seen [a couple](https://vi.stackexchange.com/q/20691/10604) [of QAs](https://vi.stackexchange.com/q/20612/10604) lately where the OP’s main issue is a missing execute (they need string interpolation/function return values in commands).
I’ve voted to close one as a dupe of the other, but I was looking for a more ... | >
> This is a suggestion for a canonical resource. Please review.
> I've gone ahead and [posted it](https://vi.stackexchange.com/q/21392/10604).
>
>
>
Question: how do I use a variable or return value in option, command, or mapping?
=================================================================================... |
1 | <p>I'd like to see line numbers, starting with <code>1</code> at the top, on the left side of Vim. Ideally it would look like this:</p>
<pre><code>1 | foo = Foo.new
2 | bar = Bar.new
3 | baz = foo.baz(bar)
...
10| test = AwesomeSauce.test
</code></pre>
<p>How can I do this in Vim?</p>
| [
{
"answer_id": 2,
"author": "Seth",
"author_id": 5,
"author_profile": "https://vi.stackexchange.com/users/5",
"pm_score": 5,
"selected": false,
"text": "<p>You can use the command: </p>\n\n<pre><code>:set number \n</code></pre>\n\n<p>to turn on line numbering. To turn it off again you... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/1",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/2/"
] | I'd like to see line numbers, starting with `1` at the top, on the left side of Vim. Ideally it would look like this:
```
1 | foo = Foo.new
2 | bar = Bar.new
3 | baz = foo.baz(bar)
...
10| test = AwesomeSauce.test
```
How can I do this in Vim? | You have two options:
`set number` for regular line numbers
And also
`set relativenumber` which will show relative line numbers. i.e. current line is always 0. This is useful for moving up/down N number of lines using `5j` for example.
What is cool is that you can combine them. I have the following in my `.vimrc`
``... |
3 | <p>A lot of vim commands can take a number referring to the number of lines that the command will act on. </p>
<p>Is it possible to show the line numbers relative to the current line? Something like the following:</p>
<pre><code>3: some text here
2: more text
1: This is the line above where the cursor is
0: The curso... | [
{
"answer_id": 7,
"author": "shawndumas",
"author_id": 27,
"author_profile": "https://vi.stackexchange.com/users/27",
"pm_score": 3,
"selected": false,
"text": "<pre><code>function! NumberToggle()\n if(&relativenumber == 1)\n set norelativenumber\n else\n set relativenumber\n... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/3",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/11/"
] | A lot of vim commands can take a number referring to the number of lines that the command will act on.
Is it possible to show the line numbers relative to the current line? Something like the following:
```
3: some text here
2: more text
1: This is the line above where the cursor is
0: The cursor is on this line
1: ... | I just replied to a similar question here: [How can I add line numbers to Vim?](https://vi.stackexchange.com/questions/1/how-can-i-add-line-numbers-to-vim)
Beginning with version 7.3, you can use the following:
```
set relativenumber
```
I actually use both `relativenumber` and `number` in my vimrc which will use r... |
4 | <p>I'd like to have different indentations based on the type of file I am working on. For example, working on a <code>.c</code> file I'd like my indentation be 4 spaces. In <code>.html</code> files I'd like to (have to) work with tabs. </p>
<p>How do I achieve that?</p>
| [
{
"answer_id": 10,
"author": "shawndumas",
"author_id": 27,
"author_profile": "https://vi.stackexchange.com/users/27",
"pm_score": 4,
"selected": false,
"text": "<p><code>augroup</code> allows you to group related autocommands into named groups. (See <a href=\"http://learnvimscriptthehar... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/4",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/12/"
] | I'd like to have different indentations based on the type of file I am working on. For example, working on a `.c` file I'd like my indentation be 4 spaces. In `.html` files I'd like to (have to) work with tabs.
How do I achieve that? | The best method is to put those settings in `~/.vim/after/ftplugin/<filetype>.vim`.
For HTML (assuming you want 4 characters-wide tabs):
```
~/.vim/after/ftplugin/html.vim
setlocal shiftwidth=4
setlocal softtabstop=4
setlocal noexpandtab
```
Using an ftplugin is prefered to using autocommands because Vim already d... |
12 | <p>Starting from a blank slate, how can I obtain a document that contains</p>
<pre><code>1
2
3
4
5
6
7
8
9
10
…
100
</code></pre>
<p>To be clear, I don't want these numbers displayed in the margin; I want them inserted into the document itself.</p>
| [
{
"answer_id": 14,
"author": "Undo",
"author_id": 2,
"author_profile": "https://vi.stackexchange.com/users/2",
"pm_score": 7,
"selected": true,
"text": "<p>Use <code>:put</code> and <code>range()</code>:</p>\n\n<pre><code>:put =range(1,100)\n</code></pre>\n\n<p>To avoid the blank line at... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/12",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/24/"
] | Starting from a blank slate, how can I obtain a document that contains
```
1
2
3
4
5
6
7
8
9
10
…
100
```
To be clear, I don't want these numbers displayed in the margin; I want them inserted into the document itself. | Use `:put` and `range()`:
```
:put =range(1,100)
```
To avoid the blank line at the top ([kudos to romainl](https://vi.stackexchange.com/questions/12/how-can-i-generate-a-list-of-sequential-numbers-one-per-line#comment15_14)), use `:0put`:
```
:0put =range(1,100)
``` |
13 | <p>Actually, I hit this problem when I used ssh from my android phone to log in into a linux server, and I tried to use vim to edit some files.</p>
<p>It was a little bit... displeasing, although I could do everything which I could do from a normal desktop/keyboard.</p>
<p><em>Extension:</em> There was a question, wh... | [
{
"answer_id": 2561,
"author": "firedev",
"author_id": 237,
"author_profile": "https://vi.stackexchange.com/users/237",
"pm_score": 3,
"selected": true,
"text": "<p>Does enabling mouse helps? This way you should be able at least do selections via touch. Maybe navigate files and buffers/t... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/13",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/28/"
] | Actually, I hit this problem when I used ssh from my android phone to log in into a linux server, and I tried to use vim to edit some files.
It was a little bit... displeasing, although I could do everything which I could do from a normal desktop/keyboard.
*Extension:* There was a question, why it was displeasing if ... | Does enabling mouse helps? This way you should be able at least do selections via touch. Maybe navigate files and buffers/tabs. Depends on plugins I guess.
```
set mouse=a
``` |
16 | <p>It is normally on the left side, and it enables a fast switching between files in a complex directory hierarchy.</p>
| [
{
"answer_id": 20,
"author": "avelino",
"author_id": 37,
"author_profile": "https://vi.stackexchange.com/users/37",
"pm_score": 2,
"selected": false,
"text": "<p>If <strong>nerdtree</strong> set:</p>\n\n<pre><code>let g:NERDTreeWinPos = \"right\"\n</code></pre>\n"
},
{
"answer_id... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/16",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/28/"
] | It is normally on the left side, and it enables a fast switching between files in a complex directory hierarchy. | Vim comes with a built-in file explorer called netrw. If you have a reasonaby recent Vim, the following command will give you the kind of feature you are missing:
```
:Lexplore
```
See `:help netrw`. |
17 | <p>This is a problem I had recently. I have a file with several hundred lines of text. How can I search for a string between two specific line numbers? For e.g. I want to search between line numbers 100 and 325.</p>
| [
{
"answer_id": 27,
"author": "romainl",
"author_id": 54,
"author_profile": "https://vi.stackexchange.com/users/54",
"pm_score": 3,
"selected": false,
"text": "<pre><code>:100,235g/foo/#<CR>\n</code></pre>\n\n<p>then press <code>:147<CR></code> to jump to the desired line.</p>... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/17",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/5/"
] | This is a problem I had recently. I have a file with several hundred lines of text. How can I search for a string between two specific line numbers? For e.g. I want to search between line numbers 100 and 325. | ```
:100,235g/foo/#<CR>
```
then press `:147<CR>` to jump to the desired line.
You can also use `:ilist`:
```
:100,235il foo<CR>
```
See `:help range`, `:help :global` and `:help :ilist`. |
19 | <p>When using <kbd>ci"</kbd> the cursor does not have to reside in the double quoted area. </p>
<pre><code>|String somestring = "some text";
</code></pre>
<p>Assuming the pipe is the cursor position, <kbd>ci"</kbd> will make it jump to the quoted area.</p>
<p>On the other hand, when using <kbd>ci(</kbd>, the cursor ... | [
{
"answer_id": 32,
"author": "jamessan",
"author_id": 15,
"author_profile": "https://vi.stackexchange.com/users/15",
"pm_score": 3,
"selected": false,
"text": "<p>The quote family of text objects (<code>i'</code>, <code>i\"</code>, <code>a'</code>, and <code>a\"</code>) are different tha... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/19",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/18/"
] | When using `ci"` the cursor does not have to reside in the double quoted area.
```
|String somestring = "some text";
```
Assuming the pipe is the cursor position, `ci"` will make it jump to the quoted area.
On the other hand, when using `ci(`, the cursor must be inside the parentheses to work and will not move the... | The main difference here is that parenthetical statements (targeted by `ci(`) can be nested, while quoted strings (targeted by `ci"`) cannot.
If your cursor is outside of some parenthetical statement, it could still be inside of some other one. For example (`*` marks the cursor position):
```
$foo = array(
'x' =>... |
24 | <p>When I do a change in my <code>.vimrc</code>, I usually exit Vim and open it again. Is there an easier way to reload the new <code>.vimrc</code> changes?</p>
| [
{
"answer_id": 26,
"author": "Paul Gessler",
"author_id": 16,
"author_profile": "https://vi.stackexchange.com/users/16",
"pm_score": 7,
"selected": true,
"text": "<p>Run:</p>\n\n<pre><code>:source $MYVIMRC\n</code></pre>\n\n<p>inside Vim to reload the <code>vimrc</code> file. Or, a short... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/24",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/53/"
] | When I do a change in my `.vimrc`, I usually exit Vim and open it again. Is there an easier way to reload the new `.vimrc` changes? | Run:
```
:source $MYVIMRC
```
inside Vim to reload the `vimrc` file. Or, a shorter version:
```
:so $MYVIMRC
```
as mentioned in a comment by [kenorb](https://vi.stackexchange.com/users/467/kenorb).
You may also find it useful to map either of these forms to a key. For example:
```
nnoremap <Leader>r :source $M... |
25 | <p>When I write a script in gedit, the commands, comments, variables etc... are given different colors. How do I setup vim to do the same?</p>
| [
{
"answer_id": 29,
"author": "romainl",
"author_id": 54,
"author_profile": "https://vi.stackexchange.com/users/54",
"pm_score": 3,
"selected": false,
"text": "<p>Try <code>:syntax on</code>.</p>\n\n<p>To have syntax highlighting enabled by default, add the following line to your <code>~/... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/25",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/17/"
] | When I write a script in gedit, the commands, comments, variables etc... are given different colors. How do I setup vim to do the same? | Try `:syntax on`.
To have syntax highlighting enabled by default, add the following line to your `~/.vimrc`:
```
syntax on
```
If the file doesn't exist, create it. |
39 | <p>Many IDEs automatically complete function names, variables, method names, etc. as the user types. The best ones complete the names based both on the language's built-in library as well as what has already been defined in other files of the same program.</p>
<p>For example, as I'm typing the following Python program... | [
{
"answer_id": 54,
"author": "Dhruva Sagar",
"author_id": 74,
"author_profile": "https://vi.stackexchange.com/users/74",
"pm_score": 5,
"selected": false,
"text": "<p>Vim has support for completion natively. You can read about the various different completions that Vim supports at <code>... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/39",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/69/"
] | Many IDEs automatically complete function names, variables, method names, etc. as the user types. The best ones complete the names based both on the language's built-in library as well as what has already been defined in other files of the same program.
For example, as I'm typing the following Python program:
```
hun... | There are many different flavors of autocomplete in vim. One way might be to use [SuperTab](https://github.com/ervandew/supertab). This provides a way to use tab-completion at more or less any time. This would enable you to hit `Tab` after you've partially typed the word to get a completion list. For instance, typing `... |
56 | <p>By default, <code>vim</code> leaves swap files in my project directory, and on crashes it leaves backup files.</p>
<p>Can I prevent this? Or do I need to update all my projects' <code>.VCSignore</code> file?</p>
| [
{
"answer_id": 57,
"author": "Martin Tournoij",
"author_id": 51,
"author_profile": "https://vi.stackexchange.com/users/51",
"pm_score": 1,
"selected": false,
"text": "<p>This is what I do in my vimrc:</p>\n<pre><code>fun! MkdirIfNeeded(dir, flags, permissions)\n if !isdirectory(a:dir)... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/56",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/51/"
] | By default, `vim` leaves swap files in my project directory, and on crashes it leaves backup files.
Can I prevent this? Or do I need to update all my projects' `.VCSignore` file? | ### Backup files
By default, Vim doesn't leave backup files behind. They are merely transient files that exist while Vim is saving the buffer to disk. As described in `:help backup-table` this behavior can be controlled by the `'backup'` and `'writebackup'` options:
```
'backup' 'writebackup' action ~
off ... |
61 | <p>I have a lot of <code>*.sage</code> that follow the Python syntax. However, VIm does not recognize this. Can I make VIm set <code>++filetype</code> based solely on the file extension?</p>
| [
{
"answer_id": 57,
"author": "Martin Tournoij",
"author_id": 51,
"author_profile": "https://vi.stackexchange.com/users/51",
"pm_score": 1,
"selected": false,
"text": "<p>This is what I do in my vimrc:</p>\n<pre><code>fun! MkdirIfNeeded(dir, flags, permissions)\n if !isdirectory(a:dir)... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/61",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/82/"
] | I have a lot of `*.sage` that follow the Python syntax. However, VIm does not recognize this. Can I make VIm set `++filetype` based solely on the file extension? | ### Backup files
By default, Vim doesn't leave backup files behind. They are merely transient files that exist while Vim is saving the buffer to disk. As described in `:help backup-table` this behavior can be controlled by the `'backup'` and `'writebackup'` options:
```
'backup' 'writebackup' action ~
off ... |
68 | <p>I've turned on spellcheck with</p>
<pre><code>:set spell spelllang=en_us
</code></pre>
<p>I can now correct the spelling of a word by typing <code>1z=</code> (that is, choose the <code>1</code>st spelling correction (<code>z=</code>)).</p>
<p>How can I make this automatically run on the previous word whenever I t... | [
{
"answer_id": 312,
"author": "wchargin",
"author_id": 142,
"author_profile": "https://vi.stackexchange.com/users/142",
"pm_score": 4,
"selected": false,
"text": "<p>I would recommend against automatically fixing every word that is marked wrong, for two reasons.</p>\n\n<ul>\n<li>First, y... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/68",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/88/"
] | I've turned on spellcheck with
```
:set spell spelllang=en_us
```
I can now correct the spelling of a word by typing `1z=` (that is, choose the `1`st spelling correction (`z=`)).
How can I make this automatically run on the previous word whenever I type a space, without any delays? It also tries to "fix" words that... | I would recommend against automatically fixing every word that is marked wrong, for two reasons.
* First, you'll get a lot of false positives on things you meant to type, especially in more technical writing.
You certainly can (and perhaps should) add these two your dictionary so that they're recognized and suggested.... |
74 | <p>Some word processors and text editors auto-save the files we're editing from time to time, which is very convenient for surviving from nasty crashes, etc.</p>
<p>Is there a way to make Vim auto-save our files after a specific interval? </p>
| [
{
"answer_id": 79,
"author": "jamessan",
"author_id": 15,
"author_profile": "https://vi.stackexchange.com/users/15",
"pm_score": 6,
"selected": true,
"text": "<p>There isn't a builtin option, although <code>:help 'autosave'</code> (in todo.txt) refers to a description of what such an opt... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/74",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/53/"
] | Some word processors and text editors auto-save the files we're editing from time to time, which is very convenient for surviving from nasty crashes, etc.
Is there a way to make Vim auto-save our files after a specific interval? | There isn't a builtin option, although `:help 'autosave'` (in todo.txt) refers to a description of what such an option could do.
One possible way to implement this is to use the `CursorHold` autocommand event. This event is triggered when the user hasn't pressed a key for `'updatetime'` milliseconds.
```
autocmd Curs... |
77 | <p>At my work we use a standard <code>ts</code> of 2; my personal preference is 4, which is what I use for my hobby projects, and this other project we inherited has the convention of <code>ts=8</code>.</p>
<p>There are also some other settings I want to set on a project basis (for example folding). Basing these setti... | [
{
"answer_id": 173,
"author": "PetersenDidIt",
"author_id": 171,
"author_profile": "https://vi.stackexchange.com/users/171",
"pm_score": 3,
"selected": false,
"text": "<p>There is the <a href=\"http://editorconfig.org\" rel=\"noreferrer\">Editor Config</a> project which allows you to def... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/77",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/51/"
] | At my work we use a standard `ts` of 2; my personal preference is 4, which is what I use for my hobby projects, and this other project we inherited has the convention of `ts=8`.
There are also some other settings I want to set on a project basis (for example folding). Basing these settings on the filetype or auto-dete... | There are a few lightweight ways to do this.
1. **Check for a file of given name and source it**
```
if filereadable(".vimscript_file")
so .vimscript_file
endif
```
The file is hidden in the example but that's optional.
2. **Local `.vimrc` files** (not the same as the plugin)
```
set exrc
```
This is similar... |
82 | <p>Some editors (such as Visual Studio on windows) do C++ autocompletion which understand C++. For example, given:</p>
<pre><code>#include <vector>
int main(void) {
std::vector<int> v;
v.i
</code></pre>
<p>In Visual Studio the auto-completion knows the only method on <code>std::vector<int></code>... | [
{
"answer_id": 389,
"author": "akshay",
"author_id": 246,
"author_profile": "https://vi.stackexchange.com/users/246",
"pm_score": 6,
"selected": true,
"text": "<p>I really like <a href=\"https://github.com/Rip-Rip/clang_complete\">clang_complete</a> for this. It does require clang, and y... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/82",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/92/"
] | Some editors (such as Visual Studio on windows) do C++ autocompletion which understand C++. For example, given:
```
#include <vector>
int main(void) {
std::vector<int> v;
v.i
```
In Visual Studio the auto-completion knows the only method on `std::vector<int>` that starts with an `i` is `insert`.
Is it possible... | I really like [clang\_complete](https://github.com/Rip-Rip/clang_complete) for this. It does require clang, and you need to tell it where libclang resides in your system. After that, it works wonderfully.
People might suggest YouCompleteMe, but to be honest, that plugin is hugely bloated for what it says it does, and ... |
84 | <p>Is there a way to copy a block of text to the system clipboard, so I can paste it in another program?</p>
| [
{
"answer_id": 89,
"author": "Quincy Bowers",
"author_id": 93,
"author_profile": "https://vi.stackexchange.com/users/93",
"pm_score": 6,
"selected": false,
"text": "<p>From <a href=\"http://vim.wikia.com/wiki/Accessing_the_system_clipboard\" rel=\"noreferrer\">http://vim.wikia.com/wiki/A... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/84",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/53/"
] | Is there a way to copy a block of text to the system clipboard, so I can paste it in another program? | For **X11**-based systems (ie. **Linux** and most other **UNIX**-like systems)
there are two clipboards which are independent of each other:
* PRIMARY - This is copy-on-select, and can be pasted with the middle mouse
button.
* CLIPBOARD - This is copied with (usually) `^C`, and pasted with `^V` (It's
like MS Windows).... |
88 | <p>For some text formats, line breaks matter.</p>
<p>For example, I often use Vim to write MediaWiki documents, where you can't just put a linebreak anywhere (unlike Markdown). So I'm forced to write lines with a lot of characters.</p>
<p>This can lead to long (200+ chars) or even <em>very</em> long (1000+ chars) lin... | [
{
"answer_id": 90,
"author": "200_success",
"author_id": 24,
"author_profile": "https://vi.stackexchange.com/users/24",
"pm_score": 6,
"selected": true,
"text": "<p>You can use <code>g</code> series of commands to move to the boundaries of the visible screen area. For example, <kbd>g</k... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/88",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/51/"
] | For some text formats, line breaks matter.
For example, I often use Vim to write MediaWiki documents, where you can't just put a linebreak anywhere (unlike Markdown). So I'm forced to write lines with a lot of characters.
This can lead to long (200+ chars) or even *very* long (1000+ chars) lines. I find this very awk... | You can use `g` series of commands to move to the boundaries of the visible screen area. For example, `g``$` moves to the right edge of the screen (which is not necessarily the end of the line). `g``j` moves the cursor down one line *as it appears on your screen* (which is not necessarily one logical line down).
Perha... |
93 | <p>Is it possible to count how many times a word or a pattern appears in a file? This is sometimes useful to find out how many times a function has been called, etc.</p>
| [
{
"answer_id": 97,
"author": "Quincy Bowers",
"author_id": 93,
"author_profile": "https://vi.stackexchange.com/users/93",
"pm_score": 2,
"selected": false,
"text": "<p><code>:%s/pattern//g</code></p>\n\n<p>You will see the number of substitutions in the status bar. That is how many time... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/93",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/53/"
] | Is it possible to count how many times a word or a pattern appears in a file? This is sometimes useful to find out how many times a function has been called, etc. | Quincy's answer is fine, but there's an exact way to do this which doesn't require editing the buffer:
```
:%s/pattern//ng
```
This will print a message like `3 matches on 2 lines`, and no changes will be made to your buffer.
The `n` flag makes the `:substitute` command print the number of matches instead of perfor... |
104 | <p>When I'm editing a file in Vim, is there a command to see the path of the current file? Sometimes this is very handy if there are multiple files with the same name in a project.</p>
| [
{
"answer_id": 105,
"author": "thameera",
"author_id": 53,
"author_profile": "https://vi.stackexchange.com/users/53",
"pm_score": 9,
"selected": true,
"text": "<p>You can press <a href=\"http://vimhelp.appspot.com/editing.txt.html#CTRL-G\" rel=\"noreferrer\"><code>{count}Ctrl-G</code></a... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/104",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/53/"
] | When I'm editing a file in Vim, is there a command to see the path of the current file? Sometimes this is very handy if there are multiple files with the same name in a project. | You can press [`{count}Ctrl-G`](http://vimhelp.appspot.com/editing.txt.html#CTRL-G):
```
{count}CTRL-G Like CTRL-G, but prints the current file name with
full path. If the count is higher than 1 the current
buffer number is also given.
```
Pressing `1` followed by `Ctrl... |
106 | <p>If I edit a file with vim that I have <em>previously</em> edited, I'd like vim to jump to the position I was in when I last closed the file.</p>
<p>How can I accomplish this?</p>
| [
{
"answer_id": 111,
"author": "Martin Tournoij",
"author_id": 51,
"author_profile": "https://vi.stackexchange.com/users/51",
"pm_score": 3,
"selected": true,
"text": "<p>What I use (adapted from <code>:help restore-cursor</code>):</p>\n\n<pre><code>\" Go to the last cursor location when ... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/106",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/-1/"
] | If I edit a file with vim that I have *previously* edited, I'd like vim to jump to the position I was in when I last closed the file.
How can I accomplish this? | What I use (adapted from `:help restore-cursor`):
```
" Go to the last cursor location when a file is opened, unless this is a
" git commit (in which case it's annoying)
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") && &filetype != "gitcommit" |
\ execute("normal `\"") |
\ endif
``... |
118 | <p>There are the "normal" straight quotes:<br>
' "</p>
<p>And you have the angled "smart quotes":<br>
‘ ’ “ ”</p>
<p>Vim's spellcheck works with "straight" quotes, but not angeled quotes, so this is considered "wrong":<br>
It’s ... Monty Python’s</p>
<p>Even though it's not.</p>
<p>Screenshot, in case your font doe... | [
{
"answer_id": 172,
"author": "wchargin",
"author_id": 142,
"author_profile": "https://vi.stackexchange.com/users/142",
"pm_score": 4,
"selected": true,
"text": "<pre><code>$ grep \"'\" /usr/share/dict/words | wc -l\n26226\n$ grep -i python /usr/share/dict/words\nPython\nPython's\npython... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/118",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/51/"
] | There are the "normal" straight quotes:
' "
And you have the angled "smart quotes":
‘ ’ “ ”
Vim's spellcheck works with "straight" quotes, but not angeled quotes, so this is considered "wrong":
It’s ... Monty Python’s
Even though it's not.
Screenshot, in case your font doesn't show the difference:
![enter... | ```
$ grep "'" /usr/share/dict/words | wc -l
26226
$ grep -i python /usr/share/dict/words
Python
Python's
python
python's
pythons
```
The problem is that all these words with apostrophes are actually in your dictionary file.
So if you're okay with modifying your vim spelling dictionary, then do so:
```
$ grep "'" /u... |
119 | <p>Let's say I have a function, named <code>StripWhitespace</code>. </p>
<p>I can run it on a single file by opening the file and running <code>:StripWhitespace</code>. </p>
<p>How can I automatically run that function against a folder of files, and save the results as I go along?</p>
| [
{
"answer_id": 121,
"author": "Martin Tournoij",
"author_id": 51,
"author_profile": "https://vi.stackexchange.com/users/51",
"pm_score": 5,
"selected": true,
"text": "<p>You can use the <code>-c</code> argument to run a command on startup, from <code>vim(1)</code>:</p>\n\n<pre><code> -... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/119",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/131/"
] | Let's say I have a function, named `StripWhitespace`.
I can run it on a single file by opening the file and running `:StripWhitespace`.
How can I automatically run that function against a folder of files, and save the results as I go along? | You can use the `-c` argument to run a command on startup, from `vim(1)`:
```
-c {command}
{command} will be executed after the first file has been
read. {command} is interpreted as an Ex command. If the
{command} contains spaces it must be enclosed in double
... |
120 | <p>In a very long file with (accurately-) indented code, it may be helpful to move directly to a line of text above or below the cursor which delimits the indenting.</p>
<p>(One way of doing this could be via the indent foldmethod, by folding the current indent level, which collapses the lines delimiting the indent le... | [
{
"answer_id": 145,
"author": "janos",
"author_id": 135,
"author_profile": "https://vi.stackexchange.com/users/135",
"pm_score": 2,
"selected": false,
"text": "<p>It's not exactly what you asked for because it's not vertical movement,\nbut something that's similar, fast, and might be goo... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/120",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/67/"
] | In a very long file with (accurately-) indented code, it may be helpful to move directly to a line of text above or below the cursor which delimits the indenting.
(One way of doing this could be via the indent foldmethod, by folding the current indent level, which collapses the lines delimiting the indent level to be ... | How about this function?
```
function FloatUp()
while line(".") > 1
\ && (strlen(getline(".")) < col(".")
\ || getline(".")[col(".") - 1] =~ '\s')
norm k
endwhile
endfunction
```
You could `nnoremap gU :call FloatUp()<CR>` (`gU` for "go up"), and then invoke with `gU`.... |
124 | <p>I usually have multiple instances of vim running on the same machine. When I make a change to my vimrc I can just <code>:source ~/.vimrc</code> (with an easy mapping or an autocmd). But in order to have all running instances reflect the change I have to run that in each of them separately. Can I use the <code>client... | [
{
"answer_id": 144,
"author": "tgrosinger",
"author_id": 41,
"author_profile": "https://vi.stackexchange.com/users/41",
"pm_score": -1,
"selected": false,
"text": "<p>I don't know about clientserver, but since you said you were interested in other solutions I would recommend looking into... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/124",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/126/"
] | I usually have multiple instances of vim running on the same machine. When I make a change to my vimrc I can just `:source ~/.vimrc` (with an easy mapping or an autocmd). But in order to have all running instances reflect the change I have to run that in each of them separately. Can I use the `clientserver` feature to ... | You can tell a Vim server to reload the vimrc file like so:
```
$ vim --servername MARTIN --remote-send '<Esc>:source $MYVIMRC<CR>'
```
And you can get a list of all servers with:
```
$ vim --serverlist
MARTIN
CARPETSMOKER
```
Which can be combined with a `for` loop:
```
$ for s in $(vim --serverlist); do vim -... |
126 | <p>In C and C-like languages, I can use <code>%</code> to jump to the corresponding curly brace that the cursor is on. This is a well-known "trick".</p>
<p>But in Ruby for example:</p>
<pre><code>def fun
[1, 2].each do |n|
end
end
</code></pre>
<p>This doesn't work, since ruby doesn't use the characters in ... | [
{
"answer_id": 132,
"author": "xthrd",
"author_id": 126,
"author_profile": "https://vi.stackexchange.com/users/126",
"pm_score": 5,
"selected": true,
"text": "<p>You can use the <a href=\"http://www.vim.org/scripts/script.php?script_id=39\">matchit</a> plugin. This is included in modern ... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/126",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/51/"
] | In C and C-like languages, I can use `%` to jump to the corresponding curly brace that the cursor is on. This is a well-known "trick".
But in Ruby for example:
```
def fun
[1, 2].each do |n|
end
end
```
This doesn't work, since ruby doesn't use the characters in `matchpairs` (set to `(:),{:},[:],<:>` by de... | You can use the [matchit](http://www.vim.org/scripts/script.php?script_id=39) plugin. This is included in modern vim distributions, so all you have to do to use it is add the following to your vimrc:
```
runtime macros/matchit.vim
```
You can also get it packaged as a plugin if you prefer. It recognizes many keyword... |
129 | <p>Too often do I make the mistake of typing with the wrong window focused (and have done so a few times with a USB authenticator). In programs with lots of hotkeys enabled (Gmail, VLC, Vim), this often has the unintended consequence of making unwanted modifications.</p>
<p>I can sometimes trace my steps and remember ... | [
{
"answer_id": 142,
"author": "wchargin",
"author_id": 142,
"author_profile": "https://vi.stackexchange.com/users/142",
"pm_score": 5,
"selected": true,
"text": "<p>Invoke</p>\n\n<pre><code>:undolist\n</code></pre>\n\n<p>to see when you made the last set of changes.\nIf it says that ther... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/129",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/114/"
] | Too often do I make the mistake of typing with the wrong window focused (and have done so a few times with a USB authenticator). In programs with lots of hotkeys enabled (Gmail, VLC, Vim), this often has the unintended consequence of making unwanted modifications.
I can sometimes trace my steps and remember what I hav... | Invoke
```
:undolist
```
to see when you made the last set of changes.
If it says that there were a few changes made, e.g., "3 seconds ago," and you know that you only *intentionally* changed it, say, a minute ago, then execute
```
:earlier 10s
```
to revert to the desired state.
Otherwise, if there are no recent... |
130 | <p>How do I comment out multiple in visual mode selected lines? How do I make it language specific?</p>
<p>For example, if the first 4 lines are selected:</p>
<pre><code>def foo(a,b):
for each in (a,b):
print each
return a+b
print "2"
</code></pre>
<p>The operation of a command/macro should result in... | [
{
"answer_id": 140,
"author": "tokoyami",
"author_id": 20,
"author_profile": "https://vi.stackexchange.com/users/20",
"pm_score": 3,
"selected": false,
"text": "<p>Doing it automatically would require you to add something like the following to your <code>vimrc</code> file (<a href=\"http... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/130",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/129/"
] | How do I comment out multiple in visual mode selected lines? How do I make it language specific?
For example, if the first 4 lines are selected:
```
def foo(a,b):
for each in (a,b):
print each
return a+b
print "2"
```
The operation of a command/macro should result in this (in python):
```
#def foo(... | If you want language specific commenting you will need a plugin like [nerdcommenter](https://github.com/scrooloose/nerdcommenter).
Alternatively, although it doesn't answer your actual question, you can use builtin vim actions and your knowledge of each language's comment characters...
Option #1: V-blocks
-----------... |
137 | <p>How do I edit <code>crontab</code> files in FreeBSD?</p>
<pre><code>$ crontab -e
# ... I do my thing in vim & :wq
"crontab.9ZcXiFaawt" 6L, 203C written
crontab: temp file must be edited in place
Exit 1
</code></pre>
<p>Using <code>EDITOR=nvi</code> works fine... Linux also seems to work fine...</p>
| [
{
"answer_id": 138,
"author": "Martin Tournoij",
"author_id": 51,
"author_profile": "https://vi.stackexchange.com/users/51",
"pm_score": 5,
"selected": true,
"text": "<p>The problem is how Vim writes files. By default, it makes a copy of the file and overwrite the original one.</p>\n\n<p... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/137",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/51/"
] | How do I edit `crontab` files in FreeBSD?
```
$ crontab -e
# ... I do my thing in vim & :wq
"crontab.9ZcXiFaawt" 6L, 203C written
crontab: temp file must be edited in place
Exit 1
```
Using `EDITOR=nvi` works fine... Linux also seems to work fine... | The problem is how Vim writes files. By default, it makes a copy of the file and overwrite the original one.
You can observe this with:
```
# Show the file's inode
$ ls -i a
3156153 a
# Open file in Vim, :wq
# inode changed!
$ ls -i a
3155322 a
```
`crontab` gets confused by this (see `:help crontab`)
You need t... |
143 | <p>There is many times in my day to day work life that I need to operate on a specific function, things like highlighting or searching for a variable, but I have never managed to limit the scope of the edits/search.</p>
<p>Is there a way in vim to selectively say, find all references to <code>$color</code> inside thes... | [
{
"answer_id": 148,
"author": "Stefan Dorunga",
"author_id": 150,
"author_profile": "https://vi.stackexchange.com/users/150",
"pm_score": 2,
"selected": false,
"text": "<p>You select the block you are interested in in visual line mode (shift + v) and then you type <code>:</code> and your... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/143",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/137/"
] | There is many times in my day to day work life that I need to operate on a specific function, things like highlighting or searching for a variable, but I have never managed to limit the scope of the edits/search.
Is there a way in vim to selectively say, find all references to `$color` inside these sets of braces, or ... | Here are a few ways to do it.
```
1 | $color = "#fff";
2 | function PickColor () {
3 | $color = "#bbb";
4 | $newColors = ["#000", "#fbf", $color];
5 | foreach ($newColors as $c) {
6 | if ($c == "#fff") {
7 | break;
8 | }
9 | }
10 | }
11 | $differentColor = $color;
... |
149 | <p>I have server log files that are several gigabytes in size (on Ubuntu). When I attempt to open them, the terminal locks up for a minute or so while the file is loaded into Vim. Is there a way to reduce this time, for example by setting Vim to load the file on demand, or by some other method?</p>
| [
{
"answer_id": 150,
"author": "Reaver",
"author_id": 18,
"author_profile": "https://vi.stackexchange.com/users/18",
"pm_score": 2,
"selected": false,
"text": "<p>I have heard that turning off syntax highlighting can help:</p>\n\n<pre><code>:syntax off\n</code></pre>\n"
},
{
"answ... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/149",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/77/"
] | I have server log files that are several gigabytes in size (on Ubuntu). When I attempt to open them, the terminal locks up for a minute or so while the file is loaded into Vim. Is there a way to reduce this time, for example by setting Vim to load the file on demand, or by some other method? | First, try loading vim with no plugins or vimrc:
```
vim -u NONE gargantuan.txt
```
If this is substantially faster, then you probably have syntax highlighting, folding, plugins, or something else going on that's taking up most of the time.
Try turning stuff off in your vimrc (and disabling your plugins) until you f... |
151 | <p>I'm editing Prolog files as part of an exploratory project, and some of the files I'm working with have the extension <code>.pl</code>, which is shared by Perl files. Whenever I do work on a Prolog file named <code>[somefile].pl</code>, Vim gives me syntax highlighting and error detection for Perl, rather than Prolo... | [
{
"answer_id": 153,
"author": "janos",
"author_id": 135,
"author_profile": "https://vi.stackexchange.com/users/135",
"pm_score": 4,
"selected": true,
"text": "<p>I can only answer the second part of your question.\nYou can tell Vim that you're editing a Prolog file with this command:</p>... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/151",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/151/"
] | I'm editing Prolog files as part of an exploratory project, and some of the files I'm working with have the extension `.pl`, which is shared by Perl files. Whenever I do work on a Prolog file named `[somefile].pl`, Vim gives me syntax highlighting and error detection for Perl, rather than Prolog. I could totally disabl... | I can only answer the second part of your question.
You can tell Vim that you're editing a Prolog file with this command:
```
:set syntax=prolog
```
If you never work in Perl, then it wouldn't seem "dictatorial" to add custom configuration in your `~/.vimrc`:
```
autocmd BufNewFile,BufRead *.pl setfiletype prolog s... |
163 | <p>There are times when I want to test changes to a file before I overwrite the original.
Is there any way I can save a file being edited to a new file?</p>
| [
{
"answer_id": 164,
"author": "Nebril",
"author_id": 162,
"author_profile": "https://vi.stackexchange.com/users/162",
"pm_score": 0,
"selected": false,
"text": "<p>Yes, there is a way.\n<code>:w new_file_name</code></p>\n"
},
{
"answer_id": 165,
"author": "Kiteration",
"a... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/163",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/25/"
] | There are times when I want to test changes to a file before I overwrite the original.
Is there any way I can save a file being edited to a new file? | You can give a parameter to the `:w` or `:write` command to save to a different file.
For example to save the current buffer to `/tmp/data.txt`:
```
:w /tmp/data.txt
```
However, keep in mind that this does not switch your buffer to that other file.
So if you keep editing and do just `:w`, that will save to the curr... |
174 | <p>Is there a way to 'pipe' text from a register to an another register or set of registers? For example, move <code>"q</code> to registers <code>"1</code> through <code>"5</code>. </p>
<p>I often wish to create slightly different versions of the same macro, so it is useful to be able to copy a 'template' macro to sev... | [
{
"answer_id": 175,
"author": "wchargin",
"author_id": 142,
"author_profile": "https://vi.stackexchange.com/users/142",
"pm_score": 3,
"selected": false,
"text": "<h1>Using <code>getreg</code> and <code>setreg</code></h1>\n\n<p>To copy from <code>q</code> to registers <code>1</code>&ndas... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/174",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/161/"
] | Is there a way to 'pipe' text from a register to an another register or set of registers? For example, move `"q` to registers `"1` through `"5`.
I often wish to create slightly different versions of the same macro, so it is useful to be able to copy a 'template' macro to several registers and then modify each of them... | Macros are just text.
Open a new empty buffer and put your macro there. You can duplicate the lines, change one thing here and something else elsewhere then yank a line and use it right away with `@"`.
No need to pollute your registers, especially the number registers which serve an entirely different purpose.
-- ed... |
177 | <p>When I edit files, Vim tends to create files named <code>.<i>filename</i>.swp</code>, which I find annoying. From <code>vim -h</code>, I see that the <code>-n</code> option suppresses the creation of swap files.</p>
<p>Is there a vimrc directive that I can use to disable swap files by default?</p>
<p>What is the ... | [
{
"answer_id": 179,
"author": "jamessan",
"author_id": 15,
"author_profile": "https://vi.stackexchange.com/users/15",
"pm_score": 8,
"selected": true,
"text": "<h3>Reasons for swap files</h3>\n<p>Swap files store changes you've made to the buffer. If Vim or your computer crashes, they a... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/177",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/24/"
] | When I edit files, Vim tends to create files named `.*filename*.swp`, which I find annoying. From `vim -h`, I see that the `-n` option suppresses the creation of swap files.
Is there a vimrc directive that I can use to disable swap files by default?
What is the purpose of swap files, and what functionality would I be... | ### Reasons for swap files
Swap files store changes you've made to the buffer. If Vim or your computer crashes, they allow you to recover those changes.
Swap files also provide a way to avoid multiple instances of Vim from editing the same file. This can be useful on multi-user systems or just to know if you have ano... |
182 | <p>I'm using <a href="https://github.com/carlhuda/janus" rel="noreferrer">https://github.com/carlhuda/janus</a> vim distribution and clearly not satisfied with load time.</p>
<p>What would be the best way to profile and speed-up vim load time?
Also would be interesting to compare load time with <a href="http://vim.spf... | [
{
"answer_id": 189,
"author": "CharlesL",
"author_id": 133,
"author_profile": "https://vi.stackexchange.com/users/133",
"pm_score": 3,
"selected": false,
"text": "<p>You can debug startup time by using the built in Vim profiler (<a href=\"http://vimcasts.org/episodes/profiling-vimscript-... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/182",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/179/"
] | I'm using <https://github.com/carlhuda/janus> vim distribution and clearly not satisfied with load time.
What would be the best way to profile and speed-up vim load time?
Also would be interesting to compare load time with <http://vim.spf13.com/> | If you just want to see what's consuming start up time, then you can use the `--startuptime` option.
```
vim --startuptime timing.out
```
The file will look like this:
```
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.000 000.000: --- VIM STARTING ---
0... |
192 | <p>When I'm shelling out some external command using <code>!</code></p>
<pre><code>:r !pbpaste
</code></pre>
<p>or </p>
<pre><code>:!./path/to_my_script
</code></pre>
<p>What environment will be used and how to manually configure it?
I'm a big fan of ZSH. Can I have some dedicated RC files that similar to my <code>... | [
{
"answer_id": 197,
"author": "jamessan",
"author_id": 15,
"author_profile": "https://vi.stackexchange.com/users/15",
"pm_score": 3,
"selected": true,
"text": "<p>TL;DR Vim runs the shell you would expect but in non-interactive mode. See your shell's documentation for non-interactive mo... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/192",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/179/"
] | When I'm shelling out some external command using `!`
```
:r !pbpaste
```
or
```
:!./path/to_my_script
```
What environment will be used and how to manually configure it?
I'm a big fan of ZSH. Can I have some dedicated RC files that similar to my `~/.zshrc` and `~/.zprofile` and explicitly set zsh as default int... | TL;DR Vim runs the shell you would expect but in non-interactive mode. See your shell's documentation for non-interactive mode affects initialization, i.e. which init files are read.
Vim uses whatever shell is specified in your environment (either through the `$SHELL` environment variable or, if that isn't available, ... |
193 | <p>Consider a directory structure like this:</p>
<pre><code>topdir/
file1
file2
foo/
bar1
bar2
</code></pre>
<p>Say I want to open some file in <code>foo/</code> in a new tab.
I would first write <code>:tabe topdir/</code>, and then keep hitting <code><TAB></code> until <code>:tabe topdir/foo/</co... | [
{
"answer_id": 197,
"author": "jamessan",
"author_id": 15,
"author_profile": "https://vi.stackexchange.com/users/15",
"pm_score": 3,
"selected": true,
"text": "<p>TL;DR Vim runs the shell you would expect but in non-interactive mode. See your shell's documentation for non-interactive mo... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/193",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/142/"
] | Consider a directory structure like this:
```
topdir/
file1
file2
foo/
bar1
bar2
```
Say I want to open some file in `foo/` in a new tab.
I would first write `:tabe topdir/`, and then keep hitting `<TAB>` until `:tabe topdir/foo/` is displayed.
Then, I want to tab-complete the files in `foo/`.
But if ... | TL;DR Vim runs the shell you would expect but in non-interactive mode. See your shell's documentation for non-interactive mode affects initialization, i.e. which init files are read.
Vim uses whatever shell is specified in your environment (either through the `$SHELL` environment variable or, if that isn't available, ... |
196 | <p>I am trying to use a regex for replacing text in a file (replace a full url with just protocol/domain/):</p>
<pre><code>:%s/\(https\?:\/\/.*?\/\).*/\1/gc
</code></pre>
<p>Unfortunately <code>.*?</code> does not match the string, even trying to escape the <code>?</code> quantifier? How should non-greedy quantifier ... | [
{
"answer_id": 199,
"author": "Doorknob",
"author_id": 88,
"author_profile": "https://vi.stackexchange.com/users/88",
"pm_score": 7,
"selected": true,
"text": "<p>Vim's regex has special syntax for non-greedy versions of operators (it's kind of annoying, but you just have to memorize the... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/196",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/188/"
] | I am trying to use a regex for replacing text in a file (replace a full url with just protocol/domain/):
```
:%s/\(https\?:\/\/.*?\/\).*/\1/gc
```
Unfortunately `.*?` does not match the string, even trying to escape the `?` quantifier? How should non-greedy quantifier be escaped in vim? | Vim's regex has special syntax for non-greedy versions of operators (it's kind of annoying, but you just have to memorize them): <http://vimregex.com/#Non-Greedy>
The non-greedy version of `*` is `\{-}`. So, simply replace `.*` with `.\{-}`:
```
:%s/\(https\?:\/\/.\{-}\/\).*/\1/gc
``` |
201 | <p>I like to use vimdiff as a git diff/merge tool. The problem is when I resize the host terminal window to a new size: of the two split panes, the leftmost remain of the same width, while the rightmost is extended to full window size.</p>
<p>Is there a command to make the split panes equal width after the windows has... | [
{
"answer_id": 204,
"author": "janos",
"author_id": 135,
"author_profile": "https://vi.stackexchange.com/users/135",
"pm_score": 4,
"selected": false,
"text": "<p><kbd>Ctrl</kbd><kbd>w</kbd><kbd>=</kbd> will resize the split panes to become equal. But I don't know how to make them equal ... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/201",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/188/"
] | I like to use vimdiff as a git diff/merge tool. The problem is when I resize the host terminal window to a new size: of the two split panes, the leftmost remain of the same width, while the rightmost is extended to full window size.
Is there a command to make the split panes equal width after the windows has been resi... | To go along with @janos's answer, you can set an `autocmd` to automatically press those keys when the window is resized (put this in your `.vimrc` without the leading colon if you want it to apply every time you open Vim):
```
:autocmd VimResized * wincmd =
```
[Here are the docs for the `VimResized` autocmd](http:/... |
211 | <p>In writing some Vimscript to try to answer <a href="https://vi.stackexchange.com/a/145/182">this question</a>, I was exploring ways to "search for a line with pattern P in position X" (P is a search pattern, X is a number).</p>
<p>One way to do this would be to search for (e.g.) <code>^.....[a-z]</code>, where <cod... | [
{
"answer_id": 212,
"author": "Doorknob",
"author_id": 88,
"author_profile": "https://vi.stackexchange.com/users/88",
"pm_score": 4,
"selected": true,
"text": "<p>Simply use regex syntax for \"repeat <code>n</code> times\":</p>\n\n<pre><code>/^.\\{5}[a-z]\n</code></pre>\n\n<p>This search... | 2015/02/03 | [
"https://vi.stackexchange.com/questions/211",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/182/"
] | In writing some Vimscript to try to answer [this question](https://vi.stackexchange.com/a/145/182), I was exploring ways to "search for a line with pattern P in position X" (P is a search pattern, X is a number).
One way to do this would be to search for (e.g.) `^.....[a-z]`, where `[a-z]` is the pattern, and `5` is t... | Simply use regex syntax for "repeat `n` times":
```
/^.\{5}[a-z]
```
This searches for 5 `.`s and then an `[a-z]`.
If you just want to repeat a character `c` `n` times, simply do:
```
let dots = repeat('.', 5)
" dots is now '.....'
``` |
220 | <p>Let's say we wanted to produce the following text in a very "vim" way:</p>
<pre><code>Row 1 {
33.33%;
}
Row 2 {
66.66%;
}
Row 3 {
100%;
}
</code></pre>
<p>This isn't too complicated, but I think of it as a standin for something far more annoying, like having 12 rows (which might happen in CSS, for instance).... | [
{
"answer_id": 225,
"author": "Doorknob",
"author_id": 88,
"author_profile": "https://vi.stackexchange.com/users/88",
"pm_score": 1,
"selected": false,
"text": "<p>This is really long and ugly, but here goes...</p>\n\n<ol>\n<li><p>Generating a list of initial numbers:</p>\n\n<pre><code>i... | 2015/02/04 | [
"https://vi.stackexchange.com/questions/220",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/130/"
] | Let's say we wanted to produce the following text in a very "vim" way:
```
Row 1 {
33.33%;
}
Row 2 {
66.66%;
}
Row 3 {
100%;
}
```
This isn't too complicated, but I think of it as a standin for something far more annoying, like having 12 rows (which might happen in CSS, for instance). I'm not interested in wri... | I don't think there's going to be a non-horrible way to do this in Vim without a plugin.
If I absolutely had to do it within Vim, without just typing it out, I would call out to awk:
`:r!awk 'BEGIN { for(i=1; i<4; i++) { print "Row " i " {"; print "\t" 100/3*i "\%;"; print "}"; } }'` |
221 | <p>Vim, by default, opens all .md files as "modula2" code. I have never heard of modula2, nor do I plan to use it.</p>
<p>How can I tell vim to always treat <code>foo.md</code> as Markdown (as if I had typed <code>:set ft=markdown</code>)?</p>
| [
{
"answer_id": 222,
"author": "Doorknob",
"author_id": 88,
"author_profile": "https://vi.stackexchange.com/users/88",
"pm_score": 4,
"selected": false,
"text": "<p>I currently have this line as an ugly hack in my .vimrc:</p>\n\n<pre><code>autocmd BufRead *.md set ft=markdown\n</code></pr... | 2015/02/04 | [
"https://vi.stackexchange.com/questions/221",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/88/"
] | Vim, by default, opens all .md files as "modula2" code. I have never heard of modula2, nor do I plan to use it.
How can I tell vim to always treat `foo.md` as Markdown (as if I had typed `:set ft=markdown`)? | In the file `filetype.vim` that is shipped with your distribution you will find a line that looks probably similar to this (on my machine it lives at `/usr/share/vim/vim74`) :
```
au BufNewFile,BufRead *.md,*.m2,*.mi setf modula2
```
Now, this tells vim to set the filetype as modula2 if your file has such an ending.... |
230 | <p>I type with a non-QWERTY keyboard layout. Many of the keys Vim uses are now on the home row, but some key bindings just don't work, the most obvious one being the <kbd>h</kbd><kbd>j</kbd><kbd>k</kbd><kbd>l</kbd> keys.</p>
<p>How and where can I change these key bindings to work better with my keyboard layout?</p>
| [
{
"answer_id": 231,
"author": "Dhruva Sagar",
"author_id": 74,
"author_profile": "https://vi.stackexchange.com/users/74",
"pm_score": 2,
"selected": false,
"text": "<p>You can remap keys in vim. <code>nnoremap [ h</code> remaps <code>[</code> to <code>h</code>, so you can use <code>[</co... | 2015/02/04 | [
"https://vi.stackexchange.com/questions/230",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/211/"
] | I type with a non-QWERTY keyboard layout. Many of the keys Vim uses are now on the home row, but some key bindings just don't work, the most obvious one being the `h``j``k``l` keys.
How and where can I change these key bindings to work better with my keyboard layout? | ```
:help langmap
```
You can remap keys in command mode but leave them intact for typing. This means you can use the intent of `hjkl` - adjacent homerow keys for scrolling - by pressing the positional equivalents on your keyboard. Suppose your layout is Dvorak, then those same keys are `dhtn`. We need to map all fou... |
233 | <p>I work on projects with varying levels of indentation. In many of these projects, because of how the files are typically structured, most lines are indented at least two levels (such as methods in Java files).</p>
<p>This would mean that creating a new line when on a line line</p>
<pre><code>public void something ... | [
{
"answer_id": 234,
"author": "Kevin Brown-Silva",
"author_id": 89,
"author_profile": "https://vi.stackexchange.com/users/89",
"pm_score": 6,
"selected": true,
"text": "<p>This can be done using a combination of the <code>autoindent</code> option and the <code>filetype</code> plugin.</p>... | 2015/02/04 | [
"https://vi.stackexchange.com/questions/233",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/89/"
] | I work on projects with varying levels of indentation. In many of these projects, because of how the files are typically structured, most lines are indented at least two levels (such as methods in Java files).
This would mean that creating a new line when on a line line
```
public void something () {
```
Would brin... | This can be done using a combination of the `autoindent` option and the `filetype` plugin.
The `autoindent` option will copy your current indentation when creating a new line. So if your current indentation level is 4 when you start the new line, the cursor will be moved to the same indentation level on the next line.... |
236 | <p>I like the smart-indent feature of Vim, it allows me to create well-indented code blocks.</p>
<p>I regularly copy/paste code in to buffers, but that code is often poorly formatted.</p>
<p>What would be ideal is to "re-process" the code through the smart-indent system.</p>
<p>Is such a thing possible?</p>
<p>For ... | [
{
"answer_id": 237,
"author": "Bhargav",
"author_id": 224,
"author_profile": "https://vi.stackexchange.com/users/224",
"pm_score": 3,
"selected": false,
"text": "<p>To reindent a file already in the buffer, use <code>gg=G</code>: See <a href=\"http://vim.wikia.com/wiki/Fix_indentation\" ... | 2015/02/04 | [
"https://vi.stackexchange.com/questions/236",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/86/"
] | I like the smart-indent feature of Vim, it allows me to create well-indented code blocks.
I regularly copy/paste code in to buffers, but that code is often poorly formatted.
What would be ideal is to "re-process" the code through the smart-indent system.
Is such a thing possible?
For example, how would you 'fix' th... | I do this one of two ways.
Indent adjusted paste
---------------------
First, if the code in the buffer is formatted, but at a different level of indentation, I use `]p` instead of `p`, which pastes the code as is, but with the indentation shifted such that the first line pasted is the same depth as the line I'm on.
... |
238 | <p>This only seems to happens when using vim inside of tmux. I'm also using iTerm 2.</p>
<p>If I create a new tmux pane or resize a tmux pane, it immediately looks like the this:</p>
<p><img src="https://i.stack.imgur.com/yQTD0.png" alt="messed up background in vim"></p>
<p>And then the only way to fix it is to scro... | [
{
"answer_id": 246,
"author": "firedev",
"author_id": 237,
"author_profile": "https://vi.stackexchange.com/users/237",
"pm_score": 1,
"selected": false,
"text": "<p>I believe this is related to <code>ttyfast</code> so the screen is not fully redrawn. Try setting it to on:</p>\n\n<pre><co... | 2015/02/04 | [
"https://vi.stackexchange.com/questions/238",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/226/"
] | This only seems to happens when using vim inside of tmux. I'm also using iTerm 2.
If I create a new tmux pane or resize a tmux pane, it immediately looks like the this:

And then the only way to fix it is to scroll around in vim, and it goes back to ... | You might try to add the following to your .vimrc.
```
if &term =~ '256color'
" disable Background Color Erase (BCE)
set t_ut=
endif
```
The `t_ut` option (default = y) describes how vim handles what it wants as background colors compared to attempting to use the current background color. This snippet clears tha... |
239 | <p>I rarely, if ever, just open <code>vim</code> without filenames. Often enough, I want to test something out, usually a quick throwaway script, and I usually name them <code>test.sh</code> (or some variant thereof, like <code>test.py</code>). Can I make <code>vim</code> assume a <code>test.sh</code> filename if I ran... | [
{
"answer_id": 243,
"author": "John O'M.",
"author_id": 227,
"author_profile": "https://vi.stackexchange.com/users/227",
"pm_score": 5,
"selected": true,
"text": "<p>Try putting this at the end of your .vimrc (modify as appropriate)</p>\n\n<pre><code>if @% == \"\" && getcwd() == ... | 2015/02/04 | [
"https://vi.stackexchange.com/questions/239",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/205/"
] | I rarely, if ever, just open `vim` without filenames. Often enough, I want to test something out, usually a quick throwaway script, and I usually name them `test.sh` (or some variant thereof, like `test.py`). Can I make `vim` assume a `test.sh` filename if I ran `vim` without any filenames? I'd usually use aliases (lik... | Try putting this at the end of your .vimrc (modify as appropriate)
```
if @% == "" && getcwd() == "/tmp"
:silent edit test.sh
endif
```
This checks if the current filename is empty (`@%` references the current filename), and checks if vim's current directory is `/tmp`. You could add other directories as well lik... |
245 | <p>Using gF I can jump to a file with the format foobar.py:27:6 to open foobar.py on line 27. My question is how I can make this jump in vimscript?</p>
<p>For example, this won't work:</p>
<pre><code>execute "normal gF " . foobar.py:27:6
</code></pre>
<p>because gF doesn't take an argument - it uses the word under t... | [
{
"answer_id": 248,
"author": "John O'M.",
"author_id": 227,
"author_profile": "https://vi.stackexchange.com/users/227",
"pm_score": 4,
"selected": true,
"text": "<p>If you don't care about the column, and as an example you have the linenumber and filename in variables, you could do this... | 2015/02/04 | [
"https://vi.stackexchange.com/questions/245",
"https://vi.stackexchange.com",
"https://vi.stackexchange.com/users/234/"
] | Using gF I can jump to a file with the format foobar.py:27:6 to open foobar.py on line 27. My question is how I can make this jump in vimscript?
For example, this won't work:
```
execute "normal gF " . foobar.py:27:6
```
because gF doesn't take an argument - it uses the word under the cursor - but hopefully this gi... | If you don't care about the column, and as an example you have the linenumber and filename in variables, you could do this:
```
execute "edit +" . linenumber . " " . filename
```
Or, as from your example
```
execute "edit +27 foobar.py"
```
To expand the colon separation and then edit would look like this:
```
l... |