-
Notifications
You must be signed in to change notification settings - Fork 0
/
polish.lua
47 lines (46 loc) · 1.22 KB
/
polish.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
return function()
-- 打开时自动定位到上次关闭位置
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
pattern = "*",
command = [[if line("'\"") >= 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif]],
})
-- 文件运行
vim.api.nvim_exec(
[[
func! CompileRunGccA()
exec "w"
for i in ["c","cpp","python","sh","html","go","lua","rust","r","nix","javascript","java","typescript"]
if &filetype == i
exec "RunFile float"
elseif &filetype == 'markdown'
exec "MarkdownPreview"
elseif &filetype == 'tex'
silent! exec "VimtexStop"
silent! exec "VimtexCompile"
" silent! exec "latexrun"
endif
endfor
endfunc
]],
false
)
-- 项目运行
vim.api.nvim_exec(
[[
func! CompileRunGccB()
exec "w"
for i in ["c","cpp","python","sh","html","go","lua","rust","r","nix","javascript","java","typescript"]
if &filetype == i
exec "RunProject"
elseif &filetype == 'markdown'
exec "MarkdownPreview"
elseif &filetype == 'tex'
silent! exec "VimtexStop"
silent! exec "VimtexCompile"
endif
endfor
endfunc
]],
false
)
end