diff --git a/init.lua b/init.lua index 0595e17..2856088 100644 --- a/init.lua +++ b/init.lua @@ -15,7 +15,7 @@ require("user.lualine") require("user.toggleterm") require("user.project") require("user.impatient") --- require("user.illuminate") +require("user.illuminate") require("user.indentline") require("user.alpha") require("user.lsp") @@ -23,3 +23,4 @@ require("user.dap") require("user.vimwiki") require("user.whichkey") require("user.crates") +require("user.colorizer") diff --git a/lua/user/autocommands.lua b/lua/user/autocommands.lua index 6e911a7..ee1f091 100644 --- a/lua/user/autocommands.lua +++ b/lua/user/autocommands.lua @@ -62,7 +62,7 @@ vim.api.nvim_create_autocmd({ "InsertEnter" }, { }) vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = { "c", "cpp", "yaml" }, + pattern = { "c", "cpp", "yaml", "vimwiki", "markdown", "html", "css", "json" }, callback = function() vim.opt_local.ts = 2 vim.opt_local.sw = 2 @@ -74,4 +74,10 @@ vim.api.nvim_create_autocmd({ "FileType" }, { vim.cmd([[ highlight CursorLine ctermbg=White cterm=bold guibg=#222222 highlight CursorColumn ctermbg=White cterm=bold guibg=#222222 + autocmd FileType python imap wexec "!python3" shellescape(@%, 1) + autocmd FileType python map wexec "!python3" shellescape(@%, 1) + autocmd FileType rust imap wexec "!cargo run" + autocmd FileType rust map wexec "!cargo run" + autocmd FileType tex imap wexec "silent !lualatex %" + autocmd FileType tex map wexec "silent !lualatex %" ]]) diff --git a/lua/user/colorizer.lua b/lua/user/colorizer.lua new file mode 100644 index 0000000..ba8fcc5 --- /dev/null +++ b/lua/user/colorizer.lua @@ -0,0 +1,6 @@ +local status_ok, colorizer = pcall(require, "colorizer") +if not status_ok then + return +end + +colorizer.setup() diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 485227b..fb41229 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -49,7 +49,7 @@ keymap("n", "", "m .-2==", opts) keymap("n", "]q", "cnext", opts) keymap("n", "[q", "cprev", opts) -keymap("n", "", ":%s//", {}) +keymap("n", "", ":%s///gi", {}) -- Insert -- -- Press jk fast to enter @@ -115,4 +115,3 @@ keymap("n", "dr", "lua require'dap'.repl.toggle()", opts) keymap("n", "dl", "lua require'dap'.run_last()", opts) keymap("n", "du", "lua require'dapui'.toggle()", opts) keymap("n", "dt", "lua require'dap'.terminate()", opts) - diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua index e2ba760..60fe28e 100644 --- a/lua/user/lsp/handlers.lua +++ b/lua/user/lsp/handlers.lua @@ -7,7 +7,8 @@ end M.capabilities = vim.lsp.protocol.make_client_capabilities() M.capabilities.textDocument.completion.completionItem.snippetSupport = true -M.capabilities = cmp_nvim_lsp.update_capabilities(M.capabilities) +-- M.capabilities = cmp_nvim_lsp.update_capabilities(M.capabilities) +M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities) M.setup = function() local signs = { diff --git a/lua/user/lsp/lsp-installer.lua b/lua/user/lsp/lsp-installer.lua index bb197b4..ee91a43 100644 --- a/lua/user/lsp/lsp-installer.lua +++ b/lua/user/lsp/lsp-installer.lua @@ -45,6 +45,16 @@ for _, server in pairs(servers) do opts = vim.tbl_deep_extend("force", pyright_opts, opts) end + -- if server == "clangd" then + -- local clangd_opts = require("user.lsp.settings.clangd") + -- opts = vim.tbl_deep_extend("force", clangd_opts) + -- end + -- + -- if server == "html" then + -- local html_opts = require("user.lsp.settings.html") + -- opts = vim.tbl_deep_extend("force", html_opts) + -- end + if server == "rust_analyzer" then local keymap = vim.keymap.set local key_opts = { silent = true } diff --git a/lua/user/lsp/null-ls.lua b/lua/user/lsp/null-ls.lua index 3e455a3..7647ece 100644 --- a/lua/user/lsp/null-ls.lua +++ b/lua/user/lsp/null-ls.lua @@ -24,7 +24,7 @@ null_ls.setup({ formatting.tidy, formatting.stylelint, diagnostics.luacheck, - diagnostics.flake8, + -- diagnostics.flake8, diagnostics.pylint, diagnostics.zsh, }, diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 2bcfdb7..b36c44f 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -66,6 +66,7 @@ return packer.startup(function(use) use("folke/tokyonight.nvim") use("lunarvim/darkplus.nvim") use("Mofiqul/dracula.nvim") + use("elkowar/yuck.vim") -- Vimwiki use("vimwiki/vimwiki") @@ -81,13 +82,12 @@ return packer.startup(function(use) -- snippets use("L3MON4D3/LuaSnip") --snippet engine use("rafamadriz/friendly-snippets") -- a bunch of snippets to use - use("mattn/emmet-vim") -- LSP use("neovim/nvim-lspconfig") -- enable LSP use("williamboman/nvim-lsp-installer") -- simple to use language server installer use("jose-elias-alvarez/null-ls.nvim") -- for formatters and linters - -- use("RRethy/vim-illuminate") + use("RRethy/vim-illuminate") use({ "Saecki/crates.nvim", tag = "v0.3.0" }) use("simrat39/rust-tools.nvim") use("p00f/clangd_extensions.nvim") diff --git a/lua/user/toggleterm.lua b/lua/user/toggleterm.lua index f08aa6d..cd60e3b 100644 --- a/lua/user/toggleterm.lua +++ b/lua/user/toggleterm.lua @@ -37,32 +37,33 @@ end vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()") local Terminal = require("toggleterm.terminal").Terminal -local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) +local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) function _LAZYGIT_TOGGLE() lazygit:toggle() end local node = Terminal:new({ cmd = "node", hidden = true }) - function _NODE_TOGGLE() node:toggle() end local ncdu = Terminal:new({ cmd = "ncdu", hidden = true }) - function _NCDU_TOGGLE() ncdu:toggle() end local btop = Terminal:new({ cmd = "btop", hidden = true }) - function _BTOP_TOGGLE() btop:toggle() end local python = Terminal:new({ cmd = "python", hidden = true }) - function _PYTHON_TOGGLE() python:toggle() end + +local rust = Terminal:new({ cmd = "cargo run", hidden = true }) +function _CARGO_RUN() + rust:toggle() +end diff --git a/lua/user/treesitter.lua b/lua/user/treesitter.lua index 2b3865a..7845527 100644 --- a/lua/user/treesitter.lua +++ b/lua/user/treesitter.lua @@ -35,13 +35,13 @@ configs.setup({ "hbs", }, }, - indent = { enable = true, disable = { "yaml" } }, - rainbox = { + indent = { enable = true, disable = { "" } }, + rainbow = { enable = true, -- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean max_file_lines = nil, -- Do not enable for files with more than n lines, int -- colors = {}, -- table of hex strings - -- termcolors = {} -- table of colour name strings + -- termcolors = {}, -- table of colour name strings }, }) diff --git a/lua/user/whichkey.lua b/lua/user/whichkey.lua index 9fe578d..460e980 100644 --- a/lua/user/whichkey.lua +++ b/lua/user/whichkey.lua @@ -141,7 +141,7 @@ local mappings = { g = { name = "Git", - g = { "_LAZYGIT_TOGGLE()", "Lazygit" }, + g = { "lua _LAZYGIT_TOGGLE()", "Lazygit" }, j = { "lua require('gitsigns').next_hunk()", "Next Hunk" }, k = { "lua require('gitsigns').prev_hunk()", "Prev Hunk" }, l = { "lua require('gitsigns').blame_line()", "Blame" }, @@ -218,6 +218,7 @@ local mappings = { u = { "lua _NCDU_TOGGLE()", "NCDU" }, b = { "lua _BTOP_TOGGLE()", "Btop" }, p = { "lua _PYTHON_TOGGLE()", "Python" }, + c = { "lua _CARGO_RUN()", "Cargo run" }, f = { "ToggleTerm direction=float", "Float" }, h = { "ToggleTerm size=10 direction=horizontal", "Horizontal" }, v = { "ToggleTerm size=80 direction=vertical", "Vertical" }, @@ -235,9 +236,15 @@ local mappings = { d = { "VimwikiDeleteFile", "Rename file" }, r = { "VimwikiRenameFile", "Delete file" }, }, - T = { - name = "Treesitter", - i = { "TSConfigInfo", "Info" }, + L = { + name = "Language settings", + c = { "setlocal formatoptions-=cro", "Disable autocomment" }, + C = { "setlocal formatoptions=cro", "Enable autocomment" }, + s = { "setlocal spell!", "Toggle spellchecker" }, + e = { "setlocal spell spelllang=en_us", "Enable English spellchecker" }, + l = { "setlocal spell spelllang=lv_LV", "Enable Lavian spellchecker" }, + I = { "setlocal autoindent", "Enable autoindent" }, + i = { "setlocal noautoindent", "Disable autoindent" }, }, }