-- settings local cmd = vim.cmd -- Return to last edit line position when opening files cmd [[au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]]; -- Set nowrap text when opening files cmd [[set nowrap]]; -- Set Cursor Underline cmd [[set guicursor=]]; -- Restore Cursor cmd [[ augroup RestoreCursorShapeOnExit autocmd! autocmd VimLeave * set guicursor=a:hor20 augroup END ]]; -- mapping 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 -- Terminal -- == CTRL + l map("n", "", ":vnew +terminal | setlocal nobuflisted ", opt) -- term over right -- == CTRL + x map("n", "", ":10new +terminal | setlocal nobuflisted ", opt) -- term bottom -- == ALT + t map("n", "", ":terminal ", opt) -- term buffer -- Number Line -- == CTRL + m map("n", "", ":set number ", opt) -- set number -- == CTRL + ALT + m map("n", "", ":set nonumber ", opt) -- set nonumber -- Wrap Text -- == CTRL + w map("n", "", [[:set wrap]], opt) map("i", "", [[:set wrap]], opt) map("v", "", [[:set wrap]], opt) -- No Wrap Text -- == CTRL + ALT + w map("n", "", [[:set nowrap]], opt) map("i", "", [[:set nowrap]], opt) map("v", "", [[:set nowrap]], opt) -- save on normal, insert and visual mode (CTRL + S) map("n", "", [[:w]], opt) map("i", "", [[:w]], opt) map("v", "", [[:w]], opt) -- quit on normal, insert and visual mode (CTRL + Q) map("n", "", [[:q]], opt) map("i", "", [[:q]], opt) map("v", "", [[:q]], opt) -- save and quit, insert and visual mode (CTRL + ALT + S) map("n", "", [[:wq!]], opt) map("i", "", [[:wq!]], opt) map("v", "", [[:wq!]], opt) -- quit without save on normal, insert and visual mode (CTRL + ALT + Q) map("n", "", [[:q!]], opt) map("i", "", [[:q!]], opt) map("v", "", [[:q!]], opt) -- move cursor to start (home) text on normal, insert and visual mode. Example: n... (CTRL + A) map("n", "", [[]], opt) map("i", "", [[]], opt) map("v", "", [[]], opt) -- move cursor to end text on normal, insert and visual mode. Example: n... (CTRL + D) map("n", "", [[]], opt) map("i", "", [[]], opt) map("v", "", [[]], opt)