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.dracula")
require("user.keymaps")
require("user.plugins")
require("user.colorscheme")

View File

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

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

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 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,

View File

@ -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

View File

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

View File

@ -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 = ","

View File

@ -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")

View File

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

View File

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