├── .gitignore ├── .gitmodules ├── README.md ├── aerospace └── aerospace.toml ├── alacritty └── alacritty.toml ├── firefox ├── .tridactylrc └── css │ ├── README.md │ ├── firefox-csshacks │ ├── autohide_sidebar.css │ └── overlay_sidebar_header.css │ ├── tabCenterReborn.css │ ├── userChrome.css │ └── userContent.css ├── fish ├── README.md ├── config.fish └── fish_plugins ├── fonts ├── Inconsolata LGC Bold Italic Nerd Font Complete Mono.ttf ├── Inconsolata LGC Bold Italic Nerd Font Complete Windows Compatible.ttf ├── Inconsolata LGC Bold Italic Nerd Font Complete.ttf ├── Inconsolata LGC Bold Nerd Font Complete Mono.ttf └── Inconsolata LGC Nerd Font Complete.ttf ├── git ├── gitconfig └── gitignore ├── misc ├── Keybindings │ ├── DefaultKeyBinding.dict │ └── README.md └── demo.png ├── nvim ├── README.md ├── init.vim ├── lua │ ├── conf.lsp.lua │ ├── conf.misc.lua │ ├── conf.nonels.lua │ ├── conf.quickfix.lua │ ├── conf.skip.lua │ ├── conf.statusline.lua │ └── conf.treesitter.lua └── snapshot.vim ├── tmux └── tmux.conf └── vim ├── README.md ├── coc-settings.json └── vimrc /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | *.pyc 4 | .ropeproject/ 5 | build/ 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hit9/dotfiles/d5bb284f3e7292ad04186cd77453d2df79506217/.gitmodules -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ❤ My ~/.dotfiles 2 | ================ 3 | 4 | **Introduction and Pictures (In Chinese)** → → https://writings.sh/post/commandline-tools 5 | 6 | Feel free to use it for any purpose, but try it at your own risk. 7 | 8 | Files: 9 | 10 | - [nvim](nvim) - Neovim config file. 11 | - [alacritty](alacritty/alacritty.yml) - Alacritty terminal config file. 12 | - [fish](fish) - Fish shell config files. 13 | - [tmux](tmux/tmux.conf) - Tmux (terminal multiplexer) config file. 14 | - [firefox](firefox/css) - Firefox css tweaks. 15 | - [tridactyl](firefox/tridactylrc) - Firefox tridactyl plugin config file. 16 | - [Keybindings](misc/Keybindings) - macos emacs keybindings.. 17 | - [aerospace](aerospace) - window manager. 18 | 19 | ![](misc/demo.png) 20 | -------------------------------------------------------------------------------- /aerospace/aerospace.toml: -------------------------------------------------------------------------------- 1 | # Place a copy of this config to ~/.aerospace.toml 2 | # After that, you can edit ~/.aerospace.toml to your liking 3 | # Ref: https://nikitabobko.github.io/AeroSpace 4 | 5 | # It's not necessary to copy all keys to your config. 6 | # If the key is missing in your config, "default-config.toml" will serve as a fallback 7 | 8 | # You can use it to add commands that run after login to macOS user session. 9 | # 'start-at-login' needs to be 'true' for 'after-login-command' to work 10 | # Available commands: https://nikitabobko.github.io/AeroSpace/commands 11 | after-login-command = [] 12 | 13 | # You can use it to add commands that run after AeroSpace startup. 14 | # 'after-startup-command' is run after 'after-login-command' 15 | # Available commands : https://nikitabobko.github.io/AeroSpace/commands 16 | after-startup-command = [] 17 | 18 | # Start AeroSpace at login 19 | start-at-login = false 20 | 21 | # Normalizations. See: https://nikitabobko.github.io/AeroSpace/guide#normalization 22 | enable-normalization-flatten-containers = true 23 | enable-normalization-opposite-orientation-for-nested-containers = true 24 | 25 | # See: https://nikitabobko.github.io/AeroSpace/guide#layouts 26 | # The 'accordion-padding' specifies the size of accordion padding 27 | # You can set 0 to disable the padding feature 28 | accordion-padding = 30 29 | 30 | # Possible values: tiles|accordion 31 | default-root-container-layout = 'tiles' 32 | 33 | # Possible values: horizontal|vertical|auto 34 | # 'auto' means: wide monitor (anything wider than high) gets horizontal orientation, 35 | # tall monitor (anything higher than wide) gets vertical orientation 36 | default-root-container-orientation = 'auto' 37 | 38 | # Possible values: (qwerty|dvorak) 39 | # See https://nikitabobko.github.io/AeroSpace/guide#key-mapping 40 | key-mapping.preset = 'qwerty' 41 | 42 | # Gaps between windows (inner-*) and between monitor edges (outer-*). 43 | # Possible values: 44 | # - Constant: gaps.outer.top = 8 45 | # - Per monitor: gaps.outer.top = [{ monitor.main = 16 }, { monitor."some-pattern" = 32 }, 24] 46 | # In this example, 24 is a default value when there is no match. 47 | # Monitor pattern is the same as for 'workspace-to-monitor-force-assignment'. 48 | # See: https://nikitabobko.github.io/AeroSpace/guide#assign-workspaces-to-monitors 49 | [gaps] 50 | inner.horizontal = 5 51 | inner.vertical = 5 52 | outer.left = 5 53 | outer.bottom = 5 54 | outer.top = 5 55 | outer.right = 5 56 | 57 | # See https://nikitabobko.github.io/AeroSpace/guide#exec-env-vars 58 | [exec] # Again, you don't need to copy all config sections to your config. 59 | inherit-env-vars = true # If you don't touch "exec" section, 60 | [exec.env-vars] # it will fallback to "default-config.toml" 61 | PATH = '/opt/homebrew/bin:/opt/homebrew/sbin:${PATH}' 62 | 63 | # 'main' binding mode declaration 64 | # See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes 65 | # 'main' binding mode must be always presented 66 | [mode.main.binding] 67 | 68 | # All possible keys: 69 | # - Letters. a, b, c, ..., z 70 | # - Numbers. 0, 1, 2, ..., 9 71 | # - Keypad numbers. keypad0, keypad1, keypad2, ..., keypad9 72 | # - F-keys. f1, f2, ..., f20 73 | # - Special keys. minus, equal, period, comma, slash, backslash, quote, semicolon, backtick, 74 | # leftSquareBracket, rightSquareBracket, space, enter, esc, backspace, tab 75 | # - Keypad special. keypadClear, keypadDecimalMark, keypadDivide, keypadEnter, keypadEqual, 76 | # keypadMinus, keypadMultiply, keypadPlus 77 | # - Arrows. left, down, up, right 78 | 79 | # All possible modifiers: cmd, alt, ctrl, shift 80 | # All possible commands: https://nikitabobko.github.io/AeroSpace/commands 81 | 82 | alt-h = 'focus left' 83 | alt-j = 'focus down' 84 | alt-k = 'focus up' 85 | alt-l = 'focus right' 86 | 87 | alt-1 = 'workspace 1' 88 | alt-2 = 'workspace 2' 89 | alt-3 = 'workspace 3' 90 | alt-4 = 'workspace 4' 91 | 92 | alt-tab = 'workspace --wrap-around next' 93 | alt-shift-tab = 'workspace --wrap-around prev' 94 | 95 | alt-w = 'mode service' 96 | alt-r = 'mode resize' 97 | 98 | cmd-h = [] # disable mac's `hide the window` shortcut key 99 | 100 | # 'service' binding mode declaration. 101 | # See: https://nikitabobko.github.io/AeroSpace/guide#binding-modes 102 | [mode.service.binding] 103 | 104 | # mode prefix-keys should also works 105 | esc = 'mode main' 106 | enter = 'mode main' 107 | alt-w = 'mode service' 108 | alt-r = 'mode resize' 109 | z = 'mode resize' 110 | 111 | r = ['reload-config', 'mode main'] # reset layout 112 | 113 | h = 'focus left' 114 | j = 'focus down' 115 | k = 'focus up' 116 | l = 'focus right' 117 | 118 | # in case of: you think it's in main mode now, but we just makes it works and back to main. 119 | alt-h = ['focus left', 'mode main'] 120 | alt-j = ['focus down', 'mode main'] 121 | alt-k = ['focus up', 'mode main'] 122 | alt-l = ['focus right', 'mode main'] 123 | 124 | shift-h = ['move left', 'mode main'] 125 | shift-j = ['move down', 'mode main'] 126 | shift-k = ['move up', 'mode main'] 127 | shift-l = ['move right', 'mode main'] 128 | 129 | x = ['close', 'mode main'] 130 | shift-x = ['close-all-windows-but-current', 'mode main'] 131 | f = ['fullscreen', 'mode main'] 132 | space = [ 'layout tiles accordion', 'mode main'] 133 | 134 | 135 | tab = 'workspace --wrap-around next' 136 | shift-tab = 'workspace --wrap-around prev' 137 | # alt-tab should also work in case of you think you're in main mode etc. 138 | alt-tab = 'workspace --wrap-around next' 139 | alt-shift-tab = 'workspace --wrap-around prev' 140 | 141 | n = ['workspace --wrap-around next', 'mode main'] 142 | p = ['workspace --wrap-around prev', 'mode main'] 143 | 144 | 1 = 'workspace 1' 145 | 2 = 'workspace 2' 146 | 3 = 'workspace 3' 147 | 4 = 'workspace 4' 148 | 149 | shift-1 = ['move-node-to-workspace 1', 'workspace 1', 'mode main'] 150 | shift-2 = ['move-node-to-workspace 2', 'workspace 2', 'mode main'] 151 | shift-3 = ['move-node-to-workspace 3', 'workspace 3', 'mode main'] 152 | shift-4 = ['move-node-to-workspace 4', 'workspace 4', 'mode main'] 153 | 154 | shift-semicolon = ['exec-and-forget open -n /Applications/Alacritty.app', 'mode main'] 155 | 156 | [mode.resize.binding] 157 | 158 | # mode prefix-keys should also works 159 | esc = 'mode main' 160 | enter = 'mode main' 161 | alt-w = 'mode service' 162 | alt-r = 'mode resize' 163 | 164 | h = 'resize width -50' 165 | j = 'resize height +50' 166 | k = 'resize height -50' 167 | l = 'resize width +50' 168 | -------------------------------------------------------------------------------- /alacritty/alacritty.toml: -------------------------------------------------------------------------------- 1 | live_config_reload = true 2 | 3 | [bell] 4 | animation = "EaseOutExpo" 5 | duration = 0 6 | 7 | [colors] 8 | draw_bold_text_with_bright_colors = true 9 | 10 | [colors.bright] 11 | black = "0x686868" 12 | blue = "0x57c7ff" 13 | cyan = "0x9aedfe" 14 | green = "0x5af78e" 15 | magenta = "0xff6ac1" 16 | red = "0xff5c57" 17 | white = "0xf1f1f0" 18 | yellow = "0xf3f99d" 19 | 20 | [colors.cursor] 21 | background = "0x008ec4" 22 | foreground = "0xf1f1f1" 23 | 24 | [colors.normal] 25 | black = "0x282a36" 26 | blue = "0x57c7ff" 27 | cyan = "0x9aedfe" 28 | green = "0x5af78e" 29 | magenta = "0xff6ac1" 30 | red = "0xff5c57" 31 | white = "0xf1f1f0" 32 | yellow = "0xf3f99d" 33 | 34 | [colors.primary] 35 | background = "0x282a36" 36 | foreground = "0xeff0eb" 37 | 38 | [cursor] 39 | style = "Block" 40 | unfocused_hollow = true 41 | 42 | [debug] 43 | render_timer = false 44 | 45 | [font] 46 | size = 13 47 | 48 | [font.bold] 49 | family = "InconsolataLGC Nerd Font" 50 | 51 | [font.glyph_offset] 52 | x = 0 53 | y = 0 54 | 55 | [font.italic] 56 | family = "InconsolataLGC Nerd Font" 57 | 58 | [font.normal] 59 | family = "InconsolataLGC Nerd Font" 60 | 61 | [font.offset] 62 | x = 0 63 | y = 0 64 | 65 | [[keyboard.bindings]] 66 | action = "Paste" 67 | key = "V" 68 | mods = "Command" 69 | 70 | [[keyboard.bindings]] 71 | action = "Copy" 72 | key = "C" 73 | mods = "Command" 74 | 75 | [[keyboard.bindings]] 76 | action = "Hide" 77 | key = "H" 78 | mods = "Command" 79 | 80 | [[keyboard.bindings]] 81 | action = "Quit" 82 | key = "Q" 83 | mods = "Command" 84 | 85 | [[keyboard.bindings]] 86 | action = "Quit" 87 | key = "W" 88 | mods = "Command" 89 | 90 | [[keyboard.bindings]] 91 | chars = "\u007F" 92 | key = "Back" 93 | 94 | [[keyboard.bindings]] 95 | chars = "\u001B[2~" 96 | key = "Insert" 97 | 98 | [[keyboard.bindings]] 99 | chars = "\u001B[3~" 100 | key = "Delete" 101 | 102 | [[keyboard.bindings]] 103 | chars = "\u001B[D" 104 | key = "Left" 105 | mode = "~AppCursor" 106 | 107 | [[keyboard.bindings]] 108 | chars = "\u001BOD" 109 | key = "Left" 110 | mode = "AppCursor" 111 | 112 | [[keyboard.bindings]] 113 | chars = "\u001B[C" 114 | key = "Right" 115 | mode = "~AppCursor" 116 | 117 | [[keyboard.bindings]] 118 | chars = "\u001BOC" 119 | key = "Right" 120 | mode = "AppCursor" 121 | 122 | [[keyboard.bindings]] 123 | chars = "\u001Bf" 124 | key = "F" 125 | mods = "Alt" 126 | 127 | [[keyboard.bindings]] 128 | chars = "\u001Bb" 129 | key = "B" 130 | mods = "Alt" 131 | 132 | [[keyboard.bindings]] 133 | chars = "\u001Bd" 134 | key = "D" 135 | mods = "Alt" 136 | 137 | [[keyboard.bindings]] 138 | # re-map Ctrl-Shift-S to Esc-s 139 | chars = "\u001Bs" 140 | key = "S" 141 | mods = "Control|Shift" 142 | 143 | [mouse] 144 | 145 | [[mouse.bindings]] 146 | action = "PasteSelection" 147 | mouse = "Middle" 148 | 149 | [scrolling] 150 | history = 15000 151 | multiplier = 3 152 | 153 | [selection] 154 | save_to_clipboard = false 155 | semantic_escape_chars = ",│`|:\"' ()[]{}<>" 156 | 157 | [shell] 158 | program = "/usr/local/bin/fish" 159 | 160 | [window] 161 | decorations = "buttonless" 162 | dynamic_title = true 163 | opacity = 1 164 | startup_mode = "Maximized" 165 | 166 | [window.padding] 167 | x = 2 168 | y = 2 169 | -------------------------------------------------------------------------------- /firefox/.tridactylrc: -------------------------------------------------------------------------------- 1 | " General Settings 2 | set update.lastchecktime 1725786400509 3 | set configversion 2.0 4 | set theme quakelight 5 | set newtab about:blank 6 | set editorcmd /Applications/Alacritty.app/Con*tents/MacOS/alacritty -e /Users/hit9/.bin/nvim/bin/nvim -f 7 | 8 | " For syntax highlighting see https://github.com/tridactyl/vim-tridactyl 9 | " vim: set filetype=tridactyl 10 | -------------------------------------------------------------------------------- /firefox/css/README.md: -------------------------------------------------------------------------------- 1 | Firefox tweaks: 2 | 3 | 1. Find the profile folder: `about:support`, find “Profile Directory”. 4 | 2. `about:config` -> `toolkit.legacyUserProfileCustomizations.stylesheets` to `true` 5 | 3. Creates a folder `chrome` under profile folder. 6 | 7 | Some tweaks: 8 | 9 | * Enable Compact Mode: `about:config` -> `browser.compactmode.show` to `true` 10 | * Remove Extensions Button: `about:config` -> `extensions.unifiedExtensions.enabled` to `false` 11 | * Compact toobar: `Customize mode > Density > Compact`. 12 | * Startup Image: `about:config` -> `browser.startup.preXulSkeletonUI` -> `false` 13 | 14 | Css tweaks for [tabcenter-reborn](https://addons.mozilla.org/en-US/firefox/addon/tabcenter-reborn/): 15 | 16 | * https://framagit.org/ariasuni/tabcenter-reborn/-/wikis/home 17 | * https://github.com/ranmaru22/firefox-vertical-tabs 18 | -------------------------------------------------------------------------------- /firefox/css/firefox-csshacks/autohide_sidebar.css: -------------------------------------------------------------------------------- 1 | /* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/autohide_sidebar.css made available under Mozilla Public License v. 2.0 2 | See the above repository for updates as well as full license text. */ 3 | 4 | /* Show sidebar only when the cursor is over it */ 5 | /* The border controlling sidebar width will be removed so you'll need to modify these values to change width */ 6 | 7 | #sidebar-box{ 8 | --uc-sidebar-width: 40px; 9 | --uc-sidebar-hover-width: 210px; 10 | --uc-autohide-sidebar-delay: 600ms; /* Wait 0.6s before hiding sidebar */ 11 | --uc-autohide-transition-duration: 115ms; 12 | --uc-autohide-transition-type: linear; 13 | position: relative; 14 | min-width: var(--uc-sidebar-width) !important; 15 | width: var(--uc-sidebar-width) !important; 16 | max-width: var(--uc-sidebar-width) !important; 17 | z-index:1; 18 | } 19 | 20 | #sidebar-box[positionend]{ direction: rtl } 21 | #sidebar-box[positionend] > *{ direction: ltr } 22 | 23 | #sidebar-box[positionend]:-moz-locale-dir(rtl){ direction: ltr } 24 | #sidebar-box[positionend]:-moz-locale-dir(rtl) > *{ direction: rtl } 25 | 26 | #main-window[sizemode="fullscreen"] #sidebar-box{ --uc-sidebar-width: 1px; } 27 | 28 | #sidebar-splitter{ display: none } 29 | 30 | #sidebar-header{ 31 | overflow: hidden; 32 | color: var(--chrome-color, inherit) !important; 33 | padding-inline: 0 !important; 34 | } 35 | 36 | #sidebar-header::before, 37 | #sidebar-header::after{ 38 | content: ""; 39 | display: flex; 40 | padding-left: 8px; 41 | } 42 | 43 | #sidebar-header, 44 | #sidebar{ 45 | transition: min-width var(--uc-autohide-transition-duration) var(--uc-autohide-transition-type) var(--uc-autohide-sidebar-delay) !important; 46 | min-width: var(--uc-sidebar-width) !important; 47 | will-change: min-width; 48 | } 49 | #sidebar-box:hover > #sidebar-header, 50 | #sidebar-box:hover > #sidebar{ 51 | min-width: var(--uc-sidebar-hover-width) !important; 52 | transition-delay: 0ms !important; 53 | } 54 | 55 | .sidebar-panel{ 56 | background-color: transparent !important; 57 | color: var(--newtab-text-primary-color) !important; 58 | } 59 | 60 | .sidebar-panel #search-box{ 61 | -moz-appearance: none !important; 62 | background-color: rgba(249,249,250,0.1) !important; 63 | color: inherit !important; 64 | } 65 | 66 | /* Add sidebar divider and give it background */ 67 | 68 | #sidebar, 69 | #sidebar-header{ 70 | background-color: inherit !important; 71 | border-inline: 1px solid rgb(80,80,80); 72 | border-inline-width: 0px 1px; 73 | } 74 | 75 | #sidebar-box:not([positionend]) > :-moz-locale-dir(rtl), 76 | #sidebar-box[positionend] > *{ 77 | border-inline-width: 1px 0px; 78 | } 79 | 80 | /* Move statuspanel to the other side when sidebar is hovered so it doesn't get covered by sidebar */ 81 | 82 | #sidebar-box:not([positionend]):hover ~ #appcontent #statuspanel{ 83 | inset-inline: auto 0px !important; 84 | } 85 | #sidebar-box:not([positionend]):hover ~ #appcontent #statuspanel-label{ 86 | margin-inline: 0px !important; 87 | border-left-style: solid !important; 88 | } 89 | -------------------------------------------------------------------------------- /firefox/css/firefox-csshacks/overlay_sidebar_header.css: -------------------------------------------------------------------------------- 1 | /* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/overlay_sidebar_header.css made available under Mozilla Public License v. 2.0 2 | See the above repository for updates as well as full license text. */ 3 | 4 | /* This is a hack that only "kinda" works! */ 5 | /* Changes sidebar header to appear as small "notch" at the top of the sidebar. Hovering it will show full sidebar so you can have access to sidebar switcher button. The caveat is that you need to click the switcher button TWICE - otherwise the header and switcher popup will hide themselver as soon as cursor is moved on top of the switcher popup. */ 6 | 7 | #sidebar-header{ 8 | display: flex; 9 | position: absolute; 10 | width: inherit; 11 | visibility: hidden; 12 | background-color: inherit; 13 | -moz-user-focus: normal; 14 | } 15 | #sidebar-header::before{ 16 | visibility: visible; 17 | content: ""; 18 | border-bottom-left-radius: 8px; 19 | border-bottom-right-radius: 8px; 20 | background-color: inherit; 21 | border: 1px solid var(--chrome-content-separator-color); 22 | border-top: none; 23 | height: 8px; 24 | width: 14px; 25 | margin-top: -9px; 26 | margin-inline-start: -4px; 27 | } 28 | #sidebar-switcher-target.active{ 29 | pointer-events: none; 30 | } 31 | #sidebar-header:focus-within, 32 | #sidebar-header:hover{ 33 | visibility: visible; 34 | } 35 | #sidebar-spacer{ 36 | flex-grow: 1; 37 | } -------------------------------------------------------------------------------- /firefox/css/tabCenterReborn.css: -------------------------------------------------------------------------------- 1 | /* Overwrite some colours */ 2 | :root { 3 | --tab-separator: transparent; 4 | --tab-selected-line: transparent; 5 | --tablist-separator: #cccccc; 6 | --overflow-indicator-border: #333333; 7 | } 8 | 9 | @media (prefers-color-scheme: dark) { 10 | :root { 11 | --background: #1c1b22; 12 | --icons: rgb(251,251,254); 13 | --tab-separator: transparent; 14 | --tab-active-background: rgb(66,65,77); 15 | --tab-active-text: rgb(251,251,254); 16 | --tab-text: #fbfbfe; 17 | --toolbar-background: rgb(43,42,51); 18 | --toolbar-text: rgb(251, 251, 254); 19 | --input-background: rgb(28,27,34); 20 | --input-border: transparent; 21 | --input-background-focus: rgb(66,65,77); 22 | --input-selected-text: rgb(251,251,254); 23 | --input-text: rgb(251,251,254); 24 | --input-text-focus: rgb(251,251,254); 25 | --identity-color-toolbar: rgb(251,251,254); 26 | --tablist-separator: #333333; 27 | --overflow-indicator-border: #cccccc; 28 | } 29 | } 30 | 31 | /* fix autoscrolling bug when middle clicking */ 32 | :root, 33 | body { 34 | overflow: hidden; 35 | } 36 | 37 | /* Move topmenu to bottom */ 38 | #topmenu { 39 | order: 2; 40 | background: transparent; 41 | border: none; 42 | } 43 | 44 | #newtab { 45 | margin-left: 6px; 46 | } 47 | 48 | #settings { 49 | margin-right: 2px; 50 | } 51 | 52 | /* Hide filterbox & settings icon */ 53 | #filterbox-icon, 54 | #filterbox-input, 55 | #settings { 56 | display: none; 57 | } 58 | 59 | #tablist-wrapper { 60 | height: auto; 61 | margin-inline: 6px; 62 | /* adds margin above tabs to make the spacing even */ 63 | margin-top: 5px; 64 | } 65 | 66 | /* fix glitch with spacing in-between pinned tabs */ 67 | #pinnedtablist:not(.compact) { 68 | display: flex; 69 | flex-direction: column; 70 | } 71 | 72 | #tablist-wrapper::after { 73 | content: ""; 74 | margin: 2px 0; 75 | border: 1px solid var(--tablist-separator); 76 | } 77 | 78 | #newtab { 79 | flex-grow: 1; 80 | margin-right: 2px; 81 | margin-left: 2px; 82 | padding-left: 9px; 83 | min-width: 36px; 84 | width: 100%; 85 | } 86 | 87 | .tab, 88 | .tab.active { 89 | border-radius: 4px; 90 | border-bottom: none !important; 91 | margin: 1px 0; 92 | } 93 | 94 | #pinnedtablist:not(.compact) .tab, 95 | #tablist .tab { 96 | padding: 0; 97 | } 98 | 99 | #newtab::after { 100 | content: "New tab"; 101 | margin-left: 10px; 102 | white-space: nowrap; 103 | overflow: hidden; 104 | } 105 | 106 | #newtab-icon { 107 | min-width: 16px; 108 | } 109 | 110 | 111 | /* the @media rule only allows these settings apply when the sidebar is expanded */ 112 | @media (min-width: 49px) { 113 | /* Move close button to left side */ 114 | /*.tab-close { 115 | left: 0; 116 | margin-left: 3px; 117 | }*/ 118 | 119 | /* Fix title gradient */ 120 | /*#tablist .tab:hover > .tab-title-wrapper { 121 | mask-image: linear-gradient(to left, transparent 0, black 2em); 122 | }*/ 123 | 124 | /* Move tab text to right when hovering to accomodate for the close button */ 125 | /*#tablist .tab:hover > .tab-title-wrapper { 126 | margin-left: 28px; 127 | transition: all 0.2s ease; 128 | }*/ 129 | 130 | /* Move favicon to right when hovering to accomodate for the close button */ 131 | /*#tablist .tab:hover > .tab-meta-image { 132 | padding-left: 25px; 133 | transition: all 0.2s ease; 134 | }*/ 135 | } 136 | 137 | 138 | /*** Move container indicators to left ***/ 139 | #tablist-wrapper { 140 | margin-left: 0px; 141 | padding-left: 6px; 142 | } 143 | #tablist, 144 | #pinnedtablist:not(.compact) { 145 | margin-left: -6px; 146 | padding-left: 6px; 147 | } 148 | .tab { 149 | overflow: visible; 150 | } 151 | #tablist .tab[data-identity-color] .tab-context, 152 | #pinnedtablist:not(.compact) .tab[data-identity-color] .tab-context { 153 | box-shadow: none !important; 154 | } 155 | #tablist .tab[data-identity-color] .tab-context::before, 156 | #pinnedtablist:not(.compact) .tab[data-identity-color] .tab-context::before { 157 | content: ""; 158 | position: absolute; 159 | top: 6px; 160 | left: -6px; 161 | bottom: 6px; 162 | width: 3px; 163 | border-radius: 0 5px 5px 0; 164 | background: var(--identity-color); 165 | transition: inset .1s; 166 | } 167 | #tablist .tab.active[data-identity-color] .tab-context::before, 168 | #pinnedtablist:not(.compact) .tab.active[data-identity-color] .tab-context::before { 169 | top: 1px; 170 | bottom: 1px; 171 | } 172 | 173 | /* center favicons within the tab */ 174 | #tablist-wrapper.shrinked>:not(#pinnedtablist.compact) .tab-meta-image { 175 | margin-left: 6px !important; 176 | } 177 | 178 | /* hide certain items when collapsed */ 179 | @media (max-width: 64px) { 180 | /* using 64px minimum width to give the tab favicons more room during the transition */ 181 | .tab-close, 182 | .tab-pin { 183 | visibility: collapse !important; 184 | } 185 | 186 | /* hide scrollbar when sidebar is collapsed */ 187 | #tablist { 188 | scrollbar-width: none; 189 | } 190 | } 191 | 192 | @media (max-width: 48px) { 193 | #settings-icon, 194 | #tablist-wrapper .tab-title-wrapper, 195 | #newtab::after, 196 | #settings { 197 | visibility: hidden !important; 198 | } 199 | } 200 | 201 | /* Use mask for overflow instead of shadows */ 202 | .can-scroll-top #tablist { 203 | mask: linear-gradient(transparent, black 40px); 204 | } 205 | .can-scroll-bottom #tablist { 206 | mask: linear-gradient(black calc(100% - 40px), transparent); 207 | } 208 | .can-scroll-bottom.can-scroll-top #tablist { 209 | mask: linear-gradient(transparent, black 40px calc(100% - 40px), transparent); 210 | } 211 | #topshadow, #bottomshadow { 212 | display: none; 213 | } 214 | 215 | /* Prevent showing scrollbar when adding/removing tabs */ 216 | #tablist-wrapper:not(.can-scroll-bottom):not(.can-scroll-top) #tablist { 217 | overflow: hidden; 218 | } 219 | 220 | /*** Prevent Favicon-only pinned tabs from wrapping ***/ 221 | #pinnedtablist.compact { 222 | flex-wrap: nowrap; 223 | overflow-x: auto; 224 | gap: 2px; 225 | } 226 | #pinnedtablist.compact:not(:hover):not(:focus-within) { /* Prevent scrollbar from showing when transitioning */ 227 | scrollbar-width: none; 228 | } 229 | #pinnedtablist.compact .tab { 230 | min-width: 36px; 231 | } 232 | @media (max-width: 48px) { 233 | #pinnedtablist.compact { 234 | overflow-x: clip /* Clip always makes it reset scroll position */ 235 | } 236 | #pinnedtablist.compact .tab.active { 237 | order: -1 238 | } 239 | } 240 | 241 | /*** Better support for non-compact mode ***/ 242 | #tablist-wrapper:not(.shrinked) .tab-meta-image { 243 | display: flex; 244 | align-items: center; 245 | 246 | width: 58px; 247 | border: 0 !important; 248 | margin-right: 4px; 249 | border-radius: inherit; 250 | background-position: center; 251 | min-width: 0px !important; 252 | background-color: var(--toolbar-background) !important; 253 | transition: margin .4s; 254 | } 255 | #tablist-wrapper:not(.shrinked) .tab-icon-wrapper { 256 | transition: margin .1s; 257 | z-index: 2; 258 | } 259 | #tablist-wrapper:not(.shrinked) .tab-icon-overlay { 260 | top: unset !important; 261 | bottom: 8px; 262 | left: 25px !important; 263 | z-index: 4; 264 | transition: inset .1s; 265 | } 266 | 267 | /* If you want to disable the website previews, 268 | comment out the @media line below and its closing bracket */ 269 | @media (max-width: 49px) { 270 | #tablist-wrapper:not(.shrinked) .tab-meta-image { 271 | background-color: inherit !important; 272 | border-width: 0 !important; 273 | box-shadow: none !important; 274 | height: 0 !important; 275 | width: 26px; 276 | margin-right: 0px; 277 | } 278 | #tablist-wrapper:not(.shrinked) .tab-icon-wrapper { 279 | background-color: transparent !important; 280 | margin-top: 0 !important; 281 | margin-left: 3px !important; 282 | box-shadow: none !important; 283 | } 284 | #tablist-wrapper:not(.shrinked) .tab-icon-overlay { 285 | bottom: 12px; 286 | left: 16px !important; 287 | } 288 | } 289 | 290 | /* middle click newtab workaround */ 291 | 292 | /* allows the #spacer element to take up more space */ 293 | #spacer { 294 | min-height: 100vh; 295 | } 296 | 297 | /* moves the new tab button to the original position */ 298 | #tablist-wrapper { 299 | margin-bottom: -100vh; 300 | } 301 | 302 | /* moves the new tab button separator to the original position */ 303 | #tablist-wrapper::after { 304 | transform: translateY(-100vh); 305 | } 306 | 307 | -------------------------------------------------------------------------------- /firefox/css/userChrome.css: -------------------------------------------------------------------------------- 1 | @import url("firefox-csshacks/autohide_sidebar.css"); 2 | @import url("firefox-csshacks/overlay_sidebar_header.css"); 3 | 4 | /* Hide vertical tabs */ 5 | #TabsToolbar { 6 | visibility: collapse !important; 7 | } 8 | -------------------------------------------------------------------------------- /firefox/css/userContent.css: -------------------------------------------------------------------------------- 1 | @-moz-document url(about:newtab), url(about:home), regexp("^moz-extension://.*/static/newtab.html$"), url(about:blank) 2 | { 3 | body { 4 | background-image: url(fx-dev-edition_wallpaper_2560x1440.jpg) !important; /* Image in chrome folder */ 5 | background-size: cover !important; 6 | background-attachment: fixed !important; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /fish/README.md: -------------------------------------------------------------------------------- 1 | Fish 2 | ---- 3 | 4 | Files: 5 | 6 | * `~/.config/fish/config.fish`: Fish shell configuration. 7 | * `~/.config/fish/fishfile`: fisher plugins. 8 | 9 | Plugins: 10 | 11 | 1. [hit9/fish-pyenv](https://github.com/hit9/fish-pyenv) - fast pyenv by lazy initialization. 12 | 2. [jethrokuan/z](https://github.com/jethrokuan/z) - jumping between directories. 13 | 14 | Notes: 15 | 16 | 1. Install plugins: `fisher update` 17 | 18 | Functions: 19 | 20 | 1. `Ctrl-X` to edit command buffer in `$EDITOR`. 21 | 2. `dotenv` to load environment variables from file (without extral tools), along with `dotenv-erase`. 22 | 3. Fancy greeting message via fast [lolcat (in C)](https://github.com/jaseg/lolcat) 23 | 24 | References: 25 | 26 | * fish shell: https://fishshell.com 27 | * fisher plugin manager: https://github.com/jorgebucaran/fisher 28 | * colorscheme: https://github.com/pure-fish/pure 29 | * blog (chinese): https://writings.sh/post/commandline-tools#shell--fish 30 | 31 | Commandline tools: 32 | 33 | * [fzf](https://github.com/junegunn/fzf): `Ctrl-R` fuzzy command finder. 34 | * [exa](https://github.com/ogham/exa): Very very fast `ls` replacement. 35 | * [the_silver_searcher](https://github.com/ggreer/the_silver_searcher): Much faster than `ack` replacement. 36 | * fortune (`brew install fortune`) 37 | * cowsay (`brew install cowsay`) 38 | * [oo](https://github.com/hit9/oo): Go version manager. 39 | * [n](https://github.com/tj/n): Node version manager. 40 | * [pyenv](https://github.com/pyenv/pyenv): Python version manager. 41 | -------------------------------------------------------------------------------- /fish/config.fish: -------------------------------------------------------------------------------- 1 | # Configuration file for fish shell. 2 | # Filepath: ~/.config/fish/config.fish 3 | # Fish shell: https://fishshell.com/ 4 | # Fish plugin manager: https://github.com/jorgebucaran/fisher 5 | 6 | # https://github.com/pure-fish/pure 7 | # Leader symbol for fish prompt 8 | set pure_symbol_prompt "\$" 9 | set pure_color_virtualenv "magenta" 10 | set pure_show_jobs true 11 | set pure_color_jobs "blue" 12 | set pure_show_system_time false 13 | 14 | # Async prompt 15 | set -g async_prompt_functions _pure_prompt_git 16 | 17 | # Basic environments 18 | set -x SHELL fish 19 | set -x TERM screen-256color 20 | set -x EDITOR /Users/hit9/.bin/nvim/bin/nvim 21 | set -x LANG en_US.UTF-8 22 | set -x LC_ALL en_US.UTF-8 23 | 24 | # Go 25 | set -x GOPATH $HOME/dev/gopark 26 | set -x GO111MODULE on 27 | 28 | # https://github.com/tj/n 29 | # Where node versions stores. 30 | set -x N_PREFIX $HOME/.n 31 | 32 | # $PATH environment variables 33 | set -e fish_user_paths 34 | set -gx fish_user_paths \ 35 | $HOME/.pyenv/shims \ 36 | /opt/homebrew/opt/llvm/bin \ 37 | /opt/homebrew/opt/ruby/bin \ 38 | /opt/homebrew/opt/n/bin \ 39 | $GOPATH/bin \ 40 | $HOME/.cargo/bin \ 41 | $HOME/.dotnet/tools \ 42 | /opt/homebrew/bin \ 43 | $N_PREFIX/bin \ 44 | /usr/local/sbin \ 45 | /usr/local/bin \ 46 | /usr/sbin \ 47 | /usr/bin \ 48 | /sbin \ 49 | /bin \ 50 | $fish_user_paths 51 | 52 | # Config files directory. 53 | set -x XDG_CONFIG_HOME $HOME/.config 54 | 55 | # oo (Go version manager) 56 | # https://github.com/hit9/oo 57 | source $HOME/.oo/env.fish 58 | 59 | # Swiftly 60 | set -x SWIFTLY_HOME_DIR "/Users/hit9/.swiftly" 61 | set -x SWIFTLY_BIN_DIR "/Users/hit9/.swiftly/bin" 62 | set -x PATH "$SWIFTLY_BIN_DIR" $PATH 63 | 64 | # homebrew 65 | # disable auto updates. 66 | set -x HOMEBREW_NO_AUTO_UPDATE 1 67 | 68 | # https://github.com/junegunn/fzf 69 | fzf --fish | source 70 | set -x FZF_DEFAULT_COMMAND 'fd --type f --exclude .git' 71 | 72 | # Rewrite Greeting message 73 | # https://github.com/jaseg/lolcat 74 | if not functions -q _old_fish_greeting 75 | functions -c fish_greeting _old_fish_greeting 76 | end 77 | function fish_greeting 78 | _old_fish_greeting 79 | if type -q fortune and type -q lolcat 80 | fortune -s | lolcat -l 81 | end 82 | end 83 | 84 | # Display current activated python virtualenv on prompt. 85 | # Rewrite prompt for pyenv (overriding pure-fish/pure) 86 | if not functions -q _old_pure_prompt_virtualenv 87 | functions -c _pure_prompt_virtualenv _old_pure_prompt_virtualenv 88 | end 89 | function _pure_prompt_virtualenv 90 | if set -q PYENV_VERSION 91 | # https://github.com/pure-fish/pure/blob/master/functions/_pure_prompt_virtualenv.fish 92 | echo -n -s (set_color magenta) "" (basename "$PYENV_VERSION") "" (set_color normal) "" 93 | end 94 | if set -q VIRTUAL_ENV 95 | echo -n -s (set_color magenta) "" (basename "$VIRTUAL_ENV") "" (set_color normal) "" 96 | end 97 | end 98 | 99 | 100 | # Rewrite function fish_user_key_bindings 101 | if functions -q fish_user_key_bindings 102 | if not functions -q _old_fish_user_key_bindings 103 | functions -c fish_user_key_bindings _old_fish_user_key_bindings 104 | end 105 | end 106 | 107 | function fish_user_key_bindings 108 | if functions -q _old_fish_user_key_bindings 109 | _old_fish_user_key_bindings 110 | end 111 | # Ctrl-X to edit command buffer with $EDITOR 112 | bind \cx edit_command_buffer 113 | end 114 | 115 | # fish dotenv function. 116 | # Execute `dotenv` will load environment variables from file `.env`. 117 | function dotenv --description 'Load environment variables from .env file' 118 | set -l envfile ".env" 119 | 120 | if [ (count $argv) -gt 0 ] 121 | set envfile $argv[1] 122 | end 123 | 124 | if test -e $envfile 125 | # If envfile exists, set env variables one by one. 126 | for line in (cat $envfile | grep -e '[^[:space:]]' | grep -v '^#') 127 | set -xg (echo $line | cut -d = -f 1) (echo $line | cut -d = -f 2-) 128 | end 129 | 130 | set -xg __DOTENV_ACTIVATE 1 131 | 132 | # Rewrite _pure_prompt function 133 | if not functions -q _old_pure_prompt 134 | functions -c _pure_prompt _old_pure_prompt 135 | end 136 | 137 | # Insert dotenv prefix to prompt 138 | function _pure_prompt --inherit-variable envfile --argument-names exit_code 139 | if set -q __DOTENV_ACTIVATE 140 | echo -n -s (set_color green) "(" $envfile ")" (set_color normal) " " 141 | end 142 | _old_pure_prompt $exit_code 143 | end 144 | end 145 | end 146 | 147 | function dotenv-erase --description 'Erase environment variables from given file' 148 | set -l envfile ".env" 149 | 150 | if [ (count $argv) -gt 0 ] 151 | set envfile $argv[1] 152 | end 153 | 154 | if test -e $envfile 155 | # If envfile exists, set env variables one by one. 156 | for line in (cat $envfile | grep -e '[^[:space:]]' | grep -v '^#') 157 | set --erase (echo $line | cut -d = -f 1) 158 | end 159 | end 160 | 161 | set --erase __DOTENV_ACTIVATE 162 | end 163 | 164 | # Alias 165 | alias g "git" 166 | alias gst "git status" 167 | alias gc "git commit -ev" 168 | alias python python3 169 | alias pip pip3 170 | alias nvim ~/.bin/nvim/bin/nvim 171 | # exa => https://github.com/ogham/exa 172 | alias ls exa 173 | # ag => https://github.com/ggreer/the_silver_searcher 174 | alias ack ag 175 | alias sed gsed 176 | -------------------------------------------------------------------------------- /fish/fish_plugins: -------------------------------------------------------------------------------- 1 | jorgebucaran/fisher 2 | jethrokuan/z 3 | hit9/fish-pyenv 4 | pure-fish/pure 5 | acomagu/fish-async-prompt 6 | -------------------------------------------------------------------------------- /fonts/Inconsolata LGC Bold Italic Nerd Font Complete Mono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hit9/dotfiles/d5bb284f3e7292ad04186cd77453d2df79506217/fonts/Inconsolata LGC Bold Italic Nerd Font Complete Mono.ttf -------------------------------------------------------------------------------- /fonts/Inconsolata LGC Bold Italic Nerd Font Complete Windows Compatible.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hit9/dotfiles/d5bb284f3e7292ad04186cd77453d2df79506217/fonts/Inconsolata LGC Bold Italic Nerd Font Complete Windows Compatible.ttf -------------------------------------------------------------------------------- /fonts/Inconsolata LGC Bold Italic Nerd Font Complete.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hit9/dotfiles/d5bb284f3e7292ad04186cd77453d2df79506217/fonts/Inconsolata LGC Bold Italic Nerd Font Complete.ttf -------------------------------------------------------------------------------- /fonts/Inconsolata LGC Bold Nerd Font Complete Mono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hit9/dotfiles/d5bb284f3e7292ad04186cd77453d2df79506217/fonts/Inconsolata LGC Bold Nerd Font Complete Mono.ttf -------------------------------------------------------------------------------- /fonts/Inconsolata LGC Nerd Font Complete.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hit9/dotfiles/d5bb284f3e7292ad04186cd77453d2df79506217/fonts/Inconsolata LGC Nerd Font Complete.ttf -------------------------------------------------------------------------------- /git/gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = hit9 3 | email = hit9@icloud.com 4 | [url "git@github.com:"] 5 | insteadOf = https://github.com/ 6 | [merge] 7 | tool = vimdiff 8 | # Include summaries of merged commits in newly created merge commit messages 9 | log = true 10 | [giggle] 11 | main-window-maximized = false 12 | main-window-geometry = 296x71+1+58 13 | history-view-vpane-position = 549 14 | main-window-view = FileView 15 | file-view-vpane-position = 538 16 | [color] 17 | ui = true 18 | diff = auto 19 | status = auto 20 | branch = auto 21 | [diff] 22 | tool = vimdiff 23 | 24 | [difftool "vimdiff"] 25 | cmd = vimdiff -b \"$LOCAL\" \"$REMOTE\" 26 | 27 | [core] 28 | editor = ~/.bin/nvim/bin/nvim 29 | pager = diff-so-fancy | less --tabs=4 -RFX 30 | excludesfile = ~/.gitignore 31 | 32 | [alias] 33 | lgg = log --graph --pretty=format:\"%C(yellow)%h%Creset%C(bold red)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\" 34 | st = status 35 | cm = commit 36 | ad = add . 37 | diff-last-tag = !git log `git describe --tags --abbrev=0`..HEAD --oneline 38 | [push] 39 | default = matching 40 | 41 | [rerere] 42 | enabled = 1 43 | autoupdate = 1 44 | [color "diff-highlight"] 45 | oldNormal = red bold 46 | oldHighlight = red bold 52 47 | newNormal = green bold 48 | newHighlight = green bold 22 49 | [color "diff"] 50 | meta = 11 51 | frag = magenta bold 52 | commit = yellow bold 53 | old = red bold 54 | new = green bold 55 | whitespace = red reverse 56 | func = 146 bold 57 | [init] 58 | defaultBranch = master 59 | [interactive] 60 | diffFilter = diff-so-fancy --patch 61 | [filter "lfs"] 62 | smudge = git-lfs smudge -- %f 63 | process = git-lfs filter-process 64 | required = true 65 | clean = git-lfs clean -- %f 66 | -------------------------------------------------------------------------------- /git/gitignore: -------------------------------------------------------------------------------- 1 | .*.sw[opnm] 2 | *.null-ls_* 3 | -------------------------------------------------------------------------------- /misc/Keybindings/DefaultKeyBinding.dict: -------------------------------------------------------------------------------- 1 | { 2 | "~d" = "deleteWordForward:"; 3 | "^w" = "deleteWordBackward:"; 4 | "~f" = "moveWordForward:"; 5 | "~b" = "moveWordBackward:"; 6 | } 7 | -------------------------------------------------------------------------------- /misc/Keybindings/README.md: -------------------------------------------------------------------------------- 1 | ln -s /path/to/dotfiles/misc/Keybindings/DefaultKeyBinding.dict ~/Library/Keybindings/DefaultKeyBinding.dict 2 | 3 | for emacs keybindings all over mac apps. 4 | -------------------------------------------------------------------------------- /misc/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hit9/dotfiles/d5bb284f3e7292ad04186cd77453d2df79506217/misc/demo.png -------------------------------------------------------------------------------- /nvim/README.md: -------------------------------------------------------------------------------- 1 | To use these neovim configs: 2 | 3 | 1. Clone this repo. 4 | 2. `ln -s /path/to/dotfiles/nvim/init.nvim ~/.config/nvim/init.nvim` 5 | 3. `ln -s /path/to/dotfiles/nvim/lua ~/.config/nvim/lua` 6 | 4. Install [junegunn/vim-plug](https://github.com/junegunn/vim-plug) and then run `nvim -c PlugInstall` to install plugins. 7 | 5. Install extra tools like lanuage servers, cppman, cppinsights etc. 8 | 6. Install treesitter grammer parsers, e.g. Run `:TSInstall cpp` in nvim. 9 | -------------------------------------------------------------------------------- /nvim/init.vim: -------------------------------------------------------------------------------- 1 | " vim: foldmethod=marker foldenable 2 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 3 | 4 | "Chao Wang's personal vim configurations. https://github.com/hit9/dotfiles 5 | "Requires: NeoVim >= 0.9, not support Vim. 6 | 7 | " Filepath: ~/.config/nvim/init.vim 8 | 9 | "Preload before all --- 10 | "Ref: https://github.com/neovim/neovim/issues/2437 11 | let g:python_host_prog = '~/.pyenv/shims/python' 12 | let g:python3_host_prog = '~/.pyenv/shims/python' 13 | "Identing inside parentheses can be very slow, regardless of the searchpair() 14 | "timeout, so let the user disable this feature if he doesn't need it 15 | "Ref: https://github.com/neovim/neovim/issues/15299 16 | let g:pyindent_disable_parentheses_indenting = 1 17 | 18 | 19 | "Plugins ---------------------------------------------- {{{ 20 | call plug#begin('~/.config/nvim/plugs') 21 | 22 | Plug 'NLKNguyen/papercolor-theme' "My favorite colorscheme. 23 | Plug 'pappasam/papercolor-theme-slim' "for 0.10+ 24 | Plug 'olimorris/onedarkpro.nvim' 25 | Plug 'EdenEast/nightfox.nvim' 26 | Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } "Famous file explorer plugin, lazy load on comand NERDTreeToggle 27 | Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' } "NERDTree plugin which shows git status flags, lazy load on comand NERDTreeToggle 28 | Plug 'nvim-lualine/lualine.nvim' "lua version statusline. 29 | Plug 'windwp/nvim-autopairs' "Close pair ()[]{} etc. automatically. 30 | Plug 'mg979/vim-visual-multi' "Multiple cursors plugin for vim/neovim. 31 | Plug 'wellle/targets.vim' "Vim plugin that provides additional text objects 32 | Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } "Fuzzy search files/buffers etc, Ctrl-p. 33 | Plug 'junegunn/fzf.vim' "Fzf vim plugin. 34 | Plug 'mhinz/vim-signify' "Show diff signs for file changes under git/hg/svn control. 35 | Plug 'simeji/winresizer' "Window resizer. 36 | Plug 'troydm/zoomwintab.vim' "Window zoom. 37 | Plug 'nvim-lua/plenary.nvim' 38 | Plug 'sindrets/diffview.nvim', { 'branch': 'main' } "Vimdiff with a files navigator. 39 | Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} "Syntax highlighting for variety filetypes. 40 | Plug 'dohsimpson/vim-macroeditor' "Edito macro => :MacroEdit a 41 | Plug 'tpope/vim-fugitive' "Git plugin. 42 | Plug 'lukas-reineke/indent-blankline.nvim', { 'tag': 'v2.20.8' } "Indent guides for Neovim 43 | Plug 'nvimtools/none-ls.nvim' 44 | Plug 'nvimtools/none-ls-extras.nvim' 45 | "Completion & LSP (language protocol server). 46 | Plug 'neovim/nvim-lspconfig' 47 | Plug 'hrsh7th/cmp-vsnip', { 'branch': 'main' } 48 | Plug 'hrsh7th/vim-vsnip' 49 | Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' } 50 | Plug 'hrsh7th/nvim-cmp', { 'branch': 'main' } 51 | Plug 'hrsh7th/cmp-buffer', { 'branch': 'main' } 52 | "ray-x/lsp_signature.nvim is slow, with poor performance... 53 | "I use another lightweight-but-fast alternative. 54 | "Plug 'erhickey/sig-window-nvim' 55 | Plug 'hit9/sig-window-nvim', { 'branch': 'split-lines-before-nvim_buf_set_lines' } 56 | Plug 'Decodetalkers/csharpls-extended-lsp.nvim', { 'for': 'cs' } 57 | Plug 'hedyhli/outline.nvim' "Code outline sidebar powered by LSP. 58 | Plug 'hit9/bitproto', { 'rtp': 'editors/vim', 'for': 'bitproto' } 59 | "C/C++ 60 | Plug 'https://git.sr.ht/~p00f/godbolt.nvim' "Godbolt - CompilerExplorer 61 | Plug 'skywind3000/vim-cppman', { 'for': 'cpp' } 62 | Plug 'Freed-Wu/cppinsights.vim' 63 | 64 | call plug#end() 65 | "End Plugins ----------------------------------------------- }}} 66 | 67 | 68 | "Basic ------------------------------------------------------ {{{ 69 | filetype plugin indent on 70 | 71 | "Basic 72 | set nocompatible " be iMproved 73 | " set shell=/usr/local/bin/fish "Vim's shell, defaults to `$SHELL`. 74 | set noeb "Disable bells. 75 | set ttyfast "Indicates a fast terminal connection. (see :help ttyfast). 76 | set title "Makes terminal title is set by vim. 77 | set titleold= "Restore old title after leaving vim. 78 | set autoread "Auto updates current file if this file is updated by outer. 79 | set hidden "Opening a new file when the current buffer has unsaved changes causes files to be hidden instead of closed. 80 | set autochdir "Auto switch current working directory to current editing file's directory. 81 | set updatetime=750 "Smaller updatetime for CursorHold & CursorHoldI 82 | 83 | "Mouse 84 | set mouse=a "Enable mouse. 85 | set selection=exclusive "Mouse can only selects the block where ths cursor is on. 86 | set selectmode=mouse,key 87 | set mousehide "Hide mouse cursor on keyboard typing. 88 | set mousemodel=popup "Right mouse button pops up a menu. 89 | 90 | "Syntax 91 | syntax enable "Enable syntax. 92 | set synmaxcol=300 "Don't perform highlight on lines that are longer than 300 chars. 93 | "syntax sync minlines=1000 94 | set redrawtime=1000 "Smaller redrawtime 95 | 96 | "Displayment 97 | set number "Show line numbers. 98 | set norelativenumber "Don't use relative line numbers. 99 | set go= "Disable gvim's gui menu. (But I personally never use gui version vim). 100 | set shortmess=atIc "Disable the short message on vim start. 101 | set noshowcmd "Don't show command in the last line of screeen. 102 | set showmode "If in Insert, Replace or Visual mode put a message on the last line. 103 | set nowrap "Lines longer than the width of window will wrap and displaying continues on the next line. 104 | set signcolumn=yes "Always show signcolumns 105 | set cmdheight=2 "Command-line height (number of screen lines). 106 | 107 | "Scroll 108 | set scrolloff=9999 "Cursor always stays in the middle of screen, https://stackoverflow.com/posts/1276428/revisions. 109 | 110 | "Statusline 111 | set laststatus=2 "Always show status line on the last window. 112 | set ruler "Show line and column number of where cursor is. 113 | 114 | "Search & Replace 115 | set gdefault "The :s/// is s///g by default 116 | set hlsearch "Highlight search results. 117 | set incsearch "Realtime search results showing. 118 | 119 | "Encoding (utf8) 120 | set encoding=utf-8 121 | set fencs=utf-8 "Encoding that creating new files. 122 | set termencoding=utf-8 "Encoding that output to terminal. 123 | set fileencoding=utf-8 "Encoding that saving files. 124 | set backspace=indent,eol,start "Backspace key, I just don't rely on it. 125 | 126 | "Fold 127 | set nofoldenable 128 | set foldmethod=indent 129 | set foldcolumn=0 "number of columns showing the foldlevels on the left sidebar. 130 | set foldlevel=0 131 | set foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo "Which commands trigger auto-unfold 132 | set foldclose=all "Close all folds (which level>foldlevel) automatically when cursor leaves. 133 | 134 | "Copy/Paste 135 | set clipboard=unnamed "Tmux copy issue: https://github.com/tmux/tmux/issues/543#issuecomment-248980734 136 | 137 | "Match 138 | set showmatch "When a bracket is inserted, briefly jump to the matching one. 139 | set matchtime=1 "Tenths of a second to show the matching paren. 140 | 141 | "Completion. 142 | "Default vim completion behavior when CTRL-P/N are used. 143 | set completeopt=longest,menu "Use a popup menu to show possible completinos. 144 | set cpt=.,w,b "Scan candidates from .(current buffer), w(buffers from other windows), b(other loaded buffers). 145 | 146 | "Indent (by default) 147 | set autoindent "Indent automatically. But notice that autoindent may make Cmd+V pastsing works wired, 148 | "so when pasting something from clipboard into vim, better to `:set paste` and then Cmd+V, 149 | "and rollback this setting via :set nopaste. 150 | set cindent "C style indent. 151 | set smartindent "http://vim.wikia.com/wiki/Indenting_source_code 152 | set expandtab "Expand tabs into spaces, by default (Python users's must-have). 153 | set tabstop=4 "Setting 1tab = 4 spaces. 154 | set softtabstop=4 "Number of spaces that a counts for while editing. :set paste makes softtabstop to 0 temply. 155 | set shiftwidth=4 "Number of spaces to use for each step of (auto)indent. 156 | 157 | set list "Show tabs via listchars below, and display end sign after endo fline. 158 | set listchars=space:·,tab:▸\ ,eol:¬,extends:❯,precedes:❮ "Chars that to display list. 159 | 160 | "Tab settings for diferent language filetypes (overriding). 161 | autocmd FileType text setlocal textwidth=79 162 | autocmd FileType go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 textwidth=110 163 | autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=110 164 | autocmd FileType ruby setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=79 165 | autocmd FileType php setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=79 166 | autocmd FileType javascript setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=79 167 | autocmd FileType html,htmldjango,xhtml,haml setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=0 168 | autocmd FileType sass,scss,css setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=79 169 | 170 | "Terminal 171 | "Using ESC to go back to normal. 172 | autocmd TermOpen * tnoremap 173 | 174 | "Basic :: Color -------------------------------- {{{ 175 | 176 | "Enable true color support: 177 | "https://lotabout.me/2018/true-color-for-tmux-and-vim/ 178 | "https://github.com/tmux/tmux/issues/1246 179 | if exists('+termguicolors') 180 | let &t_8f="\[38;2;%lu;%lu;%lum" 181 | let &t_8b="\[48;2;%lu;%lu;%lum" 182 | set termguicolors 183 | endif 184 | set t_Co=256 "Enable 256 color 185 | set background=dark "Using dark. Hmm dark is sexy. 186 | 187 | "Basic :: Color :: PaperColor ------- {{{ 188 | if has("nvim-0.10.0") 189 | "colorscheme PaperColorSlim 190 | colorscheme nordfox 191 | else 192 | let g:PaperColor_Theme_Options = { 193 | \ 'theme': { 194 | \ 'default.dark': { 195 | \ 'transparent_background': 1, 196 | \ 'override': { 197 | \ 'visual_bg': ['#006699', '31'], 198 | \ 'visual_fg': ['#ffffff', '255'] 199 | \ } 200 | \ } 201 | \ } 202 | \ } 203 | colorscheme PaperColor 204 | endif 205 | 206 | "End Basic :: Color :: PaperColor -------- }}} 207 | 208 | "Normal and Visual mode color cosutomization. 209 | highlight Normal term=none ctermbg=none "Make vim be transparent in terminal. 210 | highlight Visual term=none cterm=bold ctermbg=31 ctermfg=255 guibg=#006699 guifg=#ffffff 211 | 212 | "CursorLine/CursorColumn, should be applied after colorscheme loaded. 213 | highlight CursorLine term=none cterm=none ctermbg=238 ctermfg=none guibg=#444444 214 | highlight CursorColumn term=none cterm=none ctermbg=238 ctermfg=none guibg=#444444 215 | 216 | "Transparent background 217 | hi Normal ctermbg=NONE guibg=NONE 218 | hi LineNr ctermbg=NONE guibg=NONE 219 | hi SignColumn ctermbg=NONE guibg=NONE 220 | hi NormalFloat ctermbg=NONE guibg=NONE 221 | 222 | "End Basic :: Color ---------------------------- }}} 223 | 224 | "End Basic --------------------------------------------- }}} 225 | 226 | "Plugin :: scrooloose/nerdtree ------------------------------------------------ {{{ 227 | 228 | "Open nerdtree on buffer entered. And close it if it's the last window. 229 | autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif 230 | "nerdtree window's width. 231 | let NERDTreeWinSize=35 232 | "Show line number for nerdtree. 233 | let NERDTreeShowLineNumbers=1 234 | "Don't display these files: 235 | let NERDTreeIgnore=['\.pyc$', '\.o$', '\~$', '__pycache__', '\.mypy_cache', '\.DS_Store', 236 | \ '^\.git$', '\.o$', '\.so$', '\.egg$', "\.pytest_cache", "\.swp$", "\.swo$", "\.swn$", "\.null"] 237 | " Highlight the selected entry in the tree 238 | let NERDTreeHighlightCursorline=1 239 | " Show hidden files, too 240 | let NERDTreeShowFiles=1 241 | let NERDTreeShowHidden=1 242 | 243 | "User-defined custom command `:NT` to toggle nerdtree window 244 | :command NT :NERDTreeToggle 245 | " End Plugin :: scrooloose/nerdtree ----------------------------------------- }}} 246 | 247 | "Plugin :: mg979/vim-visual-multi ------------------------- {{{ 248 | let g:VM_theme = 'iceblue' "https://github.com/mg979/vim-visual-multi/wiki/Highlight-colors 249 | " Won't use default leader key \\, using Ctrl-N instead. 250 | " Select words: Ctrl-N and press N for next word. 251 | " Multiple lines: visual mode selection section, and Ctrl-N 252 | " Select all occurences of current word: Ctrl-N and press A quickly 253 | let g:VM_leader = '' 254 | let g:VM_maps = {} 255 | let g:VM_maps["Visual Add"] = '' 256 | "End Plugin :: mg979/vim-visual-multi ----------------------}}} 257 | 258 | "Plugin :: mhinz/vim-signify --------------------------- {{{ 259 | highlight SignColumn ctermbg=NONE cterm=NONE guibg=NONE gui=NONE 260 | highlight SignifySignAdd ctermfg=yellow ctermbg=green guifg=#F7DC6F guibg=#1E8449 261 | highlight SignifySignChange ctermfg=yellow ctermbg=blue guifg=#F7DC6F guibg=#2874A6 262 | highlight SignifySignDelete ctermfg=yellow ctermbg=red guifg=#F7DC6F guibg=#EC7063 263 | "End Plugin :: mhinz/vim-signify ----------------------- }}} 264 | 265 | "Plugin :: junegunn/fzf.vim ------------------------------ {{{ 266 | " ProjectFiles tries to locate files relative to the git root contained in 267 | " NerdTree, falling back to the current NerdTree dir if not available 268 | " see https://github.com/junegunn/fzf.vim/issues/47#issuecomment-160237795 269 | function! s:find_git_root() 270 | return system('git rev-parse --show-toplevel 2> /dev/null')[:-2] 271 | endfunction 272 | 273 | command! ProjectFiles execute 'Files' s:find_git_root() 274 | nmap :ProjectFiles 275 | nmap :Buffers 276 | 277 | "Search 'foo bar' in ~/projects 278 | ":Ag "foo bar" ~/projects 279 | "Start in fullscreen mode 280 | ":Ag! "foo bar" 281 | command! -bang -nargs=+ -complete=file Ag call fzf#vim#ag_raw(, fzf#vim#with_preview(), 0) 282 | 283 | "Search pattern in git root directory. 284 | command! -bang -nargs=+ AgGitFiles execute 'Ag!' s:find_git_root() 285 | 286 | " let g:fzf_layout = { 'window': { 'width': 1, 'height': 0.4, 'yoffset': 1, 'border': 'horizontal' } } 287 | " Customize fzf colors to match your color scheme 288 | let g:fzf_colors = { 289 | \ 'fg': ['fg', 'Normal'], 290 | \ 'bg': ['bg', 'Normal'], 291 | \ 'hl': ['fg', 'Comment'], 292 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], 293 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], 294 | \ 'hl+': ['fg', 'Statement'], 295 | \ 'info': ['fg', 'PreProc'], 296 | \ 'border': ['fg', 'Ignore'], 297 | \ 'prompt': ['fg', 'Conditional'], 298 | \ 'pointer': ['fg', 'Exception'], 299 | \ 'marker': ['fg', 'Keyword'], 300 | \ 'spinner': ['fg', 'Label'], 301 | \ 'header': ['fg', 'Comment'] } 302 | 303 | let g:fzf_layout = { 'window': { 'width': 0.7, 'height': 0.5 } } 304 | "End Plugin :: junegunn/fzf.vim ---------------------------- }}} 305 | 306 | "Plugin :: simeji/winresizer ------------------------- {{{ 307 | "Ctrl-E to reset vin windows 308 | let g:winresizer_start_key = '' 309 | "End Plugin :: simeji/winresizer -------------------- }}} 310 | 311 | "Cppman ------------------------- {{{ 312 | let g:cppman_open_mode = "vert botright" 313 | "Map to `M`, since K is already taken by `vim.lsp.buf.hover`. 314 | au FileType cpp nmap M :execute 'Cppman ' . expand('') 315 | "-------------------- }}} 316 | 317 | "cppinsights ------------------------- {{{ 318 | let g:cppinsights#extra_args = "-- -std=c++20" 319 | "-------------------- }}} 320 | 321 | "Custom :: WhiteSpaces Cleaning -------------------------------------- {{{ 322 | 323 | "Highlight trailing whitespaces as red. 324 | "http://vim.wikia.com/wiki/Highlight_unwanted_spaces. 325 | 326 | function! HighlightExtraWhitespace() 327 | highlight ExtraWhitespace ctermbg=red guibg=#EC7063 328 | match ExtraWhitespace /\s\+$/ 329 | endfunction 330 | 331 | autocmd BufWinEnter * if &buftype != 'terminal' && &buftype != 'nofile' | call HighlightExtraWhitespace() | endif 332 | autocmd TermOpen * hi clear ExtraWhitespace 333 | 334 | "Clean trailing whitespaces on buffer's save. 335 | "Command :WS is to clean trailing whitespaces. 336 | :command WS :%s/\s\+$//e 337 | 338 | "Auto clean whitespaces on buffer save for this files. 339 | autocmd BufWrite 340 | \ *.c,*.cc,*.cpp,*.cxx,*.hxx,*.hh,*.h,*.go,*.py,*.js, 341 | \*.html,*.md,.vimrc,*.ini,*.toml,*.vim, 342 | \*.markdown,*.yaml,*.proto,*.bitproto,*.rst,*.sql,*.swift,*.dart 343 | \ :WS 344 | "End Custom :: WhiteSpaces Cleaning ---------------------------------- }}} 345 | 346 | "Custom :: Window Switches -------------------------- {{{ 347 | 348 | "Shortcut window switches, w+h/j/k/l 349 | nmap wk 350 | nmap wh 351 | nmap wl 352 | nmap wj 353 | nmap wz o " Zoom 354 | " -------------------------------------------------- }}} 355 | 356 | " Custom :: Folding {{{ 357 | " Mappings to easily toggle fold levels 358 | nmap z0 :set foldlevel=0 359 | nmap z1 :set foldlevel=1 360 | nmap z2 :set foldlevel=2 361 | nmap z3 :set foldlevel=3 362 | "--------------------------------------------------- }}} 363 | 364 | "Word case converters (\%V runs substitute on visual selections). --- {{{ 365 | "Convert selected text to snake_case style: 366 | "firstly lower the first letter, then make each upper letter lower 367 | "and insert a underscore in front of that. 368 | command! -range ToSnake :s/\%V\<./\l&/e | s/\%V\u/_\l&/e 369 | 370 | "Convert selected text to camelCase style: 371 | "Find the underscores and upper the following letter, also removing the underscore. 372 | "Then make sure the first letter is in lower case. 373 | command! -range ToCamel :s/\%V_\([^_]\)/\u\1/e | s/\%V\<./\l&/e 374 | 375 | "Convert selected text to PascalCase style: 376 | "Find the underscores and upper the following letter, also removing the underscore. 377 | "Then make sure the first letter is in upper case. 378 | command! -range ToPascal :s/\%V_\([^_]\)/\u\1/e | s/\%V\<./\u&/e 379 | 380 | "Convert selected text to UPPER_SNAKE_CASE style: 381 | "firstly insert a underscore between lower and upper letters. 382 | "and then makes the whole string upper. 383 | command! -range ToUpperSnake :s/\%V\(\l\)\(\u\)/\1_\2/e | s/\%V\w\+/\U&/e 384 | "--- }}} 385 | 386 | "I don't like everything in lua, vimscript command sometimes goes more concise and clean. 387 | "Load lua configs. 388 | luafile ~/.config/nvim/lua/conf.treesitter.lua 389 | luafile ~/.config/nvim/lua/conf.lsp.lua 390 | luafile ~/.config/nvim/lua/conf.nonels.lua 391 | luafile ~/.config/nvim/lua/conf.quickfix.lua 392 | luafile ~/.config/nvim/lua/conf.statusline.lua 393 | luafile ~/.config/nvim/lua/conf.misc.lua 394 | luafile ~/.config/nvim/lua/conf.skip.lua 395 | -------------------------------------------------------------------------------- /nvim/lua/conf.lsp.lua: -------------------------------------------------------------------------------- 1 | -- vim: foldmethod=marker foldenable 2 | -- vim: tabstop=2 softtabstop=2 shiftwidth=2 3 | 4 | -- nvim-cmp setup {{{ 5 | local cmp = require('cmp') 6 | local nvim_lsp = require('lspconfig') 7 | 8 | cmp.setup({ 9 | preselect = cmp.PreselectMode.None, 10 | snippet = { 11 | expand = function(args) 12 | vim.fn['vsnip#anonymous'](args.body) 13 | end, 14 | }, 15 | sources = { 16 | { name = 'nvim_lsp' }, 17 | { name = 'vsnip' }, 18 | { name = 'buffer' }, 19 | }, 20 | mapping = cmp.mapping.preset.insert({ 21 | [''] = cmp.mapping.scroll_docs(-4), 22 | [''] = cmp.mapping.scroll_docs(4), 23 | [''] = cmp.mapping.complete(), 24 | [''] = cmp.mapping.abort(), 25 | -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. 26 | [''] = cmp.mapping.confirm({ select = true }), 27 | }), 28 | }) 29 | --- }}} 30 | 31 | -- Lsp Servers {{{ 32 | local capabilities = vim.lsp.protocol.make_client_capabilities() 33 | capabilities = require('cmp_nvim_lsp').default_capabilities() 34 | 35 | -- Make a root_dir function, searching some files at first and then fallback to cwd. 36 | function make_root_dir_function(...) 37 | local patterns = { ... } 38 | return function(fname) 39 | return nvim_lsp.util.root_pattern(unpack(patterns))(fname) or vim.fn.getcwd() 40 | end 41 | end 42 | 43 | -- Golang 44 | require('lspconfig')['gopls'].setup({ 45 | capabilities = capabilities, 46 | }) 47 | 48 | -- Python ruff, pyright & pylsp 49 | 50 | require('lspconfig').ruff.setup({ -- ruff for formatting and lint 51 | capabilities = capabilities, 52 | autostart = true, 53 | }) 54 | 55 | require('lspconfig')['pyright'].setup({ -- pyright for completion and go-to-definitions 56 | capabilities = capabilities, 57 | autostart = true, 58 | settings = { 59 | python = { 60 | useLibraryCodeForTypes = false, 61 | autoSearchPaths = true, 62 | diagnosticMode = 'openFilesOnly', 63 | analysis = { 64 | -- Ignore all files for analysis to exclusively use Ruff for linting 65 | ignore = { '*' }, 66 | }, 67 | }, 68 | }, 69 | }) 70 | 71 | require('lspconfig').pylsp.setup({ -- As an alternative to pyright, sometimes pyright dies. 72 | capabilities = capabilities, 73 | autostart = false, 74 | settings = { 75 | python = { 76 | analysis = { 77 | -- Ignore all files for analysis to exclusively use Ruff for linting 78 | ignore = { '*' }, 79 | }, 80 | }, 81 | pylsp = { 82 | configurationSources = {}, 83 | plugins = { 84 | autopep8 = { enabled = false }, 85 | flake8 = { enabled = false }, 86 | yapf = { enabled = false }, 87 | mccabe = { enabled = false }, 88 | pycodestyle = { enabled = false }, 89 | preload = { enabled = false }, 90 | pyflakes = { enabled = false }, 91 | pylint = { enabled = false }, 92 | jedi_completion = { 93 | enabled = true, 94 | }, 95 | }, 96 | }, 97 | }, 98 | }) 99 | 100 | -- C/C++ 101 | require('lspconfig')['clangd'].setup({ 102 | capabilities = capabilities, 103 | filetypes = { 'c', 'cpp', 'objc', 'objcpp' }, 104 | cmd = { 105 | 'clangd', 106 | '--offset-encoding=utf-16', 107 | '-j=1', 108 | -- '--background-index', 109 | '--background-index-priority=low', 110 | '--pch-storage=memory', 111 | -- by default, clang-tidy use -checks=clang-diagnostic-*,clang-analyzer-* 112 | -- to add more checks, create .clang-tidy file in the root directory 113 | -- and add Checks key, see https://clang.llvm.org/extra/clang-tidy/ 114 | -- This is slow.. 115 | -- '--clang-tidy', 116 | }, 117 | }) 118 | 119 | -- CMake 120 | require('lspconfig').neocmake.setup({ 121 | capabilities = capabilities, 122 | }) 123 | 124 | -- Swift: Better to use along with https://github.com/SolaWing/xcode-build-server on xcode projects. 125 | require('lspconfig').sourcekit.setup({ 126 | capabilities = capabilities, 127 | -- filetypes = { 'swift', 'objective-c', 'objective-cpp' }, 128 | filetypes = { 'swift' }, 129 | cmd = { 'xcrun', '--toolchain', 'swift', 'sourcekit-lsp' }, 130 | }) 131 | 132 | -- Dart 133 | require('lspconfig').dartls.setup({ 134 | capabilities = capabilities, 135 | root_dir = make_root_dir_function('pubspec.yaml', '.git'), 136 | }) 137 | 138 | -- CSharp 139 | require('lspconfig')['csharp_ls'].setup({ 140 | capabilities = capabilities, 141 | handlers = { 142 | ['textDocument/definition'] = require('csharpls_extended').handler, 143 | }, 144 | }) 145 | 146 | -- Typescript 147 | require('lspconfig')['ts_ls'].setup({}) 148 | 149 | -- Rust 150 | require('lspconfig')['rust_analyzer'].setup({ 151 | capabilities = capabilities, 152 | }) 153 | 154 | 155 | -- bitproto 156 | local lspconfig_configs = require("lspconfig.configs") 157 | 158 | if not lspconfig_configs.bitproto_language_server then 159 | lspconfig_configs.bitproto_language_server = { 160 | default_config = { 161 | name = "bitproto_language_server", 162 | cmd = {"bitproto-language-server"}, 163 | filetypes = { 'bitproto' }, 164 | root_dir = function(fname) 165 | return require('lspconfig').util.find_git_ancestor(fname) or vim.fn.getcwd() 166 | end, 167 | }, 168 | } 169 | end 170 | 171 | require('lspconfig').bitproto_language_server.setup{} 172 | --}}} 173 | 174 | -- Auto commands && Key bindings on Lsp Attach {{{ 175 | -- server_ready is deprecated since 0.10, use LspAttach instead 176 | vim.api.nvim_create_autocmd('LspAttach', { 177 | callback = function(args) 178 | -- Lsp Key Mapping -- {{{ 179 | ---- gd: Split and Go to Definition 180 | vim.keymap.set('n', 'gd', function() 181 | vim.cmd('split') 182 | vim.lsp.buf.definition() 183 | end, { silent = true, buffer = true }) 184 | ---- gv: VSplit and Go to Definition 185 | vim.keymap.set('n', 'gv', function() 186 | vim.cmd('vsplit') 187 | vim.lsp.buf.definition() 188 | end, { silent = true, buffer = true }) 189 | ---- gD: Split and Go to Declaration 190 | vim.keymap.set('n', 'gD', function() 191 | vim.cmd('split') 192 | vim.lsp.buf.declaration() 193 | end, { silent = true, buffer = true }) 194 | ---- gr: Split and show References of current symbol 195 | vim.keymap.set('n', 'gr', function() 196 | vim.cmd('split') 197 | vim.lsp.buf.references() 198 | end, { silent = true, buffer = true }) 199 | ---- gi: Split and show Implementations 200 | vim.keymap.set('n', 'gi', function() 201 | vim.cmd('split') 202 | vim.lsp.buf.implementation() 203 | end, { silent = true, buffer = true }) 204 | ---- Ctrl-k: Show SignatureHelp 205 | vim.keymap.set('n', '', function() 206 | vim.lsp.buf.signature_help() 207 | end, { silent = true, buffer = true }) 208 | ---- K: Hover, something like usage manual, introduction stuffs. 209 | vim.keymap.set('n', 'K', function() 210 | vim.lsp.buf.hover() 211 | end, { silent = true, buffer = true }) 212 | ---- grn: rename 213 | vim.keymap.set('n', 'grn', function() 214 | vim.lsp.buf.rename() 215 | end, { silent = true, buffer = true }) 216 | 217 | -- End lsp key mapping }}} 218 | 219 | -- Show Diagnostics on cursor hold for current line 220 | vim.api.nvim_create_autocmd('CursorHold', { 221 | pattern = '*', 222 | callback = function() 223 | -- Instead of vim.diagnostic.open_float(0, { scope = 'line', source = true, focus = false }) 224 | -- I don't like diagnostics messages show directly on the screen near my code and cursor. 225 | -- This may mess up my editing. So I echo it to the command-bar. 226 | local curline = vim.api.nvim_win_get_cursor(0)[1] 227 | local diagnostics_list = vim.diagnostic.get(args.buf, { lnum = curline - 1 }) 228 | if #diagnostics_list > 0 then 229 | -- We just show the first diagnostics message. 230 | -- We already have `severity_sort` set, so it's the most serious one. 231 | local _, first = next(diagnostics_list) 232 | -- nvim_echo receives a chunck of pairs, each pair has the structure { message, HiGroup } 233 | -- Here we use the colors of Warnings. 234 | -- The `source` is the linter stuff which produces this message (e.g. mypy) 235 | vim.api.nvim_echo({ { first.source .. ': ' .. first.message, 'WarningMsg' } }, false, {}) 236 | end 237 | end, 238 | }) 239 | -- Formatting on (pre) save. {{{ 240 | -- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) 241 | local augroup = vim.api.nvim_create_augroup('LspFormatting', {}) 242 | 243 | vim.api.nvim_create_autocmd('BufWritePre', { 244 | group = augroup, 245 | buffer = bufnr, 246 | callback = function() 247 | vim.lsp.buf.format({ async = false }) 248 | end, 249 | }) -- }}} 250 | 251 | -- Lsp Hover & SignatureHelp Configurations {{{ 252 | -- Single border for hover floating window. 253 | vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { 254 | border = 'single', 255 | }) 256 | 257 | -- Single border for signature help window. 258 | vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { 259 | border = 'single', 260 | }) 261 | 262 | -- Single border for :LspInfo window. 263 | require('lspconfig.ui.windows').default_options = { 264 | border = 'single', 265 | } 266 | -- }}} 267 | end, 268 | }) 269 | -- }}} 270 | 271 | -- Diagnostics Config {{{ 272 | vim.diagnostic.config({ 273 | virtual_text = false, -- virtual_text is too noisy, we disable it. 274 | signs = true, 275 | float = { border = 'none' }, 276 | underline = true, 277 | update_in_insert = false, 278 | -- higher severities are displayed before lower severities 279 | severity_sort = true, 280 | }) 281 | --- }}} 282 | 283 | -- Symbols Outline {{{ 284 | require("outline").setup{} 285 | -- }}} 286 | -------------------------------------------------------------------------------- /nvim/lua/conf.misc.lua: -------------------------------------------------------------------------------- 1 | -- vim: foldmethod=marker foldenable 2 | -- vim: tabstop=2 softtabstop=2 shiftwidth=2 3 | 4 | -- Misc Plugins 5 | 6 | -- Plugin erhickey/sig-window-nvim {{{ 7 | -- https://github.com/erhickey/sig-window-nvim 8 | require('sig-window-nvim').setup({ 9 | window_config = function(label, config, width, height) 10 | return { 11 | relative = 'cursor', 12 | anchor = 'SW', 13 | width = width, 14 | height = height, 15 | row = -1, 16 | col = 3, 17 | focusable = false, 18 | zindex = config.zindex, 19 | style = 'minimal', 20 | border = config.border, 21 | } 22 | end, 23 | max_height = 100, 24 | border = 'single', 25 | hl_group = 'Visual', 26 | }) 27 | 28 | -- End sig-window-nvim }}} 29 | 30 | -- Plugin windwp/nvim-autopairs {{{ 31 | require('nvim-autopairs').setup({}) 32 | -- }}} 33 | 34 | -- Plugin https://sr.ht/~p00f/godbolt.nvim/ for C++ {{{ 35 | require('godbolt').setup({ 36 | languages = { 37 | cpp = { compiler = 'clang1600', options = { userArguments = '-std=c++20' } }, 38 | c = { compiler = 'clang1600', options = {} }, 39 | }, 40 | quickfix = { 41 | enable = true, -- whether to populate the quickfix list in case of errors 42 | auto_open = false, -- whether to open the quickfix list in case of errors 43 | }, 44 | url = 'https://godbolt.org', -- can be changed to a different godbolt instance 45 | }) 46 | -- end godbolt }}} 47 | 48 | -- indent-blankline {{{ 49 | require('indent_blankline').setup({ 50 | show_current_context = true, 51 | show_current_context_start = false, 52 | }) 53 | -- end indent-blankline }}} 54 | -------------------------------------------------------------------------------- /nvim/lua/conf.nonels.lua: -------------------------------------------------------------------------------- 1 | -- vim: foldmethod=marker foldenable 2 | -- vim: tabstop=2 softtabstop=2 shiftwidth=2 3 | 4 | local null_ls = require('null-ls') 5 | 6 | function python_null_ls_condition(params) 7 | -- Don't run diagnostics stuff on these files: system and 3rd-party libraries. 8 | return not ( 9 | params.bufname:match('site-packages') 10 | or params.bufname:match('.pyenv') 11 | or params.bufname:match('Python.framework') 12 | ) 13 | end 14 | 15 | function clang_null_ls_condition(params) 16 | -- Skip to let clang to work for MacOSX system or vcpkg libraries, which are huge and may slow-down nvim. 17 | return not (params.bufname:match('MacOSX.sdk') or params.bufname:match('Toolchains') or params.bufname:match('vcpkg')) 18 | end 19 | 20 | null_ls.setup({ 21 | -- add your sources / config options here 22 | sources = { 23 | -- Python 24 | null_ls.builtins.diagnostics.mypy.with({ 25 | extra_args = { '--follow-imports', 'silent' }, 26 | prefer_local = '~/.pyenv/shims', 27 | runtime_condition = python_null_ls_condition, 28 | -- mypy runs slowly, we use it on-save instead of on-change. 29 | method = null_ls.methods.DIAGNOSTICS_ON_SAVE, 30 | }), 31 | -- C/C++/CSharp 32 | null_ls.builtins.formatting.clang_format.with({ 33 | filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'proto', 'cs' }, 34 | runtime_condition = clang_null_ls_condition, 35 | }), 36 | -- Golang 37 | null_ls.builtins.formatting.gofmt, 38 | -- Rust 39 | require('none-ls.formatting.rustfmt'), 40 | -- Swift 41 | null_ls.builtins.formatting.swift_format, 42 | -- Dart 43 | null_ls.builtins.formatting.dart_format, 44 | -- Js/Ts 45 | require('none-ls.formatting.eslint_d').with({ prefer_local = 'node_modules/.bin' }), 46 | null_ls.builtins.formatting.prettier.with({ 47 | prefer_local = 'node_modules/.bin', 48 | filetypes = { 'javascript', 'typescript', 'typescriptreact', 'css' }, 49 | }), 50 | -- CMake 51 | null_ls.builtins.formatting.cmake_format, 52 | -- Lua 53 | null_ls.builtins.formatting.stylua.with({ 54 | extra_args = { '--indent-type', 'spaces', '--indent-width', '2', '--quote-style', 'AutoPreferSingle' }, 55 | }), 56 | }, 57 | debug = false, 58 | }) 59 | -------------------------------------------------------------------------------- /nvim/lua/conf.quickfix.lua: -------------------------------------------------------------------------------- 1 | -- vim: foldmethod=marker foldenable 2 | -- vim: tabstop=2 softtabstop=2 shiftwidth=2 3 | 4 | -- Add Diagnostics to Quickfix Window. 5 | -- https://github.com/neovim/nvim-lspconfig/issues/69 6 | 7 | -- global switch:whether enable pushing diagnostics to quickfix window. 8 | vim.g._enable_push_diagnostics_to_quickfix = false 9 | 10 | -- Push diagnostics info to quickfix window. 11 | local push_diagnostics_to_quickfix = function(diagnostics) 12 | local qflist = {} 13 | for bufnr, diagnostic in pairs(diagnostics) do 14 | for _, d in ipairs(diagnostic) do 15 | d.bufnr = bufnr 16 | d.lnum = d.range.start.line + 1 17 | d.col = d.range.start.character + 1 18 | d.text = d.message 19 | table.insert(qflist, d) 20 | end 21 | end 22 | -- setqflist to add all diagnostics to the quickfix list. 23 | -- setloclist to add buffer diagnostics to the location list. 24 | vim.diagnostic.setloclist(qflist) 25 | end 26 | 27 | -- Register a handler to push diagnostics to quickfix window if new diagnostics occurs. 28 | local publish_diagnostics_method = 'textDocument/publishDiagnostics' 29 | local default_diagnostics_handler = vim.lsp.handlers[publish_diagnostics_method] 30 | 31 | vim.lsp.handlers[publish_diagnostics_method] = function(err, method, result, client_id, bufnr, config) 32 | default_diagnostics_handler(err, method, result, client_id, bufnr, config) 33 | if vim.g._enable_push_diagnostics_to_quickfix then 34 | local diagnostics = vim.diagnostic.get() 35 | push_diagnostics_to_quickfix(diagnostics) 36 | end 37 | end 38 | 39 | -- Disable push diagnostics to quickfix. 40 | local disable_push_diagnostics = function() 41 | -- Quickfix window's id. 42 | local qf_winid = vim.fn.getloclist(win, { winid = 0 }).winid 43 | if qf_winid > 0 then 44 | -- Disable quickfix automatically if quickwindow is closed. 45 | vim.g._enable_push_diagnostics_to_quickfix = false 46 | end 47 | end 48 | 49 | -- Disable push diagnostics to quickfix if Quickfix window disapper. 50 | vim.api.nvim_create_autocmd('FileType', { 51 | pattern = 'qf', 52 | callback = function(args) 53 | vim.api.nvim_create_autocmd('BufWinLeave', { buffer = args.buf, callback = disable_push_diagnostics }) 54 | end, 55 | }) 56 | 57 | -- Call :Quickfix to enter a quickfix window for all diagnostics under current buffer. 58 | vim.api.nvim_create_user_command('Quickfix', function(opts) 59 | vim.g._enable_push_diagnostics_to_quickfix = true 60 | -- Push at once if diagnostics is not empty. 61 | local diagnostics = vim.diagnostic.get() 62 | if next(diagnostics) ~= nil then 63 | push_diagnostics_to_quickfix(diagnostics) 64 | end 65 | end, {}) 66 | -------------------------------------------------------------------------------- /nvim/lua/conf.skip.lua: -------------------------------------------------------------------------------- 1 | -- vim: foldmethod=marker foldenable 2 | -- vim: tabstop=2 softtabstop=2 shiftwidth=2 3 | 4 | -- Binary-Search style cursor skip 5 | -- 's' to skip forward inline to half of remaining to end. 6 | -- 'S' to skip backward inline to half of remaining to head. 7 | -- 'ctrl-s' to skip forward vertically to half of remaining to the last line. 8 | -- 'ctrl-shift-s' (acutally esc-s) to skip backward vertically to half of remaining to the first line. 9 | 10 | -- Note: The following code is written with the help of gpt ai tool. 11 | 12 | local function skip_inline_forward() 13 | local cur_pos = vim.fn.getpos('.') 14 | local line = vim.fn.getline('.') 15 | local cur_col = cur_pos[3] 16 | local remaining_len = #line - cur_col 17 | if remaining_len <= 0 or vim.fn.col('.') >= vim.fn.col('$') - 3 then 18 | -- Move to next line if already at line's end 19 | -- why -3? to compat with chinese char. 20 | if cur_pos[2] < vim.fn.line('$') then 21 | vim.fn.setpos('.', { cur_pos[1], cur_pos[2] + 1, 1, cur_pos[4] }) 22 | end 23 | else 24 | local half_len = cur_col + (remaining_len / 2) 25 | half_len = math.floor(half_len + 0.5) 26 | vim.fn.setpos('.', { cur_pos[1], cur_pos[2], half_len, cur_pos[4] }) 27 | end 28 | end 29 | 30 | local function skip_inline_backward() 31 | local cur_pos = vim.fn.getpos('.') 32 | local line = vim.fn.getline('.') 33 | local cur_col = cur_pos[3] 34 | if cur_col <= 1 then 35 | -- Move to previous line if already at line's head. 36 | if cur_pos[2] > 1 then 37 | vim.fn.setpos('.', { cur_pos[1], cur_pos[2] - 1, #vim.fn.getline(cur_pos[2] - 1), cur_pos[4] }) 38 | end 39 | else 40 | local half_len = cur_col / 2 41 | half_len = math.floor(half_len + 0.5) 42 | vim.fn.setpos('.', { cur_pos[1], cur_pos[2], half_len, cur_pos[4] }) 43 | end 44 | end 45 | 46 | local function skip_vertical_forward() 47 | local cur_pos = vim.fn.getpos('.') 48 | local total_lines = vim.fn.line('$') 49 | local cur_line = cur_pos[2] 50 | local remaining_lines = total_lines - cur_line 51 | local half_line = cur_line + math.floor(remaining_lines / 2) 52 | vim.fn.setpos('.', { cur_pos[1], half_line, cur_pos[3], cur_pos[4] }) 53 | end 54 | 55 | local function skip_vertical_backward() 56 | local cur_pos = vim.fn.getpos('.') 57 | local cur_line = cur_pos[2] 58 | local half_line = math.floor(cur_line / 2) 59 | vim.fn.setpos('.', { cur_pos[1], half_line, cur_pos[3], cur_pos[4] }) 60 | end 61 | 62 | vim.keymap.set('n', '', function() 63 | skip_vertical_forward() 64 | end, { noremap = true, silent = true }) 65 | -- Note: we may need to remap `Ctrl-Shift-S` to `esc-s` for the terminal emulater. 66 | -- vim.keymap.set('n', 's', function() 67 | -- skip_vertical_backward() 68 | -- end, { noremap = true, silent = true }) 69 | vim.keymap.set('n', 's', function() 70 | skip_inline_forward() 71 | end, { noremap = true, silent = true }) 72 | vim.keymap.set('n', 'S', function() 73 | skip_inline_backward() 74 | end, { noremap = true, silent = true }) 75 | -------------------------------------------------------------------------------- /nvim/lua/conf.statusline.lua: -------------------------------------------------------------------------------- 1 | -- vim: foldmethod=marker foldenable 2 | -- vim: tabstop=2 softtabstop=2 shiftwidth=2 3 | 4 | -- LSP progress bar {{{ 5 | function _G.lsp_progress() ---- 0.9 version 6 | local lsp_clients = vim.lsp.get_active_clients() 7 | local lsp_client_names = {} 8 | for _, client in pairs(lsp_clients) do 9 | table.insert(lsp_client_names, client.id .. ':' .. client.name) 10 | end 11 | local lsp_msg = vim.lsp.util.get_progress_messages()[1] 12 | if lsp_msg then 13 | local name = lsp_msg.name or '' 14 | local msg = lsp_msg.message or '' 15 | local percentage = lsp_msg.percentage or 0 16 | local title = lsp_msg.title or '' 17 | return string.format(' %%<%s: %s %s (%s%%%%) ', name, title, msg, percentage) 18 | elseif #lsp_clients > 0 then 19 | return table.concat(lsp_client_names, ' ') 20 | else 21 | return 'NO LSP' 22 | end 23 | end 24 | 25 | -- neovim 0.10 version, since this version get_active_clients and get_progress_messages no longer work. 26 | function lsp_progress_v010() 27 | local clients = vim.lsp.get_clients() 28 | if #clients == 0 then 29 | return 'NO LSP' 30 | end 31 | local messages = {} 32 | -- format client lsp progress from each client.progress ringbuffer. 33 | -- example: 1:clangd(indexing 90%) 34 | -- modified from vim.lsp.status() function's source code. 35 | for _, c in ipairs(clients) do 36 | -- defaults example: '1:clangd' 37 | local message = c.id .. ':' .. c.name 38 | local percentage = nil 39 | local title = nil 40 | for progress in c.progress do 41 | local value = progress.value 42 | if type(value) == 'table' and value.kind and value.title and value.percentage then 43 | percentage = math.max(percentage or 0, value.percentage) 44 | title = value.title 45 | end 46 | end 47 | if percentage and title then 48 | local status = title .. ' ' .. tostring(percentage) .. '%%' 49 | message = message .. ' (' .. status .. ')' 50 | end 51 | messages[#messages + 1] = message 52 | end 53 | return table.concat(messages, ' ') 54 | end 55 | 56 | -- lsp_progress for neovim 0.10 57 | if vim.version().minor > 9 then 58 | _G.lsp_progress = lsp_progress_v010 59 | end 60 | -- }}} 61 | 62 | -- Plugin lualine {{{ 63 | require('lualine').setup({ 64 | options = { 65 | theme = 'onedark', 66 | icons_enabled = false, 67 | section_separators = '', 68 | component_separators = { left = '|', right = '|' }, 69 | }, 70 | sections = { 71 | lualine_b = { 72 | 'filename', 73 | { 74 | 'diagnostics', 75 | -- Show diagnostics even if there are none. 76 | always_visible = true, 77 | }, 78 | { 79 | 'lsp_progress()', 80 | color = 'Debug', 81 | }, 82 | }, 83 | lualine_x = { 84 | 'diff', 85 | 'branch', 86 | 'encoding', 87 | 'fileformat', 88 | 'filetype', 89 | }, 90 | }, 91 | -- Having a single statusline instead of each for every window. 92 | globalstatus = true, 93 | }) 94 | -- }}} 95 | -------------------------------------------------------------------------------- /nvim/lua/conf.treesitter.lua: -------------------------------------------------------------------------------- 1 | require('nvim-treesitter.configs').setup({ 2 | highlight = { 3 | enable = true, 4 | additional_vim_regex_highlighting = false, 5 | -- disable slow treesitter highlight for large files 6 | disable = function(lang, buf) 7 | local max_filesize = 1024 * 1024 -- 1MB 8 | local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) 9 | if ok and stats and stats.size > max_filesize then 10 | return true 11 | end 12 | end, 13 | }, 14 | }) 15 | -------------------------------------------------------------------------------- /nvim/snapshot.vim: -------------------------------------------------------------------------------- 1 | " Generated by vim-plug 2 | " Sat Jan 11 14:50:02 2025 3 | " :source this file in vim to restore the snapshot 4 | " or execute: vim -S snapshot.vim 5 | 6 | silent! let g:plugs['cmp-buffer'].commit = '3022dbc9166796b644a841a02de8dd1cc1d311fa' 7 | silent! let g:plugs['cmp-nvim-lsp'].commit = '99290b3ec1322070bcfb9e846450a46f6efa50f0' 8 | silent! let g:plugs['cmp-vsnip'].commit = '989a8a73c44e926199bfd05fa7a516d51f2d2752' 9 | silent! let g:plugs['cppinsights.vim'].commit = '4cc9c5556566e40cf21008b7aeba95ec211d6bb7' 10 | silent! let g:plugs['csharpls-extended-lsp.nvim'].commit = 'bedd4fbf74ebe644f2c3723327972f468fd98e4e' 11 | silent! let g:plugs['diffview.nvim'].commit = '4516612fe98ff56ae0415a259ff6361a89419b0a' 12 | silent! let g:plugs['fzf'].commit = '9030b67e4f80256f91023a01c3fb2bdab060d717' 13 | silent! let g:plugs['fzf.vim'].commit = '556f45e79ae5e3970054fee4c4373472604a1b4e' 14 | silent! let g:plugs['godbolt.nvim'].commit = 'ffb1b98087daa1e10087a3bf06c30291a17b1310' 15 | silent! let g:plugs['indent-blankline.nvim'].commit = '9637670896b68805430e2f72cf5d16be5b97a22a' 16 | silent! let g:plugs['lualine.nvim'].commit = '2a5bae925481f999263d6f5ed8361baef8df4f83' 17 | silent! let g:plugs['nerdtree'].commit = '9b465acb2745beb988eff3c1e4aa75f349738230' 18 | silent! let g:plugs['nerdtree-git-plugin'].commit = 'e1fe727127a813095854a5b063c15e955a77eafb' 19 | silent! let g:plugs['none-ls-extras.nvim'].commit = '6557f20e631d2e9b2a9fd27a5c045d701a3a292c' 20 | silent! let g:plugs['none-ls.nvim'].commit = '0143bb5f117f76863cf0c24bcf0724d3137f04d2' 21 | silent! let g:plugs['nvim-autopairs'].commit = 'd2f791ceeb26d04d87aa54343bc94e8ad8d7be1c' 22 | silent! let g:plugs['nvim-cmp'].commit = '8c82d0bd31299dbff7f8e780f5e06d2283de9678' 23 | silent! let g:plugs['nvim-lspconfig'].commit = '88157521e890fe7fdf18bee22438875edd6300a6' 24 | silent! let g:plugs['nvim-treesitter'].commit = '306dd6e9dc806db1d79568d26e1c9b6c98b95fbc' 25 | silent! let g:plugs['onedarkpro.nvim'].commit = '515d3299832d9e4a46296c8e5bc9a3eb539b5044' 26 | silent! let g:plugs['papercolor-theme'].commit = '0cfe64ffb24c21a6101b5f994ca342a74c977aef' 27 | silent! let g:plugs['papercolor-theme-slim'].commit = '9be11f4e02ad71535ea131e70f914d62fa58ddda' 28 | silent! let g:plugs['plenary.nvim'].commit = '2d9b06177a975543726ce5c73fca176cedbffe9d' 29 | silent! let g:plugs['sig-window-nvim'].commit = '606e9dbd1f80646c8d2d1b4384872ec718ddc48a' 30 | silent! let g:plugs['smear-cursor.nvim'].commit = '005b50b891d662bdd3160dc2a143939066b5cc17' 31 | silent! let g:plugs['targets.vim'].commit = '6325416da8f89992b005db3e4517aaef0242602e' 32 | silent! let g:plugs['vim-cppman'].commit = '1fe11060f5bfc72d20f2c928dd3c06a309db50fc' 33 | silent! let g:plugs['vim-fugitive'].commit = '174230d6a7f2df94705a7ffd8d5413e27ec10a80' 34 | silent! let g:plugs['vim-macroeditor'].commit = '25fd58a712f58ed16ebe924c4f92c9999e455e95' 35 | silent! let g:plugs['vim-signify'].commit = '8670143f9e12ed1cd3c9b2c54f345cdd9a4baac3' 36 | silent! let g:plugs['vim-visual-multi'].commit = 'a6975e7c1ee157615bbc80fc25e4392f71c344d4' 37 | silent! let g:plugs['vim-vsnip'].commit = '02a8e79295c9733434aab4e0e2b8c4b7cea9f3a9' 38 | silent! let g:plugs['winresizer'].commit = '9bd559a03ccec98a458e60c705547119eb5350f3' 39 | silent! let g:plugs['zoomwintab.vim'].commit = '3b76f740534ecc4114bc8a207ecb0db77b2fb002' 40 | 41 | PlugUpdate! 42 | 43 | -------------------------------------------------------------------------------- /tmux/tmux.conf: -------------------------------------------------------------------------------- 1 | # vim: ft=tmux 2 | # color codes https://i.stack.imgur.com/e63et.png 3 | 4 | # Filepath: ~/.tmux.conf 5 | 6 | # Use Ctrl-a as prefix key. 7 | set -g prefix C-a 8 | unbind C-b # unbind the default Ctrl-b. 9 | bind C-a send-prefix 10 | 11 | # Putdown the staus line bottom 12 | set-option -g status-position bottom 13 | 14 | # Press r to reload tmux configuration. 15 | bind r source-file ~/.tmux.conf \; display "Tmux Reloaded!" 16 | 17 | # Encoding. 18 | set -q -g status-utf8 on 19 | setw -q -g utf8 on 20 | 21 | # Default shell. 22 | set-option -g default-shell /usr/local/bin/fish 23 | 24 | # https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed 25 | set -sg escape-time 10 26 | 27 | # terminal colors 28 | set -g default-terminal "xterm-256color" 29 | set -ga terminal-overrides ',*256col*:Tc' 30 | 31 | # default statusbar colors 32 | set-option -g status-bg black #base02 33 | set-option -g status-fg yellow #yellow 34 | 35 | # terminal title 36 | set -g set-titles on 37 | set -g set-titles-string '#h #W' 38 | 39 | # Navigate panes using jkhl (no prefix) 40 | bind-key j select-pane -D 41 | bind-key k select-pane -U 42 | bind-key h select-pane -L 43 | bind-key l select-pane -R 44 | 45 | # Resize panel continuously in copy mode 46 | # Press Ctrl-a [ to enter copy mode 47 | # And then C-h etc to resize window 48 | # Exit copy mode by press q or y 49 | bind-key -T copy-mode-vi C-h resize-pane -L 10 50 | bind-key -T copy-mode-vi C-j resize-pane -D 5 51 | bind-key -T copy-mode-vi C-k resize-pane -U 5 52 | bind-key -T copy-mode-vi C-l resize-pane -R 10 53 | 54 | # Swap window order by `<` or `>` 55 | bind-key -r "<" swap-window -d -t -1 56 | bind-key -r ">" swap-window -d -t +1 57 | 58 | # control automatic window renaming 59 | setw -g automatic-rename on 60 | 61 | # enable wm window titles 62 | set -g set-titles on 63 | 64 | # Vi mode 65 | set-window-option -g mode-keys vi 66 | # vi-style key bindings in the status line 67 | set -g status-keys vi 68 | # Vi like copy mode 69 | bind-key -T copy-mode-vi v send-keys -X begin-selection 70 | # Copy to system clipboard 71 | bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy' 72 | 73 | # Ctrl-A + P Copy from system clipboard 74 | bind-key P run "pbpaste | tmux load-buffer - && tmux paste-buffer" 75 | # Color sytle in copy mode for selection highlights 76 | set-window-option -g mode-style bg=colour31 77 | 78 | # Status line formatting. 79 | set-option -g status on 80 | set -g status-interval 2 81 | set -g status-justify centre 82 | set -g status-fg colour231 83 | set -g status-bg colour234 84 | set -g status-left-length 150 85 | set -g status-right-length 150 86 | set -g window-status-format "#[fg=colour244,bg=colour234] #I #W " 87 | set -g window-status-current-format "#[fg=colour255,bg=colour24] #I #W " 88 | set -g status-left '#{tmux_mode_indicator}#{prefix_highlight}' 89 | 90 | # Panel border styles 91 | set -g pane-border-style "fg=colour25" 92 | set -g pane-active-border-style "fg=colour169 bg=colour237" 93 | 94 | # Plugins 95 | set -g @plugin 'tmux-plugins/tpm' 96 | set -g @plugin 'tmux-plugins/tmux-prefix-highlight' 97 | set -g @plugin 'MunifTanjim/tmux-mode-indicator' 98 | set -g @plugin 'tmux-plugins/tmux-open' 99 | 100 | # Configs for tmux-plugins/tmux-prefix-highlight 101 | set -g @prefix_highlight_fg 'colour255' 102 | set -g @prefix_highlight_bg 'colour169' 103 | 104 | run '~/.tmux/plugins/tpm/tpm' 105 | -------------------------------------------------------------------------------- /vim/README.md: -------------------------------------------------------------------------------- 1 | I switched to [neovim](../nvim) now. 2 | -------------------------------------------------------------------------------- /vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "suggest.floatEnable": false, 3 | "suggest.enablePreview": false, 4 | "suggest.maxPreviewWidth": 65, 5 | "suggest.echodocSupport": false, 6 | "suggest.noselect": true, 7 | 8 | "diagnostic.enable": false, 9 | "diagnostic.messageTarget": "echo", 10 | "diagnostic.virtualText": false, 11 | "diagnostic.errorSign": "X", 12 | "diagnostic.warningSign": "W", 13 | "diagnostic.hintSign": "H", 14 | "diagnostic.displayByAle": true, 15 | 16 | "signature.enable": true, 17 | "signature.target": "float", 18 | 19 | "coc.preferences.jumpCommand": "split", 20 | "coc.preferences.useQuickfixForLocations": false, 21 | 22 | "python.linting.enabled": false, 23 | "python.formatting.provider": "none", 24 | "pyright.organizeimports.provider": "none", 25 | "pyright.disableDiagnostics": true, 26 | "pyright.inlayHints.enable": false, 27 | 28 | "languageserver": { 29 | "golang": { 30 | "command": "gopls", 31 | "rootPatterns": ["go.mod", ".vim/", ".git/", ".hg/"], 32 | "filetypes": ["go"] 33 | }, 34 | "rust": { 35 | "command": "rls", 36 | "filetypes": ["rust"], 37 | "rootPatterns": ["Cargo.toml"] 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vim/vimrc: -------------------------------------------------------------------------------- 1 | " vim: foldmethod=marker foldenable 2 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 3 | 4 | "Chao Wang's personal vim configurations. 5 | "Repo: https://github.com/hit9/dotfiles 6 | "No considerations for gvim, only for vim in terminal. 7 | 8 | "Vim 8.2 and NeoVim >= 0.7 9 | 10 | "Plugins ---------------------------------------------- {{{ 11 | set nocompatible " be iMproved 12 | filetype off " required! 13 | 14 | call plug#begin('~/.vim/plugged') 15 | 16 | Plug 'NLKNguyen/papercolor-theme' 17 | Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } "Famous file explorer plugin. 18 | Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' } "NERDTree plugin which shows git status flags. 19 | Plug 'itchyny/lightline.vim' "Lightweight statusline plugin. 20 | Plug 'neoclide/coc.nvim', { 'branch': 'release' } "All-in-one code completion plugin. 21 | Plug 'jayflo/vim-skip' "Binary-search inline cursor movement. 22 | Plug 'jiangmiao/auto-pairs' "Auto close pairs ((),{},[],'' etc.). 23 | Plug 'tpope/vim-commentary' "Quick (un)comment line(s), shortcut key `\\`. 24 | Plug 'mg979/vim-visual-multi' "Multiple cursors plugin for vim/neovim. 25 | Plug 'dense-analysis/ale' "All-in-oine asynchronous linting/fixing for Vim. 26 | Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } "Fuzzy search files/buffers etc, Ctrl-p. 27 | Plug 'junegunn/fzf.vim' "Fzf vim plugin. 28 | Plug 'mhinz/vim-signify' "Show diff signs for file changes under git/hg/svn control. 29 | Plug 'simeji/winresizer' "Window resizer. 30 | Plug 'troydm/zoomwintab.vim' "Window zoom. 31 | "Syntax Highlighting 32 | Plug 'pangloss/vim-javascript' 33 | Plug 'vim-python/python-syntax' 34 | Plug 'octol/vim-cpp-enhanced-highlight' 35 | Plug 'hit9/vim-go-syntax' "Fork from vim-go for syntax highlighting only. 36 | Plug 'rust-lang/rust.vim' 37 | Plug 'gabrielelana/vim-markdown' 38 | Plug 'elzr/vim-json' 39 | Plug 'cespare/vim-toml' 40 | Plug 'stephpy/vim-yaml' 41 | 42 | call plug#end() 43 | "End Plugins ----------------------------------------------- }}} 44 | 45 | "Basic ------------------------------------------------------ {{{ 46 | filetype plugin indent on 47 | 48 | "Basic 49 | " set shell=/usr/local/bin/fish "Vim's shell, defaults to `$SHELL`. 50 | set noeb "Disable bells. 51 | set ttyfast "Indicates a fast terminal connection. (see :help ttyfast). 52 | set lazyredraw "Same, faster vim. 53 | set title "Makes terminal title is set by vim. 54 | set titleold= "Restore old title after leaving vim. 55 | set autoread "Auto updates current file if this file is updated by outer. 56 | set hidden "Opening a new file when the current buffer has unsaved changes causes files to be hidden instead of closed. 57 | set autochdir "Auto switch current working directory to current editing file's directory. 58 | set updatetime=300 "Smaller updatetime for CursorHold & CursorHoldI 59 | 60 | "Mouse 61 | set mouse=a "Enable mouse. 62 | set selection=exclusive "Mouse can only selects the block where ths cursor is on. 63 | set selectmode=mouse,key 64 | set mousehide "Hide mouse cursor on keyboard typing. 65 | set mousemodel=popup "Right mouse button pops up a menu. 66 | 67 | "Syntax 68 | syntax enable "Enable syntax. 69 | set synmaxcol=300 "Don't perform highlight on lines that are longer than 300 chars. 70 | syntax sync minlines=1000 71 | 72 | "Displayment 73 | set number "Show line numbers. 74 | set norelativenumber "Don't use relative line numbers. 75 | set go= "Disable gvim's gui menu. (But I personally never use gui version vim). 76 | set shortmess=atI "Disable the short message on vim start. 77 | set noshowcmd "Don't show command in the last line of screeen. 78 | set showmode "If in Insert, Replace or Visual mode put a message on the last line. 79 | set nowrap "Lines longer than the width of window will wrap and displaying continues on the next line. 80 | set shortmess+=c "Don't give |ins-completion-menu| messages. 81 | set signcolumn=yes "Always show signcolumns 82 | set cmdheight=2 "Command-line height (number of screen lines). 83 | 84 | "Scroll 85 | set scrolloff=9999 "Cursor always stays in the middle of screen, https://stackoverflow.com/posts/1276428/revisions. 86 | 87 | "Statusline 88 | set laststatus=2 "Always show status line on the last window. 89 | set ruler "Show line and column number of where cursor is. 90 | 91 | "Search & Replace 92 | set gdefault "The :s/// is s///g by default 93 | set hlsearch "Highlight search results. 94 | set incsearch "Realtime search results showing. 95 | 96 | "Encoding (utf8) 97 | set encoding=utf-8 98 | set fencs=utf-8 "Encoding that creating new files. 99 | set termencoding=utf-8 "Encoding that output to terminal. 100 | set fileencoding=utf-8 "Encoding that saving files. 101 | set backspace=indent,eol,start "Backspace key, I just don't rely on it. 102 | 103 | "Fold 104 | set nofoldenable 105 | set foldmethod=indent 106 | set foldcolumn=0 "number of columns showing the foldlevels on the left sidebar. 107 | set foldlevel=0 108 | set foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo "Which commands trigger auto-unfold 109 | set foldclose=all "Close all folds (which level>foldlevel) automatically when cursor leaves. 110 | autocmd FileType c,go,python,javascript,bitproto,protobuf setlocal foldenable "Enable folding for programming purpose. 111 | 112 | "Copy/Paste 113 | set clipboard=unnamed "Tmux copy issue: https://github.com/tmux/tmux/issues/543#issuecomment-248980734 114 | 115 | "Match 116 | set showmatch "When a bracket is inserted, briefly jump to the matching one. 117 | set matchtime=1 "Tenths of a second to show the matching paren. 118 | 119 | "Completion. 120 | "Default vim completion behavior when CTRL-P/N are used. 121 | set completeopt=longest,menu "Use a popup menu to show possible completinos. 122 | set cpt=.,w,b "Scan candidates from .(current buffer), w(buffers from other windows), b(other loaded buffers). 123 | 124 | "Indent 125 | set autoindent "Indent automatically. But notice that autoindent may make Cmd+V pastsing works wired, 126 | "so when pasting something from clipboard into vim, better to `:set paste` and then Cmd+V, 127 | "and rollback this setting via :set nopaste. 128 | set cindent "C style indent. 129 | set smartindent "http://vim.wikia.com/wiki/Indenting_source_code 130 | set expandtab "Expand tabs into spaces, by default (Python users's must-have). 131 | set tabstop=4 "Setting 1tab = 4 spaces. 132 | set softtabstop=4 "Number of spaces that a counts for while editing. :set paste makes softtabstop to 0 temply. 133 | set shiftwidth=4 "Number of spaces to use for each step of (auto)indent. 134 | 135 | set list "Show tabs via listchars below, and display end sign after endo fline. 136 | set listchars=space:·,tab:▸\ ,eol:¬,extends:❯,precedes:❮ "Chars that to display list. 137 | 138 | "Tab settings for diferent language filetypes (forked from humiaozuzu's dotfile). 139 | autocmd FileType text setlocal textwidth=79 140 | autocmd FileType go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 textwidth=110 141 | autocmd FileType python setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=110 142 | autocmd FileType ruby setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=79 143 | autocmd FileType php setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=79 144 | autocmd FileType coffee,javascript setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=79 145 | autocmd FileType html,htmldjango,xhtml,haml setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=0 146 | autocmd FileType sass,scss,css setlocal tabstop=2 shiftwidth=2 softtabstop=2 textwidth=79 147 | 148 | "Basic :: Color -------------------------------- {{{ 149 | 150 | "Normal and Visual mode color cosutomization. 151 | highlight Normal term=none ctermbg=none "Make vim be transparent in terminal. 152 | highlight Visual term=none cterm=bold ctermbg=31 ctermfg=255 guibg=#005f87 guifg=#ffffff 153 | 154 | "Enable true color support: 155 | "https://lotabout.me/2018/true-color-for-tmux-and-vim/ 156 | "https://github.com/tmux/tmux/issues/1246 157 | if exists('+termguicolors') 158 | let &t_8f="\[38;2;%lu;%lu;%lum" 159 | let &t_8b="\[48;2;%lu;%lu;%lum" 160 | set termguicolors 161 | endif 162 | set t_Co=256 "Enable 256 color 163 | set background=dark "Using dark. Hmm dark is sexy. 164 | 165 | "Basic :: Color :: PaperColor ------- {{{ 166 | let g:PaperColor_Theme_Options = { 167 | \ 'theme': { 168 | \ 'default.dark': { 169 | \ 'transparent_background': 1, 170 | \ 'override': { 171 | \ 'visual_bg': ['#005f87', '31'], 172 | \ 'visual_fg': ['#ffffff', '255'] 173 | \ } 174 | \ } 175 | \ }, 176 | \ 'language': { 177 | \ 'python': { 178 | \ 'highlight_builtins' : 1 179 | \ }, 180 | \ 'cpp': { 181 | \ 'highlight_standard_library': 1 182 | \ }, 183 | \ 'c': { 184 | \ 'highlight_builtins' : 1 185 | \ } 186 | \ } 187 | \ } 188 | 189 | colorscheme PaperColor 190 | "End Basic :: Color :: PaperColor -------- }}} 191 | 192 | "CursorLine/CursorColumn, should be applied after colorscheme loaded. 193 | highlight CursorLine term=none cterm=none ctermbg=238 ctermfg=none 194 | highlight CursorColumn term=none cterm=none ctermbg=238 ctermfg=none 195 | 196 | "Transparent background 197 | hi Normal ctermbg=NONE guibg=NONE 198 | hi LineNr ctermbg=NONE guibg=NONE 199 | hi SignColumn ctermbg=NONE guibg=NONE 200 | "End Basic :: Color ---------------------------- }}} 201 | "End Basic --------------------------------------------- }}} 202 | 203 | "Plugin :: lightline.vim ----------------------------------------- {{{ 204 | "https://github.com/itchyny/lightline.vim/blob/master/colorscheme.md 205 | let g:lightline = { 206 | \ 'colorscheme': 'PaperColor', 207 | \ } 208 | "End Plugin :: lightline.vim --------------------------- }}} 209 | 210 | "Plugin :: scrooloose/nerdtree ------------------------------------------------ {{{ 211 | 212 | "Open nerdtree on buffer entered. And close it if it's the last window. 213 | autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif 214 | "nerdtree window's width. 215 | let NERDTreeWinSize=35 216 | "Show line number for nerdtree. 217 | let NERDTreeShowLineNumbers=1 218 | "Don't display these files: 219 | let NERDTreeIgnore=['\.pyc$', '\.o$', '\~$', '__pycache__', '\.mypy_cache', '\.DS_Store', 220 | \ '^\.git$', '\.o$', '\.so$', '\.egg$', "\.pytest_cache", "\.swp$", "\.swo$", "\.swn$"] 221 | " Highlight the selected entry in the tree 222 | let NERDTreeHighlightCursorline=1 223 | " Show hidden files, too 224 | let NERDTreeShowFiles=1 225 | let NERDTreeShowHidden=1 226 | 227 | "User-defined custom command `:NT` to toggle nerdtree window 228 | :command NT :NERDTreeToggle 229 | " End Plugin :: scrooloose/nerdtree ----------------------------------------- }}} 230 | 231 | "Plugin :: tpope/vim-commentary --------------------------------------- {{{ 232 | "Type `\\` to toggle comments for current line or selected blocks. 233 | xmap Commentary 234 | nmap Commentary 235 | omap Commentary 236 | nmap CommentaryLine 237 | " End Plugin :: tpope/vim-commentary ---------------------------------- }}} 238 | 239 | "Plugin :: neoclide/coc.nvim ------------------------------------ {{{ 240 | au FileType go,python,c,cpp,javascript,rust nmap gd (coc-definition) 241 | au FileType go,python,c,cpp,javascript,rust nmap gr (coc-references) 242 | au FileType go,python,c,cpp,javascript,rust nmap gD (coc-type-definition) 243 | au FileType go,python,c,cpp,javascript,rust nmap K :call ShowDocumentation() 244 | au FileType go,python,c,cpp,javascript,rust nmap gv :call CocAction('jumpDefinition', 'vsplit') 245 | 246 | function! ShowDocumentation() 247 | if CocAction('hasProvider', 'hover') 248 | call CocActionAsync('doHover') 249 | else 250 | call feedkeys('K', 'in') 251 | endif 252 | endfunction 253 | " End Plugin :: neoclide/coc.nvim -------------------------------- }}} 254 | 255 | "Plugin :: Yggdroot/indentLine -------------------- {{{ 256 | let g:indentLine_char = '|' 257 | let g:indentLine_leadingSpaceEnabled = 1 258 | let g:indentLine_leadingSpaceChar = '-' 259 | "https://github.com/Yggdroot/indentLine/issues/47 260 | autocmd FileType help IndentLinesToggle 261 | " End Plugin :: Yggdroot/indentLine ---------------- }}} 262 | 263 | "Plugin :: pangloss/vim-javascript ----- {{{ 264 | let javascript_enable_domhtmlcss = 1 265 | let g:javascript_plugin_jsdoc = 1 266 | "--------------------------------------- }}} 267 | 268 | "Plugin :: vim-python/python-syntax ----- {{{ 269 | let python_highlight_all = 1 270 | let python_slow_sync = 0 271 | "---------------------------------------- }}} 272 | 273 | "Plugin :: rust-lang/rust.vim && racer ------------------------ {{{ 274 | let g:rustfmt_autosave = 0 " Use ale for rust formatting. 275 | "End Plugin :: rust-lang/rust.vim && racer -------------------- }}} 276 | 277 | "Plugin :: vim-json ------------------------------- {{{ 278 | let g:vim_json_syntax_conceal = 0 279 | "End Plugin :: vim-json --------------------------- }}} 280 | 281 | "Plugin :: w0rp/ale ------------------------------------- {{{ 282 | " Only run linters named in ale_linters settings. 283 | let g:ale_linters_explicit = 1 284 | let g:ale_linters = { 285 | \ 'javascript': ['standard'], 286 | \ 'python': ['black', 'mypy'], 287 | \ 'c': ['clang-format'], 288 | \ 'cpp': ['clang-format'], 289 | \ 'rust': ['cargo', 'rls'], 290 | \ 'go': ['gopls'], 291 | \} 292 | let g:ale_fixers_explicit = 1 293 | let g:ale_fixers = { 294 | \ 'javascript': ['standard'], 295 | \ 'python': ['black', "isort"], 296 | \ 'c': ['clang-format'], 297 | \ 'cpp': ['clang-format'], 298 | \ 'go': ['gofmt'], 299 | \ 'rust': ['rustfmt'], 300 | \} 301 | let g:ale_fix_on_save = 1 302 | let g:python_mypy_show_notes = 1 303 | let g:ale_python_vulture_options = '--min-confidence 80 --exclude "*pb2.py,*pb2_grpc.py,*.egg-info,dist/*,"' 304 | let g:ale_python_isort_options = '--profile black' 305 | let g:ale_rust_rls_toolchain = 'nightly' 306 | "End Plugin :: w0rp/ale ----------------------------------- }}} 307 | 308 | "Plugin :: mg979/vim-visual-multi ------------------------- {{{ 309 | let g:VM_theme = 'iceblue' "https://github.com/mg979/vim-visual-multi/wiki/Highlight-colors 310 | " Won't use default leader key \\, using Ctrl-N instead. 311 | " Select words: Ctrl-N and press N for next word. 312 | " Multiple lines: visual mode selection section, and Ctrl-N 313 | " Select all occurences of current word: Ctrl-N and press A quickly 314 | let g:VM_leader = '' 315 | let g:VM_maps = {} 316 | let g:VM_maps["Visual Add"] = '' 317 | "End Plugin :: mg979/vim-visual-multi ----------------------}}} 318 | 319 | "Plugin :: mhinz/vim-signify --------------------------- {{{ 320 | highlight SignColumn ctermbg=NONE cterm=NONE guibg=NONE gui=NONE 321 | highlight SignifySignAdd ctermfg=yellow ctermbg=green guifg=#F7DC6F guibg=#1E8449 322 | highlight SignifySignChange ctermfg=yellow ctermbg=blue guifg=#F7DC6F guibg=#2874A6 323 | highlight SignifySignDelete ctermfg=yellow ctermbg=red guifg=#F7DC6F guibg=#EC7063 324 | "End Plugin :: mhinz/vim-signify ----------------------- }}} 325 | 326 | "Plugin :: gabrielelana/vim-markdown --------------- {{{ 327 | let g:markdown_enable_spell_checking = 0 328 | let g:markdown_enable_conceal = 0 329 | "End Plugin :: gabrielelana/vim-markdown --------------- }}} 330 | " 331 | "Custom :: WhiteSpaces Cleaning -------------------------------------- {{{ 332 | 333 | "Highlight trailing whitespaces as red. 334 | "http://vim.wikia.com/wiki/Highlight_unwanted_spaces. 335 | highlight ExtraWhitespace ctermbg=red guibg=#EC7063 336 | match ExtraWhitespace /\s\+$/ 337 | 338 | "Clean trailing whitespaces on buffer's save. 339 | "Command :WS is to clean trailing whitespaces. 340 | :command WS :%s/\s\+$//e 341 | 342 | "Auto clean whitespaces on buffer save for this files. 343 | autocmd BufWrite *.c,*.h,*.go,*.py,*.js,*.html,*.md,.vimrc,*.ini,*.toml,*.markdown,*.yaml,*.proto,*.bitproto,*.rst :WS 344 | "End Custom :: WhiteSpaces Cleaning ---------------------------------- }}} 345 | 346 | "Plugin :: junegunn/fzf.vim ------------------------------ {{{ 347 | " ProjectFiles tries to locate files relative to the git root contained in 348 | " NerdTree, falling back to the current NerdTree dir if not available 349 | " see https://github.com/junegunn/fzf.vim/issues/47#issuecomment-160237795 350 | function! s:find_git_root() 351 | return system('git rev-parse --show-toplevel 2> /dev/null')[:-2] 352 | endfunction 353 | 354 | command! ProjectFiles execute 'Files' s:find_git_root() 355 | nmap :ProjectFiles 356 | nmap :Buffers 357 | 358 | " let g:fzf_layout = { 'window': { 'width': 1, 'height': 0.4, 'yoffset': 1, 'border': 'horizontal' } } 359 | " Customize fzf colors to match your color scheme 360 | let g:fzf_colors = { 361 | \ 'fg': ['fg', 'Normal'], 362 | \ 'bg': ['bg', 'Normal'], 363 | \ 'hl': ['fg', 'Comment'], 364 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], 365 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], 366 | \ 'hl+': ['fg', 'Statement'], 367 | \ 'info': ['fg', 'PreProc'], 368 | \ 'border': ['fg', 'Ignore'], 369 | \ 'prompt': ['fg', 'Conditional'], 370 | \ 'pointer': ['fg', 'Exception'], 371 | \ 'marker': ['fg', 'Keyword'], 372 | \ 'spinner': ['fg', 'Label'], 373 | \ 'header': ['fg', 'Comment'] } 374 | 375 | let g:fzf_layout = { 'window': { 'width': 0.7, 'height': 0.5 } } 376 | "End Plugin :: junegunn/fzf.vim ---------------------------- }}} 377 | 378 | "Plugin :: simeji/winresizer ------------------------- {{{ 379 | let g:winresizer_start_key = '' 380 | "End Plugin :: simeji/winresizer -------------------- }}} 381 | 382 | "Custom :: Window Switches -------------------------- {{{ 383 | 384 | "Shortcut window switches, w+h/j/k/l 385 | nmap wk 386 | nmap wh 387 | nmap wl 388 | nmap wj 389 | nmap wz o " Zoom 390 | " -------------------------------------------------- }}} 391 | 392 | " Custom :: Folding {{{ 393 | " Mappings to easily toggle fold levels 394 | nmap z0 :set foldlevel=0 395 | nmap z1 :set foldlevel=1 396 | nmap z2 :set foldlevel=2 397 | nmap z3 :set foldlevel=3 398 | "--------------------------------------------------- }}} 399 | 400 | "Custom :: git / tig ------------------------------- {{{ 401 | command! Blame :!tig blame % 402 | " -------------------------------------------------- }}} 403 | --------------------------------------------------------------------------------