First commit
This commit is contained in:
108
init.lua
Normal file
108
init.lua
Normal file
@@ -0,0 +1,108 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.opt.title = true
|
||||
vim.opt.mouse=""
|
||||
vim.opt.wrap = true
|
||||
vim.opt.fileencoding = "utf-8"
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
vim.opt.completeopt = {"menu", "menuone", "preview", "noselect"}
|
||||
vim.opt.termguicolors = false
|
||||
vim.opt.laststatus = 3
|
||||
--- Search
|
||||
vim.opt.ignorecase=true
|
||||
vim.opt.smartcase=true
|
||||
--- Numbers
|
||||
vim.opt.number=true
|
||||
vim.opt.relativenumber=true
|
||||
--- Tab Options
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.smarttab = true
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.showtabline = 2
|
||||
--- Explorer
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_browse_split = 4
|
||||
vim.g.netrw_altv = 1
|
||||
vim.g.netrw_liststyle = 3
|
||||
vim.g.netrw_winsize = 20
|
||||
vim.opt.scrolloff = 6
|
||||
vim.opt.sidescrolloff = 8
|
||||
--- Swapfile
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
|
||||
--- Keymap
|
||||
-- Resource
|
||||
vim.keymap.set("n", "<leader>r", ":source ~/.config/nvim/init.lua<cr>")
|
||||
-- Explorer
|
||||
vim.keymap.set("n", "<C-e>", ":Lexplore<cr>")
|
||||
-- Windows
|
||||
vim.keymap.set("n", "<M-O>d", "<C-w>h")
|
||||
vim.keymap.set("n", "<M-O>c", "<C-w>l")
|
||||
vim.keymap.set("n", "<M-O>a", "<C-w>k")
|
||||
vim.keymap.set("n", "<M-O>b", "<C-w>j")
|
||||
-- Resize
|
||||
vim.keymap.set("n", "-", ":vertical resize -3<cr>")
|
||||
vim.keymap.set("n", "+", ":vertical resize +3<cr>")
|
||||
-- Buffer
|
||||
vim.keymap.set("n", "<Tab>", ":buffer ")
|
||||
-- Tabs
|
||||
vim.keymap.set("n", "<leader>tn", ":tabnew<cr>")
|
||||
vim.keymap.set("n", "<leader>tc", ":tabclose<cr>")
|
||||
vim.keymap.set("n", "<S-Tab>", ":tabnext<cr>")
|
||||
-- Cheatsheet
|
||||
vim.keymap.set("n", "<C-s>", ":terminal ~/.config/nvim/nvim_help.sh<cr>i")
|
||||
-- No highlight
|
||||
vim.keymap.set("n", "<leader>nl", ":nohl<cr>")
|
||||
|
||||
--- Automaticly close brackets
|
||||
--vim.keymap.set ("i", "'", "''<Left>")
|
||||
--vim.keymap.set ("i", "\"", "\"\"<Left>")
|
||||
--vim.keymap.set ("i", "(", "()<Left>")
|
||||
--vim.keymap.set ("i", "{", "{}<Left>")
|
||||
--vim.keymap.set ("i", "[", "[]<Left>")
|
||||
|
||||
--- Statusline
|
||||
vim.cmd "highlight StatusNormal ctermbg=blue ctermfg=black"
|
||||
vim.cmd "highlight StatusModified ctermbg=red ctermfg=black"
|
||||
vim.cmd "highlight StatusGitBranch ctermbg=yellow ctermfg=black"
|
||||
vim.cmd "highlight StatusGitDiffAdd ctermbg=green ctermfg=black"
|
||||
vim.cmd "highlight StatusGitdiffRemove ctermbg=red ctermfg=black"
|
||||
|
||||
local function command(cmd)
|
||||
local handle = io.popen(cmd)
|
||||
local result = handle:read()
|
||||
handle:close()
|
||||
return result or ""
|
||||
end
|
||||
|
||||
vim.o.statusline = "%#StatusNormal# "
|
||||
.. "%#StatusGitBranch#"
|
||||
.. command("git branch 2> /dev/null | sed -e 's/..//'")
|
||||
.. "%#StatusNormal# "
|
||||
.. "%#StatusGitDiffAdd#"
|
||||
.. command("git diff --numstat | awk '{print \"+\"$1}'")
|
||||
.. "%#StatusNormal# "
|
||||
.. "%#StatusGitDiffRemove#"
|
||||
.. command("git diff --numstat | awk '{print \"-\"$2}'")
|
||||
.. "%#StatusNormal# "
|
||||
.. ">>"
|
||||
.. " %F "
|
||||
.. "%#StatusModified#"
|
||||
.. "%M"
|
||||
.. "%#StatusNormal#"
|
||||
.. " >>"
|
||||
.. "%="
|
||||
.. "<<"
|
||||
.. " %Y "
|
||||
.. "<<"
|
||||
.. " %l,%c "
|
||||
.. "<<"
|
||||
.. " %p%% "
|
||||
|
||||
|
||||
|
||||
require("core")
|
||||
require("lazy.init")
|
||||
Reference in New Issue
Block a user