From 23fca7ccf36a896732f8ed07b3ac573335a18d13 Mon Sep 17 00:00:00 2001
From: Seymur Bagirov <megadestroyer230@gmail.com>
Date: Sun, 10 Mar 2024 15:59:42 +0400
Subject: [PATCH] add rustaceanvim to neovim and change stuff in hypr

---
 hypr/autostart.conf                          |  4 +-
 nvim/lazy-lock.json                          |  1 +
 nvim/lua/themystery/plugins/dap.lua          | 27 +++++-----
 nvim/lua/themystery/plugins/lsp.lua          | 56 ++++++++++++--------
 nvim/lua/themystery/plugins/rustaceanvim.lua |  5 ++
 5 files changed, 56 insertions(+), 37 deletions(-)
 create mode 100644 nvim/lua/themystery/plugins/rustaceanvim.lua

diff --git a/hypr/autostart.conf b/hypr/autostart.conf
index a78c5a4..ee55179 100755
--- a/hypr/autostart.conf
+++ b/hypr/autostart.conf
@@ -9,7 +9,7 @@ exec-once=[workspace 1 silent] steam
 exec-once= xembedsniproxy & # for wine system tray
 exec-once=solaar --window=hide
 exec-once=blueman-applet
-exec-once=armcord --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer --ozone-platform-hint=wayland & disown
+exec-once=gio launch ~/.local/share/applications/vesktop.desktop
 exec-once=hypridle
 # exec-once=wallengine --screen-root HDMI-A-2 1383845959
 # exec-once=/home/themystery/.local/share/JetBrains/Toolbox/bin/jetbrains-toolbox
@@ -33,5 +33,5 @@ source = ~/.config/hypr/wallpaper.conf
 env = XDG_SESSION_TYPE,wayland
 env = WLR_DRM_NO_ATOMIC, 1
 env = DOTNET_CLI_TELEMETRY_OPTOUT, true
-windowrulev2 = immediate, class:^(overwatch.exe)$
+windowrulev2 = immediate, title:^(Overwatch)$
 windowrulev2 = immediate, class:^(steam_app_1088710)$
diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json
index 35fca89..e0c5a38 100644
--- a/nvim/lazy-lock.json
+++ b/nvim/lazy-lock.json
@@ -45,6 +45,7 @@
   "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
   "promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" },
   "rainbow-delimiters.nvim": { "branch": "master", "commit": "64b7006a36cec099da7eaeb056c4a27dd5d73342" },
+  "rustaceanvim": { "branch": "master", "commit": "19f12173ccb7993f86ea26b0e21bbb883c3b86c7" },
   "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
   "telescope.nvim": { "branch": "master", "commit": "2e1e382df42467029b493c143c2e727028140214" },
   "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
diff --git a/nvim/lua/themystery/plugins/dap.lua b/nvim/lua/themystery/plugins/dap.lua
index 62e43a1..663d505 100644
--- a/nvim/lua/themystery/plugins/dap.lua
+++ b/nvim/lua/themystery/plugins/dap.lua
@@ -33,20 +33,19 @@ return {
             }
         }
 
-        dap.configurations.rust = {
-            {
-                name = "Rust Debug",
-                type = "codelldb",
-                request = "launch",
-                program = function()
-                    vim.fn.jobstart("cargo build");
-                    return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug", "file")
-                end,
-                cwd = "${workspaceFolder}",
-                stopOnEntry = true,
-                showDisassembly = "never"
-            }
-        }
+        -- dap.configurations.rust = {
+        --     {
+        --         name = "Rust Debug",
+        --         type = "codelldb",
+        --         request = "launch",
+        --         program = function()
+        --             return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/target/debug", "file")
+        --         end,
+        --         cwd = "${workspaceFolder}",
+        --         stopOnEntry = true,
+        --         showDisassembly = "never"
+        --     }
+        -- }
 
 
     end
diff --git a/nvim/lua/themystery/plugins/lsp.lua b/nvim/lua/themystery/plugins/lsp.lua
index e69bbc0..679dd75 100644
--- a/nvim/lua/themystery/plugins/lsp.lua
+++ b/nvim/lua/themystery/plugins/lsp.lua
@@ -22,6 +22,9 @@ return {
         -- extras
         "SmiteshP/nvim-navic",
         "Decodetalkers/csharpls-extended-lsp.nvim",
+
+        -- rust
+        'mrcjkb/rustaceanvim'
     },
     config = function()
         local lsp = require("lsp-zero")
@@ -50,17 +53,17 @@ return {
                 }
             }
         })
-
-        lsp.configure("rust_analyzer", {
-            settings = {
-                ["rust-analyzer"] = {
-                    checkOnSave = true,
-                    check = {
-                        command = "clippy"
-                    }
-                }
-            }
-        })
+        --
+        -- lsp.configure("rust_analyzer", {
+        --     settings = {
+        --         ["rust-analyzer"] = {
+        --             checkOnSave = true,
+        --             check = {
+        --                 command = "clippy"
+        --             }
+        --         }
+        --     }
+        -- })
 
         lsp.set_server_config({
             capabilities = {
@@ -80,7 +83,7 @@ return {
 
         require('luasnip.loaders.from_vscode').lazy_load()
 
-        vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
+        vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
 
         cmp.setup({
             formatting = cmp_format,
@@ -92,16 +95,16 @@ return {
                 documentation = cmp.config.window.bordered(),
             },
             sources = {
-                {name = 'path'},
-                {name = 'nvim_lsp'},
-                {name = 'nvim_lua'},
-                {name = 'buffer', keyword_length = 3},
-                {name = 'luasnip', keyword_length = 2},
+                { name = 'path' },
+                { name = 'nvim_lsp' },
+                { name = 'nvim_lua' },
+                { name = 'buffer',  keyword_length = 3 },
+                { name = 'luasnip', keyword_length = 2 },
             },
             mapping = cmp.mapping.preset.insert({
                 -- confirm completion item
-                ['<CR>'] = cmp.mapping.confirm({select = false, behavior = cmp.ConfirmBehavior.Insert}),
-                ['<Tab>'] = cmp.mapping.confirm({select = false, behavior = cmp.ConfirmBehavior.Replace}),
+                ['<CR>'] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Insert }),
+                ['<Tab>'] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }),
 
                 -- toggle completion menu
                 ['<C-e>'] = cmp_action.toggle_completion(),
@@ -125,7 +128,7 @@ return {
 
         lsp.on_attach(function(client, bufnr)
             local opts = { buffer = bufnr, remap = false }
-            lsp.default_keymaps({buffer = bufnr})
+            lsp.default_keymaps({ buffer = bufnr })
             if client.server_capabilities.documentSymbolProvider then
                 navic.attach(client, bufnr)
             end
@@ -146,13 +149,14 @@ return {
 
         require("mason").setup({});
         require("mason-lspconfig").setup({
-            ensure_installed = {'tsserver','svelte', 'lua_ls', 'csharp_ls', "rust_analyzer"},
+            ensure_installed = { 'tsserver', 'svelte', 'lua_ls', 'csharp_ls', 'rust_analyzer' },
             handlers = {
                 lsp.default_setup,
                 lua_ls = function()
                     local lua_opts = lsp.nvim_lua_ls()
                     require('lspconfig').lua_ls.setup(lua_opts)
                 end,
+                rust_analyzer = lsp.noop,
             }
         })
 
@@ -176,5 +180,15 @@ return {
             },
         })
 
+        vim.g.rustaceanvim = {
+            server = {
+                capabilities = lsp.get_capabilities(),
+                on_attach = function()
+                    local bufnr = vim.api.nvim_get_current_buf()
+                    vim.keymap.set("n", "<C-.>", function() vim.cmd.RustLsp('codeAction') end, {silent = true, buffer = bufnr, remap = true})
+                end
+            },
+
+        }
     end
 }
diff --git a/nvim/lua/themystery/plugins/rustaceanvim.lua b/nvim/lua/themystery/plugins/rustaceanvim.lua
new file mode 100644
index 0000000..bf412af
--- /dev/null
+++ b/nvim/lua/themystery/plugins/rustaceanvim.lua
@@ -0,0 +1,5 @@
+return {
+  'mrcjkb/rustaceanvim',
+  version = '^4', -- Recommended
+  ft = { 'rust' },
+}