From 456232000cc2a5f20b5eb87f268ffea2e3667ac6 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 19 Sep 2021 15:27:34 +0530 Subject: cool new search mapping --- ftplugin/rust.vim | 18 ------------------ lua/lsp.lua | 9 +++++++-- 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 @@ setlocal ts=4 sts=4 sw=4 expandtab set formatprg=rustfmt - -" set makeprg=cargo\ clippy set errorformat= \%-G, \%-Gerror:\ aborting\ %.%#, @@ -22,19 +20,3 @@ function! RustMake() abort endfunction nnoremap r :call RustMake() silent! redraw cwindow - -if exists('*RustFmtSimple') - finish -endif - -function! RustFmtSimple() abort - let s = winsaveview() - bufdo! silent! !rustfmt % - bufdo! edit - call winrestview(s) -endfunction - -augroup SimpleRustFmt - autocmd! - autocmd BufWritePost *.rs call RustFmtSimple() -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) end end -local servers = { "hls", "rnix", "bashls", "pyls" } +local servers = { "hls", "rnix", "bashls" } for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { on_attach = on_attach } + nvim_lsp[lsp].setup { + on_attach = on_attach, + } end local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -43,6 +45,9 @@ nvim_lsp.rust_analyzer.setup { procMacro = { enable = true }, + cargo = { + allFeatures = true, + }, }, }, } 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 % " visual vnoremap > >gv vnoremap < * : + \let old_reg=getreg('"')let old_regtype=getregtype('"') + \gvy/=&ic?'\c':'\C'=substitute( + \escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g') + \gVzv:call setreg('"', old_reg, old_regtype) +vnoremap # : + \let old_reg=getreg('"')let old_regtype=getregtype('"') + \gvy?=&ic?'\c':'\C'=substitute( + \escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g') + \gVzv:call setreg('"', old_reg, old_regtype) " operator-pending onoremap ax a` -- cgit v1.2.3