diff options
| -rw-r--r-- | .bashrc | 7 | ||||
| -rw-r--r-- | .config/nvim/.vscode/launch.json | 16 | ||||
| -rw-r--r-- | .config/nvim/ftplugin/xml.lua | 12 | ||||
| -rw-r--r-- | .config/nvim/init.lua | 77 | ||||
| -rw-r--r-- | .config/nvim/lazy-lock.json | 5 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/file_explorer.lua | 28 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lsp.lua | 26 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/rust_analyzer.lua | 18 | ||||
| -rw-r--r-- | .ssh/config_global | 3 |
9 files changed, 97 insertions, 95 deletions
@@ -12,9 +12,9 @@ fi export PATH # Rust -#if [ -d "$HOME/.cargo" ]; then -# . "$HOME/.cargo/env" -#fi +if [ -d "$HOME/.cargo" ]; then + . "$HOME/.cargo/env" +fi # Uncomment the following line if you don't like systemctl's auto-paging feature: # export SYSTEMD_PAGER= @@ -47,3 +47,4 @@ alias t="tmux"; alias v="nvim"; alias vro="nvim -RM" # Neovim read-only alias nv-watch="watch -n1 nvidia-smi"; +alias clear-swap="rm -r ~/.local/share/nvim/swap/*"; diff --git a/.config/nvim/.vscode/launch.json b/.config/nvim/.vscode/launch.json deleted file mode 100644 index 10efcb2..0000000 --- a/.config/nvim/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "lldb", - "request": "launch", - "name": "Debug", - "program": "${workspaceFolder}/<executable file>", - "args": [], - "cwd": "${workspaceFolder}" - } - ] -}
\ No newline at end of file diff --git a/.config/nvim/ftplugin/xml.lua b/.config/nvim/ftplugin/xml.lua new file mode 100644 index 0000000..4d8e3f2 --- /dev/null +++ b/.config/nvim/ftplugin/xml.lua @@ -0,0 +1,12 @@ +local indent_size = 2 +local use_tabs = false + +local settings = string.format("setlocal softtabstop=%s tabstop=%s shiftwidth=%s", indent_size, indent_size, indent_size) + +if use_tabs == true then + settings = settings .. " noexpandtab" +else + settings = settings .. " expandtab" +end + +vim.cmd(settings) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index ac0f5b6..a6ec8b1 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,4 +1,6 @@ --- Basic +----------- +-- Basic -- +----------- vim.g.mapleader = " " vim.opt.mouse = '' vim.opt.wrap = true @@ -17,30 +19,53 @@ vim.opt.wildmenu = true vim.cmd("filetype plugin on") vim.api.nvim_set_keymap('v', '<C-c>', '"+y', { noremap = true, silent = true }) --- Working tabs and windows ---vim.keymap.set('n', '<leader>f', '<cmd>Neotree<CR>', { desc = 'Open Neotree' }) ---vim.keymap.set("n", '<leader>c',function() --- vim.cmd("Tex") --- vim.cmd("wincmd r") ---end, { desc = "Open tab"}) ---vim.keymap.set("n", '<leader>v', function() --- vim.cmd("Vex") --- vim.cmd("wincmd x") --- vim.cmd("wincmd l") --- vim.cmd("enew") ---end, { desc = "Open vertical split" }) ---vim.keymap.set("n", '<leader>h', function() --- vim.cmd("Sex") --- vim.cmd("wincmd x") --- vim.cmd("wincmd j") ---end, { desc = "Open horizontal split" }) ---vim.keymap.set('n', '<C-l>', '<cmd>tabnext +<CR>', { desc = 'Switch next tab' }) ---vim.keymap.set('n', '<C-h>', '<cmd>tabnext -<CR>', { desc = 'Switch prev tab' }) ---vim.keymap.set('n', '<A-k>', '<cmd>wincmd k<CR>', { desc = 'Move cursor to window above' }) ---vim.keymap.set('n', '<A-j>', '<cmd>wincmd j<CR>', { desc = 'Move cursor to window below' }) ---vim.keymap.set('n', '<A-h>', '<cmd>wincmd h<CR>', { desc = 'Move cursor to window left' }) ---vim.keymap.set('n', '<A-l>', '<cmd>wincmd l<CR>', { desc = 'Move cursor to window right' }) +------------------------------------ +-- Native Neovim tabs and windows -- +------------------------------------ +vim.keymap.set('n', '<leader>f', '<cmd>Neotree<CR>', { desc = 'Open Neotree' }) +vim.keymap.set("n", '<leader>c',function() + vim.cmd("Tex") + vim.cmd("wincmd r") +end, { desc = "Open tab"}) +vim.keymap.set("n", '<leader>v', function() + vim.cmd("Vex") + vim.cmd("wincmd x") + vim.cmd("wincmd l") + vim.cmd("enew") +end, { desc = "Open vertical split" }) +vim.keymap.set("n", '<leader>h', function() + vim.cmd("Sex") + vim.cmd("wincmd x") + vim.cmd("wincmd j") +end, { desc = "Open horizontal split" }) +-- Open terminal +local term_buf = nil +vim.keymap.set('n', '<leader>t', function() + if term_buf and vim.api.nvim_buf_is_valid(term_buf) then + -- Reuse existing terminal + vim.cmd('rightbelow vsplit') + vim.cmd('buffer ' .. term_buf) + else + -- Create a new terminal + vim.cmd('rightbelow vsplit | terminal') + term_buf = vim.api.nvim_get_current_buf() + end + vim.cmd('startinsert') +end, { desc = 'Open terminal in vertical split' }) +vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], { desc = 'Exit terminal mode' }) +vim.keymap.set('n', '<C-l>', '<cmd>tabnext +<CR>', { desc = 'Switch next tab' }) +vim.keymap.set('n', '<C-h>', '<cmd>tabnext -<CR>', { desc = 'Switch prev tab' }) +vim.keymap.set('n', '<C-A-h>', '<cmd>tabmove -1<CR>', { desc = 'Move current tab left' }) +vim.keymap.set('n', '<C-A-l>', '<cmd>tabmove +1<CR>', { desc = 'Move current tab right' }) +vim.keymap.set('n', '<A-k>', '<cmd>wincmd k<CR>', { desc = 'Move cursor to window above' }) +vim.keymap.set('n', '<A-j>', '<cmd>wincmd j<CR>', { desc = 'Move cursor to window below' }) +vim.keymap.set('n', '<A-h>', '<cmd>wincmd h<CR>', { desc = 'Move cursor to window left' }) +vim.keymap.set('n', '<A-l>', '<cmd>wincmd l<CR>', { desc = 'Move cursor to window right' }) +-------------------------------------------- +----------------- +-- Diagnostics -- +----------------- vim.diagnostic.config({ virtual_text = false, -- Disable inline text diagnostics signs = true, -- Keep signs in the sign column @@ -58,7 +83,9 @@ vim.api.nvim_create_autocmd("CursorHold", { end, }) --- Install Lazy.vim +-------------- +-- Lazy.vim -- +-------------- local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 877913e..f745448 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -3,15 +3,13 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, + "lazy.nvim": { "branch": "main", "commit": "db067881fff0fd4be8c00e5bde7492e0e1c77a2f" }, "markdown-toc": { "branch": "main", "commit": "1454bf3b4bcb855f7df41c59dfae08cc824141a0" }, "marks.nvim": { "branch": "master", "commit": "f353e8c08c50f39e99a9ed474172df7eddd89b72" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, "mini.nvim": { "branch": "main", "commit": "44a3ab2bc6b40edeb7a76359826c9779d5c70cb5" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, "none-ls.nvim": { "branch": "main", "commit": "af318216b744f2fe2d5afa6febb01f455ae61d6c" }, - "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, "nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" }, @@ -19,7 +17,6 @@ "nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" }, "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, "nvim-treesitter": { "branch": "master", "commit": "5da195ac3dfafd08d8b10756d975f0e01e1d563a" }, - "nvim-web-devicons": { "branch": "master", "commit": "0eb18da56e2ba6ba24de7130a12bcc4e31ad11cb" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "render-markdown.nvim": { "branch": "main", "commit": "ad055861d17afe058bd835e82292e14a64b51b1d" }, "rustaceanvim": { "branch": "master", "commit": "66398662c07d265b226897500ed50eafba3dffb4" }, diff --git a/.config/nvim/lua/plugins/file_explorer.lua b/.config/nvim/lua/plugins/file_explorer.lua deleted file mode 100644 index 8b27dc9..0000000 --- a/.config/nvim/lua/plugins/file_explorer.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - { - -- https://github.com/nvim-neo-tree/neo-tree.nvim - "nvim-neo-tree/neo-tree.nvim", - branch = "v3.x", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - -- Optional image support for file preview: See `# Preview Mode` for more information. - -- {"3rd/image.nvim", opts = {}}, - -- OR use snacks.nvim's image module: - -- "folke/snacks.nvim", - }, - lazy = false, -- neo-tree will lazily load itself - opts = { - window = { - position = "float", - popup = { - size = { - height = "70%", - width = "70%", - }, - }, - }, - }, - } -} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index d863802..296e73a 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -3,6 +3,10 @@ -- Goto definition with :Goto -- Open code action with :Codeact +local servers = { + "lua_ls", "bashls", "clangd", "marksman", "pyright", "lemminx", +} + return { { "williamboman/mason.nvim", @@ -15,7 +19,7 @@ return { "williamboman/mason-lspconfig.nvim", config = function() require("mason-lspconfig").setup { - ensure_installed = { "bashls", "lua_ls", "clangd", "marksman", "pyright", "rust_analyzer", "lemminx" }, + ensure_installed = servers, automatic_installation = true, } end @@ -27,21 +31,11 @@ return { -- Advertise autocompletion to lsp local capabilities = require('cmp_nvim_lsp').default_capabilities() local lspconfig = require("lspconfig") - lspconfig.bashls.setup({ - capabilities = capabilities - }) - lspconfig.lua_ls.setup({ - capabilities = capabilities - }) - lspconfig.clangd.setup({ - capabilities = capabilities - }) - lspconfig.marksman.setup({ - capabilities = capabilities - }) - lspconfig.pyright.setup({ - capabilities = capabilities - }) + for _, server in ipairs(servers) do + lspconfig[server].setup { + capabilities = capabilities, + } + end -- Key mapping -- Hover for definition diff --git a/.config/nvim/lua/plugins/rust_analyzer.lua b/.config/nvim/lua/plugins/rust_analyzer.lua index 87dc010..914befe 100644 --- a/.config/nvim/lua/plugins/rust_analyzer.lua +++ b/.config/nvim/lua/plugins/rust_analyzer.lua @@ -14,6 +14,7 @@ return { server = { default_settings = { -- rust-analyzer language server configuration + -- https://rust-analyzer.github.io/book/configuration.html ['rust-analyzer'] = { checkOnSave = true, check = { @@ -25,7 +26,24 @@ return { autoimport = { enable = false; } + }, + files = { + exclude = { + "build-dir/", + ".flatpak-builder", + } } + --settings = { + -- cargo = { allFeatures = true }, + -- imports = { group = { enable = false } }, + -- completion = { postfix = { enable = false } }, + -- -- https://www.reddit.com/r/rust/comments/1e978l7/comment/led7ibp/ + -- -- checkOnSave = { command = "clippy" }, + -- checkOnSave = { command = false }, + + -- diagnostics = { enable = true }, + -- rustfmt = { enable = true }, + --} }, }, }, diff --git a/.ssh/config_global b/.ssh/config_global deleted file mode 100644 index 7f50a4a..0000000 --- a/.ssh/config_global +++ /dev/null @@ -1,3 +0,0 @@ -# If SSH doesn't work over a particular connection. -# Prepend `Include config_global` to ~/.ssh/config to apply fix. -IPQoS=throughput |
