diff options
-rw-r--r-- | ftplugin/rust.vim | 18 | ||||
-rw-r--r-- | lua/lsp.lua | 9 | ||||
-rw-r--r-- | plugin/maps.vim | 10 |
3 files changed, 17 insertions, 20 deletions
diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim index 5007055..fce69b4 100644 --- a/ftplugin/rust.vim +++ b/ftplugin/rust.vim | |||
@@ -1,8 +1,6 @@ | |||
1 | setlocal ts=4 sts=4 sw=4 expandtab | 1 | setlocal ts=4 sts=4 sw=4 expandtab |
2 | 2 | ||
3 | set formatprg=rustfmt | 3 | set formatprg=rustfmt |
4 | |||
5 | " set makeprg=cargo\ clippy | ||
6 | set errorformat= | 4 | set errorformat= |
7 | \%-G, | 5 | \%-G, |
8 | \%-Gerror:\ aborting\ %.%#, | 6 | \%-Gerror:\ aborting\ %.%#, |
@@ -22,19 +20,3 @@ function! RustMake() abort | |||
22 | endfunction | 20 | endfunction |
23 | 21 | ||
24 | nnoremap <leader>r :call RustMake() <bar> silent! redraw <bar> cwindow<cr> | 22 | nnoremap <leader>r :call RustMake() <bar> silent! redraw <bar> cwindow<cr> |
25 | |||
26 | if exists('*RustFmtSimple') | ||
27 | finish | ||
28 | endif | ||
29 | |||
30 | function! RustFmtSimple() abort | ||
31 | let s = winsaveview() | ||
32 | bufdo! silent! !rustfmt % | ||
33 | bufdo! edit | ||
34 | call winrestview(s) | ||
35 | endfunction | ||
36 | |||
37 | augroup SimpleRustFmt | ||
38 | autocmd! | ||
39 | autocmd BufWritePost *.rs call RustFmtSimple() | ||
40 | augroup END | ||
diff --git a/lua/lsp.lua b/lua/lsp.lua index 2070c6a..b21ea70 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua | |||
@@ -28,9 +28,11 @@ local on_attach = function(client, bufnr) | |||
28 | end | 28 | end |
29 | end | 29 | end |
30 | 30 | ||
31 | local servers = { "hls", "rnix", "bashls", "pyls" } | 31 | local servers = { "hls", "rnix", "bashls" } |
32 | for _, lsp in ipairs(servers) do | 32 | for _, lsp in ipairs(servers) do |
33 | nvim_lsp[lsp].setup { on_attach = on_attach } | 33 | nvim_lsp[lsp].setup { |
34 | on_attach = on_attach, | ||
35 | } | ||
34 | end | 36 | end |
35 | 37 | ||
36 | local capabilities = vim.lsp.protocol.make_client_capabilities() | 38 | local capabilities = vim.lsp.protocol.make_client_capabilities() |
@@ -43,6 +45,9 @@ nvim_lsp.rust_analyzer.setup { | |||
43 | procMacro = { | 45 | procMacro = { |
44 | enable = true | 46 | enable = true |
45 | }, | 47 | }, |
48 | cargo = { | ||
49 | allFeatures = true, | ||
50 | }, | ||
46 | }, | 51 | }, |
47 | }, | 52 | }, |
48 | } | 53 | } |
diff --git a/plugin/maps.vim b/plugin/maps.vim index e471542..d252948 100644 --- a/plugin/maps.vim +++ b/plugin/maps.vim | |||
@@ -29,6 +29,16 @@ cmap w!! %!sudo -S tee > /dev/null % | |||
29 | " visual | 29 | " visual |
30 | vnoremap > >gv | 30 | vnoremap > >gv |
31 | vnoremap < <gv | 31 | vnoremap < <gv |
32 | vnoremap <silent> * :<C-U> | ||
33 | \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR> | ||
34 | \gvy/<C-R>=&ic?'\c':'\C'<CR><C-R><C-R>=substitute( | ||
35 | \escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR> | ||
36 | \gVzv:call setreg('"', old_reg, old_regtype)<CR> | ||
37 | vnoremap <silent> # :<C-U> | ||
38 | \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR> | ||
39 | \gvy?<C-R>=&ic?'\c':'\C'<CR><C-R><C-R>=substitute( | ||
40 | \escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR> | ||
41 | \gVzv:call setreg('"', old_reg, old_regtype)<CR> | ||
32 | 42 | ||
33 | " operator-pending | 43 | " operator-pending |
34 | onoremap ax a` | 44 | onoremap ax a` |