リビジョン | 819f77d40f71fe6054e5697646b3650175f0a78d (tree) |
---|---|
日時 | 2023-02-03 19:55:27 |
作者 | badcoff33 <none@none> |
コミッター | badcoff33 |
minor updates
@@ -18,7 +18,7 @@ vnoremap <buffer> <LocalLeader>f :call FormatLua()<CR> | ||
18 | 18 | iabbrev xcmd vim.api.nvim_create_user_command({name}, {command}, {*opts})<C-o>T( |
19 | 19 | iabbrev xmap vim.api.nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts})<C-o>T( |
20 | 20 | iabbrev xaug gid = vim.api.nvim_create_augroup({name}, {*opts})<C-o>T( |
21 | -iabbrev xauc vim.api.nvim_create_autocmd({name}, {*opts})<C-o>T( | |
21 | +iabbrev xauc vim.api.nvim_create_autocmd({events}, {*opts})<C-o>T( | |
22 | 22 | |
23 | 23 | if !executable("stylua") |
24 | 24 | finish |
@@ -78,10 +78,10 @@ execute "hi Conditional" s:Fg(s:red) s:Attr("bold") | ||
78 | 78 | execute "hi Constant" s:Fg(s:blue) |
79 | 79 | execute "hi Directory" s:Fg(s:blue) s:Attr("underline") s:Special(s:blue) |
80 | 80 | execute "hi Error" s:Fg(s:red) s:Bg("bg") s:Attr("underline") |
81 | -execute "hi ErrorMsg" s:Fg(s:red) s:Bg("bg") | |
81 | +execute "hi ErrorMsg" s:Fg(s:white) s:Bg(s:red) | |
82 | 82 | execute "hi Function" s:Fg(s:blue) |
83 | 83 | execute "hi Identifier" s:Fg(s:blue) |
84 | -execute "hi ModeMsg" s:Fg(s:blue) s:Bg("bg") s:Attr("bold") | |
84 | +execute "hi ModeMsg" s:Fg(s:white) s:Bg(s:blue) s:Attr("NONE") | |
85 | 85 | execute "hi Number" s:Fg(s:blue) |
86 | 86 | execute "hi PreCondit" s:Fg(s:blue) s:Attr("bold") |
87 | 87 | execute "hi PreProc" s:Fg(s:silver4) s:Attr("bold") |
@@ -127,8 +127,6 @@ nnoremap <A-Right> <End> | ||
127 | 127 | xnoremap <A-Left> 0 |
128 | 128 | xnoremap <A-Right> $ |
129 | 129 | |
130 | -" Replace current inner word with one key press | |
131 | -nnoremap <BS> ciw | |
132 | 130 | " Alternative keys to delete words in insert mode |
133 | 131 | inoremap <C-BS> <C-o>db |
134 | 132 | inoremap <C-Del> <C-o>de |
@@ -229,9 +227,8 @@ nnoremap <expr> <Leader>v ':silent vimgrep /' .. expand("<cword>") .. '/ ' .. ex | ||
229 | 227 | |
230 | 228 | """ :buffer, :edit and :find |
231 | 229 | nnoremap <Leader>t <cmd>tab split<CR> |
232 | -nnoremap <Leader>e :edit<space> | |
233 | -nnoremap <Leader>, :edit <C-r>=stdpath("config") .. g:slash<CR> | |
234 | -nnoremap <Leader>. :edit <C-r>=expand("%:h")=="." ? ".\\" : expand("%:h") .. g:slash<CR> | |
230 | +nnoremap <Leader>E :edit <C-r>=stdpath("config") .. g:slash<CR> | |
231 | +nnoremap <Leader>e :edit <C-r>=expand("%:h")=="." ? ".\\" : expand("%:h") .. g:slash<CR> | |
235 | 232 | nnoremap <Leader>b :buffer<space> |
236 | 233 | nnoremap <Leader>f :find<Space> |
237 | 234 | nnoremap <Leader>x <Cmd>bdelete<CR> |
@@ -268,7 +265,7 @@ function! s:ToggleQuickfix() | ||
268 | 265 | endif |
269 | 266 | endif |
270 | 267 | endfunction |
271 | -nnoremap <Leader>c <cmd>call <SID>ToggleQuickfix()<CR> | |
268 | +nnoremap <BS> <cmd>call <SID>ToggleQuickfix()<CR> | |
272 | 269 | nnoremap <Leader>G <cmd>clast<CR> |
273 | 270 | |
274 | 271 | command! -nargs=0 IC :set ignorecase nosmartcase |
@@ -1,44 +1,51 @@ | ||
1 | 1 | local files = {} |
2 | 2 | local keymap = vim.api.nvim_set_keymap |
3 | +local on_windows = vim.loop.os_uname().version:match("Windows") | |
4 | + | |
5 | +local function join_paths(...) | |
6 | + local path_sep = on_windows and "\\" or "/" | |
7 | + local result = table.concat({ ... }, path_sep) | |
8 | + return result | |
9 | +end | |
3 | 10 | |
4 | 11 | split_string = function(s, d) |
5 | - chunks = {} | |
6 | - for substring in string.gmatch(s, d) do | |
7 | - table.insert(chunks, substring) | |
8 | - end | |
9 | - return chunks | |
12 | + chunks = {} | |
13 | + for substring in string.gmatch(s, d) do | |
14 | + table.insert(chunks, substring) | |
15 | + end | |
16 | + return chunks | |
10 | 17 | end |
11 | 18 | |
12 | 19 | on_path = function(name) |
13 | - paths = split_string(os.getenv("PATH"), "[^;]+") | |
14 | - found = nil | |
15 | - for i = 1, #paths do | |
16 | - candidate = paths[i] .. "\\" .. name | |
17 | - local f = io.open(candidate, "r") | |
18 | - if f ~= nil then | |
19 | - found = candidate | |
20 | - io.close(f) | |
21 | - break | |
22 | - end | |
23 | - end | |
24 | - return found | |
20 | + paths = split_string(os.getenv("PATH"), "[^;]+") | |
21 | + found = nil | |
22 | + for i = 1, #paths do | |
23 | + candidate = paths[i] .. "\\" .. name | |
24 | + local f = io.open(candidate, "r") | |
25 | + if f ~= nil then | |
26 | + found = candidate | |
27 | + io.close(f) | |
28 | + break | |
29 | + end | |
30 | + end | |
31 | + return found | |
25 | 32 | end |
26 | 33 | |
27 | 34 | exe = on_path("cmd.exe") |
28 | 35 | |
29 | 36 | LsFilter = function() |
30 | - ft2regex = { | |
31 | - c = ".[ch]$", | |
32 | - vim = ".vim", | |
33 | - lua = ".lua", | |
34 | - py = ".py$", | |
35 | - cmake = ".cmake CMakeLists.txt", | |
36 | - } | |
37 | - if ft2regex[vim.bo.ft] ~= nil then | |
38 | - return ft2regex[vim.bo.ft] | |
39 | - else | |
40 | - return "" | |
41 | - end | |
37 | + ft2regex = { | |
38 | + c = ".[ch]$", | |
39 | + vim = ".vim", | |
40 | + lua = ".lua", | |
41 | + py = ".py$", | |
42 | + cmake = ".cmake CMakeLists.txt", | |
43 | + } | |
44 | + if ft2regex[vim.bo.ft] ~= nil then | |
45 | + return ft2regex[vim.bo.ft] | |
46 | + else | |
47 | + return "" | |
48 | + end | |
42 | 49 | end |
43 | 50 | |
44 | 51 | return files |
@@ -8,7 +8,7 @@ local ctags_locked = true -- disable until completed | ||
8 | 8 | |
9 | 9 | function CtagsTriggerUpdate() |
10 | 10 | local ctags_options = "" |
11 | - local running = vim.fn.jobwait({ctags_jobid}, 0)[1] == -1 | |
11 | + local running = vim.fn.jobwait({ ctags_jobid }, 0)[1] == -1 | |
12 | 12 | |
13 | 13 | if running then |
14 | 14 | return |
@@ -31,21 +31,14 @@ end | ||
31 | 31 | |
32 | 32 | gid_ctags = vim.api.nvim_create_augroup("Ctags", { clear = true }) |
33 | 33 | |
34 | -vim.api.nvim_create_autocmd( | |
35 | - { "BufWritePost" }, | |
36 | - { | |
37 | - group = gid_ctags, | |
38 | - pattern = { "*.c", "*.h" }, | |
39 | - callback = CtagsTriggerUpdate, | |
40 | - } | |
41 | -) | |
42 | - | |
43 | -vim.api.nvim_create_autocmd( | |
44 | - { "BufWritePost" }, | |
45 | - { | |
46 | - group = gid_ctags, | |
47 | - pattern = { "*.cxx", "*.hxx" }, | |
48 | - callback = CtagsTriggerUpdate, | |
49 | - } | |
50 | -) | |
51 | - | |
34 | +vim.api.nvim_create_autocmd({ "BufWritePost" }, { | |
35 | + group = gid_ctags, | |
36 | + pattern = { "*.c", "*.h" }, | |
37 | + callback = CtagsTriggerUpdate, | |
38 | +}) | |
39 | + | |
40 | +vim.api.nvim_create_autocmd({ "BufWritePost" }, { | |
41 | + group = gid_ctags, | |
42 | + pattern = { "*.cxx", "*.hxx" }, | |
43 | + callback = CtagsTriggerUpdate, | |
44 | +}) |