From 339b31d87c3e19c4ae26f7ee2aa5112ebbe76286 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Mon, 10 May 2021 23:00:48 +0530 Subject: [PATCH 1/3] nvimTree : hide full path of dir --- lua/nvimTree.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/nvimTree.lua b/lua/nvimTree.lua index 19a4ed4..9220fa7 100644 --- a/lua/nvimTree.lua +++ b/lua/nvimTree.lua @@ -1,10 +1,11 @@ + local cmd = vim.cmd local g = vim.g vim.o.termguicolors = true 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_auto_open = 0 g.nvim_tree_auto_close = 0 @@ -13,8 +14,8 @@ g.nvim_tree_follow = 1 g.nvim_tree_indent_markers = 1 g.nvim_tree_hide_dotfiles = 1 g.nvim_tree_git_hl = 1 -g.nvim_tree_root_folder_modifier = ":~" -g.nvim_tree_tab_open = 1 +g.nvim_tree_root_folder_modifier = ":t" +g.nvim_tree_tab_open = 0 g.nvim_tree_allow_resize = 1 g.nvim_tree_show_icons = { @@ -89,3 +90,4 @@ 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" From 7bd57b7e93a80b171b88431fca40cedcd28ba7b3 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Tue, 11 May 2021 08:02:03 +0530 Subject: [PATCH 2/3] add all highlights in one file --- init.lua | 22 ++------------- lua/custom_highlights.lua | 59 +++++++++++++++++++++++++++++++++++++++ lua/gitsigns-nvim.lua | 6 ---- lua/nvim-lspconfig.lua | 18 +----------- lua/nvimTree.lua | 9 ------ lua/statusline.lua | 9 +----- lua/telescope-nvim.lua | 9 ------ 7 files changed, 64 insertions(+), 68 deletions(-) create mode 100644 lua/custom_highlights.lua diff --git a/init.lua b/init.lua index 651860b..b30a74e 100644 --- a/init.lua +++ b/init.lua @@ -9,7 +9,7 @@ require "statusline" require("colorizer").setup() require("neoscroll").setup() -- smooth scroll --- lsp +-- lsp stuff require "nvim-lspconfig" require "compe-completion" @@ -20,12 +20,13 @@ g.mapleader = " " g.auto_save = 0 -- colorscheme related stuff - cmd "syntax on" local base16 = require "base16" base16(base16.themes["onedark"], true) +require "custom_highlights" + -- blankline local indent = 2 @@ -33,8 +34,6 @@ local indent = 2 g.indentLine_enabled = 1 g.indent_blankline_char = "▏" -cmd "hi IndentBlanklineChar guifg=#2a2e36" - g.indent_blankline_filetype_exclude = {"help", "terminal"} g.indent_blankline_buftype_exclude = {"terminal"} @@ -44,15 +43,6 @@ g.indent_blankline_show_first_indent_level = false require "treesitter-nvim" 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 "nvimTree" @@ -66,11 +56,5 @@ vim.api.nvim_exec([[ au BufEnter term://* setlocal nonumber ]], 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 require "zenmode" diff --git a/lua/custom_highlights.lua b/lua/custom_highlights.lua new file mode 100644 index 0000000..34a7017 --- /dev/null +++ b/lua/custom_highlights.lua @@ -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" diff --git a/lua/gitsigns-nvim.lua b/lua/gitsigns-nvim.lua index 83bf7d7..1fa4325 100644 --- a/lua/gitsigns-nvim.lua +++ b/lua/gitsigns-nvim.lua @@ -25,9 +25,3 @@ require("gitsigns").setup { sign_priority = 5, 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" diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index 3c5faa9..13a111e 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -44,7 +44,7 @@ for k, lang in pairs(servers) do } end --- remove the lsp servers with their configs you don want +-- vls example local vls_binary = '/usr/local/bin/vls' require'lspconfig'.vls.setup { cmd = {vls_binary}, @@ -88,19 +88,3 @@ vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnos vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"}) vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"}) 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" diff --git a/lua/nvimTree.lua b/lua/nvimTree.lua index 9220fa7..137b986 100644 --- a/lua/nvimTree.lua +++ b/lua/nvimTree.lua @@ -1,5 +1,3 @@ - -local cmd = vim.cmd local g = vim.g vim.o.termguicolors = true @@ -84,10 +82,3 @@ g.nvim_tree_bindings = { ["-"] = get_lua_cb("dir_up"), ["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" -cmd "hi NvimTreeRootFolder guifg=#f9929b" diff --git a/lua/statusline.lua b/lua/statusline.lua index ad3d9df..6d3013b 100644 --- a/lua/statusline.lua +++ b/lua/statusline.lua @@ -7,15 +7,8 @@ local colors = { bg = "#1e222a", line_bg = "#1e222a", fg = "#D8DEE9", - fg_green = "#65a380", - yellow = "#A3BE8C", - cyan = "#22262C", - darkblue = "#61afef", green = "#BBE67E", orange = "#FF8800", - purple = "#252930", - magenta = "#c678dd", - blue = "#22262C", red = "#DF8890", lightbg = "#282c34", nord = "#81A1C1", @@ -135,7 +128,7 @@ gls.left[12] = { DiagnosticWarn = { provider = "DiagnosticWarn", icon = "  ", - highlight = {colors.blue, colors.bg} + highlight = {colors.red, colors.bg} } } diff --git a/lua/telescope-nvim.lua b/lua/telescope-nvim.lua index 744cb7b..b338935 100644 --- a/lua/telescope-nvim.lua +++ b/lua/telescope-nvim.lua @@ -73,12 +73,3 @@ vim.api.nvim_set_keymap("n", "fb", [[lua require('telescope.builtin vim.api.nvim_set_keymap("n", "fh", [[lua require('telescope.builtin').help_tags()]], opt) vim.api.nvim_set_keymap("n", "fo", [[lua require('telescope.builtin').oldfiles()]], opt) vim.api.nvim_set_keymap("n", "fm", [[ Neoformat]], 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" From 2fe776a3866b49dc6bde0b5315c777855a195838 Mon Sep 17 00:00:00 2001 From: siduck76 Date: Tue, 11 May 2021 09:12:49 +0530 Subject: [PATCH 3/3] nvim-lspconfig : fix some mistakes! --- lua/nvim-lspconfig.lua | 59 ++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/lua/nvim-lspconfig.lua b/lua/nvim-lspconfig.lua index 13a111e..01655ab 100644 --- a/lua/nvim-lspconfig.lua +++ b/lua/nvim-lspconfig.lua @@ -1,8 +1,7 @@ function on_attach(client) - local function map(...) + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end @@ -10,44 +9,48 @@ function on_attach(client) buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- Mappings. - local opts = {noremap = true, silent = true, normal = true} - map("gD", "lua vim.lsp.buf.declaration()", opts) - map("gd", "lua vim.lsp.buf.definition()", opts) - map("K", "lua vim.lsp.buf.hover()", opts) - map("gi", "lua vim.lsp.buf.implementation()", opts) - map("", "lua vim.lsp.buf.signature_help()", opts) - map("wa", "lua vim.lsp.buf.add_workspace_folder()", opts) - map("wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) - map("wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) - map("D", "lua vim.lsp.buf.type_definition()", opts) - map("rn", "lua vim.lsp.buf.rename()", opts) - map("gr", "lua vim.lsp.buf.references()", opts) - map("e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) - map("[d", "lua vim.lsp.diagnostic.goto_prev()", opts) - map("]d", "lua vim.lsp.diagnostic.goto_next()", opts) - map("q", "lua vim.lsp.diagnostic.set_loclist()", opts) + local opts = {noremap = true, silent = true} + + buf_set_keymap("n", "gD", "lua vim.lsp.buf.declaration()", opts) + buf_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) + buf_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) + buf_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) + buf_set_keymap("n", "", "lua vim.lsp.buf.signature_help()", opts) + buf_set_keymap("n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) + buf_set_keymap("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) + buf_set_keymap("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) + buf_set_keymap("n", "D", "lua vim.lsp.buf.type_definition()", opts) + buf_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", opts) + buf_set_keymap("n", "gr", "lua vim.lsp.buf.references()", opts) + buf_set_keymap("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) + buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) + buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts) + buf_set_keymap("n", "q", "lua vim.lsp.diagnostic.set_loclist()", opts) -- Set some keybinds conditional on server capabilities if client.resolved_capabilities.document_formatting then - map("f", "lua vim.lsp.buf.formatting()", opts) + buf_set_keymap("n", "f", "lua vim.lsp.buf.formatting()", opts) elseif client.resolved_capabilities.document_range_formatting then - map("f", "lua vim.lsp.buf.range_formatting()", opts) + buf_set_keymap("n", "f", "lua vim.lsp.buf.range_formatting()", opts) end end -local lspconf = require "lspconfig" -local servers = {"html", "cssls", "tsserver", "pyright", "bashls", "vls", "clangd", "ccls"} +local lspconf = require("lspconfig") -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 { + on_attach = on_attach, root_dir = vim.loop.cwd } end --- vls example -local vls_binary = '/usr/local/bin/vls' -require'lspconfig'.vls.setup { - cmd = {vls_binary}, +-- vls conf example +local vls_binary = "/usr/local/bin/vls" +lspconf.vls.setup { + cmd = {vls_binary} } -- lua lsp settings @@ -56,7 +59,7 @@ USER = "/home/" .. vim.fn.expand("$USER") local sumneko_root_path = USER .. "/.config/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"}, root_dir = function() return vim.loop.cwd()