File tree Expand file tree Collapse file tree 3 files changed +75
-4
lines changed Expand file tree Collapse file tree 3 files changed +75
-4
lines changed Original file line number Diff line number Diff line change @@ -78,8 +78,47 @@ And multiple trigger timings (colorschemes don't have end time):
78
78
79
79
## ✅ Requirement
80
80
81
- - Neovim &ge ; 0.8.
82
- - [ Git] ( https://git-scm.com/ ) .
81
+ - neovim &ge ; 0.8.
82
+ - [ git] ( https://git-scm.com/ ) .
83
+ - [ rm] ( https://man7.org/linux/man-pages/man1/rm.1.html ) (optional for ` reinstall ` command on Windows).
84
+
85
+ <details >
86
+ <summary ><i >Click here to see how to install `rm` command on Windows</i ></summary >
87
+ <br />
88
+
89
+ There're many ways to install portable linux shell and builtin commands on Windows, but personally I would recommend below two methods.
90
+
91
+ ### [ Git for Windows] ( https://git-scm.com/download/win )
92
+
93
+ Install with the below 3 options:
94
+
95
+ - In ** Select Components** , select ** Associate .sh files to be run with Bash** .
96
+
97
+ <img alt =" install-windows-git1.png " src =" https://raw.githubusercontent.com/linrongbin16/lin.nvim.dev/main/assets/installations/install-windows-git1.png " width =" 70% " />
98
+
99
+ - In ** Adjusting your PATH environment** , select ** Use Git and optional Unix tools from the Command Prompt** .
100
+
101
+ <img alt =" install-windows-git2.png " src =" https://raw.githubusercontent.com/linrongbin16/lin.nvim.dev/main/assets/installations/install-windows-git2.png " width =" 70% " />
102
+
103
+ - In ** Configuring the terminal emulator to use with Git Bash** , select ** Use Windows's default console window** .
104
+
105
+ <img alt =" install-windows-git3.png " src =" https://raw.githubusercontent.com/linrongbin16/lin.nvim.dev/main/assets/installations/install-windows-git3.png " width =" 70% " />
106
+
107
+ After this step, ** git.exe** and builtin linux commands(such as ** rm.exe** ) will be available in ` %PATH% ` .
108
+
109
+ ### [ scoop] ( https://scoop.sh/ )
110
+
111
+ Run below powershell commands:
112
+
113
+ ``` powershell
114
+ # scoop
115
+ Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
116
+ irm get.scoop.sh | iex
117
+
118
+ scoop install coreutils # rm
119
+ ```
120
+
121
+ </details >
83
122
84
123
## 📦 Install
85
124
Original file line number Diff line number Diff line change @@ -508,8 +508,38 @@ local function _clean()
508
508
)
509
509
return
510
510
end
511
- vim .cmd (string.format ([[ silent execute "!rm -rf %s"]] , full_pack_dir ))
512
- logger .info (" cleaned directory: %s" , shorten_pack_dir )
511
+ if vim .fn .executable (" rm" ) > 0 then
512
+ local jobid = vim .fn .jobstart ({ " rm" , " -rf" , full_pack_dir }, {
513
+ detach = false ,
514
+ stdout_buffered = true ,
515
+ stderr_buffered = true ,
516
+ on_stdout = function (chanid , data , name )
517
+ logger .debug (
518
+ " clean job(%s) data:%s" ,
519
+ vim .inspect (name ),
520
+ vim .inspect (data )
521
+ )
522
+ end ,
523
+ on_stderr = function (chanid , data , name )
524
+ logger .debug (
525
+ " clean job(%s) data:%s" ,
526
+ vim .inspect (name ),
527
+ vim .inspect (data )
528
+ )
529
+ end ,
530
+ on_exit = function (jid , exitcode , name )
531
+ logger .debug (
532
+ " clean job(%s) done:%s" ,
533
+ vim .inspect (name ),
534
+ vim .inspect (exitcode )
535
+ )
536
+ end ,
537
+ })
538
+ vim .fn .jobwait ({ jobid })
539
+ logger .info (" cleaned directory: %s" , shorten_pack_dir )
540
+ else
541
+ logger .warn (" no 'rm' command found, skip cleaning..." )
542
+ end
513
543
end
514
544
515
545
--- @param args string ?
Original file line number Diff line number Diff line change
1
+ local is_windows = vim .fn .has (" win32" ) > 0 or vim .fn .has (" win64" ) > 0
1
2
local int32_max = 2 ^ 31 - 1
2
3
3
4
-- Returns the XOR of two binary numbers
@@ -118,6 +119,7 @@ local function readfile(filename, opts)
118
119
end
119
120
120
121
local M = {
122
+ is_windows = is_windows ,
121
123
int32_max = int32_max ,
122
124
min = min ,
123
125
math_mod = math_mod ,
You can’t perform that action at this time.
0 commit comments