mirror of
https://github.com/zoriya/flake.git
synced 2026-06-01 10:15:45 +00:00
Add a basic nvim config
This commit is contained in:
@@ -110,6 +110,7 @@
|
||||
apps.enable = true;
|
||||
zsh.enable = true;
|
||||
git.enable = true;
|
||||
nvim.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
./apps
|
||||
./zsh
|
||||
./git
|
||||
./nvim
|
||||
];
|
||||
|
||||
home.stateVersion = "22.11";
|
||||
|
||||
@@ -16,6 +16,9 @@ in {
|
||||
xorg.xprop
|
||||
discord
|
||||
kitty
|
||||
grim
|
||||
slurp
|
||||
wl-clipboard
|
||||
];
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
|
||||
@@ -129,11 +129,6 @@ bind = $mainMod SHIFT, F, fakefullscreen,
|
||||
bind = $mainMod, backslash, togglespecialworkspace, special:default
|
||||
bind = $mainMod, V, togglefloating,
|
||||
|
||||
bind = $mainMod, E, exec, kitty
|
||||
bind = $mainMod, R, exec, google-chrome-stable
|
||||
bind = $mainMod, P, exec, rofi -show run
|
||||
bindr = SUPER, SUPER_L, exec, ~/.config/eww/togglepanel.sh
|
||||
|
||||
# Move focus with mainMod + arrow keys
|
||||
bind = $mainMod, left, movefocus, l
|
||||
bind = $mainMod, right, movefocus, r
|
||||
@@ -171,6 +166,12 @@ bind = $mainMod SHIFT, S, movetoworkspace, special:default
|
||||
bindm = $mainMod, mouse:272, movewindow
|
||||
bindm = $mainMod, mouse:273, resizewindow
|
||||
|
||||
bind = $mainMod, E, exec, kitty
|
||||
bind = $mainMod, R, exec, google-chrome-stable
|
||||
bind = $mainMod, P, exec, rofi -show run
|
||||
bind = $mainMod, X, exec, grim -g "$(slurp -b 00000000 -s 61616140)" - | wl-copy
|
||||
#bindr = SUPER, SUPER_L, exec, ~/.config/eww/togglepanel.sh
|
||||
|
||||
bindl=,XF86MonBrightnessUp,exec,brightnessctl set 5%+
|
||||
bindl=,XF86MonBrightnessDown,exec,brightnessctl set 5%-
|
||||
bindl=,XF86AudioRaiseVolume,exec,pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.modules.nvim;
|
||||
in {
|
||||
options.modules.nvim = {enable = lib.mkEnableOption "nvim";};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = with pkgs; [neovim];
|
||||
|
||||
xdg.configFile."nvim".source = ./.;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
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)
|
||||
|
||||
require("./settings");
|
||||
require("lazy").setup("plugins");
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"catppuccin": { "branch": "main", "commit": "fe32c776d86e8ba608e6294c43302c985835bfea" },
|
||||
"increment-activator": { "branch": "master", "commit": "55efcff88be45bd98cfdf7333dd718399373d10c" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "8077428e63feb0f3bf795d53b23ba1695b28ab0e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "e99d733e0213ceb8f548ae6551b04ae32e590c80" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "245cf1e68840defcc75a16297740f6203f5a045d" },
|
||||
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "b5db147e28337319331d516a826b00976f3584de" },
|
||||
"nvim-navic": { "branch": "master", "commit": "7e9d2b2b601149fecdccd11b516acb721e571fe6" },
|
||||
"nvim-scrollbar": { "branch": "main", "commit": "75210c554e935740448cfb532d8a671ae544bb1b" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "4709a504d2cd2680fb511675e64ef2790d491d36" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" },
|
||||
"telescope-fzf-native.nvim": { "branch": "feature/69-prebuilt-release-binaries", "commit": "6388c4f4ec5eab8b89f974a9fa57fc955a67bbb2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "f40e3e2304c633411ddf266075f7db5184b1db02" },
|
||||
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-unimpaired": { "branch": "master", "commit": "6d44a6dc2ec34607c41ec78acf81657248580bf1" },
|
||||
"virt-column.nvim": { "branch": "master", "commit": "93b40ea038f676f5a72d7d1f2336fe7b051fc0ce" }
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
return {
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
local gps = require("nvim-navic")
|
||||
local toggleterm = {
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{
|
||||
'mode',
|
||||
fmt = function(str) return string.format("%7s", str) end
|
||||
},
|
||||
},
|
||||
lualine_b = {
|
||||
function()
|
||||
return 'ToggleTerm #' .. vim.b.toggle_number
|
||||
end
|
||||
}
|
||||
},
|
||||
filetypes = { "toggleterm" },
|
||||
}
|
||||
|
||||
return {
|
||||
options = {
|
||||
theme = "auto",
|
||||
component_separators = '|',
|
||||
section_separators = { left = '', right = '' },
|
||||
always_divide_middle = true,
|
||||
globalstatus = true,
|
||||
disabled_filetypes = {},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{
|
||||
'mode',
|
||||
fmt = function(str) return string.format("%7s", str) end
|
||||
},
|
||||
},
|
||||
lualine_b = {
|
||||
{
|
||||
"diagnostics",
|
||||
sources = {
|
||||
function()
|
||||
local diag_severity = vim.diagnostic.severity
|
||||
|
||||
local function workspace_diag(severity)
|
||||
local count = vim.diagnostic.get(nil, { severity = severity })
|
||||
return vim.tbl_count(count)
|
||||
end
|
||||
|
||||
return {
|
||||
error = workspace_diag(diag_severity.ERROR),
|
||||
warn = workspace_diag(diag_severity.WARN),
|
||||
info = workspace_diag(diag_severity.INFO),
|
||||
hint = workspace_diag(diag_severity.HINT)
|
||||
}
|
||||
end,
|
||||
},
|
||||
sections = { "error", "warn" },
|
||||
symbols = { error = " ", warn = " " },
|
||||
always_visible = false,
|
||||
}
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
function()
|
||||
return ""
|
||||
end,
|
||||
color = "ErrorMsg",
|
||||
cond = function() return not auto_save_state end,
|
||||
},
|
||||
{ 'filetype', colored = true, icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{
|
||||
'filename',
|
||||
separator = '>',
|
||||
path = 0,
|
||||
symbols = {
|
||||
modified = '',
|
||||
readonly = '[-]',
|
||||
unnamed = '[No Name]',
|
||||
},
|
||||
},
|
||||
{ gps.get_location, cond = gps.is_available },
|
||||
},
|
||||
lualine_x = {
|
||||
-- require "dap".status,
|
||||
'fileformat',
|
||||
},
|
||||
lualine_y = { 'branch', 'progress' },
|
||||
lualine_z = {
|
||||
{
|
||||
'location',
|
||||
},
|
||||
},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {
|
||||
"quickfix",
|
||||
"neo-tree",
|
||||
"fugitive",
|
||||
toggleterm
|
||||
},
|
||||
}
|
||||
end
|
||||
},
|
||||
{
|
||||
"SmiteshP/nvim-navic",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
opts = {highlight = true},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
return {
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
integrations = {
|
||||
which_key = true,
|
||||
lsp_trouble = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
neotree = true,
|
||||
harpoon = true,
|
||||
gitsigns = true,
|
||||
semantic_tokens = true,
|
||||
indent_blankline = {
|
||||
enabled = true,
|
||||
},
|
||||
}
|
||||
})
|
||||
vim.cmd([[colorscheme catppuccin-mocha]])
|
||||
end
|
||||
},
|
||||
"tpope/vim-surround",
|
||||
"tpope/vim-sleuth",
|
||||
{ "tpope/vim-repeat", event = "VeryLazy" },
|
||||
{ "tpope/vim-unimpaired", config = function() vim.g.nremap = { ["[u"] = "", ["]u"] = "" } end },
|
||||
"nishigori/increment-activator",
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
return {
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
{
|
||||
"airtonix/telescope-fzf-native.nvim",
|
||||
branch = 'feature/69-prebuilt-release-binaries',
|
||||
build = function()
|
||||
require('telescope-fzf-native').download_library()
|
||||
end
|
||||
},
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
cmd = "Telescope",
|
||||
version = false, -- telescope did only one release, so use HEAD for now
|
||||
keys = {
|
||||
{ "<leader>f", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
|
||||
{ "<leader>F", "<cmd>Telescope live_grep<cr>", desc = "Grep" },
|
||||
{ "<leader>gl", "<cmd>Telescope git_commits<CR>", desc = "Git log" },
|
||||
{ "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "Git status" },
|
||||
},
|
||||
opts = function()
|
||||
local actions = require "telescope.actions"
|
||||
|
||||
return {
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
}
|
||||
},
|
||||
path_display = { "truncate" },
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close,
|
||||
["<C-h>"] = function () vim.api.nvim_input("<C-w>") end,
|
||||
["<C-BS>"] = function () vim.api.nvim_input("<C-w>") end,
|
||||
["<A-k>"] = actions.move_selection_previous,
|
||||
["<A-j>"] = actions.move_selection_next,
|
||||
["<c-t>"] = function()
|
||||
local has_trouble, trouble_action = pcall(require, "trouble.providers.telescope")
|
||||
if has_trouble then
|
||||
trouble_action.open_with_trouble()
|
||||
end
|
||||
end
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
}
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true,
|
||||
find_command = { "fd", "--type", "f", "--strip-cwd-prefix", "-E", ".git" },
|
||||
},
|
||||
git_status = {
|
||||
mappings = {
|
||||
i = {
|
||||
-- ["<c-c>"] = local_actions.commit,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
return {
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
cmd = "Neotree",
|
||||
keys = {
|
||||
{ "-", "<cmd>Neotree current dir=%:h reveal_force_cwd toggle<CR>", desc = "Toggle explorer", },
|
||||
{ "\\", "<cmd>Neotree current dir=%:h reveal_force_cwd toggle<CR>", desc = "Toggle explorer", },
|
||||
{ "<leader>e", "<cmd>Neotree left toggle<CR>", desc = "Toggle left explorer", },
|
||||
},
|
||||
deactivate = function()
|
||||
vim.cmd([[Neotree close]])
|
||||
end,
|
||||
init = function()
|
||||
vim.g.neo_tree_remove_legacy_commands = 1
|
||||
if vim.fn.argc() == 1 then
|
||||
local stat = vim.loop.fs_stat(vim.fn.argv(0))
|
||||
if stat and stat.type == "directory" then
|
||||
require("neo-tree")
|
||||
end
|
||||
end
|
||||
end,
|
||||
opts = {
|
||||
close_if_last_window = true,
|
||||
sort_case_insensitive = true,
|
||||
default_component_configs = {
|
||||
git_status = {
|
||||
symbols = {
|
||||
-- Change type
|
||||
added = "✚",
|
||||
deleted = "",
|
||||
modified = "",
|
||||
renamed = "",
|
||||
-- Status type
|
||||
untracked = "",
|
||||
ignored = "◌",
|
||||
unstaged = "",
|
||||
staged = "✓",
|
||||
conflict = "",
|
||||
},
|
||||
align = "left",
|
||||
},
|
||||
},
|
||||
window = {
|
||||
mappings = {
|
||||
["<space>"] = "none",
|
||||
},
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = true,
|
||||
hijack_netrw_behavior = "open_current",
|
||||
filtered_items = {
|
||||
hide_dotfiles = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
return {
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
event = { "BufReadPost", "BufNewFile" },
|
||||
opts = {
|
||||
char = "▏",
|
||||
filetype_exclude = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy" },
|
||||
show_trailing_blankline_indent = true,
|
||||
use_treesitter = true,
|
||||
show_current_context = true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"lukas-reineke/virt-column.nvim",
|
||||
lazy = true,
|
||||
config = true,
|
||||
init = function()
|
||||
vim.cmd [[
|
||||
augroup virtcolumn
|
||||
autocmd!
|
||||
autocmd FileType * if index(["netrw", "NvimTree", "neo-tree", "UltestAttach", "dap-float", "Trouble", "lspinfo", "qf", "harpoon", "toggleterm", "packer"], &ft) == -1 | lua require("virt-column").setup_buffer({ virtcolumn = "80,120", char = "▏" })
|
||||
augroup end
|
||||
]]
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"petertriho/nvim-scrollbar",
|
||||
-- TODO: Add colors highlights.
|
||||
config = true;
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
local options = {
|
||||
fileencoding = "utf-8",
|
||||
expandtab = false,
|
||||
shiftwidth = 4,
|
||||
tabstop = 4,
|
||||
cinoptions = {
|
||||
"(1s",
|
||||
"m1",
|
||||
},
|
||||
|
||||
hlsearch = true,
|
||||
ignorecase = true,
|
||||
smartcase = true,
|
||||
|
||||
mouse = "a",
|
||||
splitbelow = true,
|
||||
splitright = true,
|
||||
cursorline = true,
|
||||
sidescrolloff = 8,
|
||||
wrap = false,
|
||||
|
||||
termguicolors = true,
|
||||
swapfile = false,
|
||||
undofile = true,
|
||||
updatetime = 300, -- faster completion (4000ms default)
|
||||
|
||||
number = true,
|
||||
relativenumber = true,
|
||||
numberwidth = 4,
|
||||
signcolumn = "yes",
|
||||
|
||||
list = true,
|
||||
listchars = {
|
||||
space = "·",
|
||||
tab = "▷ ",
|
||||
extends = "◣",
|
||||
precedes = "◢",
|
||||
nbsp = "○",
|
||||
},
|
||||
fillchars = {
|
||||
diff = "╱",
|
||||
},
|
||||
}
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
vim.cmd("set formatoptions-=ro")
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_set_keymap
|
||||
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- Stay in indent mode
|
||||
keymap("v", "<", "<gv", opts)
|
||||
keymap("v", ">", ">gv", opts)
|
||||
|
||||
-- Move in insert mode --
|
||||
keymap("i", "<A-j>", "<Down>", opts)
|
||||
keymap("i", "<A-k>", "<Up>", opts)
|
||||
keymap("i", "<A-h>", "<Left>", opts)
|
||||
keymap("i", "<A-l>", "<Right>", opts)
|
||||
|
||||
keymap("i", "<C-BS>", "<C-w>", opts)
|
||||
keymap("c", "<C-BS>", "<C-w>", opts)
|
||||
keymap("i", "<C-H>", "<C-w>", opts) -- Keymap for CTRL-BACKSPACE on some termial emulators.
|
||||
keymap("c", "<C-H>", "<C-w>", opts)
|
||||
|
||||
keymap("n", "<leader>y", '"+y', opts)
|
||||
keymap("x", "<leader>y", '"+y', opts)
|
||||
keymap("n", "<leader>Y", '"+y$', opts)
|
||||
keymap("x", "<leader>Y", '"+y$', opts)
|
||||
|
||||
keymap("n", "<leader>p", '"+p', opts)
|
||||
keymap("x", "<leader>p", '"+p', opts)
|
||||
keymap("n", "<leader>P", '"+P', opts)
|
||||
keymap("x", "<leader>P", '"+P', opts)
|
||||
|
||||
|
||||
keymap("t", "<C-W>", "<C-\\><C-N><C-W>", opts)
|
||||
|
||||
vim.cmd("autocmd FileType qf setl nolist")
|
||||
vim.cmd("syntax on")
|
||||
vim.cmd [[
|
||||
augroup highlight_yank
|
||||
autocmd!
|
||||
autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200})
|
||||
augroup end
|
||||
]]
|
||||
|
||||
@@ -20,6 +20,7 @@ in {
|
||||
htop
|
||||
tldr
|
||||
jq
|
||||
fd
|
||||
ripgrep
|
||||
psmisc
|
||||
atuin
|
||||
|
||||
Reference in New Issue
Block a user