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,12 +1,18 @@
|
||||||
local command = vim.api.nvim_create_user_command
|
if vim.fn.exists("g:genghis_disable_commands") == 0 then
|
||||||
local genghis = require("genghis")
|
vim.g.genghis_disable_commands = false
|
||||||
|
end
|
||||||
|
|
||||||
command("NewFromSelection", function() genghis.moveSelectionToNewFile() end, {})
|
if not vim.g.genghis_disable_commands then
|
||||||
command("Duplicate", function() genghis.duplicateFile() end, {})
|
local command = vim.api.nvim_create_user_command
|
||||||
command("Rename", function() genghis.renameFile() end, {})
|
local genghis = require("genghis")
|
||||||
command("Trash", function() genghis.trashFile() end, {})
|
|
||||||
command("Move", function() genghis.moveAndRenameFile() end, {})
|
command("NewFromSelection", function() genghis.moveSelectionToNewFile() end, {})
|
||||||
command("CopyFilename", function() genghis.copyFilename() end, {})
|
command("Duplicate", function() genghis.duplicateFile() end, {})
|
||||||
command("CopyFilepath", function() genghis.copyFilepath() end, {})
|
command("Rename", function() genghis.renameFile() end, {})
|
||||||
command("Chmodx", function() genghis.chmodx() end, {})
|
command("Trash", function() genghis.trashFile() end, {})
|
||||||
command("New", function() genghis.createNewFile() end, {})
|
command("Move", function() genghis.moveAndRenameFile() end, {})
|
||||||
|
command("CopyFilename", function() genghis.copyFilename() end, {})
|
||||||
|
command("CopyFilepath", function() genghis.copyFilepath() end, {})
|
||||||
|
command("Chmodx", function() genghis.chmodx() end, {})
|
||||||
|
command("New", function() genghis.createNewFile() end, {})
|
||||||
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue