diff options
36 files changed, 629 insertions, 187 deletions
@@ -48,3 +48,4 @@ 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/*"; +alias xclipb="xclip -selection clipboard"; diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json deleted file mode 100644 index 1e1765c..0000000 --- a/.config/nvim/.luarc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "diagnostics.globals": [ - "vim" - ] -}
\ No newline at end of file diff --git a/.config/nvim/ftplugin/cpp.lua b/.config/nvim/ftplugin/cpp.lua new file mode 100644 index 0000000..4514ab3 --- /dev/null +++ b/.config/nvim/ftplugin/cpp.lua @@ -0,0 +1,12 @@ +local indent_size = 8 +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/ftplugin/html.lua b/.config/nvim/ftplugin/html.lua new file mode 100644 index 0000000..3fbcec4 --- /dev/null +++ b/.config/nvim/ftplugin/html.lua @@ -0,0 +1,12 @@ +local indent_size = 4 +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/ftplugin/htmldjango.lua b/.config/nvim/ftplugin/htmldjango.lua new file mode 100644 index 0000000..3fbcec4 --- /dev/null +++ b/.config/nvim/ftplugin/htmldjango.lua @@ -0,0 +1,12 @@ +local indent_size = 4 +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/ftplugin/toml.lua b/.config/nvim/ftplugin/toml.lua new file mode 100644 index 0000000..3fbcec4 --- /dev/null +++ b/.config/nvim/ftplugin/toml.lua @@ -0,0 +1,12 @@ +local indent_size = 4 +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 5fe9ee8..90379f8 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,128 +1,4 @@ ------------ --- Basic -- ------------ -vim.g.mapleader = " " -vim.opt.mouse = '' -vim.opt.wrap = true -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.laststatus = 2 -vim.opt.hlsearch = true -vim.opt.incsearch = true --- Directory for swap files -vim.opt.directory = vim.fn.expand("~/.local/share/nvim/swap//") --- Search into subfolders --- Provides tab completion for file related tasks -vim.opt.path:append '**' --- Display all matching files when we tab complete -vim.opt.wildmenu = true -vim.cmd("filetype plugin on") -vim.api.nvim_set_keymap('v', '<C-c>', '"+y', { noremap = true, silent = true }) - ------------------------------------- --- Native Neovim tabs and windows -- ------------------------------------- -vim.keymap.set('n', '<leader>f', '<cmd>Explore<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>:q<CR>]], { 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 - update_in_insert = false, - underline = true, - severity_sort = true, -}) - --- Show diagnostics on hover -vim.o.updatetime = 250 -- Faster update time for hover -vim.api.nvim_create_autocmd("CursorHold", { - pattern = "*", - callback = function() - vim.diagnostic.open_float(nil, { focus = false, scope = "cursor" }) - end, -}) - --------------- --- Lazy.vim -- --------------- -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - --- Rename Tmux Window to File Opened by Neovim --- https://github.com/Dyslectric/neovim-tmux-window-rename -if vim.env.TMUX ~= nil then - -- Define an autocommand for BufEnter and FocusGained events - vim.api.nvim_create_autocmd({"BufEnter", "FocusGained"}, { - pattern = "*", - callback = function() - local file_name = vim.fn.expand("%:t") - local folder_name = vim.fn.expand("%:p:h:t") - local tmux_command = string.format( - "tmux rename-window 'Nv:%s/%s'", folder_name, file_name - ) - vim.fn.system(tmux_command) - end - }) - - -- Define an autocommand for the VimLeave event - vim.api.nvim_create_autocmd("VimLeave", { - pattern = "*", - callback = function() - local shell = vim.env.SHELL or "sh" - vim.fn.system("tmux set-window-option automatic-rename on") - end - }) -end - -require("lazy").setup("plugins") +--- General configs -- +require("configs.basic") +require("configs.filetype") +require("configs.lazyvim") diff --git a/.config/nvim/init.lua.save b/.config/nvim/init.lua.save deleted file mode 100644 index 8abcdc8..0000000 --- a/.config/nvim/init.lua.save +++ /dev/null @@ -1,31 +0,0 @@ --- Basic -vim.g.mapleader = " " -vim.opt.wrap = true -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.laststatus = 2 -vim.opt.hlsearch = true -vim.opt.incsearch = true -vim.opt.syntax = ON -vim.cmd("filetype plugin on") - --- Temp -vim.opt.mouse = "" - --- Install Lazy.vim -local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) -end -vim.opt.rtp:prepend(lazypath) - -local opts = {} - -require("lazy").setup("plugins") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 443fc76..f8d3a95 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,25 +1,25 @@ { - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, - "markdown-toc": { "branch": "main", "commit": "1454bf3b4bcb855f7df41c59dfae08cc824141a0" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "markdown-toc": { "branch": "main", "commit": "1aa53cec6207754610fc0254662cdfff730aceab" }, "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" }, - "none-ls.nvim": { "branch": "main", "commit": "af318216b744f2fe2d5afa6febb01f455ae61d6c" }, - "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, - "nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" }, - "nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, - "nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" }, - "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, - "nvim-treesitter": { "branch": "master", "commit": "5da195ac3dfafd08d8b10756d975f0e01e1d563a" }, - "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, - "render-markdown.nvim": { "branch": "main", "commit": "ad055861d17afe058bd835e82292e14a64b51b1d" }, - "rustaceanvim": { "branch": "master", "commit": "66398662c07d265b226897500ed50eafba3dffb4" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "fe661093f4b05136437b531e7f959af2a2ae66c8" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "mini.nvim": { "branch": "main", "commit": "8dccba88fc4dce006ca0ad668067c9e0d5ce7702" }, + "none-ls.nvim": { "branch": "main", "commit": "1fcf9cbf9acf893455c6cee792537aa709de62cb" }, + "nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" }, + "nvim-dap": { "branch": "master", "commit": "cdfd55a133f63228c55f91378f12908cb2a78ded" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" }, + "nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "render-markdown.nvim": { "branch": "main", "commit": "ae89236e2389836cf1c3787b2b80d5d8685cc13f" }, + "rustaceanvim": { "branch": "master", "commit": "88575b98bb9937fb9983ddec5e532b67e75ce677" }, "telescope-dap.nvim": { "branch": "master", "commit": "783366bd6c1e7fa0a5c59c07db37f49c805a28df" }, - "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" } + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" } } diff --git a/.config/nvim/lua/configs/basic.lua b/.config/nvim/lua/configs/basic.lua new file mode 100644 index 0000000..f4ccce1 --- /dev/null +++ b/.config/nvim/lua/configs/basic.lua @@ -0,0 +1,84 @@ +----------- +-- Basic -- +----------- +vim.g.mapleader = " " +vim.opt.mouse = '' +vim.opt.wrap = true +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.laststatus = 2 +vim.opt.hlsearch = true +vim.opt.incsearch = true +-- Directory for swap files +vim.opt.directory = vim.fn.expand("~/.local/share/nvim/swap//") +-- Search into subfolders +-- Provides tab completion for file related tasks +vim.opt.path:append '**' +-- Display all matching files when we tab complete +vim.opt.wildmenu = true +vim.cmd("filetype plugin on") +vim.api.nvim_set_keymap('v', '<C-c>', '"+y', { noremap = true, silent = true }) + +------------------------------------ +-- Native Neovim tabs and windows -- +------------------------------------ +vim.keymap.set('n', '<leader>f', '<cmd>Explore<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>:q<CR>]], { 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 + update_in_insert = false, + underline = true, + severity_sort = true, +}) + +-- Show diagnostics on hover +vim.o.updatetime = 250 -- Faster update time for hover +vim.api.nvim_create_autocmd("CursorHold", { + pattern = "*", + callback = function() + vim.diagnostic.open_float(nil, { focus = false, scope = "cursor" }) + end, +}) diff --git a/.config/nvim/lua/configs/filetype.lua b/.config/nvim/lua/configs/filetype.lua new file mode 100644 index 0000000..82725e2 --- /dev/null +++ b/.config/nvim/lua/configs/filetype.lua @@ -0,0 +1,7 @@ +vim.filetype.add({ + extension = { + mq4 = "c", + mq5 = "cpp", + mqh = "cpp", + } +}) diff --git a/.config/nvim/lua/configs/lazyvim.lua b/.config/nvim/lua/configs/lazyvim.lua new file mode 100644 index 0000000..0b643b4 --- /dev/null +++ b/.config/nvim/lua/configs/lazyvim.lua @@ -0,0 +1,40 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Rename Tmux Window to File Opened by Neovim +-- https://github.com/Dyslectric/neovim-tmux-window-rename +if vim.env.TMUX ~= nil then + -- Define an autocommand for BufEnter and FocusGained events + vim.api.nvim_create_autocmd({"BufEnter", "FocusGained"}, { + pattern = "*", + callback = function() + local file_name = vim.fn.expand("%:t") + local folder_name = vim.fn.expand("%:p:h:t") + local tmux_command = string.format( + "tmux rename-window 'Nv:%s/%s'", folder_name, file_name + ) + vim.fn.system(tmux_command) + end + }) + + -- Define an autocommand for the VimLeave event + vim.api.nvim_create_autocmd("VimLeave", { + pattern = "*", + callback = function() + local shell = vim.env.SHELL or "sh" + vim.fn.system("tmux set-window-option automatic-rename on") + end + }) +end + +require("lazy").setup("plugins") diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 296e73a..0314c42 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -30,11 +30,10 @@ return { config = function() -- Advertise autocompletion to lsp local capabilities = require('cmp_nvim_lsp').default_capabilities() - local lspconfig = require("lspconfig") for _, server in ipairs(servers) do - lspconfig[server].setup { + vim.lsp.config(server, { capabilities = capabilities, - } + }) end -- Key mapping diff --git a/.config/nvim_pack/ftplugin/c.lua b/.config/nvim_pack/ftplugin/c.lua new file mode 100644 index 0000000..4514ab3 --- /dev/null +++ b/.config/nvim_pack/ftplugin/c.lua @@ -0,0 +1,12 @@ +local indent_size = 8 +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_pack/ftplugin/json.lua b/.config/nvim_pack/ftplugin/json.lua new file mode 100644 index 0000000..3fbcec4 --- /dev/null +++ b/.config/nvim_pack/ftplugin/json.lua @@ -0,0 +1,12 @@ +local indent_size = 4 +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_pack/ftplugin/lua.lua b/.config/nvim_pack/ftplugin/lua.lua new file mode 100644 index 0000000..275b1a9 --- /dev/null +++ b/.config/nvim_pack/ftplugin/lua.lua @@ -0,0 +1,14 @@ +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) + +-- Check http://vimcasts.org/episodes/tabs-and-spaces/ for more info on tabs and spaces diff --git a/.config/nvim_pack/ftplugin/make.lua b/.config/nvim_pack/ftplugin/make.lua new file mode 100644 index 0000000..2ad7f95 --- /dev/null +++ b/.config/nvim_pack/ftplugin/make.lua @@ -0,0 +1,12 @@ +local indent_size = 8 +local use_tabs = true + +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_pack/ftplugin/python.lua b/.config/nvim_pack/ftplugin/python.lua new file mode 100644 index 0000000..3fbcec4 --- /dev/null +++ b/.config/nvim_pack/ftplugin/python.lua @@ -0,0 +1,12 @@ +local indent_size = 4 +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_pack/ftplugin/rust.lua b/.config/nvim_pack/ftplugin/rust.lua new file mode 100644 index 0000000..029f0da --- /dev/null +++ b/.config/nvim_pack/ftplugin/rust.lua @@ -0,0 +1,31 @@ +local indent_size = 4 +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 + +local bufnr = vim.api.nvim_get_current_buf() +vim.keymap.set( + "n", + "<leader>a", + function() + vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping + -- or vim.lsp.buf.codeAction() if you don't want grouping. + end, + { silent = true, buffer = bufnr } +) +vim.keymap.set( + "n", + "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions + function() + vim.cmd.RustLsp({'hover', 'actions'}) + end, + { silent = true, buffer = bufnr } +) + +vim.cmd(settings) diff --git a/.config/nvim_pack/ftplugin/sh.lua b/.config/nvim_pack/ftplugin/sh.lua new file mode 100644 index 0000000..4d8e3f2 --- /dev/null +++ b/.config/nvim_pack/ftplugin/sh.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_pack/ftplugin/xml.lua b/.config/nvim_pack/ftplugin/xml.lua new file mode 100644 index 0000000..4d8e3f2 --- /dev/null +++ b/.config/nvim_pack/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_pack/init.lua b/.config/nvim_pack/init.lua new file mode 100644 index 0000000..bfc4b5b --- /dev/null +++ b/.config/nvim_pack/init.lua @@ -0,0 +1,10 @@ +-- General configs -- +require("configs.basic") +require("configs.vim-plug") +require("configs.lsp") + +-- Install plugins with native vim.pack -- +require("plugins.mason") +require("plugins.marks") +require("plugins.render-markdown") +require("plugins.rustaceanvim") diff --git a/.config/nvim_pack/lsp/bashls.lua b/.config/nvim_pack/lsp/bashls.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim_pack/lsp/bashls.lua diff --git a/.config/nvim_pack/lsp/clangd.lua b/.config/nvim_pack/lsp/clangd.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim_pack/lsp/clangd.lua diff --git a/.config/nvim_pack/lsp/lemminx.lua b/.config/nvim_pack/lsp/lemminx.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim_pack/lsp/lemminx.lua diff --git a/.config/nvim_pack/lsp/lua_ls.lua b/.config/nvim_pack/lsp/lua_ls.lua new file mode 100644 index 0000000..c0a6d56 --- /dev/null +++ b/.config/nvim_pack/lsp/lua_ls.lua @@ -0,0 +1,19 @@ +return { + -- Command and arguments to start the server. + cmd = { 'lua-language-server' }, + -- Filetypes to automatically attach to. + filetypes = { 'lua' }, + -- Sets the "workspace" to the directory where any of these files is found. + -- Files that share a root directory will reuse the LSP server connection. + -- Nested lists indicate equal priority, see |vim.lsp.Config|. + root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' }, + -- Specific settings to send to the server. The schema is server-defined. + -- Example: https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + } + } + } +} diff --git a/.config/nvim_pack/lsp/marksman.lua b/.config/nvim_pack/lsp/marksman.lua new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.config/nvim_pack/lsp/marksman.lua diff --git a/.config/nvim_pack/lsp/pyright.lua b/.config/nvim_pack/lsp/pyright.lua new file mode 100644 index 0000000..aece9a7 --- /dev/null +++ b/.config/nvim_pack/lsp/pyright.lua @@ -0,0 +1,16 @@ +return { + cmd = { "pyright-langserver", "--stdio" }, + filetypes = { "python" }, + root_dir = function(filename) + return util.root_pattern(unpack(root_files))(filename) or util.path.dirname(filename) + end, + settings = { + python = { + analysis = { + autoSearchPaths = true, + diagnosticMode = "workspace", + useLibraryCodeForTypes = true + } + } + } +} diff --git a/.config/nvim_pack/lua/configs/basic.lua b/.config/nvim_pack/lua/configs/basic.lua new file mode 100644 index 0000000..b39412c --- /dev/null +++ b/.config/nvim_pack/lua/configs/basic.lua @@ -0,0 +1,83 @@ +----------- +-- Basic -- +----------- +vim.g.mapleader = " " +vim.opt.mouse = '' +vim.opt.wrap = true +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.laststatus = 2 +vim.opt.hlsearch = true +vim.opt.incsearch = true +-- Directory for swap files +vim.opt.directory = vim.fn.expand("~/.local/share/nvim/swap//") +-- Search into subfolders +-- Provides tab completion for file related tasks +vim.opt.path:append '**' +-- Display all matching files when we tab complete |
