== Vim related commands == To generate a quickfix list, use :vimgrep /pattern/ fileglob then, use :cc to jump to a given entry in the number of lists or use :copen to open the quickfix list and navigate manually. == Vim scripting == use :exe to run more complex commands that use variables for example: ``` exe 'r! echo ' .. s:somevar ``` will echo whatever is in the script local variable 'somevar' == variables and settings== To get a setting into a variable, we prefix it with an '&' {{{vim "sets the script-scoped variable somevar to "the value of the filetype setting let s:somevar = &ft }}} == Vim snipMate == by default it remaps so it needs to be changed to something else to not conflict with my CleverTab function See help file for snipmate Currently mapped it to == Vim terminal == Goto normal mode in terminal by typing N N must be capital, this we need to hold shift I remmaped it to so it works more fluently == Vim paredit == To delete an unbalanced ')' (parenthesis) we have to use x in order to bypass paredit. This issue should be fixed though, but seems like it doesn't include lone-standing parenthesis. Or just use 'r' and replace it with a space. == Spell checking == `:setlocal spell spelllang=en_us` = Autocompletion = == vim-lsc == The best autocompletion I could find was `vim-lsc` It supports LSP servers and is fast with completions. `ALE` performs terribly when doing completions from LSP servers. So Its best to use `vim-lsc` In combination with `VimComplete` this makes for a great setup. First though, one has to compile the eclipse lsp, called `jdtls` and found here: https://github.com/eclipse-jdtls/eclipse.jdt.ls Using maven with `-DskipTests` this is fairly simple. The starting of the server is a bit involved, but a wrapper script is presented to use that can handle it. Example configuration of the LSP via `vim-lsp` {{{vim let g:lsc_server_commands = { \ 'java': { \ 'name':'javalsp', \ 'enabled' : v:true, \ 'command':'/home/tino/bin/java_lsp.sh', \ }, \ 'gdscript' : { \ 'command' : '127.0.0.1:6005', \ 'enabled' : v:true, \ } \ } }}} This is for both godot and java. The `/home/tino/bin/java_lsp.sh` looks like this: {{{bash #!/bin/bash DIR=`readlink -f ~/.java_lsp_dir` WORKSPACE=$DIR/workspace /home/tino/Software/java/external_libs/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/bin/jdtls -configuration $DIR -data $WORKSPACE }}} The `-configuration` and `-data` are important because they cache stuff. Setting this to an invalid folder or something like that will cause the LSP to not be able to complete external dependencies. This is handled automatically, so make sure there is a proper folder in these. I've used the absolute path here as well just to make sure. To debug and investigae, we can set the trace level to 'verbose' an insert `tee` in between the command to pipe the input-output communication of the server. {{{bash tee /tmp/in.log | /path/to/java_lsp.sh | tee /tmp/out.log }}} This allows us to debug and check stuff in case something goes wrong. The issue with the folders didn't show up though. So I'm making a note of it here. For information on how to configure the LSP server itself, we need to look at the eclipse jdtls documentation itself. NOTE: I have not found a proper documentation link for the eclipse jdtls. A relevant github issue: https://github.com/natebosch/vim-lsc/issues/56 === Bindings === I have and bound to tab switching. So to disable some default bindings from the lsp, we have to do the following: {{{vim let g:lsc_auto_map = { \ 'defaults' : v:true, \ 'NextReference' : '', \ 'PreviousReference' : '' \} }}} For more info on configuring the plugin, just use `:help lsc` .