diff options
| author | triethyl <triethylammonium@pm.me> | 2025-07-07 11:43:06 -0400 |
|---|---|---|
| committer | triethyl <triethylammonium@pm.me> | 2025-07-07 11:43:06 -0400 |
| commit | be6c16189410b280dd9f94cc2821ffcbd721dbc2 (patch) | |
| tree | eabfba3f43b73d3db7503a02891db544bc2f77fd | |
| parent | 546752feb6576be92fe421be1998217aa7d657ff (diff) | |
working on neovim
Former-commit-id: 025d1930a0ae07909efe826cc902424ff57d5ce9
| -rw-r--r-- | pkgs/custom-neovim/Untitled | 1 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/init.lua | 1 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/mappings.lua | 38 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/neovide.lua | 46 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/options.lua | 26 | ||||
| -rw-r--r-- | pkgs/custom-neovim/config/lua/plugins/lualine.lua | 99 | ||||
| -rw-r--r-- | pkgs/custom-neovim/default.nix | 8 |
7 files changed, 170 insertions, 49 deletions
diff --git a/pkgs/custom-neovim/Untitled b/pkgs/custom-neovim/Untitled new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pkgs/custom-neovim/Untitled @@ -0,0 +1 @@ + diff --git a/pkgs/custom-neovim/config/init.lua b/pkgs/custom-neovim/config/init.lua index 365e231..ed13b55 100644 --- a/pkgs/custom-neovim/config/init.lua +++ b/pkgs/custom-neovim/config/init.lua @@ -5,6 +5,7 @@ require("utilities") require("options") require("mappings") require("autocommands") +require("neovide") -- Require plugin configs. -- UI Plugins: diff --git a/pkgs/custom-neovim/config/lua/mappings.lua b/pkgs/custom-neovim/config/lua/mappings.lua index efb1e85..1ffbadb 100644 --- a/pkgs/custom-neovim/config/lua/mappings.lua +++ b/pkgs/custom-neovim/config/lua/mappings.lua @@ -1,31 +1,29 @@ -- Keymap function. -local keymap = function(mode, key, desc, action) - vim.keymap.set(mode, key, action, {noremap = true, silent = true, desc = desc}) -end - local mapkey = utils.mapkey -- Map the leader key. vim.g.mapleader = ' ' -vim.keymap.set("n", "<C-c>", "gcc", {noremap = true, silent = true}) - -- Pickers -keymap("n", "<leader>f", "Open file picker", ":Pick files<cr>") -keymap("n", "<leader>c", "Open recent file picker", ":Pick oldfiles<cr>") -keymap("n", "<leader>e", "Open file explorer", ":Pick explorer<cr>") -keymap("n", "<leader>b", "Open buffer picker", ":Pick buffers<cr>") -keymap("n", "<leader>/", "Open live grep picker", ":Pick grep_live<cr>") -keymap("n", "<leader>\\", "Open command palette", ":Pick commands<cr>") -keymap("n", "<leader>?", "Open help picker", ":Pick help<cr>") -keymap("n", "<leader>'", "Open last picker", ":Pick resume<cr>") +mapkey("n", "<leader>f", "Open file picker", ":Telescope find_files<cr>") +mapkey("n", "<leader>c", "Open recent file picker", ":Telescope oldfiles<cr>") +-- mapkey("n", "<leader>e", "Open file explorer", ":Pick explorer<cr>") +mapkey("n", "<leader>b", "Open buffer picker", ":Telescope buffers<cr>") +mapkey("n", "<leader>/", "Open live grep picker", ":Telescope live_grep<cr>") +mapkey("n", "<leader>\\", "Open command palette", ":Telescope commands<cr>") +mapkey("n", "<leader>?", "Open help picker", ":Telescope help<cr>") +mapkey("n", "<leader>'", "Open last picker", ":Telescope resume<cr>") -- Tabs -keymap("n", "<leader>t", "Manage tabs", "") -keymap("n", "<leader>tt", "Open new tab", ":tabnew<cr>") -keymap("n", "<leader>tq", "Close tab", ":tabclose<cr>") -keymap("n", "<leader>tn", "Go to next tab", ":tabnext<cr>") -keymap("n", "<leader>tp", "Go to previous tab", ":tabprev<cr>") +mapkey("n", "<leader>t", "Manage tabs", "") +mapkey("n", "<leader>tt", "Open new tab", ":tabnew<cr>") +mapkey("n", "<leader>tq", "Close tab", ":tabclose<cr>") +mapkey("n", "<leader>tn", "Go to next tab", ":tabnext<cr>") +mapkey("n", "<leader>tp", "Go to previous tab", ":tabprev<cr>") -- QOL Keys -keymap("t", "<Esc><Esc>", "Exit terminal insert mode", "<C-\\><C-n>") +mapkey("t", "<Esc><Esc>", "Exit terminal insert mode", "<C-\\><C-n>") +vim.keymap.set("c", "<cr>", function() + if vim.fn.pumvisible() == 1 then return '<c-y>' end + return '<cr>' +end, { expr = true }) -- Make enter complete command. diff --git a/pkgs/custom-neovim/config/lua/neovide.lua b/pkgs/custom-neovim/config/lua/neovide.lua new file mode 100644 index 0000000..0476765 --- /dev/null +++ b/pkgs/custom-neovim/config/lua/neovide.lua @@ -0,0 +1,46 @@ +if vim.g.neovide then + vim.o.guifont = "CodeNewRoman Nerd Font:h12" + vim.g.neovide_scale_factor = 0.8 + + -- Zoom keymaps. + local change_scale_factor = function(delta) + vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta + end + vim.keymap.set("n", "<C-=>", function() + change_scale_factor(1.1) + end) + vim.keymap.set("n", "<C-->", function() + change_scale_factor(1/1.1) + end) + + -- Standard terminal emulator keymaps. + vim.api.nvim_set_keymap("c", "<sc-v>", "<C-R>+", { noremap = true }) -- Paste in command mode. + vim.api.nvim_set_keymap('t', '<sc-v>', '<C-\\><C-n>"+Pi', {noremap = true}) -- Paste in terminal mode. + + + local positionAnimationLength = 0.2 + local scrollAnimationFarLines = 0.1 + local scrollAnimationLength = 0.1 + vim.g.neovide_position_animation_length = positionAnimationLength + vim.g.neovide_scroll_animation_far_lines = scrollAnimationFarLines + vim.g.neovide_scroll_animation_length = scrollAnimationLength + + -- Don't smooth scroll in terminals. + vim.api.nvim_create_autocmd("BufEnter", { + pattern = "*", + callback = function(args) + local filetype = vim.api.nvim_buf_get_option(args.buf, "filetype") + + -- When entering terminal for first time I noticed the filetype is empty + if filetype == '' or filetype == 'terminal' then + vim.g.neovide_position_animation_length = 0 + vim.g.neovide_scroll_animation_far_lines = 0 + vim.g.neovide_scroll_animation_length = 0 + else + vim.g.neovide_position_animation_length = positionAnimationLength + vim.g.neovide_scroll_animation_far_lines = scrollAnimationFarLines + vim.g.neovide_scroll_animation_length = scrollAnimationLength + end + end, + }) +end diff --git a/pkgs/custom-neovim/config/lua/options.lua b/pkgs/custom-neovim/config/lua/options.lua index ae6fb0a..a51e319 100644 --- a/pkgs/custom-neovim/config/lua/options.lua +++ b/pkgs/custom-neovim/config/lua/options.lua @@ -1,5 +1,6 @@ -- General Settings vim.o.winborder = 'rounded' +vim.o.showtabline = 1 vim.o.showmode = false vim.o.icm = 'split' vim.o.cia = 'abbr,kind,menu' @@ -9,10 +10,6 @@ vim.o.scrolloff = 4 -- minimal number of screen lines to keep above and below th vim.o.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time vim.o.clipboard = "unnamedplus" -- use system clipboard vim.o.sessionoptions = 'curdir,folds,globals,help,tabpages,terminal,winsize' -- Things to save with the session. -vim.keymap.set("c", "<cr>", function() - if vim.fn.pumvisible() == 1 then return '<c-y>' end - return '<cr>' -end, { expr = true }) -- Make enter complete command. -- Indention local indent = 2 @@ -44,24 +41,3 @@ vim.o.foldtext = "" -- Color text in folds. -- Set Colorscheme vim.cmd.colorscheme("oxocarbon") vim.o.termguicolors = true - --- Neovide -if vim.g.neovide then - vim.o.guifont = "CodeNewRoman Nerd Font:h12" - vim.g.neovide_scale_factor = 0.8 - - -- Zoom keymaps. - local change_scale_factor = function(delta) - vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta - end - vim.keymap.set("n", "<C-=>", function() - change_scale_factor(1.1) - end) - vim.keymap.set("n", "<C-->", function() - change_scale_factor(1/1.1) - end) - - -- Standard terminal emulator keymaps. - vim.api.nvim_set_keymap("c", "<sc-v>", "<C-R>+", { noremap = true }) -- Paste in command mode. - vim.api.nvim_set_keymap('t', '<sc-v>', '<C-\\><C-n>"+Pi', {noremap = true}) -- Paste in terminal mode. -end diff --git a/pkgs/custom-neovim/config/lua/plugins/lualine.lua b/pkgs/custom-neovim/config/lua/plugins/lualine.lua index 9814cae..409c452 100644 --- a/pkgs/custom-neovim/config/lua/plugins/lualine.lua +++ b/pkgs/custom-neovim/config/lua/plugins/lualine.lua @@ -1 +1,98 @@ -require("lualine").setup() +local auto_theme = require("lualine.themes.auto") + +local colors = { + modes = { + normal = auto_theme.normal.a.bg, + insert = auto_theme.insert.a.bg, + visual = auto_theme.visual.a.bg, + replace = auto_theme.replace.a.bg, + command = auto_theme.command.a.bg, + inactive = auto_theme.inactive.a.bg, + }, + text = { + dark = auto_theme.normal.a.fg, + light = auto_theme.normal.c.fg, + }, + backdrop = auto_theme.normal.c.bg, +} + +local custom_auto_theme = { + normal = { + a = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.backdrop, fg = colors.text.light}, + c = {bg = colors.backdrop, fg = colors.text.light}, + x = {bg = colors.backdrop, fg = colors.text.light}, + y = {bg = colors.backdrop, fg = colors.text.light}, + z = {bg = colors.modes.normal, fg = colors.text.dark, gui = 'bold'}, + }, + insert = { + a = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.backdrop, fg = colors.text.light}, + c = {bg = colors.backdrop, fg = colors.text.light}, + x = {bg = colors.backdrop, fg = colors.text.light}, + y = {bg = colors.backdrop, fg = colors.text.light}, + z = {bg = colors.modes.insert, fg = colors.text.dark, gui = 'bold'}, + }, + visual = { + a = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.backdrop, fg = colors.text.light}, + c = {bg = colors.backdrop, fg = colors.text.light}, + x = {bg = colors.backdrop, fg = colors.text.light}, + y = {bg = colors.backdrop, fg = colors.text.light}, + z = {bg = colors.modes.visual, fg = colors.text.dark, gui = 'bold'}, + }, + replace = { + a = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.backdrop, fg = colors.text.light}, + c = {bg = colors.backdrop, fg = colors.text.light}, + x = {bg = colors.backdrop, fg = colors.text.light}, + y = {bg = colors.backdrop, fg = colors.text.light}, + z = {bg = colors.modes.replace, fg = colors.text.dark, gui = 'bold'}, + }, + command = { + a = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.backdrop, fg = colors.text.light}, + c = {bg = colors.backdrop, fg = colors.text.light}, + x = {bg = colors.backdrop, fg = colors.text.light}, + y = {bg = colors.backdrop, fg = colors.text.light}, + z = {bg = colors.modes.command, fg = colors.text.dark, gui = 'bold'}, + }, + inactive = { + a = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, + b = {bg = colors.backdrop, fg = colors.text.light}, + c = {bg = colors.backdrop, fg = colors.text.light}, + x = {bg = colors.backdrop, fg = colors.text.light}, + y = {bg = colors.backdrop, fg = colors.text.light}, + z = {bg = colors.modes.inactive, fg = colors.text.dark, gui = 'bold'}, + }, +}; + +require('lualine').setup { + options = { + theme = custom_auto_theme, + component_separators = "", + section_separators = { left = '', right = '' }, + }, + sections = { + lualine_a = { { 'mode', separator = { left = '', rignt = '' }, right_padding = 2 } }, + lualine_b = { 'filename', 'branch' }, + lualine_c = { + '%=', --[[ add your center components here in place of this comment ]] + }, + lualine_x = {}, + lualine_y = { 'filetype', 'progress' }, + lualine_z = { + { 'location', separator = { left = '', right = '' }, left_padding = 2 }, + }, + }, + inactive_sections = { + lualine_a = { 'filename' }, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = { 'location' }, + }, + tabline = {}, + extensions = {}, +} diff --git a/pkgs/custom-neovim/default.nix b/pkgs/custom-neovim/default.nix index 06ad3b2..e8bf783 100644 --- a/pkgs/custom-neovim/default.nix +++ b/pkgs/custom-neovim/default.nix @@ -13,11 +13,13 @@ inputs.mnw.lib.wrap pkgs { # Core Plugins mini-nvim # Ton of small modules. nvim-lspconfig # Adds lsp presets. - # actions-preview-nvim # Adds a selector for LSP actions. + actions-preview-nvim # Adds a selector for LSP actions. nvim-treesitter.withAllGrammars # All treesitter grammars. - # tabby-nvim # Tab bar. + tabby-nvim # Tab bar. # friendly-snippets # Extra snippets. - lualine-nvim + lualine-nvim # Status line. + telescope-nvim # Picker. + plenary-nvim # General Library. # Colorschemes oxocarbon-nvim # IBM Carbon themes. |
