From 93ef9d9a8b3bc4386c250951f4772ac9ea4ea76a Mon Sep 17 00:00:00 2001 From: pegasust Date: Thu, 29 Dec 2022 20:19:02 -0700 Subject: [PATCH] zsh vi-mode is ok. multiline command editing only possible once it hits history, though --- .luarc.json | 5 ++++- native_configs/neovim/init.lua | 23 +++++++++++++++++++++-- nix-conf/home-manager/base/shells.nix | 14 +++++++++++++- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.luarc.json b/.luarc.json index e1b9d70..ac13922 100644 --- a/.luarc.json +++ b/.luarc.json @@ -1,4 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "Lua.diagnostics.globals": [ + "vim", + ], "Lua.workspace.checkThirdParty": false -} \ No newline at end of file +} diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 37ae0d4..38ad227 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -94,6 +94,25 @@ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) endif ]]) +-- special terminals, place them at 4..=7 for ergonomics +vim.api.nvim_create_autocmd({"VimEnter"}, { + callback = function() + -- term:ctl at 4 + require('harpoon.term').gotoTerminal(4) + vim.cmd([[:exe ":file term:ctl"]]) + -- term:dev at 5 + require('harpoon.term').gotoTerminal(5) + vim.cmd([[:exe ":file term:dev"]]) + -- term:repl at 7 + require('harpoon.term').gotoTerminal(7) + vim.cmd([[:exe ":file term:repl"]]) + -- term:repl at 6 + require('harpoon.term').gotoTerminal(6) + vim.cmd([[:exe ":file term:repl2"]]) + end +}) + + vim.cmd([[ set ignorecase set smartcase @@ -130,8 +149,8 @@ vim.g.maplocalleader = ',' -- basic keymaps vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) -- since we're using space for leader -vim.keymap.set('t', '', ')') -- make :terminal escape out -vim.keymap.set({ 'n', 'i', 'v' }, '', ':mode') -- redraw on every mode +vim.keymap.set('t', '', ')') -- make :terminal escape out +vim.keymap.set({ 'n', 'i', 'v' }, '', 'mode', {desc = ""}) -- redraw on every mode -- diagnostics (errors/warnings to be shown) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index a4803ea..4567c5b 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -81,7 +81,19 @@ in }; oh-my-zsh = { enable = true; - plugins = [ "git" "sudo" "command-not-found" "gitignore" "ripgrep" "rust" ]; + plugins = [ + "git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases + "sudo" # double-escape to prepend sudo + "command-not-found" # suggests which package to install; does not support nixos (we have solution already) + "gitignore" # `gi list` -> `gi java >>.gitignore` + "ripgrep" # adds completion for `rg` + "rust" # compe for rustc/cargo + "vi-mode" # edit promps with vi motions :) + ]; + }; + sessionVariables = { + VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true; + VI_MODE_SET_CURSOR = true; }; initExtra = cfg.shellInitExtra or ""; };