summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-09-19 10:57:34 +0100
committerAkshay <[email protected]>2021-09-19 10:57:34 +0100
commit456232000cc2a5f20b5eb87f268ffea2e3667ac6 (patch)
tree6d183309a3e5f51e74fd963d9e1881c5f12b6bc8
parentc45237c7394152dc63200f7eb71e816b30600d82 (diff)
cool new search mapping
-rw-r--r--ftplugin/rust.vim18
-rw-r--r--lua/lsp.lua9
-rw-r--r--plugin/maps.vim10
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 @@
1setlocal ts=4 sts=4 sw=4 expandtab 1setlocal ts=4 sts=4 sw=4 expandtab
2 2
3set formatprg=rustfmt 3set formatprg=rustfmt
4
5" set makeprg=cargo\ clippy
6set errorformat= 4set errorformat=
7 \%-G, 5 \%-G,
8 \%-Gerror:\ aborting\ %.%#, 6 \%-Gerror:\ aborting\ %.%#,
@@ -22,19 +20,3 @@ function! RustMake() abort
22endfunction 20endfunction
23 21
24nnoremap <leader>r :call RustMake() <bar> silent! redraw <bar> cwindow<cr> 22nnoremap <leader>r :call RustMake() <bar> silent! redraw <bar> cwindow<cr>
25
26if exists('*RustFmtSimple')
27 finish
28endif
29
30function! RustFmtSimple() abort
31 let s = winsaveview()
32 bufdo! silent! !rustfmt %
33 bufdo! edit
34 call winrestview(s)
35endfunction
36
37augroup SimpleRustFmt
38 autocmd!
39 autocmd BufWritePost *.rs call RustFmtSimple()
40augroup 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
29end 29end
30 30
31local servers = { "hls", "rnix", "bashls", "pyls" } 31local servers = { "hls", "rnix", "bashls" }
32for _, lsp in ipairs(servers) do 32for _, 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 }
34end 36end
35 37
36local capabilities = vim.lsp.protocol.make_client_capabilities() 38local 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
30vnoremap > >gv 30vnoremap > >gv
31vnoremap < <gv 31vnoremap < <gv
32vnoremap <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>
37vnoremap <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
34onoremap ax a` 44onoremap ax a`