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")
|
||||
2
lua/core/init.lua
Normal file
2
lua/core/init.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
require("core.keymap")
|
||||
require("core.options")
|
||||
1
lua/core/keymap.lua
Normal file
1
lua/core/keymap.lua
Normal file
@@ -0,0 +1 @@
|
||||
print "toto"
|
||||
1
lua/core/options.lua
Normal file
1
lua/core/options.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.opt.termguicolors = true
|
||||
24
lua/lazy/init.lua
Normal file
24
lua/lazy/init.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
opts = {
|
||||
install = {
|
||||
colorsheme = { "onedark" },
|
||||
},
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = false,
|
||||
},
|
||||
}
|
||||
|
||||
require("lazy").setup("lazy.plugins", opts)
|
||||
10
lua/lazy/plugins/onedark.lua
Normal file
10
lua/lazy/plugins/onedark.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
function conf()
|
||||
require('onedark').load()
|
||||
end
|
||||
|
||||
return {
|
||||
"navarasu/onedark.nvim",
|
||||
lazy=false,
|
||||
priority = 1000,
|
||||
config = conf
|
||||
}
|
||||
85
nvim_help.sh
Executable file
85
nvim_help.sh
Executable file
@@ -0,0 +1,85 @@
|
||||
#!/bin/bash
|
||||
|
||||
_CR="\e[170D\e[1B"
|
||||
_E1="\e[1C"
|
||||
_E2="\e[2C"
|
||||
_E_RIGHT="\e[70C"
|
||||
_BOLD="\e[1m"
|
||||
_BLACK="\e[38;5;0m"
|
||||
_RED="\e[38;5;1m"
|
||||
_BLUE="\e[38;5;4m"
|
||||
_PURPLE="\e[38;5;5m"
|
||||
_CYAN="\e[38;5;6m"
|
||||
_BG_RED="\e[48;5;1m"
|
||||
_RESET="\e[0m"
|
||||
|
||||
# _title [string:bg_color] [string:message] [bool:right]
|
||||
_title() {
|
||||
printf "$_CR$_E1$_BOLD$_BLACK$1"
|
||||
[[ ! -z $3 ]] && printf "$_E_RIGHT"
|
||||
for (( i=0; i<(( 10 - ${#2} / 2 )); i++ ))
|
||||
do
|
||||
printf " "
|
||||
done
|
||||
printf "$2"
|
||||
for (( i=0; i<(( 10 - ${#2} / 2 )); i++ ))
|
||||
do
|
||||
printf " "
|
||||
done
|
||||
(( ${#2} % 2 == 0 )) && printf " "
|
||||
printf "$_RESET$_CR"
|
||||
}
|
||||
|
||||
# _shortcut [string:modifier] [string:key] [string:message] [bool:right]
|
||||
_shortcut() {
|
||||
_MODIFIER=$(sed "s|+|\\\e[38;5;1m+\\\e[38;5;5m|g" <<< $1)
|
||||
[[ ! -z $4 ]] && printf "$_E_RIGHT"
|
||||
printf "$_E2"
|
||||
printf "$_PURPLE$_MODIFIER$_RESET"
|
||||
[[ ! -z $1 ]] && printf "$_RED+$_RESET"
|
||||
printf "$_CYAN$2$_RESET"
|
||||
printf " $3"
|
||||
printf "$_CR"
|
||||
}
|
||||
|
||||
_move() {
|
||||
printf "\e[$1;$2H"
|
||||
}
|
||||
|
||||
tput civis
|
||||
clear
|
||||
|
||||
_title "\e[48;5;063m" "Windows"
|
||||
_shortcut "" "-" "Decrease size"
|
||||
_shortcut "" "+" "Increase size"
|
||||
_shortcut "Ctrl" "Arrow" "Navigate"
|
||||
_shortcut "Ctrl+w" "q" "Quit"
|
||||
_shortcut "Ctrl+w" "v" "Vertical split"
|
||||
_shortcut "Ctrl+w" "s" "Horizontal split"
|
||||
_shortcut "Ctrl+w" "x" "Exchange withnext one"
|
||||
_shortcut "Ctrl+w" "=" "Reset resizing"
|
||||
|
||||
|
||||
_title "\e[48;5;035m" "Buffer"
|
||||
_shortcut "" "Tab" "Cycle buffer"
|
||||
|
||||
_title "\e[48;5;191m" "tab (:tabxxx)"
|
||||
_shortcut "Shift" "Tab" "Cycle tables"
|
||||
_shortcut "Shift" "tn" "New Table"
|
||||
_shortcut "Leader" "tc" "Close tab"
|
||||
|
||||
_title "\e[48;5;170m" "No Highlight"
|
||||
_shortcut "Leader" "hl" "Remove search highlight"
|
||||
|
||||
_title "\e[48;5;092m" "Normal mode"
|
||||
_shortcut "" "w" "Move by word"
|
||||
_shortcut "" "0" "Move begin of line"
|
||||
_shortcut "" "$" "Move end of line"
|
||||
_shortcut "" "gg" "Move begin of buffer"
|
||||
_shortcut "" "G" "Move end of buffer"
|
||||
|
||||
_title "\e[48;5;204m" "Visual mode"
|
||||
|
||||
_title "\e[48;5;214m" "not finished yet"
|
||||
|
||||
read -n 1 -s
|
||||
Reference in New Issue
Block a user