From 6009c4e36da53e579b325348bae366f91152d36b Mon Sep 17 00:00:00 2001 From: Mikkel Svartveit Date: Tue, 21 Mar 2023 16:31:37 +0100 Subject: [PATCH] First commit --- .gitignore | 16 + fish/config.fish | 68 ++ git/config | 10 + git/gitignore_global | 2 + .../com.googlecode.iterm2.plist | 828 ++++++++++++++++++ .../custom-capslock.json | 30 + .../automatic_backups/karabiner_20221020.json | 269 ++++++ karabiner/karabiner.json | 289 ++++++ nvim/.gitignore | 1 + nvim/coc-settings.json | 38 + nvim/init.vim | 93 ++ nvim/lazy-lock.json | 25 + nvim/lua/coc-defaults.lua | 189 ++++ nvim/lua/plugins.lua | 246 ++++++ nvim/lua/test.py | 1 + vim/.vimrc | 64 ++ vscode-neovim/init.vim | 85 ++ 17 files changed, 2254 insertions(+) create mode 100644 .gitignore create mode 100644 fish/config.fish create mode 100644 git/config create mode 100644 git/gitignore_global create mode 100644 iterm2-preferences/com.googlecode.iterm2.plist create mode 100644 karabiner/assets/complex_modifications/custom-capslock.json create mode 100644 karabiner/automatic_backups/karabiner_20221020.json create mode 100644 karabiner/karabiner.json create mode 100644 nvim/.gitignore create mode 100644 nvim/coc-settings.json create mode 100644 nvim/init.vim create mode 100644 nvim/lazy-lock.json create mode 100644 nvim/lua/coc-defaults.lua create mode 100644 nvim/lua/plugins.lua create mode 100644 nvim/lua/test.py create mode 100644 vim/.vimrc create mode 100644 vscode-neovim/init.vim diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b5e61c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +# Ignore everything by default +* +!*/ + +# Whitelist certain files and directories +!.gitignore +!iterm2-preferences/**/* +!fish/config.fish +!git/**/* +!vim/**/* +!nvim/**/* +!vscode-neovim/**/* +!karabiner/**/* + +# Blacklist some stuff again +.DS_Store diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..5ce316a --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,68 @@ +alias conf="git --git-dir=$HOME/.myconfig.git/ --work-tree=$HOME" +alias fixmouse="killall LogiMgrDaemon" +alias icloud="cd ~/Library/Mobile\ Documents/com~apple~CloudDocs" +alias pi="ssh pi@185.138.33.80 -p 1733" +alias zshrc="nvim ~/.zshrc" +alias fishconfig="cd ~/.config/fish && nvim config.fish && cd -" +alias nvimconfig="cd ~/.config/nvim && nvim && cd -" +alias ai="sgpt -se" +alias y="open -a Yoink" + +abbr x86 "arch -x86_64" +abbr f "fuck" +abbr v "nvim" +abbr ghv "gh repo view --web" +abbr pr "gh pr checkout" +abbr prc "gh pr create --web" + +function ghid + gh issue develop $argv[1] --checkout --name $argv[2] +end + +# Print the directory of the top-most Finder window +function pfd + bass "echo \"`osascript -e 'tell application \"Finder\" to POSIX path of (insertion location as alias)' end tell`\"" +end + +# cd to the directory of the top-most Finder window +function cdf + cd $(pfd) +end + +# Open a file with macOS Quick Look +function ql + qlmanage -p $argv >/dev/null & +end + +# Start Docker Desktop and wait to ensure the daemon is ready +function ds + echo "Launching Docker Daemon..." + open -a "Docker" + sleep 15 + echo "Docker daemon started." +end + +function dq + osascript -e 'quit app "Docker Desktop"' +end + +# Initialize nvm through bass +bass source ~/.nvm/nvm.sh ';' +function nvm + bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv +end + +# Enable autojump +[ -f /opt/homebrew/share/autojump/autojump.fish ]; and source /opt/homebrew/share/autojump/autojump.fish + +# Initialize fuck +thefuck --alias | source + +# Allow running pip packages +export PATH="/Users/mikkelsvartveit/Library/Python/3.9/bin:$PATH" + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +eval /Users/mikkelsvartveit/opt/anaconda3/bin/conda "shell.fish" "hook" $argv | source +# <<< conda initialize <<< + diff --git a/git/config b/git/config new file mode 100644 index 0000000..ce5c06b --- /dev/null +++ b/git/config @@ -0,0 +1,10 @@ +[user] + name = Mikkel Svartveit + email = mikkel.svartveit@gmail.com +[core] + excludesfile = ~/.config/gitignore_global + editor = nvim +[init] + defaultBranch = main +[pull] + rebase = true diff --git a/git/gitignore_global b/git/gitignore_global new file mode 100644 index 0000000..5fd0411 --- /dev/null +++ b/git/gitignore_global @@ -0,0 +1,2 @@ +.DS_Store +.vim diff --git a/iterm2-preferences/com.googlecode.iterm2.plist b/iterm2-preferences/com.googlecode.iterm2.plist new file mode 100644 index 0000000..1375c2a --- /dev/null +++ b/iterm2-preferences/com.googlecode.iterm2.plist @@ -0,0 +1,828 @@ + + + + + AllowClipboardAccess + + Command + + CopySelection + + Default Bookmark Guid + 176CC3A0-7519-4F56-A9CA-A13581E4DE4E + DoubleClickPerformsSmartSelection + + EnableDivisionView + + HapticFeedbackForEsc + + HideScrollbar + + HideTab + + HotkeyMigratedFromSingleToMulti + + New Bookmarks + + + ASCII Anti Aliased + + ASCII Ligatures + + Ambiguous Double Width + + Ansi 0 Color + + Alpha Component + 1 + Blue Component + 0.203921568627 + Color Space + sRGB + Green Component + 0.17254901960800001 + Red Component + 0.15686274509799999 + + Ansi 1 Color + + Alpha Component + 1 + Blue Component + 0.458823529412 + Color Space + sRGB + Green Component + 0.42352941176499997 + Red Component + 0.87843137254899994 + + Ansi 10 Color + + Alpha Component + 1 + Blue Component + 0.47450980392199998 + Color Space + sRGB + Green Component + 0.76470588235299997 + Red Component + 0.59607843137299998 + + Ansi 11 Color + + Alpha Component + 1 + Blue Component + 0.48235294117600003 + Color Space + sRGB + Green Component + 0.75294117647100001 + Red Component + 0.89803921568599998 + + Ansi 12 Color + + Alpha Component + 1 + Blue Component + 0.93725490196100003 + Color Space + sRGB + Green Component + 0.68627450980399995 + Red Component + 0.38039215686299999 + + Ansi 13 Color + + Alpha Component + 1 + Blue Component + 0.86666666666699999 + Color Space + sRGB + Green Component + 0.47058823529400001 + Red Component + 0.77647058823500004 + + Ansi 14 Color + + Alpha Component + 1 + Blue Component + 0.76078431372499999 + Color Space + sRGB + Green Component + 0.71372549019599996 + Red Component + 0.337254901961 + + Ansi 15 Color + + Alpha Component + 1 + Blue Component + 0.89411764705899999 + Color Space + sRGB + Green Component + 0.87450980392199995 + Red Component + 0.86274509803900001 + + Ansi 2 Color + + Alpha Component + 1 + Blue Component + 0.47450980392199998 + Color Space + sRGB + Green Component + 0.76470588235299997 + Red Component + 0.59607843137299998 + + Ansi 3 Color + + Alpha Component + 1 + Blue Component + 0.48235294117600003 + Color Space + sRGB + Green Component + 0.75294117647100001 + Red Component + 0.89803921568599998 + + Ansi 4 Color + + Alpha Component + 1 + Blue Component + 0.93725490196100003 + Color Space + sRGB + Green Component + 0.68627450980399995 + Red Component + 0.38039215686299999 + + Ansi 5 Color + + Alpha Component + 1 + Blue Component + 0.86666666666699999 + Color Space + sRGB + Green Component + 0.47058823529400001 + Red Component + 0.77647058823500004 + + Ansi 6 Color + + Alpha Component + 1 + Blue Component + 0.76078431372499999 + Color Space + sRGB + Green Component + 0.71372549019599996 + Red Component + 0.337254901961 + + Ansi 7 Color + + Alpha Component + 1 + Blue Component + 0.89411764705899999 + Color Space + sRGB + Green Component + 0.87450980392199995 + Red Component + 0.86274509803900001 + + Ansi 8 Color + + Alpha Component + 1 + Blue Component + 0.56470588235294117 + Color Space + sRGB + Green Component + 0.47843137254901963 + Red Component + 0.43529411764705883 + + Ansi 9 Color + + Alpha Component + 1 + Blue Component + 0.458823529412 + Color Space + sRGB + Green Component + 0.42352941176499997 + Red Component + 0.87843137254899994 + + BM Growl + + Background Color + + Alpha Component + 1 + Blue Component + 0.20392156862745098 + Color Space + sRGB + Green Component + 0.17254901960784313 + Red Component + 0.15686274509803921 + + Background Image Location + + Badge Color + + Alpha Component + 0.5 + Blue Component + 0 + Color Space + sRGB + Green Component + 0 + Red Component + 1 + + Blinking Cursor + + Blur + + Blur Radius + 0.10000000000000001 + Bold Color + + Alpha Component + 1 + Blue Component + 0.74901962280273438 + Color Space + sRGB + Green Component + 0.69803923368453979 + Red Component + 0.67058825492858887 + + Bound Hosts + + Brighten Bold Text + + Character Encoding + 4 + Close Sessions On End + + Columns + 100 + Command + + Cursor Color + + Alpha Component + 1 + Blue Component + 0.80000000000000004 + Color Space + sRGB + Green Component + 0.701960784314 + Red Component + 0.63921568627500003 + + Cursor Guide Color + + Alpha Component + 0.25 + Blue Component + 0.25098039215700002 + Color Space + sRGB + Green Component + 0.211764705882 + Red Component + 0.19215686274499999 + + Cursor Text Color + + Alpha Component + 1 + Blue Component + 0.89411764705899999 + Color Space + sRGB + Green Component + 0.87450980392199995 + Red Component + 0.86274509803900001 + + Cursor Type + 1 + Custom Command + No + Custom Directory + Recycle + Default Bookmark + No + Description + Default + Disable Window Resizing + + Flashing Bell + + Foreground Color + + Alpha Component + 1 + Blue Component + 0.89411764705899999 + Color Space + sRGB + Green Component + 0.87450980392199995 + Red Component + 0.86274509803900001 + + Guid + 176CC3A0-7519-4F56-A9CA-A13581E4DE4E + Horizontal Spacing + 1 + Idle Code + 0 + Jobs to Ignore + + rlogin + ssh + slogin + telnet + + Keyboard Map + + 0x2d-0x40000 + + Action + 11 + Text + 0x1f + + 0x32-0x40000 + + Action + 11 + Text + 0x00 + + 0x33-0x40000 + + Action + 11 + Text + 0x1b + + 0x34-0x40000 + + Action + 11 + Text + 0x1c + + 0x35-0x40000 + + Action + 11 + Text + 0x1d + + 0x36-0x40000 + + Action + 11 + Text + 0x1e + + 0x37-0x40000 + + Action + 11 + Text + 0x1f + + 0x38-0x40000 + + Action + 11 + Text + 0x7f + + 0xf700-0x220000 + + Action + 10 + Text + [1;2A + + 0xf700-0x240000 + + Action + 10 + Text + [1;5A + + 0xf700-0x260000 + + Action + 10 + Text + [1;6A + + 0xf700-0x280000 + + Action + 11 + Text + 0x1b 0x1b 0x5b 0x41 + + 0xf701-0x220000 + + Action + 10 + Text + [1;2B + + 0xf701-0x240000 + + Action + 10 + Text + [1;5B + + 0xf701-0x260000 + + Action + 10 + Text + [1;6B + + 0xf701-0x280000 + + Action + 11 + Text + 0x1b 0x1b 0x5b 0x42 + + 0xf702-0x220000 + + Action + 10 + Text + [1;2D + + 0xf702-0x240000 + + Action + 10 + Text + [1;5D + + 0xf702-0x260000 + + Action + 10 + Text + [1;6D + + 0xf702-0x280000 + + Action + 11 + Text + 0x1b 0x1b 0x5b 0x44 + + 0xf703-0x220000 + + Action + 10 + Text + [1;2C + + 0xf703-0x240000 + + Action + 10 + Text + [1;5C + + 0xf703-0x260000 + + Action + 10 + Text + [1;6C + + 0xf703-0x280000 + + Action + 11 + Text + 0x1b 0x1b 0x5b 0x43 + + 0xf704-0x20000 + + Action + 10 + Text + [1;2P + + 0xf705-0x20000 + + Action + 10 + Text + [1;2Q + + 0xf706-0x20000 + + Action + 10 + Text + [1;2R + + 0xf707-0x20000 + + Action + 10 + Text + [1;2S + + 0xf708-0x20000 + + Action + 10 + Text + [15;2~ + + 0xf709-0x20000 + + Action + 10 + Text + [17;2~ + + 0xf70a-0x20000 + + Action + 10 + Text + [18;2~ + + 0xf70b-0x20000 + + Action + 10 + Text + [19;2~ + + 0xf70c-0x20000 + + Action + 10 + Text + [20;2~ + + 0xf70d-0x20000 + + Action + 10 + Text + [21;2~ + + 0xf70e-0x20000 + + Action + 10 + Text + [23;2~ + + 0xf70f-0x20000 + + Action + 10 + Text + [24;2~ + + 0xf729-0x20000 + + Action + 10 + Text + [1;2H + + 0xf729-0x40000 + + Action + 10 + Text + [1;5H + + 0xf72b-0x20000 + + Action + 10 + Text + [1;2F + + 0xf72b-0x40000 + + Action + 10 + Text + [1;5F + + + Link Color + + Alpha Component + 1 + Blue Component + 0.93725490196100003 + Color Space + sRGB + Green Component + 0.68627450980399995 + Red Component + 0.38039215686299999 + + Mouse Reporting + + Name + Custom + Non Ascii Font + Monaco 12 + Non-ASCII Anti Aliased + + Normal Font + FiraCodeNerdFontComplete-Retina 13 + Only The Default BG Color Uses Transparency + + Option Key Sends + 0 + Prompt Before Closing 2 + 2 + Right Option Key Sends + 0 + Rows + 24 + Screen + -1 + Scrollback Lines + 1000 + Selected Text Color + + Alpha Component + 1 + Blue Component + 0.89411764705899999 + Color Space + sRGB + Green Component + 0.87450980392199995 + Red Component + 0.86274509803900001 + + Selection Color + + Alpha Component + 1 + Blue Component + 0.364705882353 + Color Space + sRGB + Green Component + 0.30588235294100002 + Red Component + 0.27843137254900002 + + Send Code When Idle + + Shortcut + + Silence Bell + + Sync Title + + Tags + + Terminal Type + xterm-256color + Thin Strokes + 0 + Transparency + 0 + Unlimited Scrollback + + Use Bold Font + + Use Bright Bold + + Use Italic Font + + Use Non-ASCII Font + + Vertical Spacing + 1.25 + Visual Bell + + Window Type + 0 + Working Directory + /Users/mikkelsvartveit + + + OpenNewWindowAtStartup + + PMPrintingExpandedStateForPrint2 + + PointerActions + + Button,1,1,, + + Action + kContextMenuPointerAction + + Button,2,1,, + + Action + kPasteFromClipboardPointerAction + + Gesture,ThreeFingerSwipeDown,, + + Action + kPrevWindowPointerAction + + Gesture,ThreeFingerSwipeLeft,, + + Action + kPrevTabPointerAction + + Gesture,ThreeFingerSwipeRight,, + + Action + kNextTabPointerAction + + Gesture,ThreeFingerSwipeUp,, + + Action + kNextWindowPointerAction + + + PreserveWindowSizeWhenTabBarVisibilityChanges + + Print In Black And White + + PromptOnQuit + + ShowFullScreenTabBar + + SoundForEsc + + SplitPaneDimmingAmount + 0.40235626516990292 + TabStyleWithAutomaticOption + 5 + TerminalMargin + 5 + TerminalVMargin + 2 + UseBorder + + VisualIndicatorForEsc + + kCPKSelectionViewPreferredModeKey + 1 + kCPKSelectionViewShowHSBTextFieldsKey + + + diff --git a/karabiner/assets/complex_modifications/custom-capslock.json b/karabiner/assets/complex_modifications/custom-capslock.json new file mode 100644 index 0000000..5080c2c --- /dev/null +++ b/karabiner/assets/complex_modifications/custom-capslock.json @@ -0,0 +1,30 @@ +{ + "title": "Change caps_lock to Esc and Control", + "rules": [ + { + "description": "Post Esc if Caps is tapped, Control if held.", + "manipulators": [ + { + "type": "basic", + "from": { + "key_code": "left_control", + "modifiers": { + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "left_control", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "escape" + } + ] + } + ] + } + ] +} diff --git a/karabiner/automatic_backups/karabiner_20221020.json b/karabiner/automatic_backups/karabiner_20221020.json new file mode 100644 index 0000000..27be52f --- /dev/null +++ b/karabiner/automatic_backups/karabiner_20221020.json @@ -0,0 +1,269 @@ +{ + "global": { + "check_for_updates_on_startup": true, + "show_in_menu_bar": true, + "show_profile_name_in_menu_bar": false, + "unsafe_ui": false + }, + "profiles": [ + { + "complex_modifications": { + "parameters": { + "basic.simultaneous_threshold_milliseconds": 50, + "basic.to_delayed_action_delay_milliseconds": 500, + "basic.to_if_alone_timeout_milliseconds": 1000, + "basic.to_if_held_down_threshold_milliseconds": 500, + "mouse_motion_to_scroll.speed": 100 + }, + "rules": [ + { + "description": "Post Esc if Caps is tapped, Control if held.", + "manipulators": [ + { + "from": { + "key_code": "left_control", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_control", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "escape" + } + ], + "type": "basic" + } + ] + } + ] + }, + "devices": [ + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 641, + "vendor_id": 1452 + }, + "ignore": false, + "manipulate_caps_lock_led": true, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": false, + "is_pointing_device": true, + "product_id": 641, + "vendor_id": 1452 + }, + "ignore": true, + "manipulate_caps_lock_led": false, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 666, + "vendor_id": 76 + }, + "ignore": false, + "manipulate_caps_lock_led": true, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": false, + "is_pointing_device": true, + "product_id": 613, + "vendor_id": 1452 + }, + "ignore": true, + "manipulate_caps_lock_led": false, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 50504, + "vendor_id": 1133 + }, + "ignore": false, + "manipulate_caps_lock_led": true, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": false, + "is_pointing_device": true, + "product_id": 50504, + "vendor_id": 1133 + }, + "ignore": true, + "manipulate_caps_lock_led": false, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + } + ], + "fn_function_keys": [ + { + "from": { + "key_code": "f1" + }, + "to": [ + { + "consumer_key_code": "display_brightness_decrement" + } + ] + }, + { + "from": { + "key_code": "f2" + }, + "to": [ + { + "consumer_key_code": "display_brightness_increment" + } + ] + }, + { + "from": { + "key_code": "f3" + }, + "to": [ + { + "apple_vendor_keyboard_key_code": "mission_control" + } + ] + }, + { + "from": { + "key_code": "f4" + }, + "to": [ + { + "apple_vendor_keyboard_key_code": "spotlight" + } + ] + }, + { + "from": { + "key_code": "f5" + }, + "to": [ + { + "consumer_key_code": "dictation" + } + ] + }, + { + "from": { + "key_code": "f6" + }, + "to": [ + { + "key_code": "f6" + } + ] + }, + { + "from": { + "key_code": "f7" + }, + "to": [ + { + "consumer_key_code": "rewind" + } + ] + }, + { + "from": { + "key_code": "f8" + }, + "to": [ + { + "consumer_key_code": "play_or_pause" + } + ] + }, + { + "from": { + "key_code": "f9" + }, + "to": [ + { + "consumer_key_code": "fast_forward" + } + ] + }, + { + "from": { + "key_code": "f10" + }, + "to": [ + { + "consumer_key_code": "mute" + } + ] + }, + { + "from": { + "key_code": "f11" + }, + "to": [ + { + "consumer_key_code": "volume_decrement" + } + ] + }, + { + "from": { + "key_code": "f12" + }, + "to": [ + { + "consumer_key_code": "volume_increment" + } + ] + } + ], + "name": "Default profile", + "parameters": { + "delay_milliseconds_before_open_device": 1000 + }, + "selected": true, + "simple_modifications": [], + "virtual_hid_keyboard": { + "country_code": 0, + "indicate_sticky_modifier_keys_state": true, + "mouse_key_xy_scale": 100 + } + } + ] +} \ No newline at end of file diff --git a/karabiner/karabiner.json b/karabiner/karabiner.json new file mode 100644 index 0000000..8734094 --- /dev/null +++ b/karabiner/karabiner.json @@ -0,0 +1,289 @@ +{ + "global": { + "check_for_updates_on_startup": true, + "show_in_menu_bar": true, + "show_profile_name_in_menu_bar": false, + "unsafe_ui": false + }, + "profiles": [ + { + "complex_modifications": { + "parameters": { + "basic.simultaneous_threshold_milliseconds": 50, + "basic.to_delayed_action_delay_milliseconds": 500, + "basic.to_if_alone_timeout_milliseconds": 500, + "basic.to_if_held_down_threshold_milliseconds": 500, + "mouse_motion_to_scroll.speed": 100 + }, + "rules": [ + { + "description": "Post Esc if Caps is tapped, Control if held.", + "manipulators": [ + { + "from": { + "key_code": "left_control", + "modifiers": { + "optional": ["any"] + } + }, + "to": [ + { + "key_code": "left_control", + "lazy": true + } + ], + "to_if_alone": [ + { + "key_code": "escape" + } + ], + "type": "basic" + } + ] + } + ] + }, + "devices": [ + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 641, + "vendor_id": 1452 + }, + "ignore": false, + "manipulate_caps_lock_led": true, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": false, + "is_pointing_device": true, + "product_id": 641, + "vendor_id": 1452 + }, + "ignore": true, + "manipulate_caps_lock_led": false, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 666, + "vendor_id": 76 + }, + "ignore": false, + "manipulate_caps_lock_led": true, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": false, + "is_pointing_device": true, + "product_id": 613, + "vendor_id": 1452 + }, + "ignore": true, + "manipulate_caps_lock_led": false, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": true, + "is_pointing_device": false, + "product_id": 50504, + "vendor_id": 1133 + }, + "ignore": false, + "manipulate_caps_lock_led": true, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + }, + { + "disable_built_in_keyboard_if_exists": false, + "fn_function_keys": [], + "identifiers": { + "is_keyboard": false, + "is_pointing_device": true, + "product_id": 50504, + "vendor_id": 1133 + }, + "ignore": true, + "manipulate_caps_lock_led": false, + "simple_modifications": [], + "treat_as_built_in_keyboard": false + } + ], + "fn_function_keys": [ + { + "from": { + "key_code": "f1" + }, + "to": [ + { + "consumer_key_code": "display_brightness_decrement" + } + ] + }, + { + "from": { + "key_code": "f2" + }, + "to": [ + { + "consumer_key_code": "display_brightness_increment" + } + ] + }, + { + "from": { + "key_code": "f3" + }, + "to": [ + { + "apple_vendor_keyboard_key_code": "mission_control" + } + ] + }, + { + "from": { + "key_code": "f4" + }, + "to": [ + { + "apple_vendor_keyboard_key_code": "spotlight" + } + ] + }, + { + "from": { + "key_code": "f5" + }, + "to": [ + { + "consumer_key_code": "dictation" + } + ] + }, + { + "from": { + "key_code": "f6" + }, + "to": [ + { + "key_code": "f6" + } + ] + }, + { + "from": { + "key_code": "f7" + }, + "to": [ + { + "consumer_key_code": "rewind" + } + ] + }, + { + "from": { + "key_code": "f8" + }, + "to": [ + { + "consumer_key_code": "play_or_pause" + } + ] + }, + { + "from": { + "key_code": "f9" + }, + "to": [ + { + "consumer_key_code": "fast_forward" + } + ] + }, + { + "from": { + "key_code": "f10" + }, + "to": [ + { + "consumer_key_code": "mute" + } + ] + }, + { + "from": { + "key_code": "f11" + }, + "to": [ + { + "consumer_key_code": "volume_decrement" + } + ] + }, + { + "from": { + "key_code": "f12" + }, + "to": [ + { + "consumer_key_code": "volume_increment" + } + ] + } + ], + "name": "Default profile", + "parameters": { + "delay_milliseconds_before_open_device": 1000 + }, + "selected": true, + "simple_modifications": [ + { + "from": { + "key_code": "caps_lock" + }, + "to": [ + { + "key_code": "left_control" + } + ] + }, + { + "from": { + "key_code": "escape" + }, + "to": [ + { + "key_code": "caps_lock" + } + ] + } + ], + "virtual_hid_keyboard": { + "country_code": 0, + "indicate_sticky_modifier_keys_state": true, + "mouse_key_xy_scale": 100 + } + } + ] +} + diff --git a/nvim/.gitignore b/nvim/.gitignore new file mode 100644 index 0000000..6fe3cb0 --- /dev/null +++ b/nvim/.gitignore @@ -0,0 +1 @@ +.plugins.lua.swp diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json new file mode 100644 index 0000000..6f6231c --- /dev/null +++ b/nvim/coc-settings.json @@ -0,0 +1,38 @@ +{ + "coc.preferences.formatOnSaveFiletypes": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "svelte", + "json", + "graphql", + "markdown" + ], + "python.formatting.provider": "black", + "python.formatting.blackPath": "/Library/Frameworks/Python.framework/Versions/3.9/bin/black", + "pyright.inlayHints.functionReturnTypes": false, + "pyright.inlayHints.variableTypes": false, + "svelte.enable-ts-plugin": true, + "eslint.probe": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "html", + "vue", + "markdown", + "svelte" + ], + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "html", + "vue", + "markdown", + "svelte" + ] +} diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100644 index 0000000..157f036 --- /dev/null +++ b/nvim/init.vim @@ -0,0 +1,93 @@ +" NEOVIM SETTINGS - settings regarding Neovim itself + +" Set leader key to comma, since the default sucks for nordic keyboards +let mapleader = ',' + +" Set UI language to English +set langmenu=en_US +let $LANG = 'en_US' + +" Disable splash screen +set shortmess+=I + +" Set relative line numbers to make it easier to jump to a line +set number +set relativenumber + +" Always show filename and modified marker in status line +set statusline=%f\ %m + +" This setting makes search case-insensitive when all characters in the string +" being searched are lowercase. However, the search becomes case-sensitive if +" it contains any capital letters. This makes searching more convenient. +set ignorecase +set smartcase + +" Disable mouse support (to force myself to use the keyboard) +set mouse= + +" Use 2 spaces as default indentation +set tabstop=2 +set shiftwidth=2 +set expandtab +set smartindent + +" Enable soft line wrapping +set wrap +set linebreak +set breakindent + +" Always show 4 lines above and below the cursor +set scrolloff=4 + +" Allow using uppercase W and Q commands to save/quit +command WQ wq +command Wq wq +command W w +command Q q + +" Type :C to open this config file +command! -nargs=0 C :e $MYVIMRC + +" Type ':R' to reload config file +command! -nargs=0 R :source $MYVIMRC + +" Save and close all buffers with ZZ +nnoremap ZZ :wa:qa + +" Exit Terminal mode with Ctrl+k +tnoremap + +" Make yank use system clipboard as default +nnoremap y (v:register ==# '"' ? '"+' : '') . 'y' +nnoremap yy (v:register ==# '"' ? '"+' : '') . 'yy' +nnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' +xnoremap y (v:register ==# '"' ? '"+' : '') . 'y' +xnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' + +" Map 'gp' to paste from system clipboard +nnoremap gp (v:register ==# '"' ? '"+' : '') . 'p' +nnoremap gP (v:register ==# '"' ? '"+' : '') . 'P' +xnoremap gp (v:register ==# '"' ? '"+' : '') . 'p' +xnoremap gP (v:register ==# '"' ? '"+' : '') . 'P' + +" Press Enter to clear search highlighting +nnoremap :nohlsearch + +" Disable arrow keys in normal mode - enforce hjkl instead +nnoremap :echoe "Use h" +nnoremap :echoe "Use l" +nnoremap :echoe "Use k" +nnoremap :echoe "Use j" + +" Fix terminal cursor after exiting +au VimLeave * set guicursor=a:ver100 + +" Use Bash as shell for internal Vim commands (fish is slow) +set shell=/bin/bash + +" Load default Coc config from separate file +lua require("coc-defaults") + +" Load plugins from separate file +lua require("plugins") diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..d5bdca0 --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,25 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20" }, + "auto-session": { "branch": "main", "commit": "1d3dd70a2d48e0f3441128eb4fb0b437a0bf2cc4" }, + "coc.nvim": { "branch": "release", "commit": "bbaa1d5d1ff3cbd9d26bb37cfda1a990494c4043" }, + "code_runner.nvim": { "branch": "main", "commit": "a010649236fe245eaab2641a13228cd601499715" }, + "copilot.vim": { "branch": "release", "commit": "9e869d29e62e36b7eb6fb238a4ca6a6237e7d78b" }, + "git-conflict.nvim": { "branch": "main", "commit": "80bc8931d4ed8c8c4d289a08e1838fcf4741408d" }, + "gitsigns.nvim": { "branch": "main", "commit": "b1f9cf7c5c5639c006c937fc1819e09f358210fc" }, + "lazy.nvim": { "branch": "main", "commit": "690f9e88e2a7dc92bcb0cca85f778a3e99fe1f7e" }, + "leap.nvim": { "branch": "main", "commit": "f74473d23ebf60957e0db3ff8172349a82e5a442" }, + "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, + "neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" }, + "nvim-scrollbar": { "branch": "main", "commit": "f85b29805cf917f9b1d5ff0c9a52c5b1bdca5943" }, + "nvim-toggleterm.lua": { "branch": "main", "commit": "2a787c426ef00cb3488c11b14f5dcf892bbd0bda" }, + "nvim-tree.lua": { "branch": "master", "commit": "e14989c0eaa6f9c299d48f7e45ce1ed04b21180f" }, + "nvim-web-devicons": { "branch": "master", "commit": "95b1e300699be8eb6b5be1758a9d4d69fe93cc7f" }, + "onehalf": { "branch": "master", "commit": "75eb2e97acd74660779fed8380989ee7891eec56" }, + "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" }, + "telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" }, + "vim-polyglot": { "branch": "master", "commit": "bc8a81d3592dab86334f27d1d43c080ebf680d42" }, + "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, + "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, + "vim-visual-multi": { "branch": "master", "commit": "724bd53adfbaf32e129b001658b45d4c5c29ca1a" } +} \ No newline at end of file diff --git a/nvim/lua/coc-defaults.lua b/nvim/lua/coc-defaults.lua new file mode 100644 index 0000000..e45e16f --- /dev/null +++ b/nvim/lua/coc-defaults.lua @@ -0,0 +1,189 @@ +-- Default config for Coc +-- From https://github.com/neoclide/coc.nvim + +-- Some servers have issues with backup files, see #649 +vim.opt.backup = false +vim.opt.writebackup = false + +-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable +-- delays and poor user experience +vim.opt.updatetime = 300 + +-- Always show the signcolumn, otherwise it would shift the text each time +-- diagnostics appeared/became resolved +vim.opt.signcolumn = "yes" + +local keyset = vim.keymap.set +-- Autocomplete +function _G.check_back_space() + local col = vim.fn.col('.') - 1 + return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil +end + +-- Use Tab for trigger completion with characters ahead and navigate +-- NOTE: There's always a completion item selected by default, you may want to enable +-- no select by setting `"suggest.noselect": true` in your configuration file +-- NOTE: Use command ':verbose imap ' to make sure Tab is not mapped by +-- other plugins before putting this into your config +local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false} +keyset("i", "", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "" : coc#refresh()', opts) +keyset("i", "", [[coc#pum#visible() ? coc#pum#prev(1) : "\"]], opts) + +-- Make to accept selected completion item or notify coc.nvim to format +-- u breaks current undo, please make your own choice +keyset("i", "", [[coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\"]], opts) + +-- Use to trigger snippets +keyset("i", "", "(coc-snippets-expand-jump)") +-- Use to trigger completion +keyset("i", "", "coc#refresh()", {silent = true, expr = true}) + +-- Use `[g` and `]g` to navigate diagnostics +-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list +keyset("n", "[g", "(coc-diagnostic-prev)", {silent = true}) +keyset("n", "]g", "(coc-diagnostic-next)", {silent = true}) + +-- GoTo code navigation +keyset("n", "gd", "(coc-definition)", {silent = true}) +keyset("n", "gy", "(coc-type-definition)", {silent = true}) +keyset("n", "gi", "(coc-implementation)", {silent = true}) +keyset("n", "gr", "(coc-references)", {silent = true}) + + +-- Use K to show documentation in preview window +function _G.show_docs() + local cw = vim.fn.expand('') + if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then + vim.api.nvim_command('h ' .. cw) + elseif vim.api.nvim_eval('coc#rpc#ready()') then + vim.fn.CocActionAsync('doHover') + else + vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw) + end +end +keyset("n", "K", 'lua _G.show_docs()', {silent = true}) + + +-- Highlight the symbol and its references on a CursorHold event(cursor is idle) +vim.api.nvim_create_augroup("CocGroup", {}) +vim.api.nvim_create_autocmd("CursorHold", { + group = "CocGroup", + command = "silent call CocActionAsync('highlight')", + desc = "Highlight symbol under cursor on CursorHold" +}) + + +-- Symbol renaming +keyset("n", "rn", "(coc-rename)", {silent = true}) + + +-- Formatting selected code +keyset("x", "f", "(coc-format-selected)", {silent = true}) +keyset("n", "f", "(coc-format-selected)", {silent = true}) + + +-- Setup formatexpr specified filetype(s) +vim.api.nvim_create_autocmd("FileType", { + group = "CocGroup", + pattern = "typescript,json", + command = "setl formatexpr=CocAction('formatSelected')", + desc = "Setup formatexpr specified filetype(s)." +}) + +-- Update signature help on jump placeholder +vim.api.nvim_create_autocmd("User", { + group = "CocGroup", + pattern = "CocJumpPlaceholder", + command = "call CocActionAsync('showSignatureHelp')", + desc = "Update signature help on jump placeholder" +}) + +-- Apply codeAction to the selected region +-- Example: `aap` for current paragraph +local opts = {silent = true, nowait = true} +keyset("x", "a", "(coc-codeaction-selected)", opts) +keyset("n", "a", "(coc-codeaction-selected)", opts) + +-- Remap keys for apply code actions at the cursor position. +keyset("n", "ac", "(coc-codeaction-cursor)", opts) +-- Remap keys for apply code actions affect whole buffer. +keyset("n", "as", "(coc-codeaction-source)", opts) +-- Remap keys for applying codeActions to the current buffer +keyset("n", "ac", "(coc-codeaction)", opts) +-- Apply the most preferred quickfix action on the current line. +keyset("n", "qf", "(coc-fix-current)", opts) + +-- Remap keys for apply refactor code actions. +keyset("n", "re", "(coc-codeaction-refactor)", { silent = true }) +keyset("x", "r", "(coc-codeaction-refactor-selected)", { silent = true }) +keyset("n", "r", "(coc-codeaction-refactor-selected)", { silent = true }) + +-- Run the Code Lens actions on the current line +keyset("n", "cl", "(coc-codelens-action)", opts) + + +-- Map function and class text objects +-- NOTE: Requires 'textDocument.documentSymbol' support from the language server +keyset("x", "if", "(coc-funcobj-i)", opts) +keyset("o", "if", "(coc-funcobj-i)", opts) +keyset("x", "af", "(coc-funcobj-a)", opts) +keyset("o", "af", "(coc-funcobj-a)", opts) +keyset("x", "ic", "(coc-classobj-i)", opts) +keyset("o", "ic", "(coc-classobj-i)", opts) +keyset("x", "ac", "(coc-classobj-a)", opts) +keyset("o", "ac", "(coc-classobj-a)", opts) + + +-- Remap and to scroll float windows/popups +---@diagnostic disable-next-line: redefined-local +local opts = {silent = true, nowait = true, expr = true} +keyset("n", "", 'coc#float#has_scroll() ? coc#float#scroll(1) : ""', opts) +keyset("n", "", 'coc#float#has_scroll() ? coc#float#scroll(0) : ""', opts) +keyset("i", "", + 'coc#float#has_scroll() ? "=coc#float#scroll(1)" : ""', opts) +keyset("i", "", + 'coc#float#has_scroll() ? "=coc#float#scroll(0)" : ""', opts) +keyset("v", "", 'coc#float#has_scroll() ? coc#float#scroll(1) : ""', opts) +keyset("v", "", 'coc#float#has_scroll() ? coc#float#scroll(0) : ""', opts) + + +-- Use CTRL-S for selections ranges +-- Requires 'textDocument/selectionRange' support of language server +keyset("n", "", "(coc-range-select)", {silent = true}) +keyset("x", "", "(coc-range-select)", {silent = true}) + + +-- Add `:Format` command to format current buffer +vim.api.nvim_create_user_command("Format", "call CocAction('format')", {}) + +-- " Add `:Fold` command to fold current buffer +vim.api.nvim_create_user_command("Fold", "call CocAction('fold', )", {nargs = '?'}) + +-- Add `:OR` command for organize imports of the current buffer +vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {}) + +-- Add (Neo)Vim's native statusline support +-- NOTE: Please see `:h coc-status` for integrations with external plugins that +-- provide custom statusline: lightline.vim, vim-airline +vim.opt.statusline:append(" (%{coc#status()}%{get(b:,'coc_current_function','')})") + +-- Mappings for CoCList +-- code actions and coc stuff +---@diagnostic disable-next-line: redefined-local +local opts = {silent = true, nowait = true} +-- Show all diagnostics +keyset("n", "a", ":CocList diagnostics", opts) +-- Manage extensions +keyset("n", "e", ":CocList extensions", opts) +-- Show commands +keyset("n", "c", ":CocList commands", opts) +-- Find symbol of current document +keyset("n", "o", ":CocList outline", opts) +-- Search workspace symbols +keyset("n", "s", ":CocList -I symbols", opts) +-- Do default action for next item +keyset("n", "j", ":CocNext", opts) +-- Do default action for previous item +keyset("n", "k", ":CocPrev", opts) +-- Resume latest coc list +keyset("n", "p", ":CocListResume", opts) diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua new file mode 100644 index 0000000..75c1780 --- /dev/null +++ b/nvim/lua/plugins.lua @@ -0,0 +1,246 @@ +-- Install lazy.nvim (plugin manager) +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) + +-- Install plugins +require("lazy").setup({ + -- Color scheme + { + "sonph/onehalf", + priority = 1000, + config = function(plugin) + vim.opt.rtp:append(plugin.dir .. "/vim") + vim.opt.termguicolors = true + vim.cmd([[colorscheme onehalfdark]]) + end + }, + + -- VSCode-like language server + { + "neoclide/coc.nvim", + branch = "release", + init = function() + vim.g.coc_global_extensions = { + "coc-pyright", + "coc-clangd", + "coc-tsserver", + "@yaegassy/coc-volar", + "coc-svelte", + "coc-emmet", + "coc-prettier", + "coc-eslint", + } + end + }, + + -- Syntax highlighting for almost every language + { + "sheerun/vim-polyglot", + init = function() + vim.g.vim_svelte_plugin_load_full_syntax = 1 + vim.g.vim_svelte_plugin_use_typescript = 1 + vim.g.vim_svelte_plugin_use_sass = 1 + end + }, + + -- Add two-character motions with s and S + { + "ggandor/leap.nvim", + keys = "s", + dependencies = { + "tpope/vim-repeat", + }, + config = function() + require('leap').add_default_mappings() + end + }, + + -- VSCode-like multi-cursor support + { + "mg979/vim-visual-multi", + branch = "master", + }, + + -- Easy commenting/uncommenting + { + "numToStr/Comment.nvim", + config = true, + }, + + -- Easy handling of surroundings + { + "tpope/vim-surround", + dependencies = { + "tpope/vim-repeat", + }, + }, + + -- GitHub Copilot + { + "github/copilot.vim", + cmd = "CPE", -- Don't load until enable command is run + config = function() + vim.api.nvim_create_user_command("CPE", "Copilot enable", {}) + vim.api.nvim_create_user_command("CPD", "Copilot disable", {}) + end + }, + + -- Auto-restore session when opening Neovim + { + "rmagatti/auto-session", + opts = { + log_level = "error", + }, + }, + + -- File explorer sidebar + { + "kyazdani42/nvim-tree.lua", + commit = "e14989c", -- newer versions break auto-session + dependencies = { + "kyazdani42/nvim-web-devicons", + }, + opts = { + update_focused_file = { + enable = true, + }, + view = { + signcolumn = "auto", + adaptive_size = true, + mappings = { + list = { + { key = "+", action = "cd" }, + }, + }, + }, + }, + init = function() + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + vim.keymap.set("n", "n", ":NvimTreeToggle", { noremap = true, silent = true }) + end, + }, + + -- Fuzzy finder for files, buffers, etc. + { + "nvim-telescope/telescope.nvim", + tag = "0.1.1", + dependencies = { + "nvim-lua/plenary.nvim", + {"nvim-telescope/telescope-fzf-native.nvim", build = "make"}, + }, + keys = { + {"p", "Telescope find_files", noremap = true, silent = true}, + {"f", "Telescope live_grep", noremap = true, silent = true}, + {"b", "Telescope buffers", noremap = true, silent = true}, + {"o", "Telescope oldfiles", noremap = true, silent = true}, + {"t", "Telescope tags", noremap = true, silent = true}, + {":", "Telescope commands", noremap = true, silent = true}, + {"d", "Telescope git_status", noremap = true, silent = true}, + {"", "Telescope resume", noremap = true, silent = true}, + }, + config = function() + require("telescope").setup{} + require("telescope").load_extension("fzf") + end, + }, + + -- Persistent terminal that can be toggled with a keybinding + { + "akinsho/nvim-toggleterm.lua", + tag = "2.3.0", + keys = "", + opts = { + size = 20, + hide_numbers = true, + direction = 'horizontal', + open_mapping = [[]], + shade_terminals = true, + shading_factor = 2, + shell = 'fish' + } + }, + + -- Run code with a keybinding + { + "CRAG666/code_runner.nvim", + cmd = "RunCode", + dependencies = { + "akinsho/nvim-toggleterm.lua" + }, + opts = { + mode = "toggleterm", + filetype = { + python = "python", + javascript = "node", + typescript = "node", + c = "gcc -o main % && ./main", + }, + }, + init = function() + vim.keymap.set("n", "", ":RunCode", { noremap = true }) + end, + }, + + -- Live Markdown preview in browser + { + "iamcco/markdown-preview.nvim", + build = "cd app && npm install", + ft = "markdown", + init = function() + vim.g.mkdp_auto_close = 0 + end, + }, + + -- Git integration - show modified lines next to line numbers + { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup() + require("scrollbar.handlers.gitsigns").setup() + end, + }, + + -- Tool for resolving Git merge conflicts + { + "akinsho/git-conflict.nvim", + tag = "v1.0.0", + config = true, + }, + + -- VSCode-like scrollbar with Git and diagnostic markers + { + "petertriho/nvim-scrollbar", + opts = { + marks = { + Search = { color = "#ff9e64" }, + Error = { color = "#db4b4b" }, + Warn = { color = "#e0af68" }, + Info = { color = "#0db9d7" }, + Hint = { color = "#1abc9c" }, + Misc = { color = "#9d7cd8" }, + GitAdd = { color = "#9ece6a" }, + GitChange = { color = "#e0af68" }, + GitDelete = { color = "#914c54" }, + } + } + }, + + -- Smooth scrolling + { + "karb94/neoscroll.nvim", + opts = { + easing_function = "sine", + } + }, +}) diff --git a/nvim/lua/test.py b/nvim/lua/test.py new file mode 100644 index 0000000..16bb9ac --- /dev/null +++ b/nvim/lua/test.py @@ -0,0 +1 @@ +print("Hwell") diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000..7d31c19 --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,64 @@ +" Some nice defaults borrowed from Neovim +set nocompatible +set autoindent +set autoread +set belloff=all +set backspace=indent,eol,start +set encoding=utf-8 +set laststatus=2 +set history=10000 +set hlsearch +set incsearch +set smarttab +set ttimeout +set ttimeoutlen=50 +set ttyfast +set wildmenu +syntax on +let &t_SI = "\e[6 q" +let &t_EI = "\e[2 q" + +" Set relative line numbers to make it easier to jump to a line +set number +set relativenumber + +" Always show filename and modified marker in status line +set statusline=%f\ %m + +" This setting makes search case-insensitive when all characters in the string +" being searched are lowercase. However, the search becomes case-sensitive if +" it contains any capital letters. This makes searching more convenient. +set ignorecase +set smartcase + +" Enable mouse support +set mouse+=a + +" Use 2 spaces as default indentation +set tabstop=2 +set shiftwidth=2 +set expandtab +set smartindent + +" Enable soft line wrapping +set wrap +set linebreak +set breakindent + +" Always show 4 lines above and below the cursor +set scrolloff=4 + +" Allow using uppercase W and Q commands to save/quit +command WQ wq +command Wq wq +command W w +command Q q + +" Type :C to open this config file +command! -nargs=0 C :e $MYVIMRC + +" Type ':R' to reload config file +command! -nargs=0 R :source $MYVIMRC + +" Press Enter to clear search highlighting +nnoremap :nohlsearch diff --git a/vscode-neovim/init.vim b/vscode-neovim/init.vim new file mode 100644 index 0000000..e52c6b0 --- /dev/null +++ b/vscode-neovim/init.vim @@ -0,0 +1,85 @@ +" NEOVIM SETTINGS - settings regarding Neovim itself + +" Set leader key to comma, since the default sucks for nordic keyboards +let mapleader = ',' + +" This setting makes search case-insensitive when all characters in the string +" being searched are lowercase. However, the search becomes case-sensitive if +" it contains any capital letters. This makes searching more convenient. +set ignorecase +set smartcase + +" Enable searching as you type, rather than waiting till you press enter. +set incsearch + +" Always show 4 lines above and below the cursor +set scrolloff=4 + +" Allow using uppercase :W to save +command W call VSCodeCall('workbench.action.files.save') + +" Make yank use system clipboard as default +:nnoremap y (v:register ==# '"' ? '"+' : '') . 'y' +:nnoremap yy (v:register ==# '"' ? '"+' : '') . 'yy' +:nnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' +:xnoremap y (v:register ==# '"' ? '"+' : '') . 'y' +:xnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' + +" Map 'gp' to paste from system clipboard +:nnoremap gp (v:register ==# '"' ? '"+' : '') . 'p' +:nnoremap gP (v:register ==# '"' ? '"+' : '') . 'P' +:xnoremap gp (v:register ==# '"' ? '"+' : '') . 'p' +:xnoremap gP (v:register ==# '"' ? '"+' : '') . 'P' + +" Map leader bindings to VSCode commands +nnoremap p call VSCodeNotify('workbench.action.quickOpen') +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 d call VSCodeNotify('workbench.view.scm') +nnoremap n call VSCodeNotify('workbench.action.toggleSidebarVisibility') + +" Disable arrow keys in normal mode - enforce hjkl instead +nnoremap :echoe "Use h" +nnoremap :echoe "Use l" +nnoremap :echoe "Use k" +nnoremap :echoe "Use j" + + + +" PLUGINS - installation and configuration + +" Install Plug (plugin manager) if not already installed +let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +if empty(glob(data_dir . '/autoload/plug.vim')) + silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + autocmd VimEnter * q +endif + +" Install plugins automatically when launching Neovim +autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + \| PlugInstall --sync | source $MYVIMRC +\| endif + +" Fetch plugins with Plug +call plug#begin() + +" Add two-character motions with s and S +Plug 'ggandor/leap.nvim' +Plug 'tpope/vim-repeat' + +" Easy commenting/uncommenting +Plug 'numToStr/Comment.nvim' + +" Easy handling of surroundings (tags, brackets etc.) +Plug 'tpope/vim-surround' + +" End of plugin fetching +call plug#end() + +" Configure leap +lua require('leap').add_default_mappings() + +" Configure Comment.nvim +lua require('Comment').setup()