feat: initial commit
This commit is contained in:
2
lua/cargdev/core/init.lua
Normal file
2
lua/cargdev/core/init.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
require("cargdev.core.options")
|
||||
require("cargdev.core.keymaps")
|
||||
36
lua/cargdev/core/keymaps.lua
Normal file
36
lua/cargdev/core/keymaps.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
vim.g.mapleader = " "
|
||||
|
||||
local keymap = vim.keymap
|
||||
|
||||
keymap.set("n", "<leader>u", "gg0vG$", { desc = "Select the whole file open" })
|
||||
keymap.set("n", "<leader>4", "0v$hy<Esc>0o<Esc>0p0kw<CR>", { desc = "Copy the entire line and paste just below" })
|
||||
|
||||
-- file management
|
||||
keymap.set("n", "<leader>w", ":w<CR>", { desc = "Save the current file" })
|
||||
keymap.set("n", "<leader>xa", ":xa<CR>", { desc = "Save and close all the files" })
|
||||
keymap.set("n", "<leader>q", ":q<CR>", { desc = "Close all the files" })
|
||||
keymap.set("n", "<leader>so", ":source %<CR>", { desc = "Reload nvim" })
|
||||
keymap.set("n", "<leader>no", ":noh <CR>", { desc = "Reset search a word" })
|
||||
|
||||
-- increment/decrement numbers
|
||||
keymap.set("n", "<leader>+", "<C-a>", { desc = "Increment number" }) -- increment
|
||||
keymap.set("n", "<leader>-", "<C-x>", { desc = "Decrement number" }) -- decrement
|
||||
|
||||
-- window management
|
||||
keymap.set("n", "<leader>sv", "<C-w>v", { desc = "Split window vertically" }) -- split window vertically
|
||||
keymap.set("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- split window horizontally
|
||||
keymap.set("n", "<leader>se", "<C-w>=", { desc = "Make splits equal size" }) -- make split windows equal width & height
|
||||
keymap.set("n", "<leader>sx", "<cmd>close<CR>", { desc = "Close current split" }) -- close current split window
|
||||
|
||||
keymap.set("n", "<leader>to", "<cmd>tabnew<CR>", { desc = "Open new tab" }) -- open new tab
|
||||
keymap.set("n", "<leader>tx", "<cmd>tabclose<CR>", { desc = "Close current tab" }) -- close current tab
|
||||
keymap.set("n", "<leader>tn", "<cmd>tabn<CR>", { desc = "Go to next tab" }) -- go to next tab
|
||||
keymap.set("n", "<leader>tp", "<cmd>tabp<CR>", { desc = "Go to previous tab" }) -- go to previous tab
|
||||
keymap.set("n", "<leader>tf", "<cmd>tabnew %<CR>", { desc = "Open current buffer in new tab" }) -- move current buffer to new tab
|
||||
|
||||
-- sintax fixer
|
||||
keymap.set("n", "<leader>sy", "gg=G<CR>", { desc = "Format current file" })
|
||||
|
||||
|
||||
keymap.set("n", "<C-e>", "10<C-e>", { noremap = true, silent = true })
|
||||
keymap.set("n", "<C-y>", "10<C-y>", { noremap = true, silent = true })
|
||||
39
lua/cargdev/core/options.lua
Normal file
39
lua/cargdev/core/options.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
vim.cmd("let g:netrw_liststyle = 3")
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
opt.relativenumber = true
|
||||
opt.number = true
|
||||
|
||||
-- tabs & indentation
|
||||
opt.tabstop = 2 -- 2 spaces for tabs (prettier default)
|
||||
opt.shiftwidth = 2 -- 2 spaces for indent width
|
||||
opt.expandtab = true -- expand tab to spaces
|
||||
opt.autoindent = true -- copy indent from current line when starting new one
|
||||
|
||||
opt.wrap = false
|
||||
|
||||
-- search settings
|
||||
opt.ignorecase = true -- ignore case when searching
|
||||
opt.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive
|
||||
|
||||
opt.cursorline = true
|
||||
|
||||
-- turn on termguicolors for tokyonight colorscheme to work
|
||||
-- (have to use iterm2 or any other true color terminal)
|
||||
opt.termguicolors = true
|
||||
opt.background = "dark" -- colorschemes that can be light or dark will be made dark
|
||||
opt.signcolumn = "yes" -- show sign column so that text doesn't shift
|
||||
|
||||
-- backspace
|
||||
opt.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position
|
||||
|
||||
-- clipboard
|
||||
opt.clipboard:append("unnamedplus") -- use system clipboard as default register
|
||||
|
||||
-- split windows
|
||||
opt.splitright = true -- split vertical window to the right
|
||||
opt.splitbelow = true -- split horizontal window to the bottom
|
||||
|
||||
-- turn off swapfile
|
||||
opt.swapfile = false
|
||||
Reference in New Issue
Block a user