feat: started rewrite of nvim config
This commit is contained in:
parent
34f39bd404
commit
f1b8fb4a1e
|
@ -1,15 +1,24 @@
|
|||
-- required programs
|
||||
-- ripgrep
|
||||
-- git
|
||||
|
||||
|
||||
-- general settings
|
||||
|
||||
require "core"
|
||||
|
||||
|
||||
--Plugins
|
||||
require "plugins"
|
||||
-- bootstrap plugin manager
|
||||
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)
|
||||
|
||||
-- load plugins
|
||||
require("lazy").setup("plugins")
|
||||
|
||||
|
||||
-- Lua config lets go
|
||||
-- required programs:
|
||||
-- ripgrep
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
local opt = vim.opt
|
||||
|
||||
-- Set maximum undo levels
|
||||
opt.undolevels = 1000000
|
||||
-- Persistent Undo
|
||||
opt.undofile = true
|
||||
opt.undodir = vim.fn.stdpath("cache") .. "/undo"
|
||||
|
||||
-- swap file save interval
|
||||
opt.updatetime = 300
|
||||
|
||||
-- Ignore *.o and *~ files in wildmenu
|
||||
opt.wildignore = "*.o,*~"
|
||||
-- Only complete the longest common prefix and list all results.
|
||||
-- You can use the cursor keys to select an item in this list
|
||||
opt.wildmode = {"list", "full"}
|
||||
|
||||
-- set case handling
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- ╓──────────────────╖
|
||||
-- ║ Editor visuals ║
|
||||
-- ╙──────────────────╜
|
||||
|
||||
-- Enable true color in terminals
|
||||
opt.termguicolors = true
|
||||
-- set font
|
||||
opt.guifont = "FiraCode Nerd Font Mono:h10.5"
|
||||
-- full mouse support
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Do not wrap text longer than the window's width
|
||||
opt.wrap = false
|
||||
|
||||
-- Show line numbers
|
||||
opt.number = true
|
||||
opt.relativenumber = false
|
||||
|
||||
-- Keep 2 lines around the cursor.
|
||||
opt.scrolloff = 2
|
||||
opt.sidescrolloff = 2
|
||||
|
||||
-- Set indentation of tabs to be equal to 4 spaces.
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
opt.softtabstop = 4
|
||||
--round indentation to shifwidth
|
||||
opt.shiftround = true
|
||||
|
||||
|
||||
-- ╓────────────────────╖
|
||||
-- ║ Editing behavior ║
|
||||
-- ╙────────────────────╜
|
||||
|
||||
-- r = insert comment leader when hitting <Enter> in insert mode
|
||||
-- q = allow explicit formatting with gq
|
||||
-- j = remove comment leaders when joining lines if it makes sense
|
||||
opt.formatoptions = "rqj"
|
||||
|
||||
-- Allow the curser to be positioned on cells that have no actual character;
|
||||
-- Like moving beyond EOL or on any visual 'space' of a tab character
|
||||
opt.virtualedit = "all"
|
||||
|
||||
-- Do not include line ends in past the-line selections
|
||||
opt.selection = "old"
|
||||
|
||||
-- Use smart auto indenting for all file types
|
||||
opt.smartindent = true
|
||||
|
||||
-- Only wait 20 milliseconds for characters to arrive (see :help timeout)
|
||||
opt.timeoutlen = 20
|
||||
opt.ttimeoutlen = 20
|
||||
|
||||
-- Disable timeout, set ttimeout (only timeout on keycodes)
|
||||
opt.timeout = false
|
||||
opt.ttimeout = true
|
||||
|
||||
-- replace grep with ripgrep
|
||||
opt.grepprg = "rg --vimgrep --smartcase --follow"
|
||||
|
|
@ -1,18 +1,83 @@
|
|||
local opt = vim.opt
|
||||
|
||||
--required programs
|
||||
--ripgrep
|
||||
--fd
|
||||
--?pynvim
|
||||
--git
|
||||
--nvim
|
||||
|
||||
|
||||
|
||||
|
||||
--basic global settings
|
||||
require "core.config"
|
||||
require "core.keybinds"
|
||||
require "core.lsp"
|
||||
|
||||
--set venv
|
||||
vim.g.python3_host_prog=vim.fn.stdpath("data").."/venv/bin/python3"
|
||||
-- Set maximum undo levels
|
||||
opt.undolevels = 1000000
|
||||
-- Persistent Undo
|
||||
opt.undofile = true
|
||||
opt.undodir = vim.fn.stdpath("cache") .. "/undo"
|
||||
|
||||
-- swap file save interval
|
||||
opt.updatetime = 300
|
||||
|
||||
-- Ignore *.o and *~ files in wildmenu
|
||||
opt.wildignore = "*.o,*~"
|
||||
-- Only complete the longest common prefix and list all results.
|
||||
-- You can use the cursor keys to select an item in this list
|
||||
opt.wildmode = {"list", "full"}
|
||||
|
||||
-- set case handling
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
-- ╓──────────────────╖
|
||||
-- ║ Editor visuals ║
|
||||
-- ╙──────────────────╜
|
||||
|
||||
-- Enable true color in terminals
|
||||
opt.termguicolors = true
|
||||
-- set font
|
||||
opt.guifont = "FiraCode Nerd Font Mono:h10.5"
|
||||
-- full mouse support
|
||||
opt.mouse = "a"
|
||||
|
||||
-- Do not wrap text longer than the window's width
|
||||
opt.wrap = false
|
||||
|
||||
-- Show line numbers
|
||||
opt.number = true
|
||||
opt.relativenumber = false
|
||||
|
||||
-- Keep 2 lines around the cursor.
|
||||
opt.scrolloff = 2
|
||||
opt.sidescrolloff = 2
|
||||
|
||||
-- Set indentation of tabs to be equal to 4 spaces.
|
||||
opt.tabstop = 4
|
||||
opt.shiftwidth = 4
|
||||
opt.softtabstop = 4
|
||||
--round indentation to shifwidth
|
||||
opt.shiftround = true
|
||||
|
||||
|
||||
-- ╓────────────────────╖
|
||||
-- ║ Editing behavior ║
|
||||
-- ╙────────────────────╜
|
||||
|
||||
-- r = insert comment leader when hitting <Enter> in insert mode
|
||||
-- q = allow explicit formatting with gq
|
||||
-- j = remove comment leaders when joining lines if it makes sense
|
||||
opt.formatoptions = "rqj"
|
||||
|
||||
-- Allow the curser to be positioned on cells that have no actual character;
|
||||
-- Like moving beyond EOL or on any visual 'space' of a tab character
|
||||
opt.virtualedit = "all"
|
||||
|
||||
-- Do not include line ends in past the-line selections
|
||||
opt.selection = "old"
|
||||
|
||||
-- Use smart auto indenting for all file types
|
||||
opt.smartindent = true
|
||||
|
||||
-- Only wait 20 milliseconds for characters to arrive (see :help timeout)
|
||||
opt.timeoutlen = 20
|
||||
opt.ttimeoutlen = 20
|
||||
|
||||
-- Disable timeout, set ttimeout (only timeout on keycodes)
|
||||
opt.timeout = false
|
||||
opt.ttimeout = true
|
||||
|
||||
-- replace grep with ripgrep
|
||||
opt.grepprg = "rg --vimgrep --smartcase --follow"
|
||||
|
||||
|
|
|
@ -11,32 +11,13 @@ map("", "<M-up>" , "<up>" , { noremap = true, silent = true })
|
|||
map("", "<M-left>" , "<left>" , { noremap = true, silent = true })
|
||||
map("", "<M-right>", "<right>", { noremap = true, silent = true })
|
||||
|
||||
map("", "<M-r>" , "<down>" , { noremap = true, silent = true })
|
||||
map("", "<M-l>" , "<up>" , { noremap = true, silent = true })
|
||||
map("", "<M-n>" , "<left>" , { noremap = true, silent = true })
|
||||
map("", "<M-s>", "<right>", { noremap = true, silent = true })
|
||||
|
||||
-- scroll with cursor loch
|
||||
map("" , "<S-down>" , "" , { noremap = true, silent = true })
|
||||
map("" , "<S-up>" , "" , { noremap = true, silent = true })
|
||||
map("i", "<S-down>" , "a", { noremap = true, silent = true })
|
||||
map("i", "<S-up>" , "a", { noremap = true, silent = true })
|
||||
|
||||
|
||||
-- Plugin: LSP
|
||||
map("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
map("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
map("n", "gk", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
map("n", "<leader>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
map("n", "<leader>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
map("n", "<leader>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||
map("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
map("n", "<leader>r", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
map("n", "<leader>A", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
map("n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||
map("n", "gp", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
|
||||
map("n", "gn", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
|
||||
map("n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||
map("n", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
|
||||
-- Plugin: EasyAlign
|
||||
map("n", "<leader>a", "<Plug>(EasyAlign)", {silent = true})
|
||||
map("v", "<leader>a", "<Plug>(EasyAlign)", {silent = true})
|
||||
|
|
8
data/nvim/lua/plugins/colors.lua
Normal file
8
data/nvim/lua/plugins/colors.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{
|
||||
"navarasu/onedark.nvim",
|
||||
init = function()
|
||||
require("onedark").load()
|
||||
end,
|
||||
}
|
||||
}
|
123
data/nvim/lua/plugins/neotree.lua
Normal file
123
data/nvim/lua/plugins/neotree.lua
Normal file
|
@ -0,0 +1,123 @@
|
|||
local notify = function(message, level)
|
||||
vim.notify(message, level, { title = "NeoTree" })
|
||||
end
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = 'v2.x',
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"kyazdani42/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
{
|
||||
"s1n7ax/nvim-window-picker",
|
||||
config = function()
|
||||
require("window-picker").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
init = function()
|
||||
vim.notify = require("notify")
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
init = function()
|
||||
vim.cmd [[let g:neo_tree_remove_legacy_commands = 1]]
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>t", "<cmd>Neotree toggle<cr>", desc = "NeoTree" },
|
||||
},
|
||||
opts = {
|
||||
sort_case_insensitive = true,
|
||||
use_popups_for_input = false,
|
||||
popup_border_style = "rounded",
|
||||
win_options = {
|
||||
winblend = 0,
|
||||
},
|
||||
default_component_configs = {
|
||||
modified = {
|
||||
symbol = "~ ",
|
||||
},
|
||||
indent = {
|
||||
with_expanders = true,
|
||||
},
|
||||
name = {
|
||||
trailing_slash = true,
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
added = "+",
|
||||
deleted = "✖",
|
||||
modified = "",
|
||||
renamed = "➜",
|
||||
untracked = "?",
|
||||
ignored = "",
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
conflict = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
window = {
|
||||
width = 34,
|
||||
position = "left",
|
||||
mappings = {
|
||||
["<CR>"] = "open_with_window_picker",
|
||||
["s"] = "split_with_window_picker",
|
||||
["v"] = "vsplit_with_window_picker",
|
||||
["t"] = "open_tabnew",
|
||||
["z"] = "close_all_nodes",
|
||||
["Z"] = "expand_all_nodes",
|
||||
["a"] = { "add", config = { show_path = "relative" } },
|
||||
["A"] = { "add_directory", config = { show_path = "relative" } },
|
||||
["c"] = { "copy", config = { show_path = "relative" } },
|
||||
["m"] = { "move", config = { show_path = "relative" } },
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
window = {
|
||||
mappings = {
|
||||
["gA"] = "git_add_all",
|
||||
["ga"] = "git_add_file",
|
||||
["gu"] = "git_unstage_file",
|
||||
},
|
||||
},
|
||||
group_empty_dirs = true,
|
||||
follow_current_file = true,
|
||||
use_libuv_file_watcher = true,
|
||||
filtered_items = {
|
||||
hide_dotfiles = false,
|
||||
hide_by_name = { ".git" },
|
||||
},
|
||||
},
|
||||
event_handlers = {
|
||||
{
|
||||
event = "file_added",
|
||||
handler = function(arg)
|
||||
notify("Added: " .. arg, "info")
|
||||
end,
|
||||
},
|
||||
{
|
||||
event = "file_deleted",
|
||||
handler = function(arg)
|
||||
notify("Deleted: " .. arg, "info")
|
||||
end,
|
||||
},
|
||||
{
|
||||
event = "file_renamed",
|
||||
handler = function(args)
|
||||
notify("Renamed: " .. args.source .. " -> " .. args.destination, "info")
|
||||
end,
|
||||
},
|
||||
{
|
||||
event = "file_moved",
|
||||
handler = function(args)
|
||||
notify("Moved: " .. args.source .. " -> " .. args.destination, "info")
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
18
data/nvim/old/lua/core/init.lua
Normal file
18
data/nvim/old/lua/core/init.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
--required programs
|
||||
--ripgrep
|
||||
--fd
|
||||
--?pynvim
|
||||
--git
|
||||
--nvim
|
||||
|
||||
|
||||
|
||||
|
||||
--basic global settings
|
||||
require "core.config"
|
||||
require "core.keybinds"
|
||||
require "core.lsp"
|
||||
|
||||
--set venv
|
||||
vim.g.python3_host_prog=vim.fn.stdpath("data").."/venv/bin/python3"
|
Loading…
Reference in a new issue