diff --git a/init.lua b/init.lua index 3f89ad2..3d114c6 100644 --- a/init.lua +++ b/init.lua @@ -30,3 +30,5 @@ for _, module in ipairs(modules) do end require ("core.utils").load_mappings() + +vim.api.nvim_command("colorscheme gruvbox-baby") diff --git a/lua/core/mappings.lua b/lua/core/mappings.lua index 3199c36..28b5a7d 100644 --- a/lua/core/mappings.lua +++ b/lua/core/mappings.lua @@ -1,8 +1,6 @@ local M = {} M.general = { - i = {}, - n = { [""] = { " noh ", "no highlight"}, @@ -25,6 +23,76 @@ M.general = { }, } +M.bufferline = { + plugin = true, + n = { + ["" ] = {" :BufferLineCycleNext "} + } +} + +M.nvimtree = { + plugin = true, + + n = { + -- toggle + [""] = { " NvimTreeToggle ", "toggle nvimtree" }, + + -- focus + ["e"] = { " NvimTreeFocus ", "focus nvimtree" }, + }, +} + +M.nvterm = { + plugin = true, + + t = { + -- toggle in terminal mode + [""] = { + function() + require("nvterm.terminal").toggle "float" + end, + "toggle floating term", + }, + + [""] = { + function() + require("nvterm.terminal").toggle "horizontal" + end, + "toggle horizontal term", + }, + + [""] = { + function() + require("nvterm.terminal").toggle "vertical" + end, + "toggle vertical term", + }, + }, + + n = { + -- toggle in normal mode + [""] = { + function() + require("nvterm.terminal").toggle "float" + end, + "toggle floating term", + }, + + [""] = { + function() + require("nvterm.terminal").toggle "horizontal" + end, + "toggle horizontal term", + }, + + [""] = { + function() + require("nvterm.terminal").toggle "vertical" + end, + "toggle vertical term", + }, + }, +} M.telescope = { plugin = true, diff --git a/lua/core/options.lua b/lua/core/options.lua index ac166c1..a4dfb1e 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -44,10 +44,10 @@ local default_plugins = { "getscriptPlugin", "gzip", "logipat", --- "netrw", --- "netrwPlugin", --- "netrwSettings", --- "netrwFileHandlers", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", "matchit", "tar", "tarPlugin", diff --git a/lua/plugins/configs/lspconfig.lua b/lua/plugins/configs/lspconfig.lua index ff29144..dabfe7f 100644 --- a/lua/plugins/configs/lspconfig.lua +++ b/lua/plugins/configs/lspconfig.lua @@ -36,6 +36,57 @@ local lsp_flags = { -- This is the default in Nvim 0.7+ debounce_text_changes = 150, } + +local function lspSymbol(name, icon) + local hl = "DiagnosticSign" .. name + vim.fn.sign_define(hl, { text = icon, numhl = hl, texthl = hl }) +end + +lspSymbol("Error", "") +lspSymbol("Info", "") +lspSymbol("Hint", "") +lspSymbol("Warn", "") + +vim.diagnostic.config { + virtual_text = { + prefix = "", + }, + signs = true, + underline = true, + update_in_insert = false, +} + +vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + border = "single", +}) +vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + border = "single", + focusable = false, + relative = "cursor", +}) + +-- suppress error messages from lang servers +vim.notify = function(msg, log_level) + if msg:match "exit code" then + return + end + if log_level == vim.log.levels.ERROR then + vim.api.nvim_err_writeln(msg) + else + vim.api.nvim_echo({ { msg } }, true, {}) + end +end + +-- Borders for LspInfo winodw +local win = require "lspconfig.ui.windows" +local _default_opts = win.default_opts + +win.default_opts = function(options) + local opts = _default_opts(options) + opts.border = "single" + return opts +end + require('lspconfig')['sumneko_lua'].setup{ on_attach = on_attach, flags = lsp_flags, diff --git a/lua/plugins/configs/nvimtree.lua b/lua/plugins/configs/nvimtree.lua new file mode 100644 index 0000000..254ac47 --- /dev/null +++ b/lua/plugins/configs/nvimtree.lua @@ -0,0 +1,87 @@ +local present, nvimtree = pcall(require, "nvim-tree") + +if not present then + return +end + +local options = { + filters = { + dotfiles = false, + exclude = { vim.fn.stdpath "config" .. "/lua/custom" }, + }, + disable_netrw = true, + hijack_netrw = true, + open_on_setup = false, + ignore_ft_on_setup = { "alpha" }, + hijack_cursor = true, + hijack_unnamed_buffer_when_opening = false, + update_cwd = true, + update_focused_file = { + enable = true, + update_cwd = false, + }, + view = { + adaptive_size = true, + side = "left", + width = 25, + hide_root_folder = true, + }, + git = { + enable = false, + ignore = true, + }, + filesystem_watchers = { + enable = true, + }, + actions = { + open_file = { + resize_window = true, + }, + }, + renderer = { + highlight_git = false, + highlight_opened_files = "none", + + indent_markers = { + enable = false, + }, + + icons = { + show = { + file = true, + folder = true, + folder_arrow = true, + git = false, + }, + + glyphs = { + default = "", + symlink = "", + folder = { + default = "", + empty = "", + empty_open = "", + open = "", + symlink = "", + symlink_open = "", + arrow_open = "", + arrow_closed = "", + }, + git = { + unstaged = "✗", + staged = "✓", + unmerged = "", + renamed = "➜", + untracked = "★", + deleted = "", + ignored = "◌", + }, + }, + }, + }, +} + +-- check for any override +vim.g.nvimtree_side = options.view.side + +nvimtree.setup(options) diff --git a/lua/plugins/configs/nvterm.lua b/lua/plugins/configs/nvterm.lua new file mode 100644 index 0000000..a7dc6e4 --- /dev/null +++ b/lua/plugins/configs/nvterm.lua @@ -0,0 +1,30 @@ +local present, nvterm = pcall(require, "nvterm") + +if not present then + return +end + +local options = { + terminals = { + list = {}, + type_opts = { + float = { + relative = "editor", + row = 0.3, + col = 0.25, + width = 0.5, + height = 0.4, + border = "single", + }, + horizontal = { location = "rightbelow", split_ratio = 0.4 }, + vertical = { location = "rightbelow", split_ratio = 0.5 }, + }, + }, + behavior = { + close_on_exit = true, + auto_insert = true, + }, + enable_new_mappings = true, +} + +nvterm.setup(options) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 86ffeea..0ff8757 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -8,10 +8,6 @@ local plugins = { end, }, - ["luisiacc/gruvbox-baby"] = { - config ="vim.cmd 'colorscheme gruvbox-baby'" - }, - ["nvim-treesitter/nvim-treesitter"] = { module = "nvim-treesitter", setup = function() @@ -134,13 +130,35 @@ local plugins = { end, }, + -- file managing , picker etc + ["kyazdani42/nvim-tree.lua"] = { + ft = "alpha", + cmd = { "NvimTreeToggle", "NvimTreeFocus" }, + config = function() + require "plugins.configs.nvimtree" + end, + setup = function() + require("core.utils").load_mappings "nvimtree" + end, + }, + + ["NvChad/nvterm"] = { + module = "nvterm", + config = function() + require "plugins.configs.nvterm" + end, + setup = function() + require("core.utils").load_mappings "nvterm" + end, + }, + -- UI stuff ["lukas-reineke/indent-blankline.nvim"] = { event = "BufRead", config = function() require("plugins.configs.others").blankline() end, - setup = function() + setup = function() require("core.utils").load_mappings "blankline" end, },