Skip to content

Commit

Permalink
When searching for a vimrc path, first look for ~/.vscodevimrc (#8118)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicpalmer authored Jan 4, 2023
1 parent d447a27 commit 2d7657e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@
},
"vim.vimrc.path": {
"type": "string",
"markdownDescription": "Path to a Vim configuration file. If unset, it will check for `$HOME/.vimrc`, `$HOME/_vimrc`, and `$HOME/.config/nvim/init.vim`, in that order."
"markdownDescription": "Path to a Vim configuration file. If unset, it will check for `$HOME/.vscodevimrc`, `$HOME/.vimrc`, `$HOME/_vimrc`, and `$HOME/.config/nvim/init.vim`, in that order."
},
"vim.substituteGlobalFlag": {
"type": "boolean",
Expand Down
12 changes: 9 additions & 3 deletions src/configuration/vimrc.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as _ from 'lodash';
import * as fs from 'platform/fs';
import * as os from 'os';
import * as path from 'path';
import * as fs from 'platform/fs';
import * as vscode from 'vscode';
import { IConfiguration, IVimrcKeyRemapping } from './iconfiguration';
import { vimrcKeyRemappingBuilder } from './vimrcKeyRemappingBuilder';
import { window } from 'vscode';
import { Logger } from '../util/logger';
import { configuration } from './configuration';
import { IConfiguration, IVimrcKeyRemapping } from './iconfiguration';
import { vimrcKeyRemappingBuilder } from './vimrcKeyRemappingBuilder';

export class VimrcImpl {
private _vimrcPath?: string;
Expand Down Expand Up @@ -435,6 +436,11 @@ export class VimrcImpl {
}

private static async findDefaultVimrc(): Promise<string | undefined> {
const vscodeVimrcPath = path.join(os.homedir(), '.vscodevimrc');
if (await fs.existsAsync(vscodeVimrcPath)) {
return vscodeVimrcPath;
}

let vimrcPath = path.join(os.homedir(), '.vimrc');
if (await fs.existsAsync(vimrcPath)) {
return vimrcPath;
Expand Down

0 comments on commit 2d7657e

Please sign in to comment.