Sitelet https://github.com/NormalNvim/NormalNvim/pull/480/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 33 additions & 31 deletions lua/base/4-mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ maps.n["k"] =
{ "v:count == 0 ? 'gk' : 'k'", expr = true, desc = "Move cursor up" }
maps.n["<leader>w"] = { "<cmd>w<cr>", desc = "Save" }
maps.n["<leader>W"] =
{ function() vim.cmd "SudaWrite" end, desc = "Save as sudo" }
{ function() vim.cmd("SudaWrite") end, desc = "Save as sudo" }
maps.n["<leader>n"] = { "<cmd>enew<cr>", desc = "New file" }
maps.n["<Leader>/"] = { "gcc", remap = true, desc = "Toggle comment line" }
maps.x["<Leader>/"] = { "gc", remap = true, desc = "Toggle comment" }
Expand Down Expand Up @@ -194,8 +194,8 @@ maps.x["P"] = { "p", desc = "Yank what you are going to override, then paste" }
-- to avoid triggering it by accident.
maps.n["<ESC>"] = {
function()
if vim.fn.hlexists "Search" then
vim.cmd "nohlsearch"
if vim.fn.hlexists("Search") then
vim.cmd("nohlsearch")
else
vim.api.nvim_feedkeys(
vim.api.nvim_replace_termcodes("<ESC>", true, true, true),
Expand All @@ -219,7 +219,7 @@ maps.n["gg"] = {
if vim.v.count > 0 then
vim.cmd("normal! " .. vim.v.count .. "gg")
else
vim.cmd "normal! gg0"
vim.cmd("normal! gg0")
end
vim.g.minianimate_disable = false
end,
Expand All @@ -228,7 +228,7 @@ maps.n["gg"] = {
maps.n["G"] = {
function()
vim.g.minianimate_disable = true
vim.cmd "normal! G$"
vim.cmd("normal! G$")
vim.g.minianimate_disable = false
end,
desc = "G and go to the last position",
Expand All @@ -239,7 +239,7 @@ maps.x["gg"] = {
if vim.v.count > 0 then
vim.cmd("normal! " .. vim.v.count .. "gg")
else
vim.cmd "normal! gg0"
vim.cmd("normal! gg0")
end
vim.g.minianimate_disable = false
end,
Expand All @@ -248,15 +248,15 @@ maps.x["gg"] = {
maps.x["G"] = {
function()
vim.g.minianimate_disable = true
vim.cmd "normal! G$"
vim.cmd("normal! G$")
vim.g.minianimate_disable = false
end,
desc = "G and go to the last position (visual)",
}
maps.n["<C-a>"] = { -- to move to the previous position press ctrl + oo
function()
vim.g.minianimate_disable = true
vim.cmd "normal! gg0vG$"
vim.cmd("normal! gg0vG$")
vim.g.minianimate_disable = false
end,
desc = "Visually select all",
Expand Down Expand Up @@ -302,7 +302,7 @@ maps.n["<leader>C"] = { -- Close buffer keeping the window.
-- desc = "Force close buffer",
--
maps.n["<leader>ba"] = {
function() vim.cmd "wa" end,
function() vim.cmd("wa") end,
desc = "Write all changed buffers",
}
maps.n["]b"] = {
Expand Down Expand Up @@ -486,7 +486,7 @@ maps.n["<S-PageDown>"] = {
local target_line = current_line + 1 + math.floor(total_lines * 0.20)
if target_line > total_lines then target_line = total_lines end
vim.api.nvim_win_set_cursor(0, { target_line, 0 })
vim.cmd "normal! zz"
vim.cmd("normal! zz")
end,
desc = "Page down exactly a 20% of the total size of the buffer",
}
Expand All @@ -496,7 +496,7 @@ maps.n["<S-PageUp>"] = {
local target_line = current_line - 1 - math.floor(vim.fn.line "$" * 0.20)
if target_line < 1 then target_line = 1 end
vim.api.nvim_win_set_cursor(0, { target_line, 0 })
vim.cmd "normal! zz"
vim.cmd("normal! zz")
end,
desc = "Page up exactly 20% of the total size of the buffer",
}
Expand Down Expand Up @@ -626,7 +626,7 @@ end
-- git fugitive
if is_available "vim-fugitive" then
maps.n["<leader>gP"] = {
function() vim.cmd ":GBrowse" end,
function() vim.cmd(":GBrowse") end,
desc = "Open in github ",
}
end
Expand All @@ -636,7 +636,7 @@ if vim.fn.executable "lazygit" == 1 then -- if lazygit exists, show it
function()
local git_dir = vim.fn.finddir(".git", vim.fn.getcwd() .. ";")
if git_dir ~= "" then
vim.cmd "TermExec cmd='lazygit && exit'"
vim.cmd("TermExec cmd='lazygit && exit'")
else
utils.notify("Not a git repository", vim.log.levels.WARN)
end
Expand All @@ -650,9 +650,9 @@ if vim.fn.executable "gitui" == 1 then -- if gitui exists, show it
local git_dir = vim.fn.finddir(".git", vim.fn.getcwd() .. ";")
if git_dir ~= "" then
if vim.fn.executable "keychain" == 1 then
vim.cmd 'TermExec cmd="eval `keychain --eval ~/.ssh/github.key` && gitui && exit"'
vim.cmd('TermExec cmd="eval `keychain --eval ~/.ssh/github.key` && gitui && exit"')
else
vim.cmd "TermExec cmd='gitui && exit'"
vim.cmd("TermExec cmd='gitui && exit'")
end
else
utils.notify("Not a git repository", vim.log.levels.WARN)
Expand All @@ -663,9 +663,11 @@ if vim.fn.executable "gitui" == 1 then -- if gitui exists, show it
end

-- file browsers ------------------------------------
-- ranger
if is_available "rnvimr" then
maps.n["<leader>r"] = { "<cmd>RnvimrToggle<cr>", desc = "Ranger" }
if is_available("yazi.nvim") then
maps.n["<leader>r"] = {
function() vim.cmd("YaziToggle") end,
desc = "File browser",
}
end

-- neotree
Expand Down Expand Up @@ -960,7 +962,7 @@ if is_available "telescope.nvim" then
-- extra - project.nvim
if is_available "project.nvim" then
maps.n["<leader>fp"] = {
function() vim.cmd "Telescope projects" end,
function() vim.cmd("Telescope projects") end,
desc = "Find project",
}
end
Expand Down Expand Up @@ -1010,27 +1012,27 @@ if is_available "telescope.nvim" then
if is_available "compiler.nvim" and is_available "overseer.nvim" then
maps.n["<leader>m"] = icons.c
maps.n["<leader>mm"] = {
function() vim.cmd "CompilerOpen" end,
function() vim.cmdc"CompilerOpen") end,
desc = "Open compiler",
}
maps.n["<leader>mr"] = {
function() vim.cmd "CompilerRedo" end,
function() vim.cmd("CompilerRedo") end,
desc = "Compiler redo",
}
maps.n["<leader>mt"] = {
function() vim.cmd "CompilerToggleResults" end,
function() vim.cmd("CompilerToggleResults") end,
desc = "compiler results",
}
maps.n["<F6>"] = {
function() vim.cmd "CompilerOpen" end,
function() vim.cmd("CompilerOpen") end,
desc = "Open compiler",
}
maps.n["<S-F6>"] = {
function() vim.cmd "CompilerRedo" end,
function() vim.cmd("CompilerRedo") end,
desc = "Compiler redo",
}
maps.n["<S-F7>"] = {
function() vim.cmd "CompilerToggleResults" end,
function() vim.cmd("CompilerToggleResults") end,
desc = "compiler resume",
}
end
Expand Down Expand Up @@ -1222,11 +1224,11 @@ end

-- Extra - nodejs testing commands
maps.n["<leader>Ta"] = {
function() vim.cmd "TestNodejs" end,
function() vim.cmd("TestNodejs") end,
desc = "All",
}
maps.n["<leader>Te"] = {
function() vim.cmd "TestNodejsE2e" end,
function() vim.cmd("TestNodejsE2e") end,
desc = "E2e",
}

Expand Down Expand Up @@ -1266,7 +1268,7 @@ if is_available "markdown-preview.nivm" or is_available "markmap.nvim" or is_ava
-- Markdown preview
if is_available "markdown-preview.nvim" then
maps.n["<leader>Dp"] = {
function() vim.cmd "MarkdownPreview" end,
function() vim.cmd("MarkdownPreview") end,
desc = "Markdown preview",
}
end
Expand All @@ -1276,9 +1278,9 @@ if is_available "markdown-preview.nivm" or is_available "markmap.nvim" or is_ava
maps.n["<leader>Dm"] = {
function()
if is_android then
vim.cmd "MarkmapWatch"
vim.cmd("MarkmapWatch")
else
vim.cmd "MarkmapOpen"
vim.cmd("MarkmapOpen")
end
end,
desc = "Markmap",
Expand All @@ -1287,7 +1289,7 @@ if is_available "markdown-preview.nivm" or is_available "markmap.nvim" or is_ava

if is_available "dooku.nvim" then
maps.n["<leader>Dd"] = {
function() vim.cmd ":DookuGenerate" end,
function() vim.cmd(":DookuGenerate") end,
desc = "Open documentation",
}
end
Expand Down
10 changes: 2 additions & 8 deletions lua/base/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,9 @@ function M.check()
msg = "Used for mappings to pull up git TUI (Optional)",
},
{
cmd = { "pynvim" },
cmd = { "yazi" },
type = "warn",
msg =
"Used to enable ranger file browser (optional)\nNOTE: checkhealth won't detect this correctly, but you can ensure it is installed with 'pip list | grep pynvim'.",
},
{
cmd = { "ranger" },
type = "warn",
msg = "Used to enable ranger file browser (Optional)",
msg = "Used to enable yazi file browser (Optional)",
},
{
cmd = { "delta" },
Expand Down
44 changes: 14 additions & 30 deletions lua/plugins/1-base-behaviors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Things that add new behaviors.

-- Sections:
-- -> ranger file browser [ranger]
-- -> yazi file browser [yazi]
-- -> project.nvim [project search + auto cd]
-- -> trim.nvim [auto trim spaces]
-- -> stickybuf.nvim [lock special buffers]
Expand All @@ -24,39 +24,23 @@
-- -> nvim-lightbulb [lightbulb for code actions]
-- -> distroupdate.nvim [distro update]

local is_windows = vim.fn.has('win32') == 1 -- true if on windows
local is_android = vim.fn.isdirectory('/data') == 1 -- true if on android

return {
-- [ranger] file browser
-- https://github.com/kevinhwang91/rnvimr
-- This is NormalNvim file browser, which is only for Linux.
--
-- If you are on Windows, you have 3 options:
-- * Use neotree instead (<space>+e).
-- * Delete rnvimr and install some other file browser you like.
-- * Or enable WLS on Windows and launch neovim from there.
-- This way you can install and use 'ranger' and its dependency 'pynvim'.

-- [yazi] file browser
-- https://github.com/mikavilpas/yazi.nvim
-- Make sure you have yazi installed on your system!
{
"kevinhwang91/rnvimr",
"mikavilpas/yazi.nvim",
event = "User BaseDefered",
cmd = { "RnvimrToggle" },
enabled = not is_windows,
config = function()
-- vim.g.rnvimr_vanilla = 1 -- Often solves issues in your ranger config.
vim.g.rnvimr_enable_picker = 1 -- Close rnvimr after choosing a file.
vim.g.rnvimr_ranger_cmd = { "ranger" } -- By passing a script like TERM=foot ranger "$@" you can open terminals inside ranger.
if is_android then -- Open on full screenn
vim.g.rnvimr_layout = {
relative = "editor",
width = 200,
height = 100,
col = 0,
row = 0,
style = "minimal",
}
end
end,
cmd = { "Yazi", "YaziCWD", "YaziToggle" },
opts = {
open_for_directories = true,
use_ya_for_events_reading = true,
use_yazi_client_id_flag = true,
floating_window_scaling_factor = (is_android and 1.0) or 0.71
},
},

-- project.nvim [project search + auto cd]
Expand Down Expand Up @@ -146,7 +130,7 @@ return {
event = "User BaseDefered",
opts = {
timeout = 300,
},
}
},

-- Toggle floating terminal on <F7> [term]
Expand Down
7 changes: 1 addition & 6 deletions lua/plugins/2-ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,11 @@ return {
dashboard.section.header.opts.hl = "DashboardHeader"
vim.cmd "highlight DashboardHeader guifg=#F7778F"

-- If on windows, don't show the 'ranger' button
local ranger_button = dashboard.button("r", "🐍 Ranger ", "<cmd>RnvimrToggle<CR>")
if is_windows then ranger_button = nil end

-- Buttons
dashboard.section.buttons.val = {
dashboard.button("n", "📄 New ", "<cmd>ene<CR>"),
dashboard.button("e", "🌺 Recent ", "<cmd>Telescope oldfiles<CR>"),
ranger_button,
dashboard.button("r", "🦆 Yazi ", "<cmd>Yazi<CR>"),
dashboard.button(
"s",
"🔎 Sessions",
Expand Down Expand Up @@ -566,7 +562,6 @@ return {
},
config = function(_, opts)
require("nvim-web-devicons").setup(opts)
pcall(vim.api.nvim_del_user_command, "NvimWebDeviconsHiTest")
end
},

Expand Down
5 changes: 1 addition & 4 deletions lua/plugins/3-dev-core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,7 @@ return {
{ path = "luvit-meta/library", mods = { "vim%.uv" } },
}
end,
specs = {
{ "Bilal2453/luvit-meta", lazy = true },
-- { "folke/neodev.nvim", lazy = true}
},
specs = { { "Bilal2453/luvit-meta", lazy = true } },
},

-- AUTO COMPLETION --------------------------------------------------------
Expand Down