When searching for a vimrc path, first look for ~/.vscodevimrc (#8118)

This commit is contained in:
Dominic Palmer 2023-01-04 01:37:34 +00:00 committed by GitHub
parent d447a27c24
commit 2d7657e36f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -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",

View File

@ -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;
@ -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;