local function map(mode, lhs, rhs, opts) local options = {noremap = true} if opts then options = vim.tbl_extend("force", options, opts) end vim.api.nvim_set_keymap(mode, lhs, rhs, options) end local opt = {} -- dont copy any deleted text , this is disabled by default so uncomment the below mappings if you want them --[[ remove this line map("n", "dd", [=[ "_dd ]=], opt) map("v", "dd", [=[ "_dd ]=], opt) map("v", "x", [=[ "_x ]=], opt) this line too ]] -- -- OPEN TERMINALS -- map("n", "", [[vnew term://bash ]], opt) -- term over right map("n", "", [[ split term://bash | resize 10 ]], opt) -- term bottom map("n", "t", [[ tabnew | term ]], opt) -- term newtab -- copy whole file content map("n", "", [[ %y+]], opt) -- toggle numbers map("n", "n", [[ set nu!]], opt) -- Truezen.nvim map("n", "z", [[ TZAtaraxis]], opt) map("n", "m", [[ TZMinimalist]], opt) map("n", "", [[ w ]], opt) -- vim.cmd("inoremap jh ") -- Commenter Keybinding map("n", "/", ":CommentToggle", {noremap = true, silent = true}) map("v", "/", ":CommentToggle", {noremap = true, silent = true}) -- compe stuff local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end local check_back_space = function() local col = vim.fn.col(".") - 1 if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then return true else return false end end _G.tab_complete = function() if vim.fn.pumvisible() == 1 then return t "" elseif check_back_space() then return t "" else return vim.fn["compe#complete"]() end end _G.s_tab_complete = function() if vim.fn.pumvisible() == 1 then return t "" elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then return t "(vsnip-jump-prev)" else return t "" end end function _G.completions() local npairs = require("nvim-autopairs") if vim.fn.pumvisible() == 1 then if vim.fn.complete_info()["selected"] ~= -1 then return vim.fn["compe#confirm"]("") end end return npairs.check_break_line_char() end -- compe mappings map("i", "", "v:lua.tab_complete()", {expr = true}) map("s", "", "v:lua.tab_complete()", {expr = true}) map("i", "", "v:lua.s_tab_complete()", {expr = true}) map("s", "", "v:lua.s_tab_complete()", {expr = true}) map("i", "", "v:lua.completions()", {expr = true}) -- Mappings for nvimtree map( "n", "", ":NvimTreeToggle", { noremap = true, silent = true } ) map("n", "fm", [[ Neoformat]], opt) -- dashboard stuff map("n", "fw", [[ Telescope live_grep]], opt) map("n", "fn", [[ DashboardNewFile]], opt) map("n", "bm", [[ DashboardJumpMarks]], opt) map("n", "sl", [[ SessionLoad]], opt) map("n", "ss", [[ SessionSave]], opt)