Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
{
"command": "oil-code.openCwd",
"key": "shift+-",
"when": "editorTextFocus && editorLangId == oil && vim.mode == 'Normal'"
"when": "editorTextFocus && editorLangId == oil && vim.mode == 'Normal' && !config.oil-code.disableUnderscoreOpenCwd"
},
{
"command": "oil-code.preview",
Expand Down Expand Up @@ -146,6 +146,11 @@
"default": false,
"description": "Disable all Vim keymaps for oil.code. Default is false. Set this to true if you want to set your own keymaps. Reload after changing this setting."
},
"oil-code.disableUnderscoreOpenCwd": {
"type": "boolean",
"default": false,
"description": "Disable the '_' (underscore) keybind for opening the current working directory in oil buffers. When disabled, '_' will behave as normal Vim motion (first non-blank character of line). Default is false. Reload after changing this setting."
},
"oil-code.disableOpenCwdNothingOpen": {
"type": "boolean",
"default": false,
Expand Down
5 changes: 5 additions & 0 deletions src/utils/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export function getDisableOpenCwdNothingOpenSetting(): boolean {
return config.get<boolean>("disableOpenCwdNothingOpen") || false;
}

export function getdisableUnderscoreOpenCwdSetting(): boolean {
const config = vscode.workspace.getConfiguration("oil-code");
return config.get<boolean>("disableUnderscoreOpenCwd") || false;
}

export function getEnableWorkspaceEditSetting(): boolean {
const config = vscode.workspace.getConfiguration("oil-code");
return config.get<boolean>("enableWorkspaceEdit") || false;
Expand Down
7 changes: 6 additions & 1 deletion src/vim/oil.code.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ vim.api.nvim_create_autocmd({'FileType'}, {
pattern = {"oil"},
callback = function()
map("n", "-", function() vscode.action('oil-code.openParent') end)
map("n", "_", function() vscode.action('oil-code.openCwd') end)

local disableUnderscoreOpenCwd = vscode.get_config('oil-code.disableUnderscoreOpenCwd')
if not disableUnderscoreOpenCwd then
map("n", "_", function() vscode.action('oil-code.openCwd') end)
end

map("n", "<CR>", function() vscode.action('oil-code.select') end)
map("n", "<C-t>", function() vscode.action('oil-code.selectTab') end)
map("n", "<C-l>", function() vscode.action('oil-code.refresh') end)
Expand Down