From 9f4e8fff21f1711273c67a3871fb36377e2c0302 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Tue, 18 Feb 2025 13:00:42 -0800 Subject: [PATCH] feat(home): Add ideavimrc --- modules/home/programs/gui/phpstorm/.ideavimrc | 464 ++++++++++++++++++ .../home/programs/gui/phpstorm/default.nix | 2 + 2 files changed, 466 insertions(+) create mode 100644 modules/home/programs/gui/phpstorm/.ideavimrc diff --git a/modules/home/programs/gui/phpstorm/.ideavimrc b/modules/home/programs/gui/phpstorm/.ideavimrc new file mode 100644 index 0000000..1215ed1 --- /dev/null +++ b/modules/home/programs/gui/phpstorm/.ideavimrc @@ -0,0 +1,464 @@ +" LazyVim key mappings for Jetbrains IDEs. + +" LazyVim default settings +" https://www.lazyvim.org/configuration/general + +let mapleader=" " +let maplocalleader="\\" + +" Confirm to save changes before exiting modified buffer +set formatoptions=jcroqlnt +" Print line number +set number +" Relative line numbers +set relativenumber +" Lines of context +set scrolloff=4 +" Round indent +set shiftround +" Columns of context +set sidescrolloff=8 +" which-key says to set this high, or set notimeout +set timeoutlen=10000 +set notimeout +set undolevels=10000 +" Disable line wrap +set nowrap + +" Neovim settings that differ from Vim +" https://neovim.io/doc/user/diff.html +" https://github.com/mikeslattery/nvim-defaults.vim/blob/main/plugin/.vimrc + +set backspace=indent,eol,start +set formatoptions=tcqj +set listchars=tab:>\ ,trail:-,nbsp:+ +set shortmess=filnxtToOF + +" Enable plugin behavior + +" https://github.com/JetBrains/ideavim/wiki/IdeaVim-Plugins +" https://www.lazyvim.org/plugins + +" gcc and gc mappings. +Plug 'tpope/vim-commentary' +" s action, such as cs"' (replace " with '), ds" (unquote) +Plug 'tpope/vim-surround' +" Enable the whichkey plugin, available on Jetbrains marketplace +set which-key +" Extended matching. A Neovim default plugin. +set matchit + +" Key maps + +" https://www.lazyvim.org/configuration/keymaps + +" To track Action-IDs +" :action VimFindActionIdAction + +" General Keymaps + +" Go to Left Window +nmap h +" Go to Lower Window +nmap j +" Go to Upper Window +nmap k +" Go to Right Window +nmap l +" Increase Window Height +nmap (IncrementWindowHeight) +" Decrease Window Height +nmap (DecrementWindowHeight) +" Decrease Window Width +nmap (DecrementWindowWidth) +" Increase Window Width +nmap (IncrementWindowWidth) +" Move Down +nmap (MoveLineDown) +imap (MoveLineDown)i +" Move Up +nmap (MoveLineUp) +imap (MoveLineUp)i +" Prev Buffer +nmap (PreviousTab) +" Next Buffer +nmap (NextTab) +" Prev Buffer (alternative) +nmap [b (PreviousTab) +" Next Buffer (alternative) +nmap ]b (NextTab) +" Switch to Other Buffer +nnoremap bb +" Switch to Other Buffer (alternative) +nnoremap ` +" Delete Buffer +nmap bd (CloseContent) +" Delete Buffer and Window +nmap bD (CloseContent) +" Delete Other Buffers +nmap bo (CloseAllEditorsButActive) +" Escape and Clear hlsearch +nmap :nohlsearch +nmap ur :nohlsearch +" Keywordprg +nmap K :help +" Add Comment Below +nmap gco ogcc +" Add Comment Above +nmap gcO Ogcc +" Lazy +nmap l (WelcomeScreen.Plugins) +" New File +nmap fn (NewElementSamePlace) +" Location List +nmap xl (ActivateProblemsViewToolWindow) +" Quickfix List +nmap xq (ActivateProblemsViewToolWindow) +" Previous Quickfix +nmap [q (GotoPreviousError) +" Next Quickfix +nmap ]q (GotoNextError) +" Format +nmap cf (Format) +vmap cf (Format) +" Line Diagnostics +nmap cd (ActivateProblemsViewToolWindow) +" Next Diagnostic +nmap ]d (GotoNextError) +" Prev Diagnostic +nmap [d (GotoPreviousError) +" Next Error +nmap ]e (GotoNextError) +" Prev Error +nmap [e (GotoPreviousError) +" Next Warning +nmap ]w (GotoNextError) +" Prev Warning +nmap [w (GotoPreviousError) +" Toggle Auto Format (Global) +nmap ub :echo 'There is no equivalent mapping for Toggle Auto Format.' +" Toggle Auto Format (Buffer) +nmap uB :echo 'There is no equivalent mapping for Toggle Auto Format.' +" Toggle Spelling +nmap us :setlocal spell! +" Toggle Wrap +nmap uw :setlocal wrap! +" Toggle Relative Number +nmap uL :set relativenumber! +" Toggle Diagnostics +nmap ud (ActivateProblemsViewToolWindow) +" Toggle Line Numbers +nmap ul :set number! +" Toggle conceallevel +nmap uc :echo 'There is no equivalent mapping for Toggle Conceallevel.' +" Toggle Treesitter Highlight +nmap uT :echo 'There is no equivalent mapping for Toggle Treesitter Highlight.' +" Toggle Background +nmap ub (QuickChangeScheme) +" Toggle Inlay Hints +nmap uh (ToggleInlayHintsGloballyAction) +" Lazygit (Root Dir) +nmap gg (ActivateCommitToolWindow) +" Lazygit (cwd) +nmap gG (ActivateCommitToolWindow) +" Git Blame Line +nmap gb (Annotate) +" Git Browse +nmap gB (Vcs.Show.Log) +" Lazygit Current File History +nmap gf (Vcs.ShowTabbedFileHistory) +" Lazygit Log +nmap gl (Vcs.Show.Log) +" Lazygit Log (cwd) +nmap gL (Vcs.Show.Log) +" Quit All +nmap qq (Exit) +" Inspect Pos +nmap ui (ActivateStructureToolWindow) +" Inspect Tree +nmap uI (ActivateStructureToolWindow) +" LazyVim Changelog +nmap L (WhatsNewAction) +" Terminal (Root Dir) +nmap ft (ActivateTerminalToolWindow) +" Terminal (cwd) +nmap fT (ActivateTerminalToolWindow) +" Terminal (Root Dir) +nmap (ActivateTerminalToolWindow) +" nmap 'There is no equivalent mapping for .' +" Hide Terminal - terminal mode maps not possible +" Split Window Below. :split doesn't work. +nmap - s +" Split Window Right +nmap v +" Delete Window +nmap wd (CloseContent) +" Toggle Maximize +nmap wm (ToggleDistractionFreeMode) + +" Tabs are treated as saved layouts + +" Last Tab +nmap l (StoreDefaultLayout)(ChangeToolWindowLayout) +" Close Other Tabs +nmap o : +" First Tab +nmap f (StoreDefaultLayout)(ChangeToolWindowLayout) +" New Tab +nmap f (StoreDefaultLayout)(StoreNewLayout) +" Next Tab +nmap ] (StoreDefaultLayout)(ChangeToolWindowLayout) +" Previous Tab +nmap [ (StoreDefaultLayout)(ChangeToolWindowLayout) +" Close Tab +nmap f (StoreDefaultLayout)(ChangeToolWindowLayout) + +" LSP Keymaps + +" Lsp Info +nmap cc :echo 'There is no equivalent mapping for Lsp Info.' +" Goto Definition +nmap gd (GotoDeclaration) +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" References +nmap gr (FindUsages) +" Goto Implementation +nmap gI (GotoImplementation) +" Goto Type Definition +nmap gy (GotoTypeDeclaration) +" Goto Declaration +nmap gD (GotoDeclaration) +" Signature Help +nmap gK (ParameterInfo) +" Signature Help in Insert Mode +imap (ParameterInfo) +" Code Action +nmap ca (RefactoringMenu) +vmap ca (RefactoringMenu) +" Run Codelens +nmap cc :echo 'There is no equivalent mapping for Run Codelens.' +" Refresh & Display Codelens +nmap cC :echo 'There is no equivalent mapping for Refresh & Display Codelens.' +" Rename File +nmap cR (RenameFile) +" Rename +nmap cr (RenameElement) +" Source Action +nmap cA (ShowIntentionActions) +" Next Reference +nmap ]] (GotoNextError) +" Prev Reference +nmap [[ (GotoPreviousError) +" Next Reference (alternative) +nmap (GotoNextError) +" Prev Reference (alternative) +nmap (GotoPreviousError) + +" Bufferline + +" Delete buffers to the left +nmap bl (CloseAllToTheLeft) +" Toggle pin +nmap bp (PinActiveTabToggle) +" Delete Non-Pinned Buffers +nmap bP (CloseAllUnpinnedEditors) +" Delete buffers to the right +nmap br (CloseAllToTheRight) + +" Neo-tree Keymaps + +" Buffer Explorer +nmap be (ActivateProjectToolWindow) +" Explorer NeoTree (Root Dir) +nmap e (FileStructurePopup) +" Explorer NeoTree (cwd) +nmap E (SelectInProjectView) +" Explorer NeoTree (Root Dir) (alternative) +nmap fe (ActivateProjectToolWindow) +" Explorer NeoTree (cwd) (alternative) +nmap fE (ActivateProjectToolWindow) +" Git Explorer +nmap ge (ActivateVersionControlToolWindow) + +" Notifications (noice, snacks) + +nmap snd (ClearAllNotifications) +nmap un (ClearAllNotifications) + +" Telescope Keymaps + +" Find Files (Root Dir) +nmap (GotoFile) +" Switch Buffer +nmap , (Switcher) +" Grep (Root Dir) +nmap / (FindInPath) +" Command History +nmap : :history +" Buffers +nmap fb (Switcher) +" Find Config File +nmap fc (GotoFile) +" Find Files (Root Dir) (alternative) +nmap ff (GotoFile) +" Find Files (cwd) +nmap fF (GotoFile) +" Find Files (git-files) +nmap fg (GotoFile) +" Recent +nmap fr (RecentFiles) +" Recent (cwd) +nmap fR (RecentFiles) +" Commits +nmap gc (Vcs.Show.Log) +" Status +nmap gs (Vcs.Show.Log) +" Registers +nmap s" :registers +" Auto Commands +nmap sa :echo 'There is no equivalent mapping.' +" Buffer +nmap sb (Switcher) +" Command History (alternative) +nmap sc :history +" Commands +nmap sC (GotoAction) +" Document Diagnostics +nmap sd (ActivateProblemsViewToolWindow) +" Workspace Diagnostics +nmap sD (ActivateProblemsViewToolWindow) +" Grep (Root Dir) (alternative) +nmap sg (FindInPath) +" Grep (cwd) +nmap sG (FindInPath) +" Help Pages +nmap sh (HelpTopics) +" Search Highlight Groups +nmap sH (HighlightUsagesInFile) +" Jumplist +nmap sj (RecentLocations) +" Key Maps +nmap sk :map +" Location List +nmap sl (ActivateProblemsViewToolWindow) +" Jump to Mark +nmap sm :marks +" Man Pages +nmap sM (ShowDocumentation) +" Options +nmap so (ShowSettings) +" Quickfix List +nmap sq (ActivateProblemsViewToolWindow) +" Resume +nmap sR :echo 'Not yet implmented.' +" Goto Symbol +nmap ss (GotoSymbol) +" Goto Symbol (Workspace) +nmap sS (GotoSymbol) +" Word (Root Dir) +nmap sw (FindWordAtCaret) +" Word (cwd) +nmap sW (FindWordAtCaret) +" Selection (Root Dir) +vmap sw (FindWordAtCaret) +" Selection (cwd) +vmap sW (FindWordAtCaret) +" Colorscheme with Preview +nmap uC (QuickChangeScheme) + + +" DAP Keymaps + +" Run with Args +nmap da (ChooseRunConfiguration) +" Toggle Breakpoint +nmap db (ToggleLineBreakpoint) +" Breakpoint Condition +nmap dB (AddConditionalBreakpoint) +" Continue +nmap dc (Resume) +" Run to Cursor +nmap dC (ForceRunToCursor) +" Go to Line (No Execute) +nmap dg :echo 'Not yet implemented.' +" Step Into +nmap di (StepInto) +" Down +nmap dj (GotoNextError) +" Up +nmap dk (GotoPreviousError) +" Run Last +nmap dl (Debug) +" Step Out +nmap do (StepOut) +" Step Over +nmap dO (StepOver) +" Pause +nmap dp (Pause) +" Toggle REPL +nmap dr (JShell.Console) +" Session +nmap ds :echo 'Not yet implmented.' +" Terminate +nmap dt (Stop) +" Widgets +nmap dw :echo 'There is no equivalent mapping for Widgets.' + +" Todo-comments Keymaps + +" Todo +nmap st oTODOgcc +" Todo/Fix/Fixme +nmap sT :echo 'Not yet implemented.' +" Todo (Trouble) +nmap xt :echo 'Not yet implemented.' +" Todo/Fix/Fixme (Trouble) +nmap xT :echo 'Not yet implemented.' +" Previous Todo Comment +nmap [t ?TODO +" Next Todo Comment +nmap ]t /TODO + +" DAP UI Keymaps + +" Eval +nmap de (EvaluateExpression) +vmap de (EvaluateExpression) +" Dap UI +nmap du (ActivateDebugToolWindow) + +" Neotest Keymaps + +" Run Last +nmap tl (Run) +" Show Output +nmap to :echo 'Not yet implemented.' +" Toggle Output Panel +nmap tO :echo 'Not yet implemented.' +" Run Nearest +nmap tr (RunClass) +" Toggle Summary +nmap ts (ShowTestSummary) +" Stop +nmap tS (Stop) +" Run File +nmap tt (RunClass) +" Run All Test Files +nmap tT (RunAllTests) +" Toggle Watch +nmap tw (ToggleTestWatch) + +" nvim-dap +" Debug Nearest +nmap td (ChooseDebugConfiguration) + +" Neovim mappings +" https://neovim.io/doc/user/vim_diff.html#_default-mappings + +nnoremap Y y$ +inoremap u +inoremap u +" Q isn't exactly the same. +nnoremap Q @@ +" There are several more Neovim mappings that need to be ported. + diff --git a/modules/home/programs/gui/phpstorm/default.nix b/modules/home/programs/gui/phpstorm/default.nix index 017e354..9381ec1 100644 --- a/modules/home/programs/gui/phpstorm/default.nix +++ b/modules/home/programs/gui/phpstorm/default.nix @@ -15,5 +15,7 @@ in { home.packages = with pkgs; [ jetbrains.phpstorm ]; + + home.file.".ideavimrc".source = ./.ideavimrc; }; }