diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index e6c65231..c839ae32 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,4 +1,5 @@ require("user.options") +require("user.dracula") require("user.keymaps") require("user.plugins") require("user.colorscheme") diff --git a/.config/nvim/lua/user/bufferline.lua b/.config/nvim/lua/user/bufferline.lua index 5f8dbf4f..0d4f1020 100644 --- a/.config/nvim/lua/user/bufferline.lua +++ b/.config/nvim/lua/user/bufferline.lua @@ -13,9 +13,10 @@ bufferline.setup({ -- NOTE: this plugin is designed with this icon in mind, -- and so changing this is NOT recommended, this is intended -- as an escape hatch for people who cannot bear it for whatever reason - indicator_icon = "▎", - buffer_close_icon = "", - -- buffer_close_icon = '', + -- indicator_icon = "▎", + indicator = "▎", + -- buffer_close_icon = "", + buffer_close_icon = '', modified_icon = "●", close_icon = "", -- close_icon = '', @@ -73,95 +74,95 @@ bufferline.setup({ }, highlights = { fill = { - guifg = { attribute = "fg", highlight = "#ff0000" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "fg", highlight = "#ff0000" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, background = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, -- buffer_selected = { - -- guifg = {attribute='fg',highlight='#ff0000'}, - -- guibg = {attribute='bg',highlight='#0000ff'}, + -- fg = {attribute='fg',highlight='#ff0000'}, + -- bg = {attribute='bg',highlight='#0000ff'}, -- gui = 'none' -- }, buffer_visible = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, close_button = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, close_button_visible = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, -- close_button_selected = { - -- guifg = {attribute='fg',highlight='TabLineSel'}, - -- guibg ={attribute='bg',highlight='TabLineSel'} + -- fg = {attribute='fg',highlight='TabLineSel'}, + -- bg ={attribute='bg',highlight='TabLineSel'} -- }, tab_selected = { - guifg = { attribute = "fg", highlight = "Normal" }, - guibg = { attribute = "bg", highlight = "Normal" }, + fg = { attribute = "fg", highlight = "Normal" }, + bg = { attribute = "bg", highlight = "Normal" }, }, tab = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, tab_close = { - -- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "Normal" }, + -- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, + fg = { attribute = "fg", highlight = "TabLineSel" }, + bg = { attribute = "bg", highlight = "Normal" }, }, duplicate_selected = { - guifg = { attribute = "fg", highlight = "TabLineSel" }, - guibg = { attribute = "bg", highlight = "TabLineSel" }, - gui = "italic", + fg = { attribute = "fg", highlight = "TabLineSel" }, + bg = { attribute = "bg", highlight = "TabLineSel" }, + italic = true, }, duplicate_visible = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - gui = "italic", + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + italic = true, }, duplicate = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, - gui = "italic", + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, + italic = true, }, modified = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, modified_selected = { - guifg = { attribute = "fg", highlight = "Normal" }, - guibg = { attribute = "bg", highlight = "Normal" }, + fg = { attribute = "fg", highlight = "Normal" }, + bg = { attribute = "bg", highlight = "Normal" }, }, modified_visible = { - guifg = { attribute = "fg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "fg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, separator = { - guifg = { attribute = "bg", highlight = "TabLine" }, - guibg = { attribute = "bg", highlight = "TabLine" }, + fg = { attribute = "bg", highlight = "TabLine" }, + bg = { attribute = "bg", highlight = "TabLine" }, }, separator_selected = { - guifg = { attribute = "bg", highlight = "Normal" }, - guibg = { attribute = "bg", highlight = "Normal" }, + fg = { attribute = "bg", highlight = "Normal" }, + bg = { attribute = "bg", highlight = "Normal" }, }, -- separator_visible = { - -- guifg = {attribute='bg',highlight='TabLine'}, - -- guibg = {attribute='bg',highlight='TabLine'} + -- fg = {attribute='bg',highlight='TabLine'}, + -- bg = {attribute='bg',highlight='TabLine'} -- }, indicator_selected = { - guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, - guibg = { attribute = "bg", highlight = "Normal" }, + fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, + bg = { attribute = "bg", highlight = "Normal" }, }, }, }) diff --git a/.config/nvim/lua/user/comment.lua b/.config/nvim/lua/user/comment.lua index 07c1a2a5..47f4124b 100644 --- a/.config/nvim/lua/user/comment.lua +++ b/.config/nvim/lua/user/comment.lua @@ -1,22 +1,23 @@ -local status_ok, comment = pcall(require, "Comment") +local status_ok, comment = pcall(require, "nvim_comment") if not status_ok then return end comment.setup({ - pre_hook = function(ctx) - local U = require("Comment.utils") - - local location = nil - if ctx.ctype == U.ctype.block then - location = require("ts_context_commentstring.utils").get_cursor_location() - elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then - location = require("ts_context_commentstring.utils").get_visual_start_location() - end - - return require("ts_context_commentstring.internal").calculate_commentstring({ - key = ctx.ctype == U.ctype.line and "__default" or "__multiline", - location = location, - }) - end, + -- Linters prefer comment and line to have a space in between markers + marker_padding = true, + -- should comment out empty or whitespace only lines + comment_empty = true, + -- trim empty comment whitespace + comment_empty_trim_whitespace = true, + -- Should key mappings be created + create_mappings = true, + -- Normal mode mapping left hand side + line_mapping = "gcc", + -- Visual/Operator mapping left hand side + operator_mapping = "gc", + -- text object mapping, comment chunk,, + comment_chunk_text_object = "ic", + -- Hook function to call before commenting takes place + hook = nil, }) diff --git a/.config/nvim/lua/user/dracula.lua b/.config/nvim/lua/user/dracula.lua new file mode 100644 index 00000000..2b412960 --- /dev/null +++ b/.config/nvim/lua/user/dracula.lua @@ -0,0 +1,22 @@ +local status_ok, dracula = pcall(require, "dracula") +if not status_ok then + return +end + +dracula.setup({ + -- show the '~' characters after the end of buffers + show_end_of_buffer = true, -- default false + -- use transparent background + transparent_bg = true, -- default false + -- set custom lualine background color + -- lualine_bg_color = "#44475a", -- default nil + -- set italic comment + italic_comment = true, -- default false + -- overrides the default highlights see `:h synIDattr` + overrides = { + -- Examples + -- NonText = { fg = dracula.colors().white }, -- set NonText fg to white + -- NvimTreeIndentMarker = { link = "NonText" }, -- link to NonText highlight + -- Nothing = {} -- clear highlight of Nothing + }, +}) diff --git a/.config/nvim/lua/user/lsp/configs.lua b/.config/nvim/lua/user/lsp/configs.lua index 6bf23738..7f4d91e3 100644 --- a/.config/nvim/lua/user/lsp/configs.lua +++ b/.config/nvim/lua/user/lsp/configs.lua @@ -5,7 +5,22 @@ end local lspconfig = require("lspconfig") -local servers = { "jsonls", "sumneko_lua", "pyright" } +local servers = { + "bashls", + "clangd", + "cssls", + "diagnosticls", + "emmet_ls", + "html", + "jsonls", + "marksman", + "pyright", + "rust_analyzer", + "sumneko_lua", + "taplo", + "vimls", + "yamlls", +} lsp_installer.setup({ ensure_installed = servers, diff --git a/.config/nvim/lua/user/lsp/handlers.lua b/.config/nvim/lua/user/lsp/handlers.lua index 06777ff3..bdee7789 100644 --- a/.config/nvim/lua/user/lsp/handlers.lua +++ b/.config/nvim/lua/user/lsp/handlers.lua @@ -85,6 +85,15 @@ M.on_attach = function(client, bufnr) if client.name == "sumneko_lua" then client.resolved_capabilities.document_formatting = false end + if client.name == "diagnosticls" then + client.resolved_capabilities.document_formatting = false + end + if client.name == "html" then + client.resolved_capabilities.document_formatting = false + end + if client.name == "jsonls" then + client.resolved_capabilities.document_formatting = false + end lsp_keymaps(bufnr) lsp_highlight_document(client) end diff --git a/.config/nvim/lua/user/lsp/null-ls.lua b/.config/nvim/lua/user/lsp/null-ls.lua index d705b9cd..9a791d77 100644 --- a/.config/nvim/lua/user/lsp/null-ls.lua +++ b/.config/nvim/lua/user/lsp/null-ls.lua @@ -16,6 +16,9 @@ null_ls.setup({ formatting.stylua, formatting.rustfmt, formatting.beautysh, + formatting.djhtml, + formatting.tidy, + formatting.stylelint, -- diagnostics.luacheck, diagnostics.pylint, diagnostics.zsh, diff --git a/.config/nvim/lua/user/options.lua b/.config/nvim/lua/user/options.lua index 60fa9bd2..af7860b0 100644 --- a/.config/nvim/lua/user/options.lua +++ b/.config/nvim/lua/user/options.lua @@ -47,10 +47,9 @@ for k, v in pairs(options) do vim.opt[k] = v end -g.dracula_transparent_bg = true -g.dracula_italic_comment = true -g.dracula_show_end_of_buffer = true - vim.opt_local.suffixesadd:prepend(".lua") vim.opt_local.suffixesadd:prepend("init.lua") vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua") + +g.user_emmet_mode = "n" +g.user_emmet_leader_key = "," diff --git a/.config/nvim/lua/user/plugins.lua b/.config/nvim/lua/user/plugins.lua index 29f84c67..13178c26 100644 --- a/.config/nvim/lua/user/plugins.lua +++ b/.config/nvim/lua/user/plugins.lua @@ -40,13 +40,13 @@ packer.init({ -- Install your plugins here return packer.startup(function(use) - -- My plugins here + -- Plugins here use("wbthomason/packer.nvim") -- Have packer manage itself use("nvim-lua/popup.nvim") -- Useful lua functions used by lots of plugins use("nvim-lua/plenary.nvim") -- Useful lua functions used by lots of plugins use("windwp/nvim-autopairs") -- Autopairs, integrates with both cmp and treesitte - use("numToStr/Comment.nvim") + use("terrortylor/nvim-comment") use("JoosepAlviste/nvim-ts-context-commentstring") use("kyazdani42/nvim-web-devicons") use("kyazdani42/nvim-tree.lua") @@ -63,6 +63,8 @@ return packer.startup(function(use) use("mattn/emmet-vim") use("saecki/crates.nvim") use("norcalli/nvim-colorizer.lua") + use("alvan/vim-closetag") + use("tpope/vim-surround") -- Vimwiki use("vimwiki/vimwiki") diff --git a/.config/nvim/lua/user/treesitter.lua b/.config/nvim/lua/user/treesitter.lua index 7c059c3b..9f696807 100644 --- a/.config/nvim/lua/user/treesitter.lua +++ b/.config/nvim/lua/user/treesitter.lua @@ -15,6 +15,7 @@ configs.setup({ }, autotag = { enable = true, + filetypes = { "html", "htmldjango", "xml" }, }, indent = { enable = true, disable = { "yaml" } }, rainbow = { diff --git a/.config/nvim/lua/user/whichkey.lua b/.config/nvim/lua/user/whichkey.lua index 23a49946..6c93d9ac 100644 --- a/.config/nvim/lua/user/whichkey.lua +++ b/.config/nvim/lua/user/whichkey.lua @@ -88,7 +88,7 @@ local mappings = { ["c"] = { "Bdelete!", "Close Buffer" }, ["h"] = { "nohlsearch", "No Highlight" }, ["f"] = { - "lua require('telescope.builtin').find_files({hidden=true}, require('telescope.themes').get_dropdown{previewer = false})", + "lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})", "Find files", }, ["F"] = { "Telescope live_grep theme=ivy", "Find Text" }, @@ -133,6 +133,7 @@ local mappings = { -- "Telescope lsp_document_diagnostics", -- "Document Diagnostics", -- }, + w = { "Telescope diagnostics", "Workspace Diagnostics", @@ -157,6 +158,7 @@ local mappings = { "Workspace Symbols", }, }, + s = { name = "Search", b = { "Telescope git_branches", "Checkout branch" }, @@ -179,6 +181,7 @@ local mappings = { h = { "ToggleTerm size=10 direction=horizontal", "Horizontal" }, v = { "ToggleTerm size=80 direction=vertical", "Vertical" }, }, + S = { name = "Settings", c = { "setlocal formatoptions-=cro", "Disable autocomment" }, @@ -189,17 +192,18 @@ local mappings = { I = { "setlocal autoindent", "Enable autoindent" }, i = { "setlocal noautoindent", "Disable autoindent" }, }, + w = { name = "Vimwiki", - w = "VimwikiIndex", - t = "VimwikiTabIndex", - s = "VimwikiUISelect", - i = "VimwikiDiaryIndex", - h = "Vimwiki2HTML", - H = "Vimwiki2HTMLBrowse", - n = "VimwikiGoto", - d = "VimwikiDeleteFile", - r = "VimwikiRenameFile", + w = { "VimwikiIndex", "Open index file" }, + t = { "VimwikiTabIndex", "Open index file in new tab" }, + s = { "VimwikiUISelect", "Diplay list of wikis" }, + i = { "VimwikiDiaryIndex", "Open diary index" }, + h = { "Vimwiki2HTML", "Convert file to HTML" }, + H = { "Vimwiki2HTMLBrowse", "Convert file to HTML and open in browser" }, + n = { "VimwikiGoto", "Goto link provided by an argument" }, + d = { "VimwikiDeleteFile", "Rename file" }, + r = { "VimwikiRenameFile", "Delete file" }, }, }