a lot of new keymaps

This commit is contained in:
krolyxon 2022-09-06 22:08:52 +05:30
parent fddc5eeed2
commit df6dba4e66
7 changed files with 267 additions and 11 deletions

View File

@ -30,3 +30,5 @@ for _, module in ipairs(modules) do
end end
require ("core.utils").load_mappings() require ("core.utils").load_mappings()
vim.api.nvim_command("colorscheme gruvbox-baby")

View File

@ -1,8 +1,6 @@
local M = {} local M = {}
M.general = { M.general = {
i = {},
n = { n = {
["<ESC>"] = { "<cmd> noh <CR>", "no highlight"}, ["<ESC>"] = { "<cmd> noh <CR>", "no highlight"},
@ -25,6 +23,76 @@ M.general = {
}, },
} }
M.bufferline = {
plugin = true,
n = {
["<S-Tab>" ] = {"<cmd> :BufferLineCycleNext <CR>"}
}
}
M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "toggle nvimtree" },
-- focus
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "focus nvimtree" },
},
}
M.nvterm = {
plugin = true,
t = {
-- toggle in terminal mode
["<A-i>"] = {
function()
require("nvterm.terminal").toggle "float"
end,
"toggle floating term",
},
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"toggle horizontal term",
},
["<A-v>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
"toggle vertical term",
},
},
n = {
-- toggle in normal mode
["<A-i>"] = {
function()
require("nvterm.terminal").toggle "float"
end,
"toggle floating term",
},
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"toggle horizontal term",
},
["<A-v>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
"toggle vertical term",
},
},
}
M.telescope = { M.telescope = {
plugin = true, plugin = true,

View File

@ -44,10 +44,10 @@ local default_plugins = {
"getscriptPlugin", "getscriptPlugin",
"gzip", "gzip",
"logipat", "logipat",
-- "netrw", "netrw",
-- "netrwPlugin", "netrwPlugin",
-- "netrwSettings", "netrwSettings",
-- "netrwFileHandlers", "netrwFileHandlers",
"matchit", "matchit",
"tar", "tar",
"tarPlugin", "tarPlugin",

View File

@ -36,6 +36,57 @@ local lsp_flags = {
-- This is the default in Nvim 0.7+ -- This is the default in Nvim 0.7+
debounce_text_changes = 150, 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{ require('lspconfig')['sumneko_lua'].setup{
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,

View File

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

View File

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

View File

@ -8,10 +8,6 @@ local plugins = {
end, end,
}, },
["luisiacc/gruvbox-baby"] = {
config ="vim.cmd 'colorscheme gruvbox-baby'"
},
["nvim-treesitter/nvim-treesitter"] = { ["nvim-treesitter/nvim-treesitter"] = {
module = "nvim-treesitter", module = "nvim-treesitter",
setup = function() setup = function()
@ -134,13 +130,35 @@ local plugins = {
end, 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 -- UI stuff
["lukas-reineke/indent-blankline.nvim"] = { ["lukas-reineke/indent-blankline.nvim"] = {
event = "BufRead", event = "BufRead",
config = function() config = function()
require("plugins.configs.others").blankline() require("plugins.configs.others").blankline()
end, end,
setup = function() setup = function()
require("core.utils").load_mappings "blankline" require("core.utils").load_mappings "blankline"
end, end,
}, },