feat: add global variable to disable Commands
parent
009a92cc25
commit
040828240c
12
README.md
12
README.md
|
|
@ -61,6 +61,18 @@ keymap("x", "<leader>x", genghis.moveSelectionToNewFile)
|
||||||
- `.copyFilepath` or `:CopyFilepath`: Copy the absolute file path. When `clipboard="unnamed[plus]"` has been set, copies to the `+` register, otherwise to `"`.
|
- `.copyFilepath` or `:CopyFilepath`: Copy the absolute file path. When `clipboard="unnamed[plus]"` has been set, copies to the `+` register, otherwise to `"`.
|
||||||
- `.chmodx` or `:Chmodx`: Makes current file executable. Equivalent to `chmod +x`.
|
- `.chmodx` or `:Chmodx`: Makes current file executable. Equivalent to `chmod +x`.
|
||||||
|
|
||||||
|
### How to disable command-line commands
|
||||||
|
Put this in your configuration file:
|
||||||
|
```lua
|
||||||
|
-- lua
|
||||||
|
vim.g.genghis_disable_commands = true
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```vim
|
||||||
|
-- viml
|
||||||
|
let g:genghis_disable_commands = v:true
|
||||||
|
```
|
||||||
|
|
||||||
## Autocompletion of directories
|
## Autocompletion of directories
|
||||||
You can get autocompletion for directories by using `dressing.nvim`, `nvim-cmp`, and vim's omnifunc:
|
You can get autocompletion for directories by using `dressing.nvim`, `nvim-cmp`, and vim's omnifunc:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
if vim.fn.exists("g:genghis_disable_commands") == 0 then
|
||||||
|
vim.g.genghis_disable_commands = false
|
||||||
|
end
|
||||||
|
|
||||||
|
if not vim.g.genghis_disable_commands then
|
||||||
local command = vim.api.nvim_create_user_command
|
local command = vim.api.nvim_create_user_command
|
||||||
local genghis = require("genghis")
|
local genghis = require("genghis")
|
||||||
|
|
||||||
|
|
@ -10,3 +15,4 @@ command("CopyFilename", function() genghis.copyFilename() end, {})
|
||||||
command("CopyFilepath", function() genghis.copyFilepath() end, {})
|
command("CopyFilepath", function() genghis.copyFilepath() end, {})
|
||||||
command("Chmodx", function() genghis.chmodx() end, {})
|
command("Chmodx", function() genghis.chmodx() end, {})
|
||||||
command("New", function() genghis.createNewFile() end, {})
|
command("New", function() genghis.createNewFile() end, {})
|
||||||
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue