From ddca2cbe9fddc83804f83fd415e5d76b27558eda Mon Sep 17 00:00:00 2001 From: Mikkel Svartveit Date: Fri, 28 Jul 2023 17:08:06 +0200 Subject: [PATCH] Update config --- README.md | 4 +++- fish/config.fish | 11 ++++++++--- ideavim/.ideavimrc | 12 +++++++++++- nvim/lazy-lock.json | 1 + nvim/lua/plugins.lua | 38 ++++++++++++++++++++++++++++++++------ vscode-neovim/init.vim | 1 + 6 files changed, 56 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index ca319ae..8237edf 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ A small collection of configuration files for macOS, including: - Git - Neovim (complete development environment with Coc and a bunch of plugins) - Vim (simple configuration, no plugins) +- IdeaVim (Vim emulation for JetBrains IDEs) - [Karabiner](https://karabiner-elements.pqrs.org) (for [mapping CapsLock to Ctrl and Esc](https://medium.com/@pechyonkin/how-to-map-capslock-to-control-and-escape-on-mac-60523a64022b)) - Some wallpapers and custom app icons @@ -27,8 +28,9 @@ git fetch git reset --hard origin/main git branch --set-upstream-to=origin/main -# Tell Vim to source from the right file +# Tell Vim and IdeaVim to source from the right file echo "source ~/.config/vim/.vimrc" > .vimrc +echo "source ~/.config/ideavim/.ideavimrc" > .ideavimrc ``` #### Install software diff --git a/fish/config.fish b/fish/config.fish index b25b5b4..f39c026 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -13,11 +13,13 @@ alias ai="sgpt -se" abbr x86 "arch -x86_64" abbr v "nvim" abbr lg "lazygit" -abbr s "npm run serve" -abbr d "npm run dev" +abbr ns "npm start" +abbr nrs "npm run serve" +abbr nrd "npm run dev" +abbr nrw "npm run watch" +abbr lrr "source venv/bin/activate.fish && litestar run --reload" abbr venv "source venv/bin/activate.fish" abbr nobrew "HOMEBREW_NO_AUTO_UPDATE=1 brew" -abbr gpf "git push --force-with-lease" abbr ghv "gh repo view --web" abbr pr "gh pr checkout" abbr prc "gh pr create --web" @@ -68,3 +70,6 @@ end # Allow running pip packages export PATH="/Users/mikkelsvartveit/Library/Python/3.9/bin:$PATH" + +# The next line updates PATH for the Google Cloud SDK. +if [ -f '/Users/mikkelsvartveit/Applications/google-cloud-sdk/path.fish.inc' ]; . '/Users/mikkelsvartveit/Applications/google-cloud-sdk/path.fish.inc'; end diff --git a/ideavim/.ideavimrc b/ideavim/.ideavimrc index 05882ba..eb43b37 100644 --- a/ideavim/.ideavimrc +++ b/ideavim/.ideavimrc @@ -23,7 +23,7 @@ set smartcase set scrolloff=4 " Press Enter to clear search highlighting -nnoremap :nohlsearch +nmap :nohlsearch " Allow using uppercase W and Q commands to save/quit command WQ wq @@ -31,8 +31,18 @@ command Wq wq command W w command Q q +" Enable plugins Plug 'preservim/nerdtree' Plug 'tpope/vim-surround' Plug 'tpope/vim-commentary' +" Keymaps +nnoremap gh :action ShowErrorDescription +nnoremap gf :action QuickJavaDoc nnoremap n :NERDTree +nnoremap c :action GotoAction +nnoremap : :action GotoAction +nnoremap p :action GotoFile +nnoremap o :action RecentFiles +nnoremap f :action FindInPath +nnoremap d :action ActivateCommitToolWindow diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index c4941c1..a8ca36d 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -11,6 +11,7 @@ "leap.nvim": { "branch": "main", "commit": "0eb3611593e135150e2f7880ec67568ccb51c17a" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" }, + "nvim-autopairs": { "branch": "master", "commit": "e8f7dd7a72de3e7b6626c050a802000e69d53ff0" }, "nvim-scrollbar": { "branch": "main", "commit": "f85b29805cf917f9b1d5ff0c9a52c5b1bdca5943" }, "nvim-toggleterm.lua": { "branch": "main", "commit": "a5638b2206c3930a16a24e5c184dddd572f8cd34" }, "nvim-tree.lua": { "branch": "master", "commit": "e14989c0eaa6f9c299d48f7e45ce1ed04b21180f" }, diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 8acc0ea..dae5ef4 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -65,12 +65,6 @@ require("lazy").setup({ end }, - -- VSCode-like multi-cursor support - { - "mg979/vim-visual-multi", - branch = "master", - }, - -- Easy commenting/uncommenting { "numToStr/Comment.nvim", @@ -85,6 +79,37 @@ require("lazy").setup({ }, }, + -- Auto-match brackets, quotes etc. + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + opts = {}, + -- Make it play well with CoC + init = function() + local remap = vim.api.nvim_set_keymap + local npairs = require('nvim-autopairs') + npairs.setup({map_cr=false}) + + _G.MUtils= {} + + MUtils.completion_confirm=function() + if vim.fn["coc#pum#visible"]() ~= 0 then + return vim.fn["coc#pum#confirm"]() + else + return npairs.autopairs_cr() + end + end + + remap('i' , '','v:lua.MUtils.completion_confirm()', {expr = true , noremap = true}) + end + }, + + -- VSCode-like multi-cursor support + { + "mg979/vim-visual-multi", + branch = "master", + }, + -- GitHub Copilot { "github/copilot.vim", @@ -149,6 +174,7 @@ require("lazy").setup({ {"b", "Telescope buffers", noremap = true, silent = true}, {"o", "Telescope oldfiles", noremap = true, silent = true}, {"t", "Telescope tags", noremap = true, silent = true}, + {"c", "Telescope commands", noremap = true, silent = true}, {":", "Telescope commands", noremap = true, silent = true}, {"d", "Telescope git_status", noremap = true, silent = true}, {"", "Telescope resume", noremap = true, silent = true}, diff --git a/vscode-neovim/init.vim b/vscode-neovim/init.vim index e52c6b0..dbbb411 100644 --- a/vscode-neovim/init.vim +++ b/vscode-neovim/init.vim @@ -37,6 +37,7 @@ nnoremap b call VSCodeNotify('workbench.action.showAllEditors') nnoremap o call VSCodeNotify('workbench.action.quickOpen') nnoremap f call VSCodeNotify('workbench.action.findInFiles') nnoremap : call VSCodeNotify('workbench.action.showCommands') +nnoremap c call VSCodeNotify('workbench.action.showCommands') nnoremap d call VSCodeNotify('workbench.view.scm') nnoremap n call VSCodeNotify('workbench.action.toggleSidebarVisibility')