|
1 local command = vim.api.nvim_create_user_command |
|
2 local calias = require("config.util").calias |
|
3 local cmd = vim.cmd |
|
4 local fn = vim.fn |
|
5 |
|
6 command("Hgcd", function() |
|
7 local root = fn.systemlist("hg root 2>/dev/null")[1] |
|
8 if vim.v.shell_error == 0 then |
|
9 cmd.cd(root) |
|
10 end |
|
11 end, {}) |
|
12 |
|
13 command("Gcd", function() |
|
14 local root = fn.systemlist("git rev-parse --show-toplevel 2>/dev/null")[1] |
|
15 if vim.v.shell_error == 0 then |
|
16 cmd.cd(root) |
|
17 end |
|
18 end, {}) |
|
19 |
|
20 calias("Q", "q") |
|
21 calias("Qa", "qa") |
|
22 calias("W", "w") |
|
23 calias("grep", "Grep") |
|
24 |
|
25 calias("gcd", "Gcd") |
|
26 calias("hgcd", "Hgcd") |
|
27 |
|
28 -- Switch these to default to stay in one window + buffer |
|
29 calias("doc", "ViewDoc!") |
|
30 calias("help", "ViewDocHelp!") |
|
31 calias("man", "ViewDocMan!") |
|
32 calias("perldoc", "ViewDocPerl!") |