Update neovim

This commit is contained in:
Kristofers Solo 2022-08-27 21:53:40 +03:00
parent 374863da12
commit b0d56edd56
11 changed files with 138 additions and 80 deletions

View File

@ -1,4 +1,5 @@
require("user.options") require("user.options")
require("user.dracula")
require("user.keymaps") require("user.keymaps")
require("user.plugins") require("user.plugins")
require("user.colorscheme") require("user.colorscheme")

View File

@ -13,9 +13,10 @@ bufferline.setup({
-- NOTE: this plugin is designed with this icon in mind, -- NOTE: this plugin is designed with this icon in mind,
-- and so changing this is NOT recommended, this is intended -- and so changing this is NOT recommended, this is intended
-- as an escape hatch for people who cannot bear it for whatever reason -- as an escape hatch for people who cannot bear it for whatever reason
indicator_icon = "", -- indicator_icon = "▎",
buffer_close_icon = "", indicator = "",
-- buffer_close_icon = '', -- buffer_close_icon = "",
buffer_close_icon = '',
modified_icon = "", modified_icon = "",
close_icon = "", close_icon = "",
-- close_icon = '', -- close_icon = '',
@ -73,95 +74,95 @@ bufferline.setup({
}, },
highlights = { highlights = {
fill = { fill = {
guifg = { attribute = "fg", highlight = "#ff0000" }, fg = { attribute = "fg", highlight = "#ff0000" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
background = { background = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
-- buffer_selected = { -- buffer_selected = {
-- guifg = {attribute='fg',highlight='#ff0000'}, -- fg = {attribute='fg',highlight='#ff0000'},
-- guibg = {attribute='bg',highlight='#0000ff'}, -- bg = {attribute='bg',highlight='#0000ff'},
-- gui = 'none' -- gui = 'none'
-- }, -- },
buffer_visible = { buffer_visible = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
close_button = { close_button = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
close_button_visible = { close_button_visible = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
-- close_button_selected = { -- close_button_selected = {
-- guifg = {attribute='fg',highlight='TabLineSel'}, -- fg = {attribute='fg',highlight='TabLineSel'},
-- guibg ={attribute='bg',highlight='TabLineSel'} -- bg ={attribute='bg',highlight='TabLineSel'}
-- }, -- },
tab_selected = { tab_selected = {
guifg = { attribute = "fg", highlight = "Normal" }, fg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" }, bg = { attribute = "bg", highlight = "Normal" },
}, },
tab = { tab = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
tab_close = { tab_close = {
-- guifg = {attribute='fg',highlight='LspDiagnosticsDefaultError'}, -- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
guifg = { attribute = "fg", highlight = "TabLineSel" }, fg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "Normal" }, bg = { attribute = "bg", highlight = "Normal" },
}, },
duplicate_selected = { duplicate_selected = {
guifg = { attribute = "fg", highlight = "TabLineSel" }, fg = { attribute = "fg", highlight = "TabLineSel" },
guibg = { attribute = "bg", highlight = "TabLineSel" }, bg = { attribute = "bg", highlight = "TabLineSel" },
gui = "italic", italic = true,
}, },
duplicate_visible = { duplicate_visible = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
gui = "italic", italic = true,
}, },
duplicate = { duplicate = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
gui = "italic", italic = true,
}, },
modified = { modified = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
modified_selected = { modified_selected = {
guifg = { attribute = "fg", highlight = "Normal" }, fg = { attribute = "fg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" }, bg = { attribute = "bg", highlight = "Normal" },
}, },
modified_visible = { modified_visible = {
guifg = { attribute = "fg", highlight = "TabLine" }, fg = { attribute = "fg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
separator = { separator = {
guifg = { attribute = "bg", highlight = "TabLine" }, fg = { attribute = "bg", highlight = "TabLine" },
guibg = { attribute = "bg", highlight = "TabLine" }, bg = { attribute = "bg", highlight = "TabLine" },
}, },
separator_selected = { separator_selected = {
guifg = { attribute = "bg", highlight = "Normal" }, fg = { attribute = "bg", highlight = "Normal" },
guibg = { attribute = "bg", highlight = "Normal" }, bg = { attribute = "bg", highlight = "Normal" },
}, },
-- separator_visible = { -- separator_visible = {
-- guifg = {attribute='bg',highlight='TabLine'}, -- fg = {attribute='bg',highlight='TabLine'},
-- guibg = {attribute='bg',highlight='TabLine'} -- bg = {attribute='bg',highlight='TabLine'}
-- }, -- },
indicator_selected = { indicator_selected = {
guifg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" }, fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
guibg = { attribute = "bg", highlight = "Normal" }, bg = { attribute = "bg", highlight = "Normal" },
}, },
}, },
}) })

View File

@ -1,22 +1,23 @@
local status_ok, comment = pcall(require, "Comment") local status_ok, comment = pcall(require, "nvim_comment")
if not status_ok then if not status_ok then
return return
end end
comment.setup({ comment.setup({
pre_hook = function(ctx) -- Linters prefer comment and line to have a space in between markers
local U = require("Comment.utils") marker_padding = true,
-- should comment out empty or whitespace only lines
local location = nil comment_empty = true,
if ctx.ctype == U.ctype.block then -- trim empty comment whitespace
location = require("ts_context_commentstring.utils").get_cursor_location() comment_empty_trim_whitespace = true,
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then -- Should key mappings be created
location = require("ts_context_commentstring.utils").get_visual_start_location() create_mappings = true,
end -- Normal mode mapping left hand side
line_mapping = "gcc",
return require("ts_context_commentstring.internal").calculate_commentstring({ -- Visual/Operator mapping left hand side
key = ctx.ctype == U.ctype.line and "__default" or "__multiline", operator_mapping = "gc",
location = location, -- text object mapping, comment chunk,,
}) comment_chunk_text_object = "ic",
end, -- Hook function to call before commenting takes place
hook = nil,
}) })

View File

@ -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
},
})

View File

@ -5,7 +5,22 @@ end
local lspconfig = require("lspconfig") 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({ lsp_installer.setup({
ensure_installed = servers, ensure_installed = servers,

View File

@ -85,6 +85,15 @@ M.on_attach = function(client, bufnr)
if client.name == "sumneko_lua" then if client.name == "sumneko_lua" then
client.resolved_capabilities.document_formatting = false client.resolved_capabilities.document_formatting = false
end 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_keymaps(bufnr)
lsp_highlight_document(client) lsp_highlight_document(client)
end end

View File

@ -16,6 +16,9 @@ null_ls.setup({
formatting.stylua, formatting.stylua,
formatting.rustfmt, formatting.rustfmt,
formatting.beautysh, formatting.beautysh,
formatting.djhtml,
formatting.tidy,
formatting.stylelint,
-- diagnostics.luacheck, -- diagnostics.luacheck,
diagnostics.pylint, diagnostics.pylint,
diagnostics.zsh, diagnostics.zsh,

View File

@ -47,10 +47,9 @@ for k, v in pairs(options) do
vim.opt[k] = v vim.opt[k] = v
end 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(".lua")
vim.opt_local.suffixesadd:prepend("init.lua") vim.opt_local.suffixesadd:prepend("init.lua")
vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua") vim.opt_local.path:prepend(vim.fn.stdpath("config") .. "/lua")
g.user_emmet_mode = "n"
g.user_emmet_leader_key = ","

View File

@ -40,13 +40,13 @@ packer.init({
-- Install your plugins here -- Install your plugins here
return packer.startup(function(use) return packer.startup(function(use)
-- My plugins here -- Plugins here
use("wbthomason/packer.nvim") -- Have packer manage itself use("wbthomason/packer.nvim") -- Have packer manage itself
use("nvim-lua/popup.nvim") -- Useful lua functions used by lots of plugins 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("nvim-lua/plenary.nvim") -- Useful lua functions used by lots of plugins
use("windwp/nvim-autopairs") -- Autopairs, integrates with both cmp and treesitte 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("JoosepAlviste/nvim-ts-context-commentstring")
use("kyazdani42/nvim-web-devicons") use("kyazdani42/nvim-web-devicons")
use("kyazdani42/nvim-tree.lua") use("kyazdani42/nvim-tree.lua")
@ -63,6 +63,8 @@ return packer.startup(function(use)
use("mattn/emmet-vim") use("mattn/emmet-vim")
use("saecki/crates.nvim") use("saecki/crates.nvim")
use("norcalli/nvim-colorizer.lua") use("norcalli/nvim-colorizer.lua")
use("alvan/vim-closetag")
use("tpope/vim-surround")
-- Vimwiki -- Vimwiki
use("vimwiki/vimwiki") use("vimwiki/vimwiki")

View File

@ -15,6 +15,7 @@ configs.setup({
}, },
autotag = { autotag = {
enable = true, enable = true,
filetypes = { "html", "htmldjango", "xml" },
}, },
indent = { enable = true, disable = { "yaml" } }, indent = { enable = true, disable = { "yaml" } },
rainbow = { rainbow = {

View File

@ -88,7 +88,7 @@ local mappings = {
["c"] = { "<cmd>Bdelete!<CR>", "Close Buffer" }, ["c"] = { "<cmd>Bdelete!<CR>", "Close Buffer" },
["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" }, ["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
["f"] = { ["f"] = {
"<cmd>lua require('telescope.builtin').find_files({hidden=true}, require('telescope.themes').get_dropdown{previewer = false})<CR>", "<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<CR>",
"Find files", "Find files",
}, },
["F"] = { "<cmd>Telescope live_grep theme=ivy<CR>", "Find Text" }, ["F"] = { "<cmd>Telescope live_grep theme=ivy<CR>", "Find Text" },
@ -133,6 +133,7 @@ local mappings = {
-- "<cmd>Telescope lsp_document_diagnostics<CR>", -- "<cmd>Telescope lsp_document_diagnostics<CR>",
-- "Document Diagnostics", -- "Document Diagnostics",
-- }, -- },
w = { w = {
"<cmd>Telescope diagnostics<CR>", "<cmd>Telescope diagnostics<CR>",
"Workspace Diagnostics", "Workspace Diagnostics",
@ -157,6 +158,7 @@ local mappings = {
"Workspace Symbols", "Workspace Symbols",
}, },
}, },
s = { s = {
name = "Search", name = "Search",
b = { "<cmd>Telescope git_branches<CR>", "Checkout branch" }, b = { "<cmd>Telescope git_branches<CR>", "Checkout branch" },
@ -179,6 +181,7 @@ local mappings = {
h = { "<cmd>ToggleTerm size=10 direction=horizontal<CR>", "Horizontal" }, h = { "<cmd>ToggleTerm size=10 direction=horizontal<CR>", "Horizontal" },
v = { "<cmd>ToggleTerm size=80 direction=vertical<CR>", "Vertical" }, v = { "<cmd>ToggleTerm size=80 direction=vertical<CR>", "Vertical" },
}, },
S = { S = {
name = "Settings", name = "Settings",
c = { "<cmd>setlocal formatoptions-=cro<CR>", "Disable autocomment" }, c = { "<cmd>setlocal formatoptions-=cro<CR>", "Disable autocomment" },
@ -189,17 +192,18 @@ local mappings = {
I = { "<cmd>setlocal autoindent<CR>", "Enable autoindent" }, I = { "<cmd>setlocal autoindent<CR>", "Enable autoindent" },
i = { "<cmd>setlocal noautoindent<CR>", "Disable autoindent" }, i = { "<cmd>setlocal noautoindent<CR>", "Disable autoindent" },
}, },
w = { w = {
name = "Vimwiki", name = "Vimwiki",
w = "<Plug>VimwikiIndex", w = { "<Plug>VimwikiIndex", "Open index file" },
t = "<Plug>VimwikiTabIndex", t = { "<Plug>VimwikiTabIndex", "Open index file in new tab" },
s = "<Plug>VimwikiUISelect", s = { "<Plug>VimwikiUISelect", "Diplay list of wikis" },
i = "<Plug>VimwikiDiaryIndex", i = { "<Plug>VimwikiDiaryIndex", "Open diary index" },
h = "<Plug>Vimwiki2HTML", h = { "<Plug>Vimwiki2HTML", "Convert file to HTML" },
H = "<Plug>Vimwiki2HTMLBrowse", H = { "<Plug>Vimwiki2HTMLBrowse", "Convert file to HTML and open in browser" },
n = "<Plug>VimwikiGoto", n = { "<Plug>VimwikiGoto", "Goto link provided by an argument" },
d = "<Plug>VimwikiDeleteFile", d = { "<Plug>VimwikiDeleteFile", "Rename file" },
r = "<Plug>VimwikiRenameFile", r = { "<Plug>VimwikiRenameFile", "Delete file" },
}, },
} }