├── CHANGELOG.md ├── KEYMAPS.md ├── LICENSE ├── README.md ├── img └── vimrc.png ├── nvim └── .config │ └── nvim │ └── init.vim └── vim ├── .gvimrc ├── .vim └── after │ └── syntax │ ├── c.vim │ ├── css.vim │ ├── csv.vim │ ├── html.vim │ ├── markdown.vim │ └── vim.vim └── .vimrc /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog 2 | 3 | ### 2.9.9 4 | * Fix the nnoremap `gb`: the command is `:Git blame`. 5 | * Remove 'tgpt' (Terminal GPT 3.5). 6 | 7 | ### 2.9.8 8 | * Change the inoremap `ññ` (insert a backslash) to `ñl`. 9 | * Change the inoremap `çç` (insert `{{ }}`) to `ññ`. 10 | * Add the inoremap `ñ-` to insert the liquid tags `{%- -%}`. 11 | * Change the inoremap `ñc` (do math operations) to `ñm`. 12 | 13 | ### 2.9.7 14 | * Improve the markdown syntax. 15 | 16 | ### 2.9.6 17 | * Add 'proselint' to `g:ale_linters_ignore` in vimwiki files. 18 | 19 | ### 2.9.5 20 | * Allow FZF updates again; compatibility issues have been resolved. 21 | * Enable Undotree again. 22 | * Enable the colorizer plugin. 23 | * Add 'proselint' to `g:ale_linters_ignore` in markdown files. 24 | 25 | ### 2.9.4 26 | * Stop FZF updates for compatibility issues with tmux. 27 | 28 | ### 2.9.3 29 | * Disable Undotree temporarily. 30 | * Add line number in Goyo plugin. 31 | * Add settings for Atomic color scheme. 32 | * Change the preview window size. 33 | 34 | ### 2.9.2 35 | * Change the map `` (toggle AutoPairs) to ``. 36 | 37 | ### 2.9.1 38 | * Recover the default map for Visual-Block. 39 | * Add ALE signs. 40 | * Change the nnoremap `` (`:Files` from FZF) to ``. 41 | * Change the map `` (toggle AutoPairs) to ``. 42 | * Change the cnoremap `` (delete a word, forward) to ``. 43 | 44 | ### 2.9.0 45 | * Add 'tgpt' (Terminal GPT 3.5). 46 | 47 | ### 2.8.5 48 | * Code cleanup. 49 | 50 | ### 2.8.4 51 | * Update fillchars. 52 | * Add the function `CustomGx()` to customize the map `gx`. 53 | 54 | ### 2.8.3 55 | * Fix the cursor shape in vim for the tty. 56 | * Next an prev centered. 57 | 58 | ### 2.8.2 59 | * Enable local `.vimrc` config (`set exrc`). 60 | 61 | ### 2.8.1 62 | * Update `FZF` settings. 63 | * Add the nnoremap `uh` (`:History`). 64 | * Add the nnoremap `ul` (`:BLines`). 65 | * Add the nnoremap `ut` (`:Tags`). 66 | * Add the nnoremap `uu` (`:BTags`). 67 | * Add the nnoremap `uf` (`:BTags`, filter functions). 68 | * Add the nnoremap `uv` (`:BTags`, filter variables). 69 | 70 | ### 2.8.0 71 | * Add the internal `FZF` map `` to hide the window preview. 72 | * Remove the plugin `CtrlP`. 73 | * Remove the plugin `GV`. 74 | * Use the nnoremap `` (`:Files`). 75 | * Add the nnoremap `` (`:Buffers`). 76 | * The nnoremap `gz` executes `:Commits` instead of `:GV`. 77 | * The nnoremap `dd` (word-count) changes to `cx`. 78 | * The vnoremap `dd` (word-count) changes to `cx`. 79 | * The nnoremap `bw` (switch CWD) changes to `dd`. 80 | * Add the nnoremap `dg` (switch to git root directory). 81 | * Add the function `GitRoot()` to switch to git root directory. 82 | * The nnoremap `u` (`Undotree`) changes to `U`. 83 | 84 | ### 2.7.9 85 | * Revert a little change in the function `Generator()`. 86 | 87 | ### 2.7.8 88 | * Extend the function `Previewer()` to use Zathura for PDF files. 89 | * Improve the function `Generator()`. 90 | 91 | ### 2.7.7 92 | * Improve the function `ToggleGstatus()`. 93 | 94 | ### 2.7.6 95 | * Add the inoremap `ñc` to enter Vim's expression register (math). 96 | 97 | ### 2.7.5 98 | * Improve the function `ToggleJekyll()`. 99 | 100 | ### 2.7.4 101 | * Add little CSV syntax. 102 | 103 | ### 2.7.3 104 | * Change the nnoremap `` (`:OpenSession`) to Visual-Block. 105 | * The nnoremap to `:OpenSession` disappears. 106 | * Change the vmap `` (`expand_region_shrink`) to `m`. 107 | - I'm using `^V` at terminal level to paste. 108 | 109 | ### 2.7.2 110 | * Update listchars and showbreak 111 | 112 | ### 2.7.1 113 | * Add the nnoremap `ij` to preview the current post in the web browser. 114 | 115 | ### 2.7.0 116 | * Install the plugin `vim-md-checkbox` (toggle checkboxes). 117 | 118 | ### 2.6.2 119 | * Change the nnoremap `` (`:Files` from FZF) to ``. 120 | * Remove the nnoremap `` (:`Commits`). 121 | * Remove the nnoremap `` (:`BLines`). 122 | 123 | ### 2.6.1 124 | * Update `CtrlP` settings. 125 | * Update `vim-move` settings. 126 | 127 | ### 2.6.0 128 | * Install the plugin `vim-openscad` (syntax for openscad). 129 | * Update surround keymaps. 130 | * Add the inoremap `çç` to add `{{ }}`. 131 | 132 | ### 2.5.4 133 | * Use `python` by default instead of `python3`. 134 | 135 | ### 2.5.3 136 | * Change and reduce vim-surround keymaps. 137 | * Add the inoremap `ññ` to insert a backslash (`\`) faster. 138 | 139 | ### 2.5.2 140 | * Syntax improvements. 141 | * Remove the nnoremap `Yab` (copy buffer to clipboard). 142 | 143 | ### 2.5.1 144 | * Fix cursor shape on `VimEnter` via `edit-command-line` (zle). 145 | * Update vnoremap to copy text into the clipboard. 146 | 147 | ### 2.5.0 148 | * Install the plugin `vim-rec` (syntax for recfiles). 149 | 150 | ### 2.4.4 151 | * Remove the variable `g:ale_sign_column_always`. 152 | 153 | ### 2.4.3 154 | * Downgrade NERDCommenter version. 155 | * Add 'vint' to `g:ale_linters`. 156 | 157 | ### 2.4.2 158 | * Fix plugins path (NERDCommenter and NERDTree). 159 | 160 | ### 2.4.1 161 | * Change the nnoremap `` (`:Files` from FZF) to ``. 162 | * Change the nnoremap `` (`:Commits` from FZF) to ``. 163 | * Add the nnoremap `` tot open the command `:Blines` (FZF). 164 | 165 | ### 2.4.0 166 | * Install `FZF` plugin. 167 | * The nnoremap `` (fullscreen window) changed to `f`. 168 | * Add the nnoremap `` to open the command `:Files` (FZF). 169 | * Add the nnoremap `` to open the command `:Commits` (FZF). 170 | 171 | ### 2.3.7 172 | * Use `Git` instead of `Gstatus` (deprecated). 173 | 174 | ### 2.3.6 175 | * Use `Gclog` instead of `Glog` (deprecated). 176 | 177 | ### 2.3.5 178 | * Fix `ToggleJekyll()` function. 179 | * Change `yml` to `yaml`. 180 | 181 | ### 2.3.4 182 | * Add `*.md` to closetag settings. 183 | * Add the command `Enes` to translate selection (Eng to Spa). 184 | * Add the command `Esen` to translate selection (Spa to Eng). 185 | 186 | ### 2.3.3 187 | * Change the nnoremap `gs` (add line to staging area) to `ga`. 188 | - It is more intuitive. 189 | 190 | ### 2.3.2 191 | * Add the nnoremap `gd` to remove markdown links. 192 | 193 | ### 2.3.1 194 | * Fix vim-surround shortcut. 195 | 196 | ### 2.3.0 197 | * Add support to generate sky charts with pp3. 198 | 199 | ### 2.2.2 200 | * Update `markdown.vim` for math equations (Latex). 201 | 202 | ### 2.2.1 203 | * Update CtrlP settings. 204 | * The function `GrepWrapper` must escape `#`. 205 | * Improve arglist commands. 206 | 207 | ### 2.2.0 208 | * Extend some markdown maps to liquid syntax files. 209 | * Remove vim-polyglot. Too much conflicts all the time. 210 | * Reinstall some syntax files from the original source. 211 | * Install the plugin vim-move. 212 | * The nnoremap `J` (join lines) changed to ``. 213 | * Add the nnoremap `` (split lines). 214 | * The nnoremap `` (move line down) changed to `J`. 215 | * The nnoremap `` (move line up) changed to `K`. 216 | * Add the nnoremap `H` to move a character to the left. 217 | * Add the nnoremap `L` to move a character to the right. 218 | 219 | ### 2.1.5 220 | * Add `bundle exec` to the function `ToggleJekyll()`. 221 | 222 | ### 2.1.4 223 | * Remove the function to reload the colorscheme. 224 | * Change the nnoremap `` to toggle Goyo. 225 | * Add Goyo settings. 226 | * Update markdown.vim to include tex.vim for maths. 227 | 228 | ### 2.1.3 229 | * Define section z for vim-airline. 230 | * Add a new surround shortcut: `x` to `«\r»`. 231 | * Change the surround shortcut `b` to `o` for the bold. 232 | * Remove other useless surround shortcuts, I'll use defaults. 233 | * Add the inoremap `ñb` to insert `()`. 234 | * Change the inoremap `ññ` to `ñr` insert `[]`. 235 | * Change the inoremap `ÑÑ` to `ñB` insert `{}`. 236 | * Add airline section z. 237 | 238 | ### 2.1.2 239 | * The function `GrepWrapper` must escape `"` and `%`. 240 | 241 | ### 2.1.1 242 | * The workaround to fix the vulnerability CVE-2019-12735 can be removed. 243 | - It was fixed in the patch 8.1.1365. 244 | 245 | ### 2.1.0 246 | * Add the plugin `asy.vim` (syntax for Asymptote). 247 | * Add the plugin `eukleides.vim` (syntax for Eukleides). 248 | 249 | ### 2.0.6 250 | * Declare `g:polyglot_disabled` before polyglot is loaded. 251 | 252 | ### 2.0.5 253 | * Escape double quotes when executing SQL queries (`SQLExec()`). 254 | 255 | ### 2.0.4 256 | * Set the ALE variable `g:ale_sign_column_always` to 1. 257 | - This fixes an issue with the vim airline tabline, moving between buffers. 258 | 259 | ### 2.0.3 260 | * Fix indentation. 261 | * Change the nnoremap `` to `` (jump to the next AutoPairs match). 262 | - Fix a conflict introduced in the version 2.0.2. 263 | * Change the nnoremap `` to `gz` (plugin GV). 264 | * The plugin CtrlP now can scroll until 85 results (`g:ctrlp_match_window`). 265 | * Add `wildignore` for liquid, html and yml files (exclude `.jekyll-cache`). 266 | 267 | ### 2.0.2 268 | * Change the map `` to `` (jump to the next AutoPairs match). 269 | * Change the map `` to `` (toggle the plugin AutoPairs). 270 | - Maps for normal and insert modes. 271 | * Change the nnoremap `` to `` (`:OpenSession`). 272 | * Change the nnoremap `ç` to `zl` (move to next misspelled word). 273 | * Change the nnoremap `Ç` to `zh` (move to previous misspelled word). 274 | * Change the nnoremap `ç` to `zp` (suggest correctly spelled words). 275 | * Change the cnoremap `` to `` (paste yanked text). 276 | * Change CtrlP maps to close it with ``, the same map to open it. 277 | 278 | ### 2.0.1 279 | * Change the map `` to `` (jump to the next AutoPairs match). 280 | * Change the map `` to `` (toggle the plugin AutoPairs). 281 | - Maps for normal and insert modes. 282 | 283 | ### 2.0.0 284 | * Merge vim and nvim configs. 285 | 286 | ### 1.23.37 287 | * Change the nnoremap for conceallevel and concealcursor. 288 | * Add syntax definitions to `~/.vim/after/syntax/`. 289 | 290 | ### 1.23.36 291 | * Change the nnoremap `ck` (KeywordDenisty) to `cc`. 292 | * Change the nnoremap `cj` (word-count) to `dd`. 293 | * Change the vnoremap `cj` (word-count) to `dd`. 294 | - Make them easier to type. 295 | * Update github path for ALE plugin. 296 | * Update github path for deoplete-go plugin. 297 | * Update github path for deoplete-zsh plugin. 298 | * Update github path for deoplete-clang plugin. 299 | - Some paths changed. 300 | * Add clang to ALE linters list. 301 | * Update clang and libclang paths for deoplete. 302 | 303 | ### 1.23.35 304 | * Change the nnoremap `ik` (KeywordDenisty) to `ck`. 305 | * Change the nnoremap `ij` (word-count) to `cj`. 306 | * Change the vnoremap `ij` (word-count) to `cj`. 307 | 308 | ### 1.23.34 309 | * Add nnoremap and vnoremap `ij` to `` (word-count). 310 | 311 | ### 1.23.33 312 | * Add new shortcuts for vim-surround on markdown. 313 | 314 | ### 1.23.32 315 | * The function `KeywordDensity()` excludes comments on liquid files. 316 | 317 | ### 1.23.31 318 | * Exclude some subdirectories for searches in the current directory. 319 | 320 | ### 1.23.30 321 | * Remove `:argdelete %` when deleting a buffer. No need to mix it. 322 | 323 | ### 1.23.29 324 | * Disable markdown for polyglot, again. 325 | * Add `syn region` to conceal links in markdown. 326 | * Add the nnoremap `gl` to go to the next markdown link. 327 | * Add the nnoremap `gh` to go to the previous markdown link. 328 | 329 | ### 1.23.28 330 | * Enable markdown for polyglot. 331 | 332 | ### 1.23.27 333 | * Update `GrepWrapper` for `git log`, using `-G` instead of `-S`. 334 | * When deleting a buffer, do an `:argdelete` as well. 335 | * Remove the nnoremap `vb`: grep in loaded buffers. 336 | * Remove teh nnormap `a`: populate args with wildcards. 337 | * Remove teh nnormap `A`: populate args with wildcards. 338 | * Add the nnoremap `aa` for `:argadd`. 339 | * Add the nnoremap `ad` for `:argadelete`. 340 | * Add the nnoremap `an` for `:args **/*.`. 341 | * Add the nnoremap `al` to display the arglist. 342 | * Fix the function `QFCounter()`. 343 | * Fix the function `GrepWrapper()`. 344 | 345 | ### 1.23.26 346 | * The nnoremap `gh` now is `:Gvdiffsplit HEAD`. 347 | * Improve the word count tool: strip front matter and HTML tags. 348 | 349 | ### 1.23.25 350 | * Fix for the last commit about path plugins. 351 | 352 | ### 1.23.24 353 | * Update Github path for some plugins. 354 | * Improve the function `ToggleNERDTree()`. 355 | * Improve the function `ToggleGGPrev()`. 356 | 357 | ### 1.23.23 358 | * The nnoremap `` can open and close the `Gstatus` window. 359 | 360 | ### 1.23.22 361 | * Set `wrap` after using `Gvdiff` and `Gsdiff`. 362 | 363 | ### 1.23.21 364 | * Add some flags to the function `ToggleJekyll()`. 365 | 366 | ### 1.23.20 367 | * Add custom wildignore for liquid files to skip `_site` and images. 368 | 369 | ### 1.23.19 370 | * Display words counter even when no patterns are found. 371 | 372 | ### 1.23.18 373 | * The function `ToggleBundle` is now `ToggleJekyll`. 374 | - Better `system()` check, using `v:shell_error`. 375 | - Create/remove a temporary file for i3status. 376 | - Send system notifications with `notify-send`. 377 | 378 | ### 1.23.17 379 | * Change the nnoremap `ib` (toggle bundle) to `ii`. 380 | 381 | ### 1.23.16 382 | * Reorganization of code. 383 | 384 | ### 1.23.15 385 | * Automatically `setlocal spell!` and `spelllang` for `liquid` ft. 386 | * Disable `colorcolumn` for `liquid` ft. 387 | * Add a function to toggle `bundle exec jekyll serve` in the background. 388 | 389 | ### 1.23.14 390 | * Load the plugin `vim-polyglot` first, so it can be overriden by other plugins. 391 | * Set `g:vimwiki_global_ext` to 0, so `vim-liquid` can set `liquid` ft on Jekyll posts. 392 | 393 | ### 1.23.13 394 | * Add a new shortcut for vim-surround on markdown. 395 | 396 | ### 1.23.12 397 | * Change the nnoremap `id` (keyword density) to `ik`. 398 | 399 | ### 1.23.11 400 | * Improvements in the keyword density checker. 401 | 402 | ### 1.23.10 403 | * Vimwiki plugin: use the branch master. 404 | * Set `g:AutoPairsMultilineClose` to 0. 405 | * Fix the keyword density checker. 406 | 407 | ### 1.23.09 408 | * Add new shortcuts for vim-surround on markdown. 409 | * Set `expandtab` for markdown files. 410 | 411 | ### 1.23.08 412 | * Set `nrformats` to remove octal on increase/decrease. 413 | * Improve toggle function for NERDTree plugin. 414 | 415 | ### 1.23.07 416 | * Fix the nnoremap for `:pclose`. 417 | 418 | ### 1.23.06 419 | * Stop updates for some deoplete plugins. Unstable on Debian 9. 420 | 421 | ### 1.23.05 422 | * Use vim-go version v1.19 (it's more stable). 423 | 424 | ### 1.23.04 425 | * Improve cursor shapes support. 426 | 427 | ### 1.23.03 428 | * Add commit hash for plugin neosnippet.vim. 429 | * Add commit hash for plugin deoplete.nvim (only nvim). 430 | * Workaround to fix warning version of vim-go plugin (only nvim). 431 | * Clean code on init.vim. 432 | 433 | ### 1.23.02 434 | * Add some shortcuts for vim-surround on markdown filetype. 435 | 436 | ### 1.23.01 437 | * Extend `Generator()` to generate PNG from DOT (Graphviz). 438 | * Change tab size to 2 instead of 4. 439 | 440 | ### 1.23.00 441 | * Install the plugin `vim-md-headings` to add two new maps. 442 | - Add the nnoremap `=` to increase markdown headings. 443 | - Add the nnoremap `_` to decrease markdown headings. 444 | * Workaround to fix warning version of vim-go plugin (only vim). 445 | 446 | ### 1.22.02 447 | * Fix for `GitGutterNextHunk` and `GitGutterPrevHunk`. 448 | 449 | ### 1.22.01 450 | * Add the inoremap `ÑP` to insert the liquid tags `{% %}`. 451 | * Add the inoremap `Ñ-` to insert the liquid tags `{%- -%}`. 452 | 453 | ### 1.22.00 454 | * Install the plugin `vim-liquid`. 455 | 456 | ### 1.21.00 457 | * Get the keyword density with the nnoremap `id`. 458 | 459 | ### 1.20.36 460 | * The nnoremap `wd` (`DeleteTrailing()`) changes to `td`. 461 | 462 | ### 1.20.35 463 | * Add semicolon to Maxima strings when it's needed. 464 | 465 | ### 1.20.34 466 | * Reduce automatic pclose to deoplete functionality. 467 | 468 | ### 1.20.33 469 | * Set `nomodeline` to fix vulnerability. 470 | 471 | ### 1.20.32 472 | * Change the maps `` (neosnippet) to ``. 473 | 474 | ### 1.20.31 475 | * Rename `Converter()` to `EPS2PNG()`. 476 | 477 | ### 1.20.30 478 | * Add the cnoremap `` to delete a word, forward; as I do in Zsh. 479 | 480 | ### 1.20.29 481 | * Cnoremap `` must paste yanked text instead of word under the cursor. 482 | 483 | ### 1.20.28 484 | * Fix: delete the previous content in the preview window. 485 | 486 | ### 1.20.27 487 | * Unify functions to generate images to only one: `Generator()`. 488 | * Remove the old five functions. 489 | * Add support to generate PNG images with Asymptote language. 490 | * Add support to images with POV-Ray. 491 | * Redirect the stderr to the preview window when generator fails. 492 | * Split `Commander()` function to `ResizeWinPreview()`. 493 | 494 | ### 1.20.26 495 | * Add Lua and PHP commands in `Runners()` to execute them. 496 | 497 | ### 1.20.25 498 | * Fix: delete tmux window when it's already open (rename tmux window). 499 | 500 | ### 1.20.24 501 | * Autoupdate buffer before running the script. 502 | 503 | ### 1.20.23 504 | * Remove some makeprg settings. 505 | * The nnoremap to preview code in a tmux window changes to `ij`. 506 | * Add the function `Scripty()` to output code in the preview window. 507 | * Add the nnoremap `ii` to output code in the preview window. 508 | * Add the function `Runners()` to define commands for some languages. 509 | 510 | ### 1.20.22 511 | * Remove the plugin Quickrun, since I'm using own functions. 512 | * Remove the maps `` to run Quickrun. 513 | * Add the function `PyShebang` to check the python version in the shebang. 514 | * Prevents `Tmuxy()` to don't close the tmux window until Enter is pressed. 515 | 516 | ### 1.20.21 517 | * Change all the nnoremaps to convert, generate or run to `ii`. 518 | * Reorganize the configuration. 519 | 520 | ### 1.20.20 521 | * Add the function `Texy()` to convert LaTeX to PDF. 522 | * Add thte nnoremap `ix` to convert LaTeX to PDF and preview it. 523 | * Add the linter `chktex` for LaTeX syntax checking. 524 | 525 | ### 1.20.19 526 | * Remove the nnoremap `` for `:TmuxNavigatePrevious`. 527 | * Add the nnoremap `` to scroll down the preview window from another. 528 | * Add the nnoremap `` to scroll up the preview window from another. 529 | * Remove the last empty line from the output of the `:Commander` function. 530 | * Remove the plugin sexy_scroller. 531 | 532 | ### 1.20.18 533 | * Move the cursor to top in the preview window. 534 | 535 | ### 1.20.17 536 | * Resize automatically the preview window. 537 | 538 | ### 1.20.16 539 | * Fix `ToggleSpelllang()`: better conditionals to check the language. 540 | * Fix `SQLExec()`: format queries only when it's a SQL `SELECT`. 541 | 542 | ### 1.20.15 543 | * Improve the nnoremaps to work on bufer. 544 | * Fix an error in the SQL queries execution. 545 | 546 | ### 1.20.14 547 | * Add the nnoremap `q` to close the temporary preview window from inside. 548 | 549 | ### 1.20.13 550 | * Remove the plugin vim-notebook. 551 | - It needs blocks in markdown and the output writes same document. 552 | - It requires to start the kernel first... 553 | * Implement a function to execute Maxima instructions, as in SQL queries. 554 | - This solution is cleaner because it uses a temporary preview window. 555 | - A second instruction overwrites the previous one (better workflow). 556 | - It has syntax enabled, using MAX files. 557 | - It does not require extra commands to start a kernel. 558 | - It executes one line or one selection instead of a markdown block. 559 | 560 | ### 1.20.12 561 | * Exclude csv syntax from vim-polyglot. 562 | * Add `Plotty()` to generate 2D/3D graphs with Gnuplot and mupdf preview. 563 | 564 | ### 1.20.11 565 | * Improve `Eucly()` to echo syntax errors when it's required. 566 | 567 | ### 1.20.10 568 | * Add `convert` options for the EUK to PNG conversion. 569 | 570 | ### 1.20.9 571 | * Create a new configuration section: "External tools integration". 572 | 573 | ### 1.20.8 574 | * Add `Eucly()` to generate PNG from EUK using Eukleides and mupdf preview. 575 | * Add the nnoremap `ie` to run `Eucly()`. 576 | 577 | ### 1.20.7 578 | * Set properly the height of the preview window. 579 | 580 | ### 1.20.6 581 | * Remove the plugin vim-dadbod. 582 | * Improve the function `SQLExec()` to handle sqlite natively. 583 | * Implement a function to create a temporary preview window. 584 | * Implement a function to send a command to the preview window. 585 | * Add the map `.` to close the preview window faster. 586 | * The map for wincmd is now `,` (faster to type). 587 | * Create the command `Commander` to preview shell commands. 588 | 589 | ### 1.20.5 590 | * Split vimwiki into subfolders based on categories. 591 | 592 | ### 1.20.4 593 | * Check if sqlite database exists before running SQL queries. 594 | 595 | ### 1.20.3 596 | * Refactor `ToggleColorColumn()`. 597 | * Refactor `ToggleCPosition()`, and execute it silently. 598 | 599 | ### 1.20.2 600 | * Improve `ToggleResize()` so it maximizes the window on WinEnter event. 601 | * Remove the command `ToggleResize`. The nnoremap `` is enough and faster. 602 | 603 | ### 1.20.1 604 | * Extend `SQLExec()` to execute SQL queries from the visual mode. 605 | * Add the nnoremap `ia` to add/change the database path. 606 | 607 | ### 1.20.0 608 | * Install the plugin vim-dadbod to use Vim as databases client. 609 | * Add the nnoremap `is` to execute SQL queries (one by line). 610 | 611 | ### 1.19.13 612 | * Add `Planty()` to generate PNG from UML using PlantUML and mupdf preview. 613 | * Add the nnoremap `iu` to run `Planty()`. 614 | * Add plantuml output for vim-quickrun to preview with feh. 615 | 616 | ### 1.19.12 617 | * Remove the nnoremap `` (omni SQL completion). Deoplete is enough. 618 | * Disable omni SQL default maps with global variable. 619 | 620 | ### 1.19.11 621 | * Use `ii` with `` to extend `Tmuxy()`. 622 | * Improve `Tmuxy()`: it wraps for any FileType. 623 | 624 | ### 1.19.10 625 | * Improve `Marky()` adding `grep mupdf`. 626 | 627 | ### 1.19.9 628 | * Add the nnoremap `io` to run bash in a tmux window. 629 | * Improve `Marky()` changing `lsof -a` to a good `ps -ef`filter. 630 | * Add options to convert to MD to PDF with better fontsize and margins. 631 | 632 | ### 1.19.8 633 | * Fix markdown keymaps! 634 | * The nnoremap `ins` (`:NotebookStart`) is now `ims`. 635 | * The nnoremap `inc` (`:NotebookClose`) is now `imc`. 636 | * The nnoremap `inn` (`:NotebookEvaluate`) is now `imm`. 637 | * Add `--webtex` service to generate math formulas in EPUB. 638 | 639 | ### 1.19.7 640 | * Fix surround settings: double quotes required. 641 | * Remove closetag settings for php and erb. 642 | 643 | ### 1.19.6 644 | * Reduce markdown fenced languages (only sh and python). 645 | - This change reduces de timeload of a markdown file. 646 | 647 | ### 1.19.5 648 | * Downgrade deoplete, again (Vim). 649 | 650 | ### 1.19.4 651 | * Add auto-shebang for new `*.js` files (node). 652 | 653 | ### 1.19.3 654 | * Add `auto_complete_delay` for deoplete plugin. 655 | * Fix auto-shebang for new `*.py` files (use python3). 656 | 657 | ### 1.19.2 658 | * Remove the plugin vim-instant-markdown. Marky has better workflow. 659 | * Remove the nnoremap `im` for `InstantMarkdownPreview`. 660 | * Set the option `conceallevel` to 0. 661 | * Add the nnoremap `coo` to set `conceallevel` to 0. 662 | * Add the nnoremap `coi` to set `conceallevel` to 2. 663 | * Remove the nnoremap `y` to delete a file. Use other methods. 664 | * Stop removing automatically trailing whitespaces. Now is a command. 665 | * Add the nnoremap `wd` to remove trailing white spaces. 666 | * Unset default spell for markdown files. It's annoying. 667 | * Stop renaming title of tmux tab with current filename. 668 | * Change the inoremap `çç` to `ÑÑ` to insert `{}` faster. 669 | 670 | ### 1.19.1 671 | * Improve Marky: use Mathjax for HTML, and fix "bug" on lsof command. 672 | 673 | ### 1.19.0 674 | * The nnoremap `` (close buffer) changes to `bd`. Regression. 675 | * Install the plugin vim-notebook to use maxima into Vim. 676 | * Add the nnoremap `ins` to run the command `:NotebookStart`. 677 | * Add the nnoremap `inc` to run the command `:NotebookClose`. 678 | * Add the nnoremap `inn` to run the command `:NotebookEvaluate`. 679 | 680 | ### 1.18.4 681 | * Upgrade deoplete.nvim (Vim only). They fixed bugs. 682 | * Remove `ToggleGsPrev()`. Use `:Gstatus` directly. 683 | 684 | ### 1.18.3 685 | * Extend Marky function to export to PDF and HTML. 686 | 687 | ### 1.18.2 688 | * Function to convert MD to EPUB and preview it with Mupdf 689 | 690 | ### 1.18.1 691 | * Downgrade deoplete.nvim (Vim only). 692 | * Add csslint in the ALE options. 693 | 694 | ### 1.18.0 695 | * Install the plugin vim-polyglot (better syntax support). 696 | * Install the plugin perlomni.vim (Perl support). 697 | * Install the plugin vim-ruby (Ruby support). 698 | * Install the plugin vim-rails (RoR support). 699 | * Install the plugin vim-endwise (end certain structures). 700 | * Install the plugin phpcomplete.vim (PHP support). 701 | * Install the plugin vim-racer (Rust support). 702 | * Remove the plugin neopairs.vim (using auto-pairs). 703 | * Remove the plugin vim-jquery (not used). 704 | * Remove the plugin vim-javascript (already into vim-polyglot). 705 | * Reformat plugins organization. 706 | 707 | ### 1.17.14 708 | * Fix italics issue (only in Vim). 709 | * Fix tmux-navigator setting introduced in v1.17.12 (only in Neovim). 710 | 711 | ### 1.17.13 712 | * Switch nnoremaps `` (is now terminal) and `` (is now Tagbar). 713 | * Create a custom function to have a better toggle for Tagbar. 714 | 715 | ### 1.17.12 716 | * Remove 'runner/vimproc' (vim-quickrun settings). 717 | * Improve markdown otuput for vim-quickrun. 718 | 719 | ### 1.17.11 720 | * Change the workspace directory name (for vimwiki). 721 | 722 | ### 1.17.10 723 | * The nnoremap `cc` (toggle NERDCommenter) changes to `cc`. 724 | - Faster to type. 725 | * Remove the inoremaps `` and `` to move lines from Insert Mode. 726 | - These maps must be only for Normal and Visual modes. 727 | * Add the map `` to jump to the next AutoPairs match. 728 | * Add the map `` to toggle the plugin AutoPairs. 729 | * Add a workaround to fix an AutoPairs bug into nvim for ``. 730 | * Update `closetag_filenames` with `*.html.erb`. 731 | * Set fillchars with different unicode symbols. 732 | * The nnoremap `df` changes to `cv`. 733 | - Faster to type. 734 | * The nnoremap `ds` changes to `cx`. 735 | - Faster to type. 736 | * Add the inoremap `ññ` to insert `[]` faster. 737 | - Faster to type. 738 | * Add the inoremap `çç` to insert `{}` faster. 739 | - Faster to type. 740 | * The nnoremap `wd` (switch CWD) changes to `bw`. 741 | - Back to the version 1.17.4. 742 | * Remove the inoremap `` to delete the last character. 743 | * Remove the cnoremap `` to delete the last character. 744 | * KEYMAPS.md file has been reorganized. 745 | 746 | ### 1.17.9 747 | * Add the cmap `` to init CapsLock into the command-line. 748 | 749 | ### 1.17.8 750 | * Function `Tmuxy()` for python doesn't need to use the interactive mode. 751 | 752 | ### 1.17.7 753 | * Remove `make` from the `autocmd QuickfixCmdPre`. 754 | * Add the function `Tmuxy()` to run code into a tmux window. 755 | * Add the nnoremap `ii` to run the function `Tmuxy()`. 756 | * The nnoremap `M` (InstantMarkdownPreview) changes to `im`. 757 | * Redistribute some Fkeys and avoid the Shift + Fkeys: 758 | * - The nnoremap `` (toggle Tagbar) is now ``. 759 | * - The nnoremap `` (toggle relative numbers) is now ``. 760 | * - The nnoremap `` (toggle spell dictionaries) is now ``. 761 | * - The nnoremap `` (toggle colorcolumn) is now ``. 762 | * - The nnoremap `` (reload colorscheme) is now ``. 763 | - (F7, F10 and F11 were available). 764 | 765 | ### 1.17.6 766 | * Check if vim 8 has terminal. 767 | * The nnoremap `ii` changes to `gs` (stage hunk). 768 | * The nnoremap `io` changes to `gu` (unstage hunk). 769 | - This change avoids staging hunks by error pressing double i. 770 | * Add the nnoremap `gg` to search a string between commits (Glog). 771 | - With this, I extended the function `GrepWrapper()`. 772 | * Add the path for the plugin vim-sessions. 773 | - Neovim was using `~/.vim` path by default... 774 | * Add the path for the clang library. 775 | - Deoplete couldn't find it on Debian. It worked fine on Arch, though. 776 | * The nnoremap `` (close the window) changes to `j`. 777 | * The nnoremap `` (fullscreen window) changes to ``. 778 | * The nnoremap `bd` (close buffer) changes to ``. 779 | * Remove the nnoremap `ba` (to close all buffers). Never used it. 780 | 781 | ### 1.17.5 782 | * Add terminal keycodes on vim to make it compatible with rxvt. 783 | * Remove paste mode on nvim (bracketed-paste-mode is built-in). 784 | * Configure vim to use bracketed-paste-mode under 'screen' &term. 785 | * Remove the map `` to toggle between paste/nopaste. Obsolete. 786 | * Fix URL referencing my tmux config from dotfiles repository. 787 | 788 | ### 1.17.4 789 | * The nnoremap `g` (Gvdiff) changed to `gv`. 790 | * Add the nnoremap `gh` to split horizontally (Gsdiff). 791 | * Add the nnoremap `gb` to run the command Gblame. 792 | * The nnoremap `i` (GitGutterStageHunk) change to `ii`. 793 | * Add the nnoremap `io` to run the command GitGutterUndoHunk. 794 | - These maps are more intuitive. 795 | * The nmap `gl` (openbrowser) changed to `gl`. Avoid conflict with Vimwiki. 796 | * The nnoremap `bw` (switch CWD) changed to `wd`. 797 | * Remove the cnoremap `%%` to expand the path of the current buffer. 798 | 799 | ### 1.17.3 800 | * Remove xterm-modifier-keys for tmux. It works well using URxvt. 801 | - `$TERM` must be rxvt-unicode-256color (.Xresources and .tmux.conf). 802 | 803 | ### 1.17.2 804 | * Add `\<` and `\>` to highlight the word under the cursor. 805 | - Removed it in the version 1.14.1 (it's better with it). 806 | * Add options to `grep -R`: exclude CVS directories and LICENSE file. 807 | 808 | ### 1.17.1 809 | * Add `g:NERDCustomDelimiters` for Python. 810 | * Remove the `gv` after toggle comment with `c`. 811 | - Tired of pressing `` to return to Normal Mode. 812 | * Add highlights (headers and checkbox) for the Vimwiki. 813 | * Fix some vint warnings. 814 | * Add the setting `mouse=a` in Vim (like in Neovim). 815 | * I decided to adjust `colorcolumn=80` and `set number`. 816 | * Add file headers for Python, Ruby, Perl and Bash new files. 817 | 818 | ### 1.17.0 819 | * Remove phpcomplete-extended plugin. 820 | * Remove neocomplete plugin from Vim8. 821 | * Remove jedi-vim plugin from Vim8. 822 | * Install deoplete plugin on Vim8. 823 | * Install nvim-yarp plugin (required to use deoplete on Vim8). 824 | * Install vim-hug-neovim-rpc plugin (required to use deoplete on Vim8). 825 | * Install deoplete-jedi plugin for Vim8 (Python autocomplete). 826 | * Install deoplete-ternjs plugin (javascript autocomplete). 827 | * Install deoplete-zsh plugin (zsh autocomplete). 828 | * Install neco-ghc plugin (Haskell autocomplete). 829 | * Update all settings for deoplete. 830 | * Add pylint (python linter). 831 | * Quickrun outputter uses vertical buffer instead of quickfix. 832 | * Vimwiki: avoid URL shortener (show full URL). Shortener was buggy. 833 | * Rename `CloseLastQF` function to `CloseLastBuffer`. 834 | * Function `CloseLastBuffer` closes 'nofile' `&buftype`. 835 | * Function `CloseLastBuffer` calls system to rename tmux window. 836 | 837 | ### 1.16.3 838 | * Change `g:ftplugin_sql_omni_key` to ``. 839 | - Default was `` (it was in conflict). 840 | 841 | ### 1.16.2 842 | * Add the `--ignore-case` option to grepprg. 843 | 844 | ### 1.16.1 845 | * The nnoremap `g` (Gstatus) changed to ``. 846 | - It's faster to toggle Gstatus having Ctrl pressed. 847 | * The nnoremap `G` (Gvdiff) is now `g`. 848 | - It reduces one keystroke to make a Gvdiff (faster). 849 | * The nnoremap `` (OpenSession) moved to ``. 850 | - It's normally used once at start, so I put it farther. 851 | * The nnoremap `v` (vimgrep %) changed to `vg`. 852 | * The nnoremap `V` (vimgrep \*\*/\*.) changed to `vf`. 853 | * Add the nnoremap `vv`: grep the highlight (current buffer). 854 | * Add the nnoremap `vb`: grep the highlight (loaded buffers). 855 | * Add the nnoremap `vn`: grep the highlight (current directory). 856 | * Add the nnoremap `vm`: addgrep the highlight (current buffer). 857 | * Add the nnoremap `va`: grep the highlight (current arglist). 858 | * Add two functions: `QFCounter()` and `GrepWrapper()` for the last commands. 859 | * The nnoremap `R` now uses `:bufdo` instead of `:argdo`. 860 | * Add the nnoremap `Q`: replace the highlight to each quickfix entry. 861 | * Improve the function to toggle the cursor position (`ñ`). 862 | 863 | ### 1.16.0 864 | * Add the plugin js-beautify, mapped to `bf`. 865 | * Add the maps `bf` to autoformat SQL and XML. 866 | * Add the nnoremap `tf` to `:retab` the buffer. 867 | 868 | ### 1.15.2 869 | * Remove the plugin Vimshell from vim. 870 | * Add a new function for Vim: `ToggleTerminal()`. 871 | * Improve the same function on Neovim. 872 | * Add the tnoremap `` to ``. 873 | 874 | ### 1.15.1 875 | * Allow plugin CtrlP to follow symlinks. 876 | * Fix double quotes in function `WrapForTmux(s)`. 877 | 878 | ### 1.15.0 879 | * Add the plugin vimwiki. 880 | * Add the maps `we` to `:VimwikiToggleListItem`. 881 | * Configure the plugin open-browser to use w3m into a tmux window. 882 | 883 | ### 1.14.1 884 | * Follow vimscript style guide. 885 | * Switch nnoremaps `` and `m`. 886 | * Remove `\<` and `\>` from highlight the word under the cursor. 887 | * Remove nnoremaps `ww` and `wg` (spelling). 888 | * Add `g:markdown_fenced_languages` for some languages. 889 | * Fix `ToggleCPosition`, use `$` instead of `g_`. 890 | 891 | ### 1.14.0 892 | * Install Atomic color scheme as plugin. 893 | * Add the nnoremap `i` for `:GitGutterStageHunk`. 894 | * Add the nnoremap `I` for `:GitGutterUndoHunk`. 895 | * Remove background setting. Color scheme manages it. 896 | * Remove the workaround for ncurses 6.0 on neovim. 897 | * Add the cnoremap `` to paste yanked text (``). 898 | * Change foldmethod to marker. 899 | 900 | ### 1.13.1 901 | * Fix vnoremap `` to execute `:QuickRun`. 902 | 903 | ### 1.13.0 904 | * Remove Syntastic and Neomake from Vim/Neovim. Use ALE. 905 | - Syntastic is not async. 906 | - Syntastic and Neomake don't lint while coding. 907 | * Use QuickRun to run code in Neovim, with better settings. 908 | - QuickRun can run the selected lines in 'Visual mode'. 909 | * Remove function for `:Glog`. Use the plugin GV. 910 | - It does not populate the quickfix, so it's better for me. 911 | - It is possible to track the changes in the selected lines. 912 | - And it shows the last commits with a nicer format. 913 | * Finally, remove FZF plugins. I prefer CtrlP + GV combo. 914 | * So, remove the nnoremap `C` to open `:Commits`. 915 | * Also, install the plugin vim-ruby. (Support for ruby). 916 | * Expand neosnippet with `` instead of ``. 917 | - `` is closer to `Tab` and avoid conflicts with GV. 918 | * Fix some makeprg settings, and drop cpp. 919 | 920 | ### 1.12.3 921 | * The command `:W` changed to :`WW`. It was in conflict. 922 | * Added a new function for Neovim: `ToggleTerminal`. 923 | 924 | ### 1.12.2 (only Neovim) 925 | * Added python2 path for deoplete. It's optional. 926 | * Added `mouse=a` because it's not a default in nvim 2.0. 927 | * Cursor shape options changed in nvim 2.0, so I updated them. 928 | * Disabled true colors for terminal (old option is ignored). 929 | 930 | ### 1.12.1 931 | * Fixed the command `:W`. It was not well defined. 932 | * Added a workaround for ncurses 6.0 on Archlinux/nvim. 933 | * Yank the last pasted text automatically (`pgvy`). 934 | 935 | ### 1.12.0 936 | * Added the command `:W` to save a file with sudo permissions. 937 | 938 | ### 1.11.0 939 | * Removed Vimshell plugin from Neovim (unnecessary). 940 | * The nmap `` (GitGutter preview) changed to ``. 941 | * Improved the nnoremap `G` (added `gg`). 942 | * The map `` (CtrlP menu) changed to ``. 943 | * Better prompt mappings (readline) for CtrlP plugin. 944 | * Added the nnoremap `` to open `:OpenSession`. 945 | * The vnoremaps `<` (toggle case) changed to `z`. 946 | * The nnoremap `z` (`:FZF`) now toggles the caps. 947 | * The nnoremap `Z` (`:Commits`) changed to `C`. 948 | * Added new function to toggle vim-fugitive-:Glog with ``. 949 | * Deleted the navigation maps from Insert mode `^X@sh`. 950 | * Deleted the navigation maps from Command mode `^X@sh`. 951 | * Added the inoremap `` to delete the last character. 952 | * Added the inoremap `` to delete the current character. 953 | * Added the cnoremap `` to delete the last character. 954 | * Added the cnoremap `` to delete the current character. 955 | * Extended the nnoremap `` to vim (open `:Vimshell`). 956 | * Vim supports cursor shape only for `rxvt\|xterm\|tmux`. 957 | 958 | ### 1.10.0 959 | * Added the plugin goyo. 960 | 961 | ### 1.9.0 962 | * Switched the plugin Gundo to Undotree (tired of Python 2.4+ requirement). 963 | 964 | ### 1.8.2 965 | * Fixed Neomake settings: `BufEnter` changed to `BufWinEnter`. 966 | * Added a function to close the quickfix window if it's the last window. 967 | 968 | ### 1.8.1 969 | * Added the nnoremap `` to open the `:terminal` (only for Neovim). 970 | * Added the tnoremap `` to switch `:terminal` to the last window. 971 | 972 | ### 1.8.0 973 | * Added the plugin neco-vim. 974 | * Added the plugin neco-syntax. 975 | * Added the plugin neopairs. 976 | 977 | ### 1.7.6 978 | * Maps `` (neosnippet) changed to ``; had conflict with CtrlP maps. 979 | 980 | ### 1.7.5 981 | * Autocompletion fixes. 982 | * Removed the plugin deoplete-ternjs because it has a .tern-port issue. 983 | 984 | ### 1.7.4 985 | * Tern fix: do not create .tern-port file. 986 | 987 | ### 1.7.3 988 | * Show hidden files into CtrlP menu. 989 | 990 | ### 1.7.2 991 | * Removed the nnoremap and vnoremap `4` to `g$`. 992 | * Removed the nnoremap and vnoremap `6` to `g^`. 993 | 994 | ### 1.7.1 995 | * The maps `` (expand neosnippet) changed to ``. Conflict fix. 996 | 997 | ### 1.7.0 998 | * Removed all the `` commands from Insert mode. 999 | * Removed most of the `` commands from Visual mode. 1000 | * Removed the fast Escape key (``). 1001 | * The `` function can be used with the triggered ``. 1002 | * Removed the plugin (a.vim), it was annoying and useless. 1003 | * Added the nnoremap `G` for the command `:Gvdiff`. 1004 | * CtrlP map changed to `` (`` crashed in Visual mode). 1005 | * The nnoremap `` (show syntax groups) changed to `B`. 1006 | * Added the nnoremap `` to search backward (`?`). 1007 | * Also, better notation for `^C` maps (letters in lowercase). 1008 | 1009 | ### 1.6.0 1010 | * Installed the plugin 'deoplete-go' (autocompletion). 1011 | * Installed the plugin 'gocode' (autocompletion). 1012 | * Installed the plugin 'deoplete-ternjs' (autocompletion). 1013 | * Installed the plugin 'jspc' (autocompletion). 1014 | * Installed the plugin 'phpcomplete-extended' (autocompletion). 1015 | * Installed the plugin 'clang_complete' (autocompletion). 1016 | * Removed the plugin 'phpcompletion'. 1017 | * Removed the plugin 'vim-clang'. 1018 | * Added the nnoremap `g` to toggle `:Gstatus` (fugitive). 1019 | * Added ignore git, hg and svn files for CtrlP plugin 1020 | * Added more general settings for deoplete plugin. 1021 | * Added settings for the plugin 'deoplete-go'. 1022 | * Added settings for the plugin 'deoplete-jedi'. 1023 | * Added settings for the plugin 'deoplete-ternjs'. 1024 | * Added settings for the plugin 'phpcompletion-extended'. 1025 | * Added settings for the plugin 'clang_complete'. 1026 | * The maps `` (expand neosnippet) changed to ``. 1027 | * The maps `ga` (EasyAlign plugin) changed to `gi`. 1028 | * The vnoremap `ta` (tabularize) changed to `x`. 1029 | * The vnoremap `t1` (tabularize first) changed to `X`. 1030 | * Added settings for the plugin 'closetag', also for PHP and Ruby. 1031 | * Added settings for the plugin 'surround', also for PHP and Ruby. 1032 | * Added «omnifunc» settings (better autocompletions). 1033 | * Duplicated for Visual modes the function to toggle `^`/`g_`. 1034 | 1035 | ### 1.5.7 1036 | * Added the inoremaps `` and ``. 1037 | * Better misspelled words navigation with `ç` and `Ç`. 1038 | * The map `w?` (suggestions) changed to `ç`. 1039 | * The map `wa` (wrong is good) changed to `wg`. 1040 | * The map `wx` (wrong is wrong) changed to `ww`. 1041 | 1042 | ### 1.5.6 1043 | * Removed the nnoremap `` (stop pressing message). 1044 | * The map `` (open CtrlP) changed to ``. 1045 | * The maps `x` (open FZF buffers) have been removed. 1046 | * The maps `C` (poen FZF commits) changed to `Z`. 1047 | 1048 | ### 1.5.5 1049 | * Added and fixed the vnoremap to vimgrep into the visual selection. 1050 | * The nnoremap `do` (replace to all open files) changed to `R`. 1051 | 1052 | ### 1.5.4 1053 | * Added `:copen` to `:vimgrep` nnoremaps. 1054 | * Removed the vnoremap to vimgrep into the visual selection. 1055 | 1056 | ### 1.5.3 1057 | * Jump to the search results (grep, vimgrep) in buffers, not in tabs. 1058 | 1059 | ### 1.5.2 1060 | * New toggle function to switch start and end of line with `ñ`. 1061 | 1062 | ### 1.5.1 1063 | * New NERDCommenter settings: default maps disabled. 1064 | * The maps `x` (toggle comments) changed to `c`. 1065 | * New Neomake/Syntastic settings: new error signs. 1066 | * New CtrlP settings: changed some prompt mappings. 1067 | * Added a new map `x` to open `:Buffers` (FZF). 1068 | * Added a new map `C` to open `:Commits` (FZF). 1069 | * The maps `gu` (toggle Gundo) changed to `u`. 1070 | * The map `cd` (pwd directory) changed to `bw`. 1071 | * The map `by` (copy filepath) changed to `by`. 1072 | * Added new 'Readline commands' for the Command mode, navigate like in a terminal. 1073 | * The maps `u` (toggle case) changed to `<`. 1074 | * The function to toggle GitGutterPreviewHunk has been improved. 1075 | 1076 | ### 1.5.0 1077 | * Added a new function: search into a Visual selection. 1078 | * Removed the inoremap ';;' (inserts a comma and ``). 1079 | * The map `m` now returns to the last column cursor position. 1080 | * Display the current dictionary when we toggle between dictionaries. 1081 | 1082 | ### 1.4.4 1083 | * Removed indentation settings from markdown and mail file types. 1084 | * Removed useless nnoremap and vnoremap to `` for Windows key. 1085 | * Fixed Caps Lock setting: leaving 'Insert Mode' now disables CAPS automatically. 1086 | 1087 | ### 1.4.3 1088 | * Added the setting `nomore` to avoid the pause of listings. 1089 | 1090 | ### 1.4.2 1091 | * Fixed the inoremap `p` (paste from clipboard one character left). 1092 | 1093 | ### 1.4.1 1094 | * The maps `g` (`:GundoToggle`) changed to `gu`. 1095 | * Better Neocomplete/Deoplete settings. 1096 | * Deleted the inoremap `` to delete a line. 1097 | * Added the inoremap `` to expand Jedi completions. 1098 | * Fixed the imap `` (Caps Lock) to prevents popup completions. 1099 | * Better cursor shape detection for older Vim versions. 1100 | * New maps to switch between Vim and Tmux windows even from the Insert/Visual Modes. 1101 | * Now easily navigate between characters from Insert Mode with Windows key + hjkl. 1102 | * Added the cnoremaps `^X@sh` and `^X@sl` to move one character left and right. 1103 | * The nnoremap `da` (`:argdo`) changed to `**do**`. 1104 | * The nnoremap `F` now it enters a new line Up. 1105 | 1106 | ### 1.4.0 1107 | * Added a new section: 'Filetype settings'. 1108 | * More time delay for `timeoutlen` (3000). 1109 | * New inoremap to insert a colon and return to Normal Mode. 1110 | * Trigger `InsertLeave` autocmd when using `` to escape. 1111 | * Echo a warning when pressing `` in Normal Mode. 1112 | * Disabled Q Mode. 1113 | * New cnoreabbrev to open help in a vertical window. 1114 | * Installed the plugin 'fzf'. 1115 | * Installed the plugin 'tern_for_vim'. 1116 | * Installed the plugin 'vim-closetag'. 1117 | * Installed the plugin 'targets.vim'. 1118 | * Installed the plugin 'vim-sort-motion'. 1119 | * Installed the plugin 'vim-expand-region'. 1120 | * Installed the plugin 'MatchTagAlways'. 1121 | * Installed the plugin 'vim-argwrap'. 1122 | * Installed the plugin 'vim-characterize'. 1123 | * GitGutter will ignore space at EOL. 1124 | * The map `` (open CtrlP plugin) changed to ``. 1125 | * Added the nmap `` to toggle preview GitGutter hunks. 1126 | * All maps `` (toggle comment) changed to `x`. 1127 | * Added new maps `h` to jump to the previous error. 1128 | * Added new maps `l` to jump to the next error. 1129 | * Added new maps `z` to open FZF plugin. 1130 | * All maps `` (toggle Tagbar) changed to ``. 1131 | * All maps `` (expand neosnippet) changed to ``. 1132 | * Added the nnoremap `` to open `:VimShell` or `:terminal`. 1133 | * The plugin 'easy-align' now uses the map `ga`. 1134 | * The plugin 'tabularize' now uses the map `t1`. 1135 | * The plugin 'expand-region' uses the vmap `v` and ``. 1136 | * Added settings for the plugin 'MatchTagAlways'. 1137 | * Added settings for the plugin 'ArgWrap' and `W`. 1138 | * The plugin 'vim-instant-markdown' now uses the map `M`. 1139 | * Added new settings to change the cursor shape. 1140 | * To reload the `colorscheme` now it is mapped to `` 1141 | * The nnoremap `` (show syntax) changed to ``. 1142 | * Added the onoremap `af` and `aF` to work on all file. 1143 | * Added the nnoremap `cf` to copy the filepath to clipboard. 1144 | * Added the cnoremap `%%` to expand the path of the current buffer. 1145 | * All maps `` (toggle relative numbers) changed to ``. 1146 | * Removed maps to treat long lines as break lines using arrows. 1147 | * Removed maps to move lines using arrows. 1148 | * Removed maps to duplicate a line using arrows. 1149 | * Added four 'Readline commands': ``, ``, ``, ``. 1150 | * The nnoremap `` (`:vimgrep`) changed to `v`. 1151 | * The vnoremap `` (`:vimgrep`) changed to `v`. 1152 | * The nnoremap `v` (`:vimgrep`) changed to `V`. 1153 | * The nnoremap `l` (`:cnext`) changed to `n`. 1154 | * The nnoremap `h` (`:cprev`) changed to `N`. 1155 | * The nnoremap `aa` (`:args *.`) changed to `a`. 1156 | * The nnoremap `as` (`:args **/*.`) changed to `A`. 1157 | * The nnoremap `ad` (`:argdo %s...`) changed to `da`. 1158 | * The vnoremap `x` (toggle case) changed to `u`. 1159 | * Added the nnoremap `u` to toggle case: easier than `~`. 1160 | * Added the inoremap `u` to toggle case from Insert Mode. 1161 | * Added maps to toggle spell dictionary using ``. 1162 | * Added the inoremap `p` to paste the clipboard from Insert Mode. 1163 | * Added the nnoremap `Y` to yank everything from the cursor to the EOL. 1164 | * Added the inoremap `` to delete de current line from Insert Mode. 1165 | * Added the nnoremap `o` to isolate the current line. 1166 | * Added the nnoremap `f` to add a new line below. 1167 | * Added the nnoremap `F` to join lines. 1168 | * Added 'binary' filetype settings. 1169 | * Added 'markdown' filetype settings. 1170 | * Added 'mail' filetype settings. 1171 | 1172 | ### 1.3.0 1173 | * Installed the plugin 'vim-capslock': use `` (Insert Mode) instead of Caps Lock key. 1174 | * Removed the nnoremap `e` (replace the word under the cursor). Use `ciw` instead. 1175 | * The nnoremap `h` (`:GitGutterPreviewHunk`) changed to `f`. 1176 | * The nnoremap `l` (toggle the 'loclist') changed to `e`. 1177 | * The nnoremap `p` (`:cprev`) changed to `h`. 1178 | * The nnoremap `n` (`:cnext`) changed to `l`. 1179 | * Added the nnoremap `p` to paste from the clipboard. 1180 | * The nnoremap `y` changed to `ya` (**y**ank **a**ll). 1181 | 1182 | ### 1.2.0 1183 | * Installed the plugin 'vim-instant-markdown' 1184 | * Added a map to preview markdown files using `z`. 1185 | * The vnoremap `z` (sorting lines) changed to `az`. 1186 | * Installed the plugin 'open-browser'. 1187 | * Installed the plugin 'MatchTagAlways'. 1188 | * Installed the plugin 'Emmet'. 1189 | 1190 | ### 1.1.2 1191 | * Fixed `xterm-keys` for tmux. 1192 | * Improved conditional to enable 256 colors, matching to a `$TERM` pattern. 1193 | * Turn `viminfo^=%` to comment (don't remember the last open buffer on close). 1194 | * Better maps for splitting and resizing windows, so it fits in my `.tmux.conf`. 1195 | * Stop resizing all windows when the terminal is resized. Makes no sense. 1196 | * Removed the nnoremap `` (delete the last character). 1197 | 1198 | ### 1.1.1 1199 | * Fixed the map for reloading settings `.vimrc`. Now it uses `$MYVIMRC` var. 1200 | * Fixed `DeleteTrailing`, so it works in all files (`*`). 1201 | * The nnoremap `` (search the word under the cursor) changed to ``. 1202 | * The vnoremap `` (search the visual selection) changed to ``. 1203 | * The nnoremap `` (disable highlight) changed to ``. 1204 | * The inoremap `` (toggle NERDCommenter) have been deleted. 1205 | * The nnoremap `` (toggle 'NERDTree') changed to ``. 1206 | * Jump to the end of line in Insert Mode using ``. 1207 | 1208 | ### 1.1.0 1209 | * Installed a pluggin for a smoother scrolling. 1210 | * Changed `scrolloff` to 0. 1211 | * Set `mousehide` (always, in term and GUI). 1212 | * Added a map to reload the current colorscheme. 1213 | * Added a map to display syntax highlighting groups. 1214 | * Added a map for `:retab` (Visual Mode). 1215 | * Added a map to jump to the end of line in the Insert Mode. 1216 | * Added ignore case when autocompletes when browsing files. 1217 | * Added maps for 'gitgutter' hunks: next, prev and preview. 1218 | * Added a map to delete the current file: `y`. 1219 | * Added a map to reload the current colorscheme: ``. 1220 | * Removed conditional statement on 'tabularize' settings. 1221 | * Rename the title of tmux tabs with the current filename. 1222 | * New `showbreak` characters: `│——»`. (4 characters). 1223 | * Search the word under cursor without jumping to the next result. 1224 | * Search the selected text without jumping to the next result. 1225 | * Disabled 'Fly Mode' from plugin 'auto-pairs'. 1226 | * Vim-airline's tabline show only the filename instead of path. 1227 | * Installed plugins for autocomplete and snippets. 1228 | * Added a new category for `:make` settings. 1229 | * Installed the plugin 'QuickRun'. 1230 | * Set `updatetime` to 250. 1231 | 1232 | ### 1.0.0 1233 | * Initial commit, first version. 1234 | -------------------------------------------------------------------------------- /KEYMAPS.md: -------------------------------------------------------------------------------- 1 | ### Interface 2 | - Normal mode 3 | - `` it's the default help. 4 | - `` renames the current buffer. 5 | - `` toggles line numbers. 6 | - `` toggles relative numbers. 7 | - `` reloads all open buffers. 8 | - `` toggles list. 9 | - `` opens the `:terminal`. 10 | - `` toggles spell checking. 11 | - `` toggles spell dictionaries. 12 | - `` toggles colorcolumn. 13 | - `` toggles Goyo plugin. 14 | - `` reloads your Vim/Neovim configuration. 15 | 16 | ### Buffers 17 | - Normal mode 18 | - `` goes to the previous buffer. 19 | - `` goes to the next buffer. 20 | - `bd` closes the current buffer. 21 | - `s` updates the buffer (save). 22 | - `S` updates all the buffers. 23 | - `bb` opens the `:edit` command. 24 | - `bg` opens a list of all buffers. 25 | - `by` copies the filepath to the clipboard. 26 | - `dd` switches CWD to the current filepath. 27 | - `dg` switches CWD to the git root directory. 28 | - `yab` yanks the buffer content. 29 | - `dab` deletes the buffer content. 30 | - `vab` selects the buffer content. 31 | 32 | ### Tabs 33 | - Normal mode 34 | - `td` closes the current tab. 35 | - `to` closes all the tabs except the current. 36 | - `tt` opens the `:tabedit` command. 37 | - `tr` moves the tab position to the left. 38 | - `ty` moves the tab position to the right. 39 | 40 | ### Windows 41 | - Normal mode 42 | - `` goes to the window: left. 43 | - `` goes to the window: down. 44 | - `` goes to the window: up. 45 | - `` goes to the window: right. 46 | - `,f` toggles maximize/minimize the current window. 47 | - `,` it is `wincmd` to easily manage windows. 48 | - `,-` splits window horizontally. 49 | - `,.` splits window vertically. 50 | - `,j` closes the current window. 51 | - `,x` closes the current window forcing it. 52 | - `,,` restores the proportional size of windows. 53 | - `,l` returns to the last window. 54 | - `,p` goes to the previous window. 55 | - `,n` goes to the next window. 56 | - `,o` closes all windows excepting the current. 57 | - `.` scrolls down the preview window from another window. 58 | - `.` scrolls up the preview window from another window. 59 | - `.` closes the preview window from another window. 60 | - `q` closes the preview window (`:pclose`) from inside. 61 | 62 | ### Edition 63 | - Normal mode 64 | - `J` moves lines down. 65 | - `K` moves lines up. 66 | - `H` moves character left. 67 | - `L` moves character right. 68 | - `` joins lines. 69 | - `` splits lines. 70 | - `` increases a number value. 71 | - `` decreases a number value. 72 | - `` scrolls the window down [count]. 73 | - `` scrolls the window up [count]. 74 | - `` scrolls the window down 50%. 75 | - `` scrolls the window up 50%. 76 | - `` inits the Visual-block mode. 77 | - `bf` autoformat a buffer (sql, js, html, xml, css). 78 | - `` deletes the Windows ^M. 79 | - `o` isolates the current line. 80 | - `f` enters a new line down from 'Normal Mode'. 81 | - `F` enters a new line up from 'Normal Mode'. 82 | - `tf` retabs the current buffer. 83 | - `dt` removes trailing white spaces. 84 | - `p` pastes text from the clipboard. 85 | - `coi` sets the conceallevel to 0, concealcursor to niv. 86 | - `coo` sets the conceallevel to 2, concealcursor to vc. 87 | - `cop` sets the conceallevel to 2, concealcursor to niv. 88 | - `com` sets the conceallevel to 3, concealcursor to niv. 89 | - `zl` moves to the next misspelled word. 90 | - `zh` moves to the previous misspelled word. 91 | - `zp` suggests correctly spelled words. 92 | - `ñ` toggles the cursor position: start of text/end of line. 93 | - `cc` toggles the commented code. 94 | - `cx` duplicates a line up. 95 | - `cv` duplicates a line down. 96 | - `` adds one tabulator. 97 | - `` deletes one tabulator. 98 | - `` toggles AutoPairs plugin. 99 | - `` jumps to the next AutoPairs match. 100 | - `=` increases a markdown heading (plugin `vim-md-headings`). 101 | - `_` decreases a markdown heading (plugin `vim-md-headings`). 102 | - `we` toggles a checkbox (plugin `vim-md-checkbox`). 103 | - `wx` removes a checkbox (plugin `vim-md-checkbox`). 104 | - `gl` goes to the next markdown link. 105 | - `gh` goes to the previous markdown link. 106 | - `gd` removes the next markdown link. 107 | - `cx` displays the cursor position and buffer word-count. 108 | 109 | - Visual mode 110 | - `y` copies the selection into the clipboard. 111 | - `z` toggles the case of the selection. 112 | - `tf` retabs the current selection. 113 | - `` expands neosnippet. 114 | - `v` expands the region selected. 115 | - `m` shrinks the selection. 116 | - `cx` displays the cursor position and selection word-count. 117 | 118 | - Insert mode 119 | - `` moves the cursor to the start of line (0). 120 | - `` moves the cursor to the end of line ($). 121 | - `` moves the cursor back one character. 122 | - `` moves the cursor forward one character. 123 | - `` deletes the last character. 124 | - `` deletes the current character. 125 | - `` deletes all characters before the cursor. 126 | - `` enters a new line. 127 | - `` enters a digraph. 128 | - `` toggles the CapsLock key. 129 | - `` expands neosnippet. 130 | - `` ins-completion. 131 | - `` keyword completion: next. 132 | - `` keyword completion: previous. 133 | - `ñr` inserts `[]` faster. 134 | - `ñb` inserts `()` faster. 135 | - `ñB` inserts `{}` faster. 136 | - `ññ` inserts `{{ }}` faster. 137 | - `ñp` inserts `{% %}` faster. 138 | - `ñ-` inserts `{%- -%}` faster. 139 | - `ñl` inserts a `\` faster. 140 | - `ñm` enter Vim's expression register (math). 141 | - `` jumps to the next AutoPairs match. 142 | - `` toggles AutoPairs plugin. 143 | 144 | - Command mode 145 | - `` moves the cursor to the start of line (0). 146 | - `` moves the cursor to the end of line ($). 147 | - `` moves the cursor back one character. 148 | - `` moves the cursor forward one character. 149 | - `` deletes the last character. 150 | - `` deletes the current character. 151 | - `` deletes a word, forward. 152 | - `` deletes a word, backward. 153 | - `` deletes all characters before the cursor. 154 | - `` enters a new line. 155 | - `` enters a digraph. 156 | - `` pastes the yanked text (`"`). 157 | - `` toggles the CapsLock key. 158 | - `` navigates command history: next. 159 | - `` navigates command history: previous. 160 | 161 | - Surround maps for markdown 162 | - `=` surrounds to `{% \r %}` (Liquid) 163 | - `-` surrounds to `{%- \r -%}` (Liquid) 164 | - `i` surrounds to `_\r_` 165 | - `o` surrounds to `**\r**` 166 | - `u` surrounds to `\r` 167 | - `d` surrounds to `\r` 168 | - `k` surrounds to `\r` 169 | - `n` surrounds to `\r` 170 | - `p` surrounds to `\r` 171 | - `h` surrounds to `[\r](//)` 172 | - `j` surrounds to `![\r](/images/){: .align-}` 173 | - `e` surrounds to `[\r\](){:rel="noopener noreferrer" target="_blank"}` 174 | - `y` surrounds to `\r<\/a>` 175 | - `r` surrounds to `[\r]` 176 | - `b` surrounds to `(\r)` 177 | - `B` surrounds to `{\r}` 178 | - `x` surrounds to `«\r»` 179 | 180 | ### Search 181 | - Normal mode 182 | - `` searches forward for the pattern. 183 | - `` searches backward for the pattern. 184 | - `` highlights the word under the cursor. 185 | - `m` disables highlight. 186 | 187 | - Visual mode 188 | - `` highlights the current selection. 189 | 190 | ### Grep 191 | - Normal mode 192 | - `vg` vimgreps the highlight in the current buffer. 193 | - `vf` vimgreps the highlight in the current directory. 194 | - `vv` greps the highlight in the current buffer. 195 | - `vn` greps the highlight in the current directory. 196 | - `va` greps the highlight in the current arglist. 197 | - `vm` grepadds the highlight of the current buffer. 198 | - `n` goes to the next vimgrep result. 199 | - `N` goes to the previous vimgrep result. 200 | 201 | ### Replace 202 | - Normal mode 203 | - `r` replaces the highlight in the current buffer. 204 | - `R` replaces the highlight the loaded buffers. 205 | - `Q` replaces the highlight to each valid quickfix entry. 206 | 207 | ### Arglist 208 | - `aa` adds files to the arglist with `:argadd`. 209 | - `ad` deletes files from the arglist with `:argdelete`. 210 | - `an` creates a new arglist starting with `:args **/*.`. 211 | - `al` displays the arglist vertically. 212 | 213 | ### Git 214 | - Normal mode 215 | - `` toggles the plugin fugitive `:Gstatus`. 216 | - `` previews the current GitGutter hunk. 217 | - `j` goes to the next GitGutter hunk. 218 | - `k` goes to the previous GitGutter hunk. 219 | - `ga` adds the line to the staging area (GitGutter). 220 | - `gu` undoes the hunk (GitGutter). 221 | - `gv` starts the fugitive command `:Gvdiffsplit`. 222 | - `gh` starts the fugitive command `:Gvdiffsplit HEAD`. 223 | - `gb` starts the fugitive command `:Git blame`. 224 | - `gg` searches a string between commits (Glog). 225 | - `gz` opens the menu of `:Commits` (FZF). 226 | 227 | ### Errors 228 | - Normal mode 229 | - `h` goes to the previous warning/error. 230 | - `l` goes to the next warning/error. 231 | - `q` toggles the quickfix window. 232 | - `e` toggles the location list window. 233 | 234 | ### Tools 235 | - Normal mode 236 | - `` opens, focuses or closes NERDTree. 237 | - `` opens, focuses or closes Tagbar. 238 | - `` opens the menu of `:Files` (FZF). 239 | - `` opens the menu of `:Buffers` (FZF). 240 | - `uh` opens the menu of `:History` (FZF). 241 | - `ul` opens the menu of `:BLines` (FZF). 242 | - `ut` opens the menu of `:Tags` (FZF). 243 | - `uu` opens the menu of `:BTags` (FZF). 244 | - `uf` opens the menu of `:BTags`, filter functions (FZF). 245 | - `uv` opens the menu of `:BTags`, filter variables (FZF). 246 | - `ii` runs a script and previews it in a split window. 247 | - `ij` runs a script into a tmux window. 248 | - `ia` adds/changes the path of a database. 249 | - `ii` executes SQL (Sqlite3) and previews it in a split window. 250 | - `ii` executes Maxima and previews it in a split window. 251 | - `ii` converts LaTeX to PDF and previews it with Mupdf. 252 | - `ii` converts MD to PDF and previews it with Mupdf. 253 | - `ih` converts MD to HTML and previews it with Mupdf. 254 | - `ij` converts MD to EPUB and previews it with Mupdf. 255 | - `ii` converts UML (PlantUML) to PNG and previews it with Mupdf. 256 | - `ii` converts EUK (Eukleides) to PNG and previews it with Mupdf. 257 | - `ii` converts ASY (Asymptote) to PNG and previews it with Mupdf. 258 | - `ii` converts PP3 (Sky charts) to PNG and previews it with Mupdf. 259 | - `ii` converts PLT (Gnuplot) to PNG and previews it with Mupdf. 260 | - `ii` renders POV (POV-Ray) to PNG and previews it with Mupdf. 261 | - `ii` runs/stops bundle in the background, for liquid files. 262 | - `ij` previews the current post (MD file) in the web browser. 263 | - `cc` gets the keyword density of a text. 264 | - `B` shows syntax highlighting groups. 265 | - `U` toggles the plugin Undotree. 266 | - `W` inits ArgWrap plugin. 267 | - `ww` opens the personal vimwiki. 268 | - `we` toggles the status of a vimwiki list item. 269 | - `gll` increases indentation level of a vimwiki list item. 270 | - `glh` decreases indentation level of a vimwiki list item. 271 | - `gl` opens the URL under the cursor in a web browser. 272 | - `gi` inits the plugin EasyAlign. 273 | 274 | - Visual mode 275 | - `x` inits tabularize plugin. 276 | - `X` inits tabularize plugin (only the first match). 277 | 278 | - FZF plugin (customized) 279 | - `` hides the window preview (into FZF). 280 | 281 | ### Terminal 282 | - Terminal mode 283 | - `` returns to the last window (Neovim). 284 | - `t` returns to the last window (Vim). 285 | 286 | ### Commands 287 | - Command mode 288 | - `:WW` save the current buffer with sudo permissions. 289 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Gerard Bajona 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vim configuration 2 | Gerard's **Vim** & **Neovim** configuration. 3 | 4 | This Vim configuration is purely subjective. The goal of it is to get comfortable while programming. 5 | 6 | ## General settings: 7 | 8 | The `` key is ",": it's enabled only in 'Normal mode' to avoid the delay time when typing it from 'Insert mode'. The map `` is used as `` from any mode. Three cursor shapes (block, vertical and horizontal) are defined for Vim and Neovim for the terminals URxvt and XTerm (even into tmux); it also works in the last versions of gnome-terminal, terminator, termite and st. Default encoding is UTF-8. Color support: 256 colors for Vim and Neovim. 9 | 10 | Navigate easily: between buffers, tabs, windows and tmux panes; between syntax warnings and errors (it populates location-list); between misspelled words, where you can cycle between Catalan, English and Spanish dictionaries; between highlighted search results, where you can grep the highlight in the current buffer, all files from the current directory and subdirectories, the arglist and even between the old git commits, or use the internal vimgrep (grep and vimgrep populate the Quickfix and display the total matches); between GitGutter hunks; between git history (using the plugins vim-fugitive and FZF); between tags of source code files with tagbar. 11 | 12 | Easily highlight the word under the cursor or the current selection. A lot of commands have been defined to work with the highlighted text: the mentioned grep and vimgrep, and replace. Also, you can search and replace into the visual selection only. 13 | 14 | Some useful tools have been integrated. Plugins: **FZF** (navigate between files, open buffers, git commits, git files, lines, history, etc), **NERDTree** (tree files with filesystem operations), **vim-fugitive** (git commands), **undotree** (history visualizer), **ALE** (async syntax linter), **deoplete** (autocompletion for Vim and Neovim), **neosnippet** (code snippets), **Vimwiki** (organize notes, manage todo-lists...) and manage sessions with **vim-session**. 15 | 16 | Additionally, run scripting code (Bash, Perl, Ruby, Python, Lua, PHP and JavaScript) into a separate **tmux** window or simply preview the output in the preview window, where you can also preview SQL queries from **Sqlite** databases and **Maxima** operations (symbolic maths) from a MAX file. Preview the output of any shell command using the command `:Commander`. 17 | 18 | Instant preview with MuPDF (PNG, HTML and EPUB) and Zathura (PDF) after making the following conversions: 19 | 20 | - MD to PDF, EPUB and HTML using pandoc, with math support. 21 | - TEX to PDF using pdflatex. 22 | - UML to PNG using PlantUML (UML diagrams). 23 | - DOT to PNG using Graphviz (graph drawing tools). 24 | - EUK to PNG using Eukleides and Convert (elementary plane geometry). 25 | - ASY to PNG using Asymptote and Convert (vector graphics language). 26 | - PP3 to PNG using pp3 (Sky charts) and Convert (vector graphics language). 27 | - PLT to PNG using Gnuplot (2D and 3D graphics). 28 | - POV to PNG using POV-Ray (3D ray tracer). 29 | 30 | This configuration is focused on programming in C/C++, Go, Rust, Haskell, Perl, Python, Ruby, PHP, Bash, JavaScript, Liquid (Jekyll) and web development in general, with HTML5 and CSS3. It's also a good configuration to write technical and academic papers with LaTeX and markdown. 31 | 32 | **More specific information:** 33 | - [Keymaps](https://github.com/gerardbm/vimrc/blob/master/KEYMAPS.md) 34 | - [Changelog](https://github.com/gerardbm/vimrc/blob/master/CHANGELOG.md) 35 | 36 | ## List of plugins: 37 | - Statusbar: 38 | - [vim-airline](https://github.com/vim-airline/vim-airline) 39 | - [vim-airline-themes](https://github.com/vim-airline/vim-airline-themes) 40 | 41 | - Git tools: 42 | - [vim-gitgutter](https://github.com/airblade/vim-gitgutter) 43 | - [vim-fugitive](https://github.com/tpope/vim-fugitive) 44 | 45 | 46 | - Sessions: 47 | - [vim-session](https://github.com/xolox/vim-session) 48 | - [vim-misc](https://github.com/xolox/vim-misc) 49 | 50 | - Tools: 51 | - [nerdcommenter](https://github.com/scrooloose/nerdcommenter) 52 | - [nerdtree](https://github.com/scrooloose/nerdtree) 53 | - [listtoggle](https://github.com/valloric/listtoggle) 54 | - [tagbar](https://github.com/majutsushi/tagbar) 55 | - [undotree](https://github.com/mbbill/undotree) 56 | - [colorizer](https://github.com/chrisbra/colorizer) 57 | - [ale](https://github.com/w0rp/ale) 58 | - [fzf](https://github.com/junegunn/fzf.vim) 59 | 60 | 61 | - Specific for Vim and Deoplete: 62 | - [nvim-yarp](https://github.com/roxma/nvim-yarp) 63 | - [vim-hug-neovim-rpc](https://github.com/roxma/vim-hug-neovim-rpc) 64 | 65 | - Autocomplete: 66 | - [deoplete](https://github.com/Shougo/deoplete) 67 | - [neosnippet.vim](https://github.com/Shougo/neosnippet.vim) 68 | - [neosnippet-snippets](https://github.com/Shougo/neosnippet-snippets) 69 | - [context_filetype.vim](https://github.com/Shougo/context_filetype.vim) 70 | - [supertab](https://github.com/ervandew/supertab) 71 | 72 | - C/C++ support 73 | - [deoplete-clang](https://github.com/deoplete-plugins/deoplete-clang) 74 | 75 | - Go support 76 | - [vim-go](https://github.com/fatih/vim-go) 77 | - [gocode](https://github.com/nsf/gocode) 78 | - [deoplete-go](https://github.com/zchee/deoplete-go) 79 | 80 | - Perl support 81 | - [perlomni.vim](https://github.com/c9s/perlomni.vim) 82 | 83 | - Python support 84 | - [deoplete-jedi](https://github.com/deoplete-plugins/deoplete-jedi) 85 | 86 | - Ruby support 87 | - [vim-ruby](https://github.com/vim-ruby/vim-ruby) 88 | - [vim-rails](https://github.com/tpope/vim-rails) 89 | - [vim-endwise](https://github.com/tpope/vim-endwise) 90 | - [vim-liquid](https://github.com/tpope/vim-liquid) 91 | 92 | - PHP support 93 | - [phpcomplete.vim](https://github.com/shawncplus/phpcomplete.vim) 94 | 95 | - Haskell support 96 | - [neco-ghc](https://github.com/eagletmt/neco-ghc) 97 | 98 | - Rust support 99 | - [vim-racer](https://github.com/racer-rust/vim-racer) 100 | 101 | - Zsh support 102 | - [deoplete-zsh](https://github.com/deoplete-plugins/deoplete-zsh) 103 | 104 | - JavaScript support 105 | - [tern_for_vim](https://github.com/ternjs/tern_for_vim) 106 | - [deoplete-ternjs](https://github.com/carlitux/deoplete-ternjs) 107 | - [jspc.vim](https://github.com/othree/jspc.vim) 108 | - [vim-jsbeautify](https://github.com/maksimr/vim-jsbeautify) 109 | 110 | - VimL support 111 | - [neco-vim](https://github.com/Shougo/neco-vim) 112 | 113 | - Additional syntax files: 114 | - [html5.vim](https://github.com/othree/html5.vim) 115 | - [css-syntax.vim](https://github.com/vim-language-dept/css-syntax.vim) 116 | - [vim-css3-syntax](https://github.com/hail2u/vim-css3-syntax) 117 | - [vim-javascript](https://github.com/pangloss/vim-javascript) 118 | - [neco-syntax](https://github.com/Shougo/neco-syntax) 119 | - [i3config.vim](https://github.com/mboughaba/i3config.vim) 120 | - [plantuml-syntax](https://github.com/aklt/plantuml-syntax) 121 | - [asy.vim](https://github.com/gerardbm/asy.vim) 122 | - [eukleides.vim](https://github.com/gerardbm/eukleides.vim) 123 | - [vim-rec](https://github.com/zaid/vim-rec) 124 | - [vim-openscad](https://github.com/sirtaj/vim-openscad) 125 | 126 | - Edition: 127 | - [vim-easy-align](https://github.com/junegunn/vim-easy-align) 128 | - [tabular](https://github.com/godlygeek/tabular) 129 | - [auto-pairs](https://github.com/jiangmiao/auto-pairs) 130 | - [vim-closetag](https://github.com/alvan/vim-closetag) 131 | - [vim-surround](https://github.com/tpope/vim-surround) 132 | - [vim-repeat](https://github.com/tpope/vim-repeat) 133 | - [vim-capslock](https://github.com/tpope/vim-capslock) 134 | - [targets.vim](https://github.com/wellle/targets.vim) 135 | - [vim-sort-motion](https://github.com/christoomey/vim-sort-motion) 136 | - [vim-expand-region](https://github.com/terryma/vim-expand-region) 137 | - [MatchTagAlways](https://github.com/Valloric/MatchTagAlways) 138 | - [vim-argwrap](https://github.com/FooSoft/vim-argwrap) 139 | - [vim-md-headings](https://github.com/gerardbm/vim-md-headings) 140 | - [vim-md-checkbox](https://github.com/gerardbm/vim-md-checkbox) 141 | - [vim-move](https://github.com/gerardbm/vim-move) 142 | 143 | - Misc: 144 | - [christoomey/vim-tmux-navigator](https://github.com/christoomey/vim-tmux-navigator) 145 | - [vim-characterize](https://github.com/tpope/vim-characterize) 146 | - [open-browser.vim](https://github.com/tyru/open-browser.vim) 147 | - [goyo.vim](https://github.com/junegunn/goyo.vim) 148 | - [webapi-vim](https://github.com/mattn/webapi-vim) 149 | - [emmet-vim](https://github.com/mattn/emmet-vim) 150 | - [vimwiki](https://github.com/vimwiki/vimwiki) 151 | 152 | - Color schemes: 153 | - [vim-atomic](https://github.com/gerardbm/vim-atomic) 154 | 155 | Read the [code](https://github.com/gerardbm/vimrc/blob/master/vim/.vimrc) directly to know more details. 156 | 157 | ## Screenshot 158 | 159 | ![Screenshot](https://raw.githubusercontent.com/gerardbm/vimrc/master/img/vimrc.png) 160 | -------------------------------------------------------------------------------- /img/vimrc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gerardbm/vimrc/40142faa9aa7783955244b964815348cbdfddb6e/img/vimrc.png -------------------------------------------------------------------------------- /nvim/.config/nvim/init.vim: -------------------------------------------------------------------------------- 1 | set runtimepath^=~/.vim runtimepath+=~/.vim/after 2 | let &packpath=&runtimepath 3 | source ~/.vimrc 4 | -------------------------------------------------------------------------------- /vim/.gvimrc: -------------------------------------------------------------------------------- 1 | " Hide menus 2 | set guioptions-=T 3 | set guioptions-=r 4 | set guioptions-=l 5 | set guioptions-=L 6 | set guioptions-=R 7 | 8 | " Only remove menubar on non-windows platforms. 9 | " The windows version looks a bit like ass without it, 10 | " somehow, it develops ugly white borders around 11 | " the bottom frame, I have no clue where they come from. 12 | if !has("gui_win32") 13 | set guioptions-=m 14 | endif 15 | 16 | " Add Vim icon to window, where it is shown depends on platform, windowing 17 | " system, X11 server depth, etc etc. 18 | set guioptions+=i 19 | 20 | " Automagically yank to windowing system clipboard on visual select. 21 | " This makes gvim behave like a normal unix application. 22 | set guioptions+=a 23 | 24 | " Typography 25 | if has("gui_gtk2") || has("gui_gtk3") 26 | set guifont=Terminess\ Powerline\ 13 27 | elseif has("gui_macvim") 28 | set guifont=Menlo\ Regular:h14 29 | elseif has("gui_win32") 30 | set guifont=Consolas:h11:cANSI 31 | endif 32 | 33 | " Toggle fullscreen 34 | " - Don't need it anymore; i3wm does it (Super+f). 35 | " map :call system("wmctrl -ir " . v:windowid . " -b toggle,fullscreen") 36 | 37 | " Set initial window size 38 | " set lines=36 columns=144 39 | 40 | " Disable mouse 41 | " set mouse=c 42 | 43 | " Colorscheme settings 44 | " It is required to use the Atomic Color Scheme 45 | " Source: https://github.com/gerardbm/vim-atomic 46 | " function! AtomicSwitcher() 47 | " if (strftime('%H') > 8) && (strftime('%H') < 20) 48 | " AtomicSpaceMC 49 | " else 50 | " AtomicNightHC 51 | " endif 52 | " endfunction 53 | 54 | " call AtomicSwitcher() 55 | 56 | AtomicSpaceMC 57 | 58 | " Shortcuts 59 | nnoremap :call CycleModes():colorscheme atomic 60 | nnoremap 1 :AtomicSpaceHC 61 | nnoremap 2 :AtomicSpaceMC 62 | nnoremap 3 :AtomicSpaceLC 63 | nnoremap 4 :AtomicNightHC 64 | nnoremap 5 :AtomicNightMC 65 | nnoremap 6 :AtomicNightLC 66 | nnoremap 7 :AtomicLightHC 67 | nnoremap 8 :AtomicLightMC 68 | nnoremap 9 :AtomicLightLC 69 | nnoremap :AtomicOnionHC 70 | nnoremap :AtomicOnionMC 71 | nnoremap :AtomicOnionLC 72 | nnoremap :AtomicBloodHC 73 | nnoremap :AtomicBloodMC 74 | nnoremap :AtomicBloodLC 75 | nnoremap :AtomicGrassHC 76 | nnoremap :AtomicGrassMC 77 | nnoremap :AtomicGrassLC 78 | nnoremap :AtomicOceanHC 79 | nnoremap :AtomicOceanMC 80 | nnoremap :AtomicOceanLC 81 | 82 | " Paste ('p') from the clipboard 83 | set clipboard=unnamedplus 84 | -------------------------------------------------------------------------------- /vim/.vim/after/syntax/c.vim: -------------------------------------------------------------------------------- 1 | syn match cFunction "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2 2 | syn match cFunction "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1 3 | 4 | hi cFunction ctermfg=12 5 | -------------------------------------------------------------------------------- /vim/.vim/after/syntax/css.vim: -------------------------------------------------------------------------------- 1 | syn match VendorPrefix /-\(moz\|webkit\|o\|ms\)-[a-zA-Z-]\+/ containedin=cssDefinition 2 | 3 | hi VendorPrefix ctermfg=3 cterm=italic 4 | -------------------------------------------------------------------------------- /vim/.vim/after/syntax/csv.vim: -------------------------------------------------------------------------------- 1 | if exists('b:current_syntax') 2 | finish 3 | endif 4 | 5 | let s:del_def = ',' 6 | let s:del = '\%(' . s:del_def . '\|$\)' 7 | let s:del_noend = '\%(' . s:del_def . '\)' 8 | let s:col = 9 | \ '\%(\%(\%(' . (s:del_def !~# '\s' ? '\s*' : '') . 10 | \ '"\%(' . (exists("g:csv_nl") ? '\_' : '' ) . 11 | \ '[^"]\|""\)*"\s*\)' . s:del . '\)\|\%(' . 12 | \ '[^' . s:del_def . ']*' . s:del . '\)\)' 13 | let s:col_end = '\%(\%(\%(' . (s:del_def !~# '\s' ? '\s*' : '') . 14 | \ '"\%(' . (exists("g:csv_nl") ? '\_' : '' ) . 15 | \ '[^"]\|""\)*"\)' . s:del_noend . '\)\|\%(' . 16 | \ '[^' . s:del_def . ']*' . s:del_noend . '\)\)' 17 | let s:del = get(b:, 'delimiter', s:del_def) 18 | 19 | exe 'syn match CSVColumnEven nextgroup=CSVColumnOdd /' 20 | \ . s:col . '/ contains=CSVDelimiter' 21 | exe 'syn match CSVColumnOdd nextgroup=CSVColumnEven /' 22 | \ . s:col . '/ contains=CSVDelimiter' 23 | exe 'syn match CSVDelimiter /' . s:col_end . '/ms=e,me=e contained' 24 | 25 | hi def link CSVDelimiter Number 26 | hi def link CSVColumnOdd Define 27 | hi def link CSVColumnEven Keyword 28 | 29 | let b:current_syntax = 'csv' 30 | -------------------------------------------------------------------------------- /vim/.vim/after/syntax/html.vim: -------------------------------------------------------------------------------- 1 | syn match htmlEqual /=/ containedin=htmlTag 2 | 3 | hi htmlEqual ctermfg=15 4 | -------------------------------------------------------------------------------- /vim/.vim/after/syntax/markdown.vim: -------------------------------------------------------------------------------- 1 | " Links 2 | syn region markdownLinkText matchgroup=markdownLinkTextDelimiter 3 | \ start="!\=\[\%(\_[^]]*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" 4 | \ nextgroup=markdownLink,markdownId skipwhite 5 | \ contains=@markdownInline,markdownLineStart concealends 6 | syn region markdownLink matchgroup=markdownLinkDelimiter 7 | \ start="(" end=")" keepend contained conceal contains=markdownUrl 8 | syn cluster markdownInline add=@NoSpell 9 | 10 | " Code 11 | syn region markdownCode matchgroup=markdownCodeDelimiter 12 | \ start="`" end="`" concealends 13 | 14 | " Extended 15 | syn match markdownExt /{[.:#][^}]*}/ conceal 16 | 17 | " Error 18 | " syn match markdownError "\w\@<=_\w\@=" 19 | syn match markdownError "\w\@<=\w\@=" 20 | 21 | " Latex 22 | let b:current_syntax = '' 23 | unlet b:current_syntax 24 | syn include syntax/tex.vim 25 | syn region markdownTexBlock matchgroup=markdownTexMathDelimiter 26 | \ start='^\$\$' end='\$\$$' contains=@texMathZoneGroup 27 | syn match markdownTexLine '\$[^$].\{-}\$' contains=@texMathZoneGroup 28 | 29 | " Highlights 30 | hi markdownTexMathDelimiter ctermfg=13 31 | hi markdownTexBlock ctermfg=13 32 | hi markdownTexLine ctermfg=13 33 | hi markdownExt ctermfg=11 cterm=none 34 | -------------------------------------------------------------------------------- /vim/.vim/after/syntax/vim.vim: -------------------------------------------------------------------------------- 1 | syn keyword vimKeywords1 if endif containedin=vimFuncBody 2 | syn keyword vimKeywords2 try catch endtry containedin=vimFuncBody 3 | 4 | hi vimKeywords1 ctermfg=10 5 | hi vimKeywords2 ctermfg=9 6 | -------------------------------------------------------------------------------- /vim/.vimrc: -------------------------------------------------------------------------------- 1 | "---------------------------------------------------------------- 2 | " _ 3 | " _ __(_)___ ___ __________ 4 | " | | / / / __ `__ \/ ___/ ___/ 5 | " _| |/ / / / / / / / / / /__ 6 | " (_)___/_/_/ /_/ /_/_/ \___/ 7 | " 8 | "---------------------------------------------------------------- 9 | " Version : 2.9.9 10 | " License : MIT 11 | " Author : Gerard Bajona 12 | " URL : https://github.com/gerardbm/vimrc 13 | "---------------------------------------------------------------- 14 | " Index: 15 | " 1. General settings 16 | " 2. Plugins (Plug) 17 | " 3. Plugins settings 18 | " 4. User interface 19 | " 5. Scheme and colors 20 | " 6. Files and backup 21 | " 7. Buffers management 22 | " 8. Tabs management 23 | " 9. Multiple windows 24 | " 10. Indentation tabs 25 | " 11. Moving around lines 26 | " 12. Paste mode 27 | " 13. Search, vimgrep and grep 28 | " 14. Text edition 29 | " 15. Make settings 30 | " 16. Filetype settings 31 | " 17. Helper functions 32 | " 18. External tools integration 33 | "---------------------------------------------------------------- 34 | 35 | "---------------------------------------------------------------- 36 | " 1. General settings 37 | "---------------------------------------------------------------- 38 | " Disable vi compatibility 39 | if !has("nvim") 40 | set nocompatible 41 | endif 42 | 43 | " Reload .vimrc 44 | nnoremap :so $MYVIMRC 45 | 46 | " Enable local .vimrc config 47 | set exrc 48 | set secure 49 | 50 | " Lines of memory to remember 51 | set history=10000 52 | 53 | " Leader key to add extra key combinations 54 | let mapleader = ',' 55 | let g:mapleader = ',' 56 | 57 | " Time delay on key 58 | set timeoutlen=3000 ttimeoutlen=100 59 | 60 | " Update time 61 | set updatetime=250 62 | 63 | " Trigger InsertLeave autocmd 64 | inoremap 65 | 66 | " No need for Ex mode 67 | nnoremap Q 68 | 69 | " Open help in a vertical window 70 | cnoreabbrev help vert help 71 | 72 | " Terminal (nvim) 73 | if has("terminal") && has("nvim") 74 | nnoremap :call ToggleTerminal() 75 | tnoremap :wincmd p 76 | tnoremap 77 | endif 78 | 79 | " Set inc/dec 80 | set nrformats-=octal 81 | 82 | "---------------------------------------------------------------- 83 | " 2. Plugins (Plug) 84 | "---------------------------------------------------------------- 85 | " List of plugins installed 86 | call plug#begin('~/.vim/plugged') 87 | 88 | " Statusbar 89 | Plug 'vim-airline/vim-airline' 90 | Plug 'vim-airline/vim-airline-themes' 91 | 92 | " Git tools 93 | Plug 'airblade/vim-gitgutter' 94 | Plug 'tpope/vim-fugitive' 95 | 96 | " Sessions 97 | Plug 'xolox/vim-session' 98 | Plug 'xolox/vim-misc' 99 | 100 | " Tools 101 | Plug 'preservim/nerdcommenter', { 'commit': 'a5d1663' } 102 | Plug 'preservim/nerdtree' 103 | Plug 'valloric/listtoggle' 104 | Plug 'majutsushi/tagbar' 105 | Plug 'dense-analysis/ale' 106 | Plug 'junegunn/fzf' 107 | Plug 'junegunn/fzf.vim' 108 | 109 | " Deoplete, specific for Vim8 110 | if !has("nvim") 111 | Plug 'roxma/nvim-yarp' 112 | Plug 'roxma/vim-hug-neovim-rpc' 113 | endif 114 | 115 | " Autocomplete 116 | Plug 'Shougo/deoplete.nvim', { 'commit': '17ffeb9' } 117 | Plug 'Shougo/neosnippet.vim', { 'commit': '037b7a7' } 118 | Plug 'Shougo/neosnippet-snippets' 119 | Plug 'Shougo/context_filetype.vim', { 'commit': 'e276626' } 120 | Plug 'ervandew/supertab' 121 | 122 | " C/C++ support 123 | Plug 'deoplete-plugins/deoplete-clang', { 'commit': '30f17cb' } 124 | 125 | " Go support 126 | Plug 'fatih/vim-go', { 'tag': 'v1.19' } 127 | Plug 'nsf/gocode', { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' } 128 | Plug 'deoplete-plugins/deoplete-go', { 'commit': 'fa73f06'} 129 | 130 | " Perl support 131 | Plug 'c9s/perlomni.vim' 132 | 133 | " Python support 134 | Plug 'deoplete-plugins/deoplete-jedi', { 'commit': '46121d9' } 135 | 136 | " Ruby support 137 | Plug 'vim-ruby/vim-ruby' 138 | Plug 'tpope/vim-rails' 139 | Plug 'tpope/vim-endwise' 140 | Plug 'tpope/vim-liquid' 141 | 142 | " PHP support 143 | Plug 'shawncplus/phpcomplete.vim' 144 | 145 | " Haskell support 146 | Plug 'eagletmt/neco-ghc' 147 | 148 | " Rust support 149 | Plug 'racer-rust/vim-racer' 150 | 151 | " Zsh support 152 | Plug 'deoplete-plugins/deoplete-zsh', { 'commit': '12141ad' } 153 | 154 | " JavaScript support 155 | Plug 'ternjs/tern_for_vim', { 'do': 'npm install' } 156 | Plug 'carlitux/deoplete-ternjs', { 'do': 'npm install -g tern' } 157 | Plug 'othree/jspc.vim' 158 | Plug 'maksimr/vim-jsbeautify' 159 | 160 | " VimL support 161 | Plug 'Shougo/neco-vim', { 'commit' : '4c0203b' } 162 | 163 | " Additional syntax files 164 | Plug 'othree/html5.vim' 165 | Plug 'vim-language-dept/css-syntax.vim' 166 | Plug 'hail2u/vim-css3-syntax' 167 | Plug 'pangloss/vim-javascript' 168 | Plug 'Shougo/neco-syntax', { 'commit': '98cba4a' } 169 | Plug 'mboughaba/i3config.vim' 170 | Plug 'aklt/plantuml-syntax' 171 | Plug 'gerardbm/asy.vim' 172 | Plug 'gerardbm/eukleides.vim' 173 | Plug 'zaid/vim-rec' 174 | Plug 'sirtaj/vim-openscad' 175 | 176 | " Edition 177 | Plug 'junegunn/vim-easy-align' 178 | Plug 'godlygeek/tabular' 179 | Plug 'jiangmiao/auto-pairs' 180 | Plug 'alvan/vim-closetag' 181 | Plug 'tpope/vim-surround' 182 | Plug 'tpope/vim-repeat' 183 | Plug 'tpope/vim-capslock' 184 | Plug 'wellle/targets.vim' 185 | Plug 'christoomey/vim-sort-motion' 186 | Plug 'terryma/vim-expand-region' 187 | Plug 'Valloric/MatchTagAlways' 188 | Plug 'FooSoft/vim-argwrap' 189 | Plug 'gerardbm/vim-md-headings' 190 | Plug 'gerardbm/vim-md-checkbox' 191 | Plug 'matze/vim-move' 192 | 193 | " Misc 194 | Plug 'christoomey/vim-tmux-navigator' 195 | Plug 'tpope/vim-characterize' 196 | Plug 'tyru/open-browser.vim' 197 | Plug 'junegunn/goyo.vim' 198 | Plug 'mattn/webapi-vim' 199 | Plug 'mattn/emmet-vim' 200 | Plug 'vimwiki/vimwiki', { 'branch': 'master' } 201 | Plug 'mbbill/undotree' 202 | Plug 'chrisbra/colorizer' 203 | 204 | " Color schemes 205 | Plug 'gerardbm/vim-atomic' 206 | 207 | call plug#end() 208 | 209 | "---------------------------------------------------------------- 210 | " 3. Plugins settings 211 | "---------------------------------------------------------------- 212 | " --- Statusbar --- 213 | " Airline settings 214 | let g:airline_theme = 'atomic' 215 | let g:airline_powerline_fonts = 1 216 | let g:airline#extensions#tabline#enabled = 1 217 | let g:airline#extensions#tabline#fnamemod = ':t' 218 | let g:airline_section_z = airline#section#create([ 219 | \ '%1p%% ', 220 | \ 'Ξ%l%', 221 | \ '\⍿%c']) 222 | call airline#parts#define_accent('mode', 'black') 223 | 224 | " --- Git tools --- 225 | " Gitgutter settings 226 | let g:gitgutter_max_signs = 5000 227 | let g:gitgutter_sign_added = '+' 228 | let g:gitgutter_sign_modified = '»' 229 | let g:gitgutter_sign_removed = '_' 230 | let g:gitgutter_sign_modified_removed = '»╌' 231 | let g:gitgutter_map_keys = 0 232 | let g:gitgutter_diff_args = '--ignore-space-at-eol' 233 | 234 | nmap j (GitGutterNextHunk)zz 235 | nmap k (GitGutterPrevHunk)zz 236 | nnoremap :call ToggleGGPrev()zz 237 | nnoremap ga :GitGutterStageHunk 238 | nnoremap gu :GitGutterUndoHunk 239 | 240 | " Fugitive settings 241 | nnoremap :call ToggleGstatus() 242 | nnoremap gv :Gvdiffsplit:windo set wrap 243 | nnoremap gh :Gvdiffsplit HEAD:windo set wrap 244 | nnoremap gb :Git blame 245 | 246 | " Searching for text added or removed by a commit 247 | nnoremap gg :call GrepWrapper('Gclog', '-i -G', '--') 248 | 249 | " --- Sessions --- 250 | " Vim-session settings 251 | let g:session_autosave = 'no' 252 | let g:session_autoload = 'no' 253 | let g:session_directory = '~/.vim/sessions/' 254 | 255 | " --- Tools --- 256 | " NERDCommenter settings 257 | let g:NERDDefaultAlign = 'left' 258 | let g:NERDSpaceDelims = 1 259 | let g:NERDCompactSexyComs = 1 260 | let g:NERDCommentEmptyLines = 0 261 | let g:NERDCreateDefaultMappings = 0 262 | let g:NERDCustomDelimiters = { 263 | \ 'python': {'left': '#'}, 264 | \ } 265 | 266 | nnoremap cc :call NERDComment(0,'toggle') 267 | vnoremap cc :call NERDComment(0,'toggle') 268 | 269 | " NERDTree settings 270 | nnoremap :call ToggleNERDTree() 271 | 272 | " ALE settings 273 | let g:ale_linters = { 274 | \ 'c' : ['clang'], 275 | \ 'vim' : ['vint'], 276 | \ 'python' : ['pylint'], 277 | \ 'javascript' : ['jshint'], 278 | \ 'css' : ['csslint'], 279 | \ 'tex' : ['chktex'], 280 | \ } 281 | 282 | let g:ale_linters_ignore = { 283 | \ 'markdown' : ['proselint'], 284 | \ 'vimwiki' : ['proselint'], 285 | \} 286 | 287 | let g:ale_sign_error='✗' 288 | let g:ale_sign_warning='•' 289 | let g:ale_sign_info='ℹ' 290 | 291 | " FZF settings 292 | let $FZF_DEFAULT_COMMAND = "ag --hidden --ignore .git -p ~/.gitignore -g ''" 293 | let $FZF_PREVIEW_COMMAND = 'cat {}' 294 | let g:fzf_preview_window = ['right', 'ctrl-i'] 295 | nnoremap :Files 296 | nnoremap :Buffers 297 | nnoremap gz :Commits 298 | nnoremap uh :History 299 | nnoremap ul :BLines 300 | nnoremap ut :Tags 301 | nnoremap uu :BTags 302 | nnoremap uf 303 | \ :call fzf#vim#buffer_tags('', 304 | \ { 'options': ['--nth', '..-2,-1', '--query', '^f$ '] }) 305 | nnoremap uv 306 | \ :call fzf#vim#buffer_tags('', 307 | \ { 'options': ['--nth', '..-2,-1', '--query', '^v$ '] }) 308 | 309 | " Navigate between errors 310 | nnoremap h :lpreviouszz 311 | nnoremap l :lnextzz 312 | 313 | " Listtoggle settings 314 | let g:lt_location_list_toggle_map = 'e' 315 | let g:lt_quickfix_list_toggle_map = 'q' 316 | 317 | " Tagbar toggle (custom function) 318 | nnoremap :call ToggleTagbar() 319 | let g:tagbar_autofocus = 1 320 | let g:tagbar_show_linenumbers = 2 321 | let g:tagbar_sort = 0 322 | 323 | " Undotree toggle 324 | nnoremap U :UndotreeToggle 325 | 326 | " --- Languages --- 327 | " Go settings 328 | let g:go_highlight_functions = 1 329 | let g:go_highlight_methods = 1 330 | let g:go_highlight_fields = 1 331 | let g:go_highlight_types = 1 332 | let g:go_highlight_operators = 1 333 | let g:go_highlight_build_constraints = 1 334 | let g:go_bin_path = expand('~/.gotools') 335 | let g:go_list_type = 'quickfix' 336 | let g:go_version_warning = 0 " Keep until vim v8.0.1453, nvim v3.2 337 | 338 | " CSS3 settings 339 | augroup VimCSS3Syntax 340 | autocmd! 341 | autocmd FileType css setlocal iskeyword+=- 342 | augroup END 343 | 344 | " Javascript settings 345 | let g:javascript_plugin_jsdoc = 1 346 | let g:javascript_plugin_ngdoc = 1 347 | let g:javascript_plugin_flow = 1 348 | 349 | " Tern_for_vim settings 350 | let g:tern#command = ['tern'] 351 | let g:tern#arguments = ['--persistent'] 352 | 353 | " JS-Beautify 354 | let g:config_Beautifier = {} 355 | let g:config_Beautifier['js'] = {} 356 | let g:config_Beautifier['js'].indent_style = 'tab' 357 | let g:config_Beautifier['jsx'] = {} 358 | let g:config_Beautifier['jsx'].indent_style = 'tab' 359 | let g:config_Beautifier['json'] = {} 360 | let g:config_Beautifier['json'].indent_style = 'tab' 361 | let g:config_Beautifier['css'] = {} 362 | let g:config_Beautifier['css'].indent_style = 'tab' 363 | let g:config_Beautifier['html'] = {} 364 | let g:config_Beautifier['html'].indent_style = 'tab' 365 | 366 | augroup beautify 367 | autocmd! 368 | autocmd FileType javascript nnoremap bf :call JsBeautify() 369 | autocmd FileType javascript vnoremap bf :call RangeJsBeautify() 370 | autocmd FileType json nnoremap bf :call JsonBeautify() 371 | autocmd FileType json vnoremap bf :call RangeJsonBeautify() 372 | autocmd FileType jsx nnoremap bf :call JsxBeautify() 373 | autocmd FileType jsx vnoremap bf :call RangeJsxBeautify() 374 | autocmd FileType html nnoremap bf :call HtmlBeautify() 375 | autocmd FileType html vnoremap bf :call RangeHtmlBeautify() 376 | autocmd FileType css nnoremap bf :call CSSBeautify() 377 | autocmd FileType css vnoremap bf :call RangeCSSBeautify() 378 | augroup end 379 | 380 | " --- Autocomplete --- 381 | " SuperTab settings 382 | let g:SuperTabDefaultCompletionType = '' 383 | 384 | " Deoplete settings 385 | " - «Deoplete requires Neovim with Python3 enabled» 386 | let g:python3_host_prog = '/usr/bin/python3' 387 | let g:python3_host_skip_check = 1 388 | 389 | autocmd CompleteDone * if pumvisible() == 0 | pclose | endif 390 | let g:deoplete#enable_at_startup = 1 391 | let g:deoplete#enable_smart_case = 1 392 | let g:deoplete#omni#functions = {} 393 | call deoplete#custom#option('auto_complete_delay', 250) 394 | 395 | inoremap pumvisible() ? "\" : "\" 396 | 397 | " Python autocompletion 398 | let g:deoplete#sources#jedi#show_docstring = 1 399 | 400 | " Go autocompletion 401 | let g:deoplete#sources#go#gocode_binary = $GOPATH.'/bin/gocode' 402 | let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const'] 403 | let g:deoplete#sources#go#use_cache = 1 404 | 405 | " Javascript autocompletion 406 | let g:deoplete#omni#functions.javascript = [ 407 | \ 'tern#Complete', 408 | \ 'jspc#omni', 409 | \ ] 410 | 411 | " Clang autocompletion 412 | let g:deoplete#sources#clang#libclang_path = '/usr/lib/llvm-4.0/lib/libclang.so' 413 | let g:deoplete#sources#clang#clang_header = '/usr/lib/clang' 414 | 415 | " --- Snippets --- 416 | " Neosnippet settings 417 | imap (neosnippet_expand_or_jump) 418 | smap (neosnippet_expand_or_jump) 419 | xmap (neosnippet_expand_target) 420 | 421 | " Behaviour like SuperTab 422 | smap 423 | \ neosnippet#expandable_or_jumpable() ? 424 | \ "\(neosnippet_expand_or_jump)" : "\" 425 | 426 | " For conceal markers 427 | if has('conceal') 428 | set conceallevel=0 concealcursor=niv 429 | nnoremap coi :set conceallevel=0:set concealcursor=niv 430 | nnoremap coo :set conceallevel=2:set concealcursor=vc 431 | nnoremap cop :set conceallevel=2:set concealcursor=niv 432 | nnoremap com :set conceallevel=3:set concealcursor=niv 433 | endif 434 | 435 | augroup all 436 | autocmd InsertLeave * NeoSnippetClearMarkers 437 | augroup end 438 | 439 | " --- Edition --- 440 | " Easy align settings 441 | xmap gi (EasyAlign) 442 | nmap gi (EasyAlign) 443 | 444 | " Tabularize (e.g. /= or /:) 445 | vnoremap x :Tabularize / 446 | 447 | " Tabularize only the first match on the line (e.g. /=.*/) 448 | vnoremap X :Tabularize /.*/ 449 | 450 | " Auto-pairs settings 451 | " Maps for normal and insert modes 452 | let g:AutoPairsFlyMode = 0 453 | let g:AutoPairsMultilineClose = 0 454 | let g:AutoPairsShortcutJump = '' 455 | let g:AutoPairsShortcutToggle = '' 456 | 457 | " Workaround to fix an Auto-pairs bug until it gets fixed 458 | if has("nvim") 459 | autocmd VimEnter,BufEnter,BufWinEnter * silent! iunmap 460 | endif 461 | 462 | " Closetag settings 463 | let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.xml,*.html.erb,*.md' 464 | 465 | " Surround settings 466 | " Use 'yss?', 'yss%' or 'yss=' to surround a line 467 | autocmd FileType php let b:surround_{char2nr('p')} = "" 468 | autocmd FileType erb let b:surround_{char2nr('=')} = "<%= \r %>" 469 | autocmd FileType erb let b:surround_{char2nr('-')} = "<% \r %>" 470 | autocmd FileType html,markdown,liquid let b:surround_{char2nr('p')} = "{% \r %}" 471 | autocmd FileType markdown,liquid let b:surround_{char2nr('i')} = "_\r_" 472 | autocmd FileType markdown,liquid let b:surround_{char2nr('o')} = "**\r**" 473 | autocmd FileType markdown,liquid let b:surround_{char2nr('x')} = "«\r»" 474 | autocmd FileType markdown,liquid let b:surround_{char2nr('h')} = "\[\r\]\(//\)" 475 | autocmd FileType markdown,liquid let b:surround_{char2nr('j')} = "!\[\r\] 476 | \\(/images/\){: .align-}" 477 | autocmd FileType markdown,liquid let b:surround_{char2nr('e')} = "\[\r\] 478 | \\(\){:rel=\"noopener noreferrer\" target=\"_blank\"}" 479 | autocmd FileType markdown,liquid let b:surround_{char2nr('y')} = "\r<\/a>" 481 | 482 | " Caps Lock settings 483 | imap deoplete#smart_close_popup()."\CapsLockToggle" 484 | cmap CapsLockToggle 485 | 486 | " Expand region settings 487 | vmap v (expand_region_expand) 488 | vmap m (expand_region_shrink) 489 | 490 | " MatchTagAlways settings 491 | let g:mta_filetypes = { 492 | \ 'html' : 1, 493 | \ 'xhtml' : 1, 494 | \ 'xml' : 1, 495 | \ 'jinja' : 1, 496 | \ 'php' : 1, 497 | \ } 498 | 499 | " ArgWrap settings 500 | let g:argwrap_tail_comma = 1 501 | let g:argwrap_padded_braces = '[{' 502 | 503 | nnoremap W :ArgWrap 504 | 505 | " Vim-move settings. Use Shift 506 | let g:move_key_modifier = 'S' 507 | let g:move_key_modifier_visualmode = 'S' 508 | 509 | " --- Misc --- 510 | " Vim-tmux navigator settings 511 | let g:tmux_navigator_no_mappings = 1 512 | 513 | " Open-browser settings 514 | let g:openbrowser_browser_commands = [{ 515 | \ 'name': 'w3m', 516 | \ 'args': 'tmux new-window w3m {uri}', 517 | \ }] 518 | 519 | nmap gl (openbrowser-open) 520 | 521 | " Goyo settings 522 | let g:goyo_width = "80" 523 | let g:goyo_height = "100%" 524 | let g:goyo_linenr = 1 525 | 526 | nnoremap :Goyo 527 | 528 | " Vimwiki settings 529 | let g:vimwiki_url_maxsave = 0 530 | let g:vimwiki_global_ext = 0 531 | let g:vimwiki_syntax = 'markdown' 532 | let g:vimwiki_list = [ 533 | \ {'path': '~/Workspace/vimwiki'}, 534 | \ {'path': '~/Workspace/vimwiki/Articles'}, 535 | \ {'path': '~/Workspace/vimwiki/Codes'}, 536 | \ {'path': '~/Workspace/vimwiki/Notes'}, 537 | \ {'path': '~/Workspace/vimwiki/Projects'}, 538 | \ {'path': '~/Workspace/vimwiki/Studies'}, 539 | \ {'path': '~/Workspace/vimwiki/ToDos'}, 540 | \ {'path': '~/Workspace/vimwiki/Unix'} 541 | \ ] 542 | 543 | nnoremap we :VimwikiToggleListItem 544 | vnoremap we :VimwikiToggleListItem 545 | 546 | "---------------------------------------------------------------- 547 | " 4. User interface 548 | "---------------------------------------------------------------- 549 | " Set X lines to the cursor when moving vertically 550 | set scrolloff=0 551 | 552 | " Always show mode 553 | set showmode 554 | 555 | " Show command keys pressed 556 | set showcmd 557 | 558 | " Enable the WiLd menu 559 | set wildmenu 560 | 561 | " Show the current position 562 | set ruler 563 | 564 | " Command bar height 565 | set cmdheight=2 566 | 567 | " Backspace works on Insert mode 568 | set backspace=eol,start,indent 569 | 570 | " Don't redraw while executing macros (good performance config) 571 | set lazyredraw 572 | 573 | " Show matching brackets when text indicator is over them 574 | set showmatch 575 | 576 | " How many tenths of a second to blink when matching brackets 577 | set matchtime=2 578 | 579 | " No annoying sound on errors 580 | set noerrorbells 581 | set novisualbell 582 | 583 | if !has("nvim") 584 | set t_vb= 585 | 586 | " Terminal keycodes 587 | if &term =~ 'screen' 588 | set =[11~ 589 | set =[12~ 590 | set =[13~ 591 | set =[14~ 592 | set =[15~ 593 | set =[17~ 594 | set =[18~ 595 | set =[19~ 596 | set =[20~ 597 | set =[21~ 598 | set =[23~ 599 | set =[24~ 600 | set =[11;2~ 601 | set =[12;2~ 602 | set =[13;2~ 603 | set =[14;2~ 604 | set =[15;2~ 605 | set =[17;2~ 606 | set =[18;2~ 607 | set =[19;2~ 608 | set =[20;2~ 609 | set =[21;2~ 610 | set =[23;2~ 611 | set =[24;2~ 612 | endif 613 | endif 614 | 615 | " Mouse 616 | set mouse=a 617 | 618 | " Highlight cursor line and cursor column 619 | set cursorline 620 | set nocursorcolumn 621 | 622 | " Always show the status line 623 | set laststatus=2 624 | 625 | " Change the cursor shape 626 | if !has("nvim") 627 | if &term != "linux" 628 | let &t_SI = "\[6 q" 629 | let &t_SR = "\[4 q" 630 | let &t_EI = "\[2 q" 631 | endif 632 | else 633 | set guicursor=n-v:block-Cursor/lCursor-blinkon0 634 | set guicursor+=i-ci-c:ver100-Cursor/lCursor-blinkon0 635 | set guicursor+=r-cr:hor100-Cursor/lCursor-blinkon0 636 | endif 637 | 638 | " Omni completion 639 | if has('autocmd') && exists('+omnifunc') 640 | autocmd Filetype * 641 | \ if &omnifunc == "" | 642 | \ setlocal omnifunc=syntaxcomplete#Complete | 643 | \ endif 644 | endif 645 | 646 | " Fix italics issue 647 | if !has("nvim") 648 | let &t_ZH="\e[3m" 649 | let &t_ZR="\e[23m" 650 | endif 651 | 652 | "---------------------------------------------------------------- 653 | " 5. Scheme and colors 654 | "---------------------------------------------------------------- 655 | " True color 656 | " if !has("nvim") 657 | " if has("termguicolors") 658 | " let &t_8f = "\[38;2;%lu;%lu;%lum" 659 | " let &t_8b = "\[48;2;%lu;%lu;%lum" 660 | " set termguicolors 661 | " endif 662 | " else 663 | " set termguicolors 664 | " endif 665 | 666 | " Syntax highlighting 667 | syntax enable 668 | 669 | " Color scheme 670 | let g:atomic_matchparen = 0 671 | colorscheme atomic 672 | 673 | " Show syntax highlighting groups 674 | nnoremap B :call SynStack() 675 | 676 | "---------------------------------------------------------------- 677 | " 6. Files and backup 678 | "---------------------------------------------------------------- 679 | " Disable swap files 680 | set noswapfile 681 | 682 | " No backup (use Git instead) 683 | set nobackup 684 | 685 | " Prevents automatic write backup 686 | set nowritebackup 687 | 688 | " Use UTF-8 as default encoding 689 | set encoding=utf8 690 | 691 | " Use Unix as the standard file type 692 | set fileformats=unix,dos,mac 693 | 694 | " Autoread a file when it is changed from the outside 695 | set autoread 696 | 697 | " Reload a file when it is changed from the outside 698 | let g:f5msg = 'Buffer reloaded.' 699 | nnoremap :e:echo g:f5msg 700 | 701 | " Enable filetype plugins 702 | filetype plugin on 703 | filetype indent on 704 | 705 | " Allow us to use Ctrl-s and Ctrl-q as keybinds 706 | " Restore default behaviour when leaving Vim. 707 | if !has("nvim") 708 | silent !stty -ixon 709 | autocmd VimLeave * silent !stty ixon 710 | endif 711 | 712 | " Save the current buffer 713 | nnoremap s :update 714 | 715 | " Save all buffers 716 | nnoremap S :bufdo update 717 | 718 | " :W sudo saves the file 719 | " (useful for handling the permission-denied error) 720 | cnoremap WW w !sudo tee > /dev/null % 721 | 722 | " Rename file 723 | nnoremap :call RenameFile() 724 | 725 | " Work on buffer 726 | nnoremap yab :%y 727 | nnoremap dab :%d 728 | nnoremap vab ggVG 729 | 730 | "---------------------------------------------------------------- 731 | " 7. Buffers management 732 | "---------------------------------------------------------------- 733 | " Buffer hidden when it is abandoned 734 | set hidden 735 | 736 | " Close the current buffer 737 | nnoremap bd :call CustomCloseBuffer() 738 | 739 | " Move between buffers 740 | nnoremap :bprev 741 | nnoremap :bnext 742 | 743 | " Edit and explore buffers 744 | nnoremap bb :edit =expand("%:p:h")/ 745 | nnoremap bg :buffers:buffer 746 | 747 | " Copy the filepath to clipboard 748 | nnoremap by :let @+=expand("%:p") 749 | 750 | " Switch CWD to the directory of the current buffer 751 | nnoremap dd :lcd %:p:h:pwd 752 | 753 | " Switch CWD to git root directory 754 | nnoremap dg :call GitRoot() 755 | 756 | " Ignore case when autocompletes when browsing files 757 | set fileignorecase 758 | 759 | " Specify the behavior when switching between buffers 760 | try 761 | set switchbuf=useopen,usetab,newtab 762 | set showtabline=2 763 | catch 764 | endtry 765 | 766 | " Remember info about open buffers on close 767 | " set viminfo^=% 768 | 769 | "---------------------------------------------------------------- 770 | " 8. Tabs management 771 | "---------------------------------------------------------------- 772 | " Create and close tabs 773 | nnoremap td :tabclose 774 | nnoremap to :tabonly 775 | 776 | " Open a new tab with the current buffer's path 777 | " Useful when editing files in the same directory 778 | nnoremap tt :tabedit =expand("%:p:h")/ 779 | 780 | " Move tabs position 781 | nnoremap tr :execute 'silent! tabmove ' . (tabpagenr()-2) 782 | nnoremap ty :execute 'silent! tabmove ' . tabpagenr() 783 | 784 | "---------------------------------------------------------------- 785 | " 9. Multiple windows 786 | "---------------------------------------------------------------- 787 | " Remap wincmd 788 | map , 789 | 790 | set winminheight=0 791 | set winminwidth=0 792 | set splitbelow 793 | set splitright 794 | set fillchars+=stlnc:―,vert:│,fold:―,diff:― 795 | 796 | " Split windows 797 | map - :split 798 | map . :vsplit 799 | map j :close 800 | map x :q! 801 | map , = 802 | 803 | " Resize windows 804 | if bufwinnr(1) 805 | map + :resize +1 806 | map - :resize -1 807 | map < :vertical resize +1 808 | map > :vertical resize -1 809 | endif 810 | 811 | " Toggle resize window 812 | nnoremap f :call ToggleResize() 813 | 814 | " Last, previous and next window; and only one window 815 | nnoremap l :wincmd p:echo "Last window." 816 | nnoremap p :wincmd w:echo "Previous window." 817 | nnoremap n :wincmd W:echo "Next window." 818 | nnoremap o :wincmd o:echo "Only one window." 819 | 820 | " Move between Vim windows and Tmux panes 821 | " - It requires the corresponding configuration into Tmux. 822 | " - Check it at my .tmux.conf from my dotfiles repository. 823 | " - URL: https://github.com/gerardbm/dotfiles/blob/master/tmux/.tmux.conf 824 | " - Plugin required: https://github.com/christoomey/vim-tmux-navigator 825 | if !has("nvim") 826 | set =h 827 | set =j 828 | set =k 829 | set =l 830 | endif 831 | 832 | nnoremap :TmuxNavigateLeft 833 | nnoremap :TmuxNavigateDown 834 | nnoremap :TmuxNavigateUp 835 | nnoremap :TmuxNavigateRight 836 | 837 | " Remove the Windows ^M - when the encodings gets messed up 838 | noremap mmHmt:%s///ge'tzt`m 839 | 840 | " Close the preview window 841 | nnoremap . :pclose 842 | 843 | " Scroll the preview window 844 | if !has("nvim") 845 | set =d 846 | set =u 847 | endif 848 | 849 | nnoremap :wincmd P5:wincmd p 850 | nnoremap :wincmd P5:wincmd p 851 | 852 | "---------------------------------------------------------------- 853 | " 10. Indentation tabs 854 | "---------------------------------------------------------------- 855 | " Enable autoindent & smartindent 856 | set autoindent 857 | set smartindent 858 | 859 | " Use tabs, no spaces 860 | set noexpandtab 861 | 862 | " Be smart when using tabs 863 | set smarttab 864 | 865 | " Tab size (in spaces) 866 | set shiftwidth=2 867 | set tabstop=2 868 | 869 | " Remap indentation 870 | nnoremap >> 871 | nnoremap << 872 | 873 | vnoremap >gv 874 | vnoremap 877 | inoremap 878 | 879 | " Don't show tabs 880 | set list 881 | 882 | let g:f6msg = 'Toggle list.' 883 | nnoremap :set list!:echo g:f6msg 884 | 885 | " Show tabs and end-of-lines 886 | set listchars=tab:┊\ ,trail:¬ 887 | 888 | "---------------------------------------------------------------- 889 | " 11. Moving around lines 890 | "---------------------------------------------------------------- 891 | " Specify which commands wrap to another line 892 | set whichwrap+=<,>,h,l 893 | 894 | " Many jump commands move the cursor to the start of line 895 | set nostartofline 896 | 897 | " Wrap lines into the window 898 | set wrap 899 | 900 | " Don't break the words 901 | " Only works if I set nolist (F6) 902 | set linebreak 903 | set showbreak=↳\ 904 | 905 | " Stop automatic wrapping 906 | set textwidth=0 907 | 908 | " Column at 80 width 909 | set colorcolumn=80 910 | 911 | " Listings don't pause 912 | set nomore 913 | 914 | " Color column 915 | let g:f10msg = 'Toggle colorcolumn.' 916 | nnoremap :call ToggleColorColumn():echo g:f10msg 917 | 918 | " Show line numbers 919 | set number 920 | set numberwidth=2 921 | 922 | let g:f3msg = 'Toggle line numbers.' 923 | nnoremap :set number!:echo g:f3msg 924 | 925 | " Set relative line numbers 926 | set relativenumber 927 | 928 | let g:f4msg = 'Toggle relative line numbers.' 929 | nnoremap :set norelativenumber!:echo g:f4msg 930 | 931 | " Treat long lines as break lines (useful when moving around in them) 932 | nnoremap k (v:count == 0 ? 'gk' : 'k') 933 | nnoremap j (v:count == 0 ? 'gj' : 'j') 934 | 935 | vnoremap k (v:count == 0 ? 'gk' : 'k') 936 | vnoremap j (v:count == 0 ? 'gj' : 'j') 937 | 938 | nnoremap g^ 939 | nnoremap g$ 940 | 941 | vnoremap g^ 942 | vnoremap g$ 943 | 944 | " Toggle the cursor position start/end of the line 945 | nnoremap ñ :call ToggleCPosition('') 946 | vnoremap ñ :call ToggleCPosition('normal! gv') 947 | 948 | " Join / split lines 949 | nnoremap J 950 | nnoremap i 951 | 952 | " Duplicate a line 953 | nnoremap cx yyP 954 | nnoremap cv yyp 955 | 956 | " Folding 957 | set foldmethod=marker 958 | 959 | " Return to last edit position when opening files 960 | autocmd BufReadPost * 961 | \ if line("'\"") > 0 && line("'\"") <= line("$") | 962 | \ exe "normal! g`\"" | 963 | \ endif 964 | 965 | " --- Readline commands --- 966 | "---------------------------------------------------------------- 967 | " Move the cursor to the line start 968 | inoremap 0 969 | 970 | " Move the cursor to the line end 971 | inoremap $ 972 | 973 | " Moves the cursor back one character 974 | inoremap deoplete#smart_close_popup()."\" 975 | 976 | " Moves the cursor forward one character 977 | inoremap deoplete#smart_close_popup()."\" 978 | 979 | " Remove one character 980 | inoremap 981 | 982 | " Command Mode 983 | cnoremap 984 | cnoremap 985 | cnoremap 986 | cnoremap 987 | cnoremap 988 | cnoremap 989 | cnoremap 990 | cnoremap " 991 | cnoremap 992 | 993 | "---------------------------------------------------------------- 994 | " 12. Paste mode 995 | "---------------------------------------------------------------- 996 | " Bracketed paste mode 997 | " - Source: https://ttssh2.osdn.jp/manual/en/usage/tips/vim.html 998 | if !has("nvim") 999 | if has("patch-8.0.0238") 1000 | if &term =~ "screen" 1001 | let &t_BE = "\e[?2004h" 1002 | let &t_BD = "\e[?2004l" 1003 | exec "set t_PS=\e[200~" 1004 | exec "set t_PE=\e[201~" 1005 | endif 1006 | endif 1007 | endif 1008 | 1009 | "---------------------------------------------------------------- 1010 | " 13. Search, vimgrep and grep 1011 | "---------------------------------------------------------------- 1012 | " Highlight search results 1013 | set hlsearch 1014 | 1015 | " Makes search act like search in modern browsers 1016 | set incsearch 1017 | 1018 | " Search, wrap around the end of the buffer 1019 | set wrapscan 1020 | 1021 | " Ignore case when searching 1022 | set ignorecase 1023 | 1024 | " When searching try to be smart about cases 1025 | set smartcase 1026 | 1027 | " For regular expressions turn magic on 1028 | set magic 1029 | 1030 | " Maximum amount of memory in Kbyte used for pattern matching 1031 | set maxmempattern=1000 1032 | 1033 | " --- Highlight --- 1034 | "---------------------------------------------------------------- 1035 | " Map to / (search) 1036 | nnoremap / 1037 | nnoremap ? 1038 | 1039 | " Highlight the word under the cursor and don't jump to next 1040 | nnoremap :let @/='\<=expand("")\>':set hlsearch 1041 | 1042 | " Highlight the selected text and don't jump to next 1043 | vnoremap :call VSetSearch():set hlsearch 1044 | 1045 | " Disable highlight 1046 | nnoremap m :noh 1047 | 1048 | " Next and prev centered 1049 | nnoremap n nzz 1050 | nnoremap N Nzz 1051 | 1052 | " Search into a Visual selection 1053 | vnoremap :call RangeSearch('/') 1054 | \ :if strlen(g:srchstr) > 0 1055 | \ \|exec '/'.g:srchstr\|endifn 1056 | vnoremap ? :call RangeSearch('?') 1057 | \ :if strlen(g:srchstr) > 0 1058 | \ \|exec '?'.g:srchstr\|endifN 1059 | 1060 | " --- Vimgrep and grep --- 1061 | "---------------------------------------------------------------- 1062 | " Vimgrep the highlight in the current file 1063 | nnoremap vg :vimgrep ///j % 1064 | 1065 | " Vimgrep the highlight in the current directory and subdirectories 1066 | nnoremap vf :vimgrep ///j **/*. 1067 | 1068 | autocmd QuickfixCmdPre grep,grepadd,vimgrep,vimgrepadd,helpgrep copen 1069 | 1070 | " Grep settings 1071 | set grepprg=grep\ -nHi 1072 | 1073 | " Current buffer 1074 | nnoremap vv :call GrepWrapper('grep!', '', '%') 1075 | 1076 | " Current working directory 1077 | nnoremap vn :call GrepWrapper('grep!', '-R 1078 | \ --exclude-dir={.git,.svn,.jekyll-cache,_site} 1079 | \ --exclude=LICENSE', '') 1080 | 1081 | " Current buffer (grepadd) 1082 | nnoremap vm :call GrepWrapper('grepadd!', '', '%') 1083 | 1084 | " Current arglist 1085 | nnoremap va :call GrepWrapper('grep!', '', '##') 1086 | 1087 | " Navigate between grep and vimgrep results 1088 | nnoremap n :cnextzz 1089 | nnoremap N :cprevzz 1090 | 1091 | " Jump to the results in buffers (first open window), not tabs 1092 | set switchbuf=useopen 1093 | 1094 | " --- Replace --- 1095 | "---------------------------------------------------------------- 1096 | " Replace the highlight in the current file 1097 | nnoremap r :%s////g 1098 | 1099 | " Replace the highlight in the visual selection 1100 | " Flag \%V --> Match only inside the visual selection 1101 | vnoremap r :s/\%V/\%V//g 1102 | 1103 | " Replace the highlight to all loaded buffers and arglist 1104 | nnoremap R :bufdo %s////ge 1105 | 1106 | " Replace the highlight to each valid entry in the quickfix 1107 | nnoremap Q :cdo %s////ge 1108 | 1109 | " Populate the arglist 1110 | nnoremap aa :argadd 1111 | nnoremap ad :argdelete 1112 | nnoremap an :args **/*. 1113 | nnoremap al :call DisplayArglist():argument 1114 | 1115 | "---------------------------------------------------------------- 1116 | " 14. Text edition 1117 | "---------------------------------------------------------------- 1118 | " Toggle case 1119 | nnoremap z ~ 1120 | vnoremap z y:call setreg('', ToggleCase(@"), getregtype(''))gv""Pgv 1121 | vnoremap ~ y:call setreg('', ToggleCase(@"), getregtype(''))gv""Pgv 1122 | 1123 | " Toggle and untoggle spell checking 1124 | let g:f8msg = 'Toggle spell checking.' 1125 | nnoremap :setlocal spell!:echo g:f8msg 1126 | 1127 | " Toggle spell dictionary 1128 | nnoremap :call ToggleSpelllang() 1129 | 1130 | " Move to next misspelled word 1131 | nnoremap zl ]s 1132 | 1133 | " Find the misspelled word before the cursor 1134 | nnoremap zh [s 1135 | 1136 | " Suggest correctly spelled words 1137 | nnoremap zp z= 1138 | 1139 | " Copy text into the clipboard 1140 | vnoremap y "+y 1141 | 1142 | " Paste text from the clipboard 1143 | nnoremap p "+p 1144 | 1145 | " Quickly select the text pasted from the clipboard 1146 | nnoremap gV `[v`] 1147 | 1148 | " Yank everything from the cursor to the EOL 1149 | nnoremap Y y$ 1150 | 1151 | " Yank the last pasted text automatically 1152 | vnoremap p pgvy 1153 | 1154 | " Retab the selected text 1155 | nnoremap tf :retab! 1156 | vnoremap tf :retab! 1157 | 1158 | " Isolate the current line 1159 | nnoremap o m`okO`` 1160 | 1161 | " Enter a new line Down from 'Normal Mode' 1162 | nnoremap f mao`a 1163 | 1164 | " Enter a new line Up from 'Normal Mode' 1165 | nnoremap F maO`a 1166 | 1167 | " Insert brackets faster using the ISO-ES layout 1168 | inoremap ñr [] 1169 | inoremap ñb () 1170 | inoremap ñB {} 1171 | inoremap ññ {{ }} 1172 | inoremap ñl \ 1173 | autocmd FileType html,markdown,liquid inoremap ñp {% %} 1174 | autocmd FileType html,markdown,liquid inoremap ñ- {%- -%} 1175 | 1176 | " Enter Vim's expression register (math) 1177 | inoremap ñm = 1178 | 1179 | "---------------------------------------------------------------- 1180 | " 15. Make settings 1181 | "---------------------------------------------------------------- 1182 | " Set makeprg 1183 | if !filereadable(expand('%:p:h').'/Makefile') 1184 | autocmd FileType c setlocal makeprg=gcc\ %\ &&\ ./a.out 1185 | endif 1186 | 1187 | " Go to the error line 1188 | set errorformat=%m\ in\ %f\ on\ line\ %l 1189 | 1190 | " Use the correct cursor shape via 'edit-command-line' (zle) 1191 | augroup zsh 1192 | autocmd! 1193 | if !has("nvim") 1194 | autocmd Filetype zsh silent! exec "! echo -ne '\e[2 q'" 1195 | endif 1196 | augroup end 1197 | 1198 | " Run code in a tmux window 1199 | augroup tmuxy 1200 | autocmd! 1201 | autocmd FileType javascript,lua,perl,php,python,ruby,sh 1202 | \ nnoremap ij 1203 | \ :call Tmuxy() 1204 | augroup end 1205 | 1206 | " Run code in the preview window 1207 | augroup scripty 1208 | autocmd! 1209 | autocmd FileType javascript,lua,perl,php,python,ruby,sh 1210 | \ nnoremap ii 1211 | \ :call Scripty() 1212 | augroup end 1213 | 1214 | " Work with Sqlite databases 1215 | augroup sqlite 1216 | autocmd! 1217 | autocmd FileType sql nnoremap ia 1218 | \ :call SqliteDatabase() 1219 | autocmd FileType sql nnoremap ii 1220 | \ :call SQLExec('n') 1221 | autocmd FileType sql vnoremap ii 1222 | \ :call SQLExec('v') 1223 | augroup end 1224 | 1225 | " Work with maxima (symbolic mathematics) 1226 | augroup maxima 1227 | autocmd! 1228 | autocmd BufRead,BufNewFile *.max set filetype=maxima 1229 | autocmd FileType maxima nnoremap ii 1230 | \ :call MaximaExec('n') 1231 | autocmd FileType maxima vnoremap ii 1232 | \ :call MaximaExec('v') 1233 | augroup end 1234 | 1235 | " Convert LaTeX to PDF 1236 | augroup latex 1237 | autocmd! 1238 | autocmd FileType tex nnoremap ii 1239 | \ :call Generator('.pdf', &ft) 1240 | augroup end 1241 | 1242 | " Convert markdown to PDF, HTML and EPUB 1243 | augroup markdown 1244 | autocmd! 1245 | autocmd FileType markdown nnoremap ii 1246 | \ :call Generator('.pdf', &ft) 1247 | autocmd FileType markdown nnoremap ih 1248 | \ :call Generator('.html', &ft) 1249 | autocmd FileType markdown nnoremap ij 1250 | \ :call Generator('.epub', &ft) 1251 | augroup end 1252 | 1253 | " Draw with PlantUML 1254 | augroup uml 1255 | autocmd! 1256 | autocmd FileType plantuml nnoremap ii 1257 | \ :call Generator('.png', &ft) 1258 | augroup end 1259 | 1260 | " Draw with Graphviz 1261 | augroup dot 1262 | autocmd! 1263 | autocmd FileType dot nnoremap ii 1264 | \ :call Generator('.png', &ft) 1265 | augroup end 1266 | 1267 | " Draw with Eukleides 1268 | augroup eukleides 1269 | autocmd! 1270 | autocmd BufRead,BufNewFile *.euk set filetype=eukleides 1271 | autocmd FileType eukleides nnoremap ii 1272 | \ :call Generator('.png', &ft) 1273 | augroup end 1274 | 1275 | " Draw with Asymptote 1276 | augroup asymptote 1277 | autocmd! 1278 | autocmd BufRead,BufNewFile *.asy set filetype=asy 1279 | autocmd FileType asy nnoremap ii 1280 | \ :call Generator('.png', &ft) 1281 | augroup end 1282 | 1283 | " Draw with pp3 1284 | augroup pp3 1285 | autocmd! 1286 | autocmd BufRead,BufNewFile *.pp3 set filetype=pp3 1287 | autocmd FileType pp3 nnoremap ii 1288 | \ :call Generator('.png', &ft) 1289 | augroup end 1290 | 1291 | " Draw with Gnuplot 1292 | augroup gnuplot 1293 | autocmd! 1294 | autocmd BufRead,BufNewFile *.plt set filetype=gnuplot 1295 | autocmd FileType gnuplot nnoremap ii 1296 | \ :call Generator('.png', &ft) 1297 | augroup end 1298 | 1299 | " Draw with POV-Ray 1300 | augroup povray 1301 | autocmd! 1302 | autocmd FileType pov nnoremap ii 1303 | \ :call Generator('.png', &ft) 1304 | augroup end 1305 | 1306 | " Run Jekyll (liquid) 1307 | augroup liquid 1308 | autocmd! 1309 | autocmd FileType liquid,html,yaml set wildignore+=*/.jekyll-cache/*, 1310 | \*/_site/*,*/images/*,*/timg/*,*/icons/*,*/logo/*,*/where/* 1311 | autocmd FileType liquid setlocal spell spelllang=es colorcolumn=0 1312 | autocmd FileType liquid,yaml nnoremap ii 1313 | \ :call ToggleJekyll() 1314 | autocmd FileType liquid,md nnoremap ij 1315 | \ :call ViewJekyllPost() 1316 | augroup end 1317 | 1318 | "---------------------------------------------------------------- 1319 | " 16. Filetype settings 1320 | "---------------------------------------------------------------- 1321 | " Delete trailing white spaces 1322 | func! s:DeleteTrailing() 1323 | exe 'normal mz' 1324 | %s/\s\+$//ge 1325 | exe 'normal `z' 1326 | echo 'Trailing white spaces have been removed.' 1327 | noh 1328 | endfunc 1329 | 1330 | nnoremap dt :call DeleteTrailing() 1331 | 1332 | " Binary 1333 | augroup binary 1334 | autocmd! 1335 | autocmd BufReadPre *.bin let &bin=1 1336 | autocmd BufReadPost *.bin if &bin | %!xxd 1337 | autocmd BufReadPost *.bin set ft=xxd | endif 1338 | autocmd BufWritePre *.bin if &bin | %!xxd -r 1339 | autocmd BufWritePre *.bin endif 1340 | autocmd BufWritePost *.bin if &bin | %!xxd 1341 | autocmd BufWritePost *.bin set nomod | endif 1342 | augroup end 1343 | 1344 | " Mail 1345 | augroup mail 1346 | autocmd! 1347 | autocmd FileType mail setl spell 1348 | autocmd FileType mail setl spelllang=ca 1349 | augroup end 1350 | 1351 | " SQL (it requires sqlparse) 1352 | augroup sql 1353 | let g:omni_sql_no_default_maps = 1 1354 | autocmd FileType sql nnoremap bf 1355 | \ :%!sqlformat --reindent --keywords upper --identifiers upper - 1356 | autocmd FileType sql vnoremap bf 1357 | \ :%!sqlformat --reindent --keywords upper --identifiers upper - 1358 | augroup end 1359 | 1360 | " XML (it requires tidy) 1361 | augroup xml 1362 | autocmd FileType xml nnoremap bf 1363 | \ :%!tidy -q -i -xml --show-errors 0 -wrap 0 --indent-spaces 4 1364 | augroup end 1365 | 1366 | " MD 1367 | augroup md 1368 | autocmd FileType markdown,liquid,text,yaml set expandtab 1369 | autocmd FileType markdown,liquid,text 1370 | \ nnoremap cc :call KeywordDensity() 1371 | autocmd FileType markdown,liquid,text nnoremap cx g 1372 | autocmd FileType markdown,liquid,text vnoremap cx g 1373 | autocmd FileType markdown,liquid,text 1374 | \ nnoremap gl :call search('\v\[[^]]*]\([^)]*\)', 'W') 1375 | autocmd FileType markdown,liquid,text 1376 | \ nnoremap gh :call search('\v\[[^]]*]\([^)]*\)', 'bW') 1377 | autocmd FileType markdown,liquid,text 1378 | \ nnoremap gd :call RemoveMdLink() 1379 | autocmd FileType markdown,liquid,text 1380 | \ :command! -range Enes ,!trans en:es -brief 1381 | autocmd FileType markdown,liquid,text 1382 | \ :command! -range Esen ,!trans es:en -brief 1383 | autocmd FileType markdown,liquid,text 1384 | \ nnoremap gx :call CustomGx() 1385 | augroup end 1386 | 1387 | " CSV 1388 | augroup csv 1389 | autocmd! 1390 | autocmd BufRead,BufNewFile *.csv set filetype=csv 1391 | augroup end 1392 | 1393 | " New file headers 1394 | augroup headers 1395 | autocmd! 1396 | autocmd BufNewFile *.py 0put =\"#!/usr/bin/env python\\# 1397 | \ -*- coding: utf-8 -*-\\"|$ 1398 | autocmd BufNewFile *.rb 0put =\"#!/usr/bin/env ruby\\"|$ 1399 | autocmd BufNewFile *.pl 0put =\"#!/usr/bin/env perl\\"|$ 1400 | autocmd BufNewFile *.sh 0put =\"#!/usr/bin/env bash\\"|$ 1401 | autocmd BufNewFile *.js 0put =\"#!/usr/bin/env node\\"|$ 1402 | augroup end 1403 | 1404 | "---------------------------------------------------------------- 1405 | " 17. Helper functions 1406 | "---------------------------------------------------------------- 1407 | " Toggle Terminal 1408 | function! s:ToggleTerminal() 1409 | if bufexists('terminal') 1410 | call win_gotoid(s:winZsh) 1411 | norm! i 1412 | else 1413 | execute ':below 10sp term://$SHELL' 1414 | keepalt file terminal 1415 | let s:winZsh = win_getid() 1416 | norm! i 1417 | endif 1418 | endfunction 1419 | 1420 | " Show syntax highlighting groups 1421 | function! s:SynStack() 1422 | if !exists('*synstack') 1423 | return 1424 | endif 1425 | echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') 1426 | endfunction 1427 | 1428 | " Rename file 1429 | function! s:RenameFile() 1430 | let l:old_name = expand('%') 1431 | let l:new_name = input('New file name: ', expand('%'), 'file') 1432 | if l:new_name !=# '' && l:new_name !=# l:old_name 1433 | exec ':saveas ' . l:new_name 1434 | exec ':silent !rm ' . l:old_name 1435 | redraw! 1436 | endif 1437 | endfunction 1438 | 1439 | " Don't close window when deleting a buffer 1440 | function! s:CustomCloseBuffer() 1441 | let l:currentBufNum = bufnr('%') 1442 | let l:alternateBufNum = bufnr('#') 1443 | 1444 | if buflisted(l:alternateBufNum) 1445 | buffer # 1446 | else 1447 | bnext 1448 | endif 1449 | 1450 | if bufnr('%') == l:currentBufNum 1451 | new 1452 | endif 1453 | 1454 | if buflisted(l:currentBufNum) 1455 | exec ':bdelete! ' . l:currentBufNum 1456 | endif 1457 | endfunction 1458 | 1459 | " Close the last buffer if it's the last window 1460 | " - For 'quickfix' and 'nofile' 1461 | autocmd BufEnter * call CloseLastBuffer() 1462 | function! s:CloseLastBuffer() 1463 | if &buftype ==# 'quickfix' || &buftype ==# 'nofile' 1464 | if winnr('$') < 2 1465 | quit! 1466 | endif 1467 | endif 1468 | endfunction 1469 | 1470 | " Display the arglist vertically 1471 | function! s:DisplayArglist() abort 1472 | let l:argnum = 0 1473 | let l:lenargc = len(argc()) 1474 | for l:arg in argv() 1475 | let l:argnum += 1 1476 | let l:filename = fnamemodify(l:arg, ':t') 1477 | let l:changed = 1478 | \ getbufinfo(bufname('^' . l:arg . '$'))[0].changed == 1 1479 | \ ? '+' 1480 | \ : ' ' 1481 | let l:current = expand('%') ==# l:arg ? '%' : ' ' 1482 | echo printf( '%-*d %s%s %s', 1483 | \ l:lenargc, l:argnum, l:current, l:changed, l:filename) 1484 | endfor 1485 | endfunction 1486 | 1487 | " Toggle maximize window and resize windows 1488 | function! s:ToggleResize() abort 1489 | if winnr('$') > 1 1490 | if exists('t:zoomed') && t:zoomed 1491 | execute t:zoom_winrestcmd 1492 | let t:zoomed = 0 1493 | echo 'Windows resized.' 1494 | else 1495 | let t:zoom_winrestcmd = winrestcmd() 1496 | resize 1497 | vertical resize 1498 | let t:zoomed = 1 1499 | echo 'Window maximized.' 1500 | endif 1501 | endif 1502 | endfunction 1503 | autocmd VimEnter * autocmd WinEnter * let t:zoomed = 0 1504 | 1505 | " Search into a Visual selection 1506 | function! s:RangeSearch(direction) 1507 | call inputsave() 1508 | let g:srchstr = input(a:direction) 1509 | call inputrestore() 1510 | if strlen(g:srchstr) > 0 1511 | let g:srchstr = g:srchstr. 1512 | \ '\%>'.(line("'<")-1).'l'. 1513 | \ '\%<'.(line("'>")+1).'l' 1514 | else 1515 | let g:srchstr = '' 1516 | endif 1517 | endfunction 1518 | 1519 | " Highlight the selected text (visual mode) 1520 | " Source: https://github.com/nelstrom/vim-visual-star-search 1521 | " (You can install it as a plugin) 1522 | function! s:VSetSearch() 1523 | let l:temp = @@ 1524 | norm! gvy 1525 | let @/ = '\V' . substitute(escape(@@, '\'), '\n', '\\n', 'g') 1526 | let @@ = l:temp 1527 | endfunction 1528 | 1529 | " Count grep matches 1530 | function! QFCounter() abort 1531 | let l:results = len(getqflist()) 1532 | if l:results > 0 1533 | copen 1534 | else 1535 | cclose 1536 | endif 1537 | echo 'Found ' . l:results . ' matches.' 1538 | endfunction 1539 | 1540 | " Grep wrapper 1541 | function! s:GrepWrapper(cmd, dir, scope) abort 1542 | cclose 1543 | let l:pattern = substitute(@/, '\\V', '', '') 1544 | let l:pattern = substitute(pattern, '\\<', '', '') 1545 | let l:pattern = substitute(pattern, '\\>', '', '') 1546 | let l:pattern = escape(pattern, '"') 1547 | let l:pattern = escape(pattern, '%') 1548 | let l:pattern = escape(pattern, '#') 1549 | silent execute a:cmd . ' ' . a:dir . ' "' . l:pattern . '" ' . a:scope 1550 | redraw! 1551 | set hlsearch 1552 | call QFCounter() 1553 | endfunction 1554 | 1555 | " Toggle case 1556 | function! ToggleCase(str) 1557 | if a:str ==# toupper(a:str) 1558 | let l:result = tolower(a:str) 1559 | elseif a:str ==# tolower(a:str) 1560 | let l:result = substitute(a:str,'\(\<\w\+\>\)', '\u\1', 'g') 1561 | else 1562 | let l:result = toupper(a:str) 1563 | endif 1564 | return l:result 1565 | endfunction 1566 | 1567 | " Toggle spell dictionary 1568 | function! ToggleSpelllang() 1569 | if (&spelllang =~# '^en') 1570 | set spelllang=ca 1571 | echo 'Català' 1572 | elseif (&spelllang =~# '^ca') 1573 | set spelllang=es 1574 | echo 'Castellano' 1575 | elseif (&spelllang =~# '^es') 1576 | set spelllang=en_us,en_gb 1577 | echo 'English' 1578 | endif 1579 | set spelllang? 1580 | endfunction 1581 | 1582 | " New :windo command to return to the last current window 1583 | " - Default :windo cycles through all the open windows 1584 | " - Use 'Windo' instead of 'windo' to avoid it 1585 | command! -nargs=+ -complete=command Windo 1586 | \ let s:currentWindow = winnr() | 1587 | \ execute 'windo ' | 1588 | \ exe s:currentWindow . 'wincmd w' 1589 | 1590 | " Toggle colorcolumn 1591 | function! s:ToggleColorColumn() 1592 | if !exists('s:color_column_old') || s:color_column_old == 0 1593 | let s:color_column_old = &colorcolumn 1594 | Windo let &colorcolumn = 0 1595 | else 1596 | Windo let &colorcolumn = s:color_column_old 1597 | let s:color_column_old = 0 1598 | endif 1599 | endfunction 1600 | 1601 | " Toggle the cursor position start/end 1602 | function! s:ToggleCPosition(mode) 1603 | execute a:mode 1604 | if !exists('s:togglecp') 1605 | let s:togglecp = 0 1606 | endif 1607 | if col('.') >= col('$') - 1 1608 | let s:togglecp = 1 1609 | norm! ^ 1610 | else 1611 | let s:togglecp = 0 1612 | norm! $ 1613 | endif 1614 | endfunction 1615 | 1616 | " Toggle GitGutterPreviewHunk 1617 | function! s:ToggleGGPrev() 1618 | if getwinvar(winnr('#'), '&pvw') == 1 1619 | \ && exists('s:curr') && line(".") == s:curr 1620 | \ || gitgutter#hunk#in_hunk(line(".")) == 0 1621 | pclose 1622 | else 1623 | GitGutterPreviewHunk 1624 | let s:curr = line(".") 1625 | endif 1626 | endfunction 1627 | 1628 | " Switch CWD to git root directory 1629 | function! s:GitRoot() abort 1630 | execute ':lcd %:p:h' 1631 | let l:isgit = system('git rev-parse --is-inside-work-tree 2>/dev/null') 1632 | if v:shell_error == 0 1633 | let l:path = system('git rev-parse --show-toplevel 2>/dev/null') 1634 | execute ':lcd ' . l:path 1635 | execute ':pwd' 1636 | else 1637 | echo "You're not in a git directory." 1638 | endif 1639 | endfunction 1640 | 1641 | " Toggle Gstatus window 1642 | function! s:ToggleGstatus() abort 1643 | for l:winnr in range(1, winnr('$')) 1644 | if !empty(getwinvar(l:winnr, 'fugitive_status')) 1645 | exe l:winnr 'close' 1646 | return 1647 | endif 1648 | endfor 1649 | keepalt Git 1650 | endfunction 1651 | 1652 | " Better toggle for NERDTree 1653 | function! s:ToggleNERDTree() abort 1654 | if bufname('%') != "" 1655 | if exists("g:NERDTree") && g:NERDTree.IsOpen() 1656 | if &filetype ==# 'nerdtree' 1657 | execute ':NERDTreeClose' 1658 | else 1659 | execute ':NERDTreeFocus' 1660 | endif 1661 | else 1662 | execute ':NERDTreeFind' 1663 | endif 1664 | else 1665 | execute ':NERDTreeToggleVCS' 1666 | endif 1667 | endfunction 1668 | 1669 | " Get Tagbar buffer name 1670 | function! s:TagbarBufName() abort 1671 | if !exists('t:tagbar_buf_name') 1672 | let s:buffer_seqno += 1 1673 | let t:tagbar_buf_name = '__Tagbar__.' . s:buffer_seqno 1674 | endif 1675 | return t:tagbar_buf_name 1676 | endfunction 1677 | 1678 | " Better toggle for Tagbar 1679 | function! s:ToggleTagbar() abort 1680 | let tagbarwinnr = bufwinnr(s:TagbarBufName()) 1681 | if tagbarwinnr != -1 1682 | if &modifiable 1683 | execute tagbarwinnr 'wincmd w' 1684 | else 1685 | execute ':TagbarClose' 1686 | endif 1687 | else 1688 | execute ':TagbarOpen' 1689 | endif 1690 | endfunction 1691 | 1692 | " Keyword density checker 1693 | function! s:KeywordDensity() abort 1694 | silent update 1695 | 1696 | " Words count 1697 | " > Strip the front matter, comments, HTML tags and count the words 1698 | let s:sf = " | sed '1 { /^---/ { :a N; /\\n---/! ba; d } }'" 1699 | let s:sc = " | sed 's/{% comment.*endcomment %}//g'" 1700 | let s:sh = " | sed 's/<[^>]*.//g'" 1701 | let s:wc = " | wc -w" 1702 | let s:get_words = system("cat " . expand('%') . s:sf. s:sc . s:sh . s:wc) 1703 | let s:int_words = str2nr(s:get_words) 1704 | let s:str_words = string(s:int_words) 1705 | 1706 | " Highlight count 1707 | let s:match_count = "" 1708 | redir => s:match_count 1709 | silent exec '%s/' . @/ . '//gne' 1710 | redir END 1711 | 1712 | if ! empty(s:match_count) 1713 | let s:str_keys = split(s:match_count)[0] 1714 | let s:flt_keys = str2float(s:str_keys) 1715 | 1716 | " Density 1717 | let s:flt_dens = (s:flt_keys/s:int_words)*100 1718 | let s:str_dens = string(s:flt_dens) 1719 | 1720 | echo '> ' . s:str_keys . ' of ' . s:str_words . ' (' . s:str_dens . '%)' 1721 | else 1722 | echo '> 0 of ' . s:str_words . ' (0%, pattern not found)' 1723 | endif 1724 | endfunction 1725 | 1726 | " Remove markdown link 1727 | function! s:RemoveMdLink() abort 1728 | let [l, c] = searchpos('\v\[[^]]*]\([^)]*\)', 'ncW') 1729 | if l > 0 && c > 0 1730 | if getline(".")[col(".")-1] ==# "[" 1731 | norm! xf]vf)d 1732 | else 1733 | call cursor(l, c) 1734 | endif 1735 | endif 1736 | endfunction 1737 | 1738 | " Custom gx to preview images in markdown 1739 | function! s:CustomGx() 1740 | let l:src = expand("") 1741 | execute "silent !feh " . substitute(l:src, '^/', '', 'g') . " &" 1742 | redraw! 1743 | endfunction 1744 | 1745 | "---------------------------------------------------------------- 1746 | " 18. External tools integration 1747 | "---------------------------------------------------------------- 1748 | " Run code into a tmux window 1749 | function! s:Tmuxy() abort 1750 | if exists('$TMUX') 1751 | update 1752 | let s:runner = Runners() 1753 | let s:cmdk = 'tmux kill-window -t run' 1754 | let s:cmdn = 'tmux new-window -n run' 1755 | let s:cmds = " '" . s:runner . " " . expand("%:p") . " ; read'" 1756 | call system(s:cmdk) 1757 | call system(s:cmdn . s:cmds) 1758 | else 1759 | echo 'Tmux is not running.' 1760 | endif 1761 | endfunction 1762 | 1763 | " Run code in the preview window 1764 | function! s:Scripty() abort 1765 | update 1766 | let s:runner = Runners() 1767 | let s:cmd = s:runner . " " . expand("%:p") 1768 | call Commander(s:cmd) 1769 | endfunction 1770 | 1771 | " Define the runners 1772 | function! s:Runners() abort 1773 | if &filetype =~# 'javascript' 1774 | let s:run = 'node' 1775 | elseif &filetype =~# 'lua' 1776 | let s:run = 'lua' 1777 | elseif &filetype =~# 'perl' 1778 | let s:run = 'perl' 1779 | elseif &filetype =~# 'php' 1780 | let s:run = 'php' 1781 | elseif &filetype =~# 'python' 1782 | let s:run = 'python' 1783 | elseif &filetype =~# 'ruby' 1784 | let s:run = 'ruby' 1785 | elseif &filetype =~# 'sh' 1786 | let s:run = 'bash' 1787 | else 1788 | let s:run = 'empty' 1789 | endif 1790 | return s:run 1791 | endfunction 1792 | 1793 | " Generator function 1794 | function! s:Generator(ext, ft) abort 1795 | update 1796 | let l:inp = expand('%') 1797 | let l:out = expand('%:r') . a:ext 1798 | if a:ft ==# 'tex' 1799 | let l:cmd = system('pdflatex ' . l:inp) 1800 | elseif a:ft ==# 'markdown' 1801 | if a:ext ==# '.html' 1802 | let l:opt = '--mathjax ' 1803 | elseif a:ext ==# '.epub' 1804 | let l:opt = '-t epub2 --webtex ' 1805 | elseif a:ext ==# '.pdf' 1806 | let l:opt = '-V fontsize=12pt 1807 | \ -V papersize=a4 1808 | \ -V geometry:margin=2.5cm ' 1809 | endif 1810 | let l:cmd = system('pandoc -s ' . l:opt . l:inp . ' -o ' . l:out) 1811 | elseif a:ft ==# 'plantuml' 1812 | let l:cmd = system('plantuml ' . l:inp . ' ' . l:out) 1813 | elseif a:ft ==# 'dot' 1814 | let l:cmd = system('dot -Tpng ' . l:inp . ' -o ' . l:out) 1815 | elseif a:ft ==# 'eukleides' 1816 | let l:eps = expand('%:r') . '.eps' 1817 | let l:cmd = system('eukleides ' . l:inp) 1818 | elseif a:ft ==# 'asy' 1819 | let l:eps = expand('%:r') . '.eps' 1820 | let l:cmd = system('asy ' . l:inp) 1821 | elseif a:ft ==# 'pp3' 1822 | let l:eps = expand('%:r') . '.eps' 1823 | let l:cmd = system('pp3 ' . l:inp) 1824 | elseif a:ft ==# 'gnuplot' 1825 | let l:opt = ' -e "set terminal png; set output ''' . l:out . '''" ' 1826 | let l:cmd = system('gnuplot' . l:opt . l:inp) 1827 | elseif a:ft ==# 'pov' 1828 | let l:cmd = system('povray -D ' . l:inp) 1829 | endif 1830 | if v:shell_error == 0 1831 | pclose 1832 | if a:ft =~# '\(eukleides\|asy\|pp3\)' 1833 | call EPS2PNG(l:eps, l:out) 1834 | endif 1835 | call Previewer(l:out, a:ext) 1836 | else 1837 | call WinPreview() 1838 | exec '0put =l:cmd' 1839 | call ResizeWinPreview() 1840 | endif 1841 | endfunction 1842 | 1843 | " Convert from EPS to PNG 1844 | function! s:EPS2PNG(eps, out) abort 1845 | let l:opt_bef = ' -density 150 ' 1846 | let l:opt_aft = ' -flatten -alpha off -colorspace hsl ' 1847 | call system('convert' . l:opt_bef . a:eps . l:opt_aft . a:out) 1848 | endfunction 1849 | 1850 | " Preview EPUB, HTML & PNG with mupdf 1851 | " Preview PDF with zathura 1852 | function! s:Previewer(out, ft) abort 1853 | if a:ft ==# '.pdf' 1854 | let l:tool = 'zathura' 1855 | else 1856 | let l:tool = 'mupdf' 1857 | endif 1858 | let l:dev = ' 2>/dev/null' 1859 | let l:checkps = system('ps -ef 1860 | \ | grep -v grep 1861 | \ | grep '. l:tool .' 1862 | \ | grep -o ' . a:out . l:dev) 1863 | if l:checkps ==# '' 1864 | call system(l:tool . ' ' . a:out . ' &') 1865 | else 1866 | if l:tool ==# 'mupdf' 1867 | call system('pkill -HUP mupdf') 1868 | endif 1869 | endif 1870 | endfunction 1871 | 1872 | " Configure a sqlite database 1873 | function! s:SqliteDatabase() abort 1874 | let t:path = input('Database: ') 1875 | endfunction 1876 | 1877 | " Execute SQL queries 1878 | function! s:SQLExec(opt) abort 1879 | if a:opt ==# 'n' 1880 | silent norm! yy 1881 | elseif a:opt ==# 'v' 1882 | silent norm! gvy 1883 | endif 1884 | if !exists('t:path') 1885 | call SqliteDatabase() 1886 | endif 1887 | if filereadable(t:path) 1888 | let t:sql = @ 1889 | let t:sql = substitute(t:sql, '\n', ' ', 'g') 1890 | let t:format = " | column -t -s '|'" 1891 | if t:sql =~? '^select' 1892 | let t:cmd = t:path . ' "' . escape(t:sql, '"') . '"' . t:format 1893 | else 1894 | let t:cmd = t:path . ' "' . escape(t:sql, '"') . '"' 1895 | endif 1896 | let s:cmd = "sqlite3 -list -batch " . t:cmd 1897 | call Commander(s:cmd) 1898 | else 1899 | echo "\nThis database does not exist!" 1900 | endif 1901 | endfunction 1902 | 1903 | " Execute Maxima instructions 1904 | function! s:MaximaExec(opt) abort 1905 | if a:opt ==# 'n' 1906 | silent norm! yy 1907 | elseif a:opt ==# 'v' 1908 | silent norm! gvy 1909 | endif 1910 | let b:equ = @ 1911 | let b:equ = substitute(b:equ, '\n', ' ', 'g') 1912 | let b:equ = substitute(b:equ, '\s$', '', 'g') 1913 | let b:equ = substitute(b:equ, '%', '\\%', 'g') 1914 | if b:equ !~# ';$' 1915 | let b:equ = substitute(b:equ, '$', ';', 'g') 1916 | endif 1917 | let s:cmd = 'maxima --very-quiet --batch-string "' . b:equ . '"' 1918 | call Commander(s:cmd) 1919 | endfunction 1920 | 1921 | " Window previewer 1922 | function! s:WinPreview() abort 1923 | silent! wincmd P 1924 | if !&previewwindow 1925 | exec 'new' 1926 | setlocal previewwindow 1927 | setlocal buftype=nowrite bufhidden=wipe 1928 | setlocal nobuflisted noswapfile nowrap 1929 | nnoremap q :pclose 1930 | endif 1931 | exec '%delete' 1932 | endfunction 1933 | 1934 | " Commander 1935 | function! s:Commander(cmd) abort 1936 | call WinPreview() 1937 | exec '0read !' . a:cmd 1938 | call ResizeWinPreview() 1939 | endfunction 1940 | 1941 | " Resize the preview window 1942 | function! s:ResizeWinPreview() abort 1943 | exec '$d' 1944 | let s:size = line('$') 1945 | if s:size < 10 1946 | exec 'resize ' . line('$') 1947 | else 1948 | exec 'resize 10' 1949 | endif 1950 | norm! gg 1951 | wincmd p 1952 | endfunction 1953 | 1954 | command! -nargs=1 Commander call Commander() 1955 | 1956 | " Toggle Jekyll server in the background 1957 | function! s:ToggleJekyll() abort 1958 | call system('lsof -i :4000 | grep -i listen') 1959 | if v:shell_error 1960 | silent exec "!(bundle exec jekyll serve -q -l -I &) > /dev/null" 1961 | call system("touch /tmp/jekyll.ps") 1962 | call system("notify-send -t 2 'Executing Jekyll server...'") 1963 | else 1964 | silent exec "!(pkill -f jekyll &) > /dev/null" 1965 | call system("rm -f /tmp/jekyll.ps") 1966 | call system("notify-send -t 2 'Jekyll server was stoped!'") 1967 | endif 1968 | redraw! 1969 | endfunction 1970 | 1971 | " Preview the current post in the web broswer 1972 | function! s:ViewJekyllPost() abort 1973 | silent update 1974 | let s:grep = expand("grep '^permalink: ' ") 1975 | let s:file = expand('%') 1976 | let s:sed = expand(" | sed 's/permalink: //g'") 1977 | let s:permalink = system(s:grep . s:file . s:sed) 1978 | call system("google-chrome http://localhost:4000" . s:permalink) 1979 | endfunction 1980 | 1981 | " Shell output to the buffer 1982 | command! -nargs=1 SH :r ! 1983 | --------------------------------------------------------------------------------