Merge pull request #2 from siduck76/main

update
This commit is contained in:
Henri 2021-05-12 09:43:44 -07:00 committed by GitHub
commit 162fe51d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 96 deletions

View File

@ -9,7 +9,7 @@ require "statusline"
require("colorizer").setup() require("colorizer").setup()
require("neoscroll").setup() -- smooth scroll require("neoscroll").setup() -- smooth scroll
-- lsp -- lsp stuff
require "nvim-lspconfig" require "nvim-lspconfig"
require "compe-completion" require "compe-completion"
@ -20,12 +20,13 @@ g.mapleader = " "
g.auto_save = 0 g.auto_save = 0
-- colorscheme related stuff -- colorscheme related stuff
cmd "syntax on" cmd "syntax on"
local base16 = require "base16" local base16 = require "base16"
base16(base16.themes["onedark"], true) base16(base16.themes["onedark"], true)
require "custom_highlights"
-- blankline -- blankline
local indent = 2 local indent = 2
@ -33,8 +34,6 @@ local indent = 2
g.indentLine_enabled = 1 g.indentLine_enabled = 1
g.indent_blankline_char = "" g.indent_blankline_char = ""
cmd "hi IndentBlanklineChar guifg=#2a2e36"
g.indent_blankline_filetype_exclude = {"help", "terminal"} g.indent_blankline_filetype_exclude = {"help", "terminal"}
g.indent_blankline_buftype_exclude = {"terminal"} g.indent_blankline_buftype_exclude = {"terminal"}
@ -44,15 +43,6 @@ g.indent_blankline_show_first_indent_level = false
require "treesitter-nvim" require "treesitter-nvim"
require "mappings" require "mappings"
-- highlights --
cmd "hi LineNr guifg=#42464e"
cmd "hi Comment guifg=#42464e"
cmd "hi VertSplit guifg=#2a2e36"
cmd "hi EndOfBuffer guifg=#1e222a"
cmd "hi PmenuSel guibg=#98c379"
cmd "hi Pmenu guibg=#282c34"
require "telescope-nvim" require "telescope-nvim"
require "nvimTree" require "nvimTree"
@ -66,11 +56,5 @@ vim.api.nvim_exec([[
au BufEnter term://* setlocal nonumber au BufEnter term://* setlocal nonumber
]], false) ]], false)
-- inactive statuslines as thin splitlines
cmd("highlight! StatusLineNC gui=underline guifg=#383c44")
cmd "hi clear CursorLine"
cmd "hi cursorlinenr guifg=#abb2bf"
-- setup for TrueZen.nvim -- setup for TrueZen.nvim
require "zenmode" require "zenmode"

59
lua/custom_highlights.lua Normal file
View File

@ -0,0 +1,59 @@
local cmd = vim.cmd
-- blankline
cmd "hi IndentBlanklineChar guifg=#383c44"
-- misc --
cmd "hi LineNr guifg=#42464e"
cmd "hi Comment guifg=#42464e"
cmd "hi NvimInternalError guifg=#f9929b"
cmd "hi VertSplit guifg=#2a2e36"
cmd "hi EndOfBuffer guifg=#1e222a"
-- Pmenu
cmd "hi PmenuSel guibg=#98c379"
cmd "hi Pmenu guibg=#282c34"
cmd "hi PmenuSbar guibg =#353b45"
cmd "hi PmenuThumb guibg =#81A1C1"
-- inactive statuslines as thin splitlines
cmd("highlight! StatusLineNC gui=underline guifg=#383c44")
-- line n.o
cmd "hi clear CursorLine"
cmd "hi cursorlinenr guifg=#abb2bf"
-- git signs ---
cmd "hi DiffAdd guifg=#81A1C1 guibg = none"
cmd "hi DiffChange guifg =#3A3E44 guibg = none"
cmd "hi DiffModified guifg = #81A1C1 guibg = none"
-- NvimTree
cmd "hi NvimTreeFolderIcon guifg = #61afef"
cmd "hi NvimTreeFolderName guifg = #61afef"
cmd "hi NvimTreeIndentMarker guifg=#383c44"
cmd "hi NvimTreeNormal guibg=#1b1f27"
cmd "hi NvimTreeVertSplit guifg=#1e222a"
cmd "hi NvimTreeRootFolder guifg=#f9929b"
-- telescope
cmd "hi TelescopeBorder guifg=#2a2e36"
cmd "hi TelescopePromptBorder guifg=#2a2e36"
cmd "hi TelescopeResultsBorder guifg=#2a2e36"
cmd "hi TelescopePreviewBorder guifg=#525865"
-- LspDiagnostics ---
-- error / warnings
cmd "hi LspDiagnosticsSignError guifg=#f9929b"
cmd "hi LspDiagnosticsVirtualTextError guifg=#BF616A"
cmd "hi LspDiagnosticsSignWarning guifg=#EBCB8B"
cmd "hi LspDiagnosticsVirtualTextWarning guifg=#EBCB8B"
-- info
cmd "hi LspDiagnosticsSignInformation guifg=#A3BE8C"
cmd "hi LspDiagnosticsVirtualTextInformation guifg=#A3BE8C"
-- hint
cmd "hi LspDiagnosticsSignHint guifg=#b6bdca"
cmd "hi LspDiagnosticsVirtualTextHint guifg=#b6bdca"

View File

@ -25,9 +25,3 @@ require("gitsigns").setup {
sign_priority = 5, sign_priority = 5,
status_formatter = nil -- Use default status_formatter = nil -- Use default
} }
local cmd = vim.cmd
cmd "hi DiffAdd guifg=#81A1C1 guibg = none"
cmd "hi DiffChange guifg =#3A3E44 guibg = none"
cmd "hi DiffModified guifg = #81A1C1 guibg = none"

View File

@ -1,8 +1,7 @@
function on_attach(client) function on_attach(client)
local function map(...) local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...) vim.api.nvim_buf_set_keymap(bufnr, ...)
end end
local function buf_set_option(...) local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...) vim.api.nvim_buf_set_option(bufnr, ...)
end end
@ -10,44 +9,48 @@ function on_attach(client)
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings. -- Mappings.
local opts = {noremap = true, silent = true, normal = true} local opts = {noremap = true, silent = true}
map("gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
map("gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts) buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
map("K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts) buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
map("gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
map("<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
map("<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts) buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
map("<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts) buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
map("<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts) buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
map("<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts) buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
map("<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
map("gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
map("<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts) buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
map("[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts) buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
map("]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts) buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
map("<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts) buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
-- Set some keybinds conditional on server capabilities -- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then if client.resolved_capabilities.document_formatting then
map("<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then elseif client.resolved_capabilities.document_range_formatting then
map("<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts) buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end end
end end
local lspconf = require "lspconfig" local lspconf = require("lspconfig")
local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "vls", "clangd", "ccls"}
for k, lang in pairs(servers) do -- these langs require same lspconfig so put em all in a table and loop through!
local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "clangd", "ccls"}
for _, lang in ipairs(servers) do
lspconf[lang].setup { lspconf[lang].setup {
on_attach = on_attach,
root_dir = vim.loop.cwd root_dir = vim.loop.cwd
} }
end end
-- remove the lsp servers with their configs you don want -- vls conf example
local vls_binary = '/usr/local/bin/vls' local vls_binary = "/usr/local/bin/vls"
require'lspconfig'.vls.setup { lspconf.vls.setup {
cmd = {vls_binary}, cmd = {vls_binary}
} }
-- lua lsp settings -- lua lsp settings
@ -56,7 +59,7 @@ USER = "/home/" .. vim.fn.expand("$USER")
local sumneko_root_path = USER .. "/.config/lua-language-server" local sumneko_root_path = USER .. "/.config/lua-language-server"
local sumneko_binary = USER .. "/.config/lua-language-server/bin/Linux/lua-language-server" local sumneko_binary = USER .. "/.config/lua-language-server/bin/Linux/lua-language-server"
require "lspconfig".sumneko_lua.setup { lspconf.sumneko_lua.setup {
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}, cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
root_dir = function() root_dir = function()
return vim.loop.cwd() return vim.loop.cwd()
@ -88,19 +91,3 @@ vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnos
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"}) vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"}) vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"}) vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
-- diagnostics highlights
local cmd = vim.cmd
cmd "hi LspDiagnosticsSignError guifg=#f9929b"
cmd "hi LspDiagnosticsVirtualTextError guifg=#BF616A"
cmd "hi LspDiagnosticsSignWarning guifg=#EBCB8B"
cmd "hi LspDiagnosticsVirtualTextWarning guifg=#EBCB8B"
cmd "hi LspDiagnosticsSignInformation guifg=#A3BE8C"
cmd "hi LspDiagnosticsVirtualTextInformation guifg=#A3BE8C"
cmd "hi LspDiagnosticsSignHint guifg=#b6bdca"
cmd "hi LspDiagnosticsVirtualTextHint guifg=#b6bdca"

View File

@ -1,10 +1,9 @@
local cmd = vim.cmd
local g = vim.g local g = vim.g
vim.o.termguicolors = true vim.o.termguicolors = true
g.nvim_tree_side = "left" g.nvim_tree_side = "left"
g.nvim_tree_width = 25 g.nvim_tree_width = 26
g.nvim_tree_ignore = {".git", "node_modules", ".cache"} g.nvim_tree_ignore = {".git", "node_modules", ".cache"}
g.nvim_tree_auto_open = 0 g.nvim_tree_auto_open = 0
g.nvim_tree_auto_close = 0 g.nvim_tree_auto_close = 0
@ -13,8 +12,8 @@ g.nvim_tree_follow = 1
g.nvim_tree_indent_markers = 1 g.nvim_tree_indent_markers = 1
g.nvim_tree_hide_dotfiles = 1 g.nvim_tree_hide_dotfiles = 1
g.nvim_tree_git_hl = 1 g.nvim_tree_git_hl = 1
g.nvim_tree_root_folder_modifier = ":~" g.nvim_tree_root_folder_modifier = ":t"
g.nvim_tree_tab_open = 1 g.nvim_tree_tab_open = 0
g.nvim_tree_allow_resize = 1 g.nvim_tree_allow_resize = 1
g.nvim_tree_show_icons = { g.nvim_tree_show_icons = {
@ -83,9 +82,3 @@ g.nvim_tree_bindings = {
["-"] = get_lua_cb("dir_up"), ["-"] = get_lua_cb("dir_up"),
["q"] = get_lua_cb("close") ["q"] = get_lua_cb("close")
} }
cmd "hi NvimTreeFolderIcon guifg = #61afef"
cmd "hi NvimTreeFolderName guifg = #61afef"
cmd "hi NvimTreeIndentMarker guifg=#383c44"
cmd "hi NvimTreeNormal guibg=#1b1f27"
cmd "hi NvimTreeVertSplit guifg=#1e222a"

View File

@ -7,15 +7,8 @@ local colors = {
bg = "#1e222a", bg = "#1e222a",
line_bg = "#1e222a", line_bg = "#1e222a",
fg = "#D8DEE9", fg = "#D8DEE9",
fg_green = "#65a380",
yellow = "#A3BE8C",
cyan = "#22262C",
darkblue = "#61afef",
green = "#BBE67E", green = "#BBE67E",
orange = "#FF8800", orange = "#FF8800",
purple = "#252930",
magenta = "#c678dd",
blue = "#22262C",
red = "#DF8890", red = "#DF8890",
lightbg = "#282c34", lightbg = "#282c34",
nord = "#81A1C1", nord = "#81A1C1",
@ -135,7 +128,7 @@ gls.left[12] = {
DiagnosticWarn = { DiagnosticWarn = {
provider = "DiagnosticWarn", provider = "DiagnosticWarn",
icon = "", icon = "",
highlight = {colors.blue, colors.bg} highlight = {colors.red, colors.bg}
} }
} }

View File

@ -73,12 +73,3 @@ vim.api.nvim_set_keymap("n", "<Leader>fb", [[<Cmd>lua require('telescope.builtin
vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fh", [[<Cmd>lua require('telescope.builtin').help_tags()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fo", [[<Cmd>lua require('telescope.builtin').oldfiles()<CR>]], opt)
vim.api.nvim_set_keymap("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt) vim.api.nvim_set_keymap("n", "<Leader>fm", [[<Cmd> Neoformat<CR>]], opt)
-- highlights
local cmd = vim.cmd
cmd "hi TelescopeBorder guifg=#2a2e36"
cmd "hi TelescopePromptBorder guifg=#2a2e36"
cmd "hi TelescopeResultsBorder guifg=#2a2e36"
cmd "hi TelescopePreviewBorder guifg=#525865"