├── Dockerfile ├── README.md ├── neovim-init-lsp-cmp-rust-tools.lua ├── run.sh ├── stylua.toml └── unmaintained ├── neovim-init-lsp-cmp-rust-tools.vim ├── neovim-init-lsp.vim ├── vim-vimrc-coc.vim └── vim-vimrc.vim /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | 5 | USER root 6 | ENV USER=root 7 | 8 | # Install vim and neovim 9 | RUN apt-get update \ 10 | # Install common deps 11 | && apt-get install -y build-essential curl git exuberant-ctags software-properties-common gnupg \ 12 | # Install rust-analyzer 13 | && curl -L -o rust-analyzer-x86_64-unknown-linux-gnu.gz https://github.com/rust-analyzer/rust-analyzer/releases/download/nightly/rust-analyzer-x86_64-unknown-linux-gnu.gz \ 14 | && gzip -d rust-analyzer-x86_64-unknown-linux-gnu.gz \ 15 | && mkdir -p ~/.local/bin \ 16 | && mv rust-analyzer-x86_64-unknown-linux-gnu ~/.local/bin/rust-analyzer \ 17 | && chmod +x ~/.local/bin/rust-analyzer \ 18 | # Node required for vim-vimrc-coc example 19 | && curl -sL https://deb.nodesource.com/setup_14.x | bash - \ 20 | && apt-get install nodejs \ 21 | # Setup latest vim with vim-plug 22 | && apt-get install -y vim \ 23 | && curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ 24 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \ 25 | # Setup latest neovim with vim-plug 26 | && add-apt-repository -y ppa:neovim-ppa/unstable \ 27 | && apt-get install -y neovim \ 28 | && sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ 29 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' \ 30 | && mkdir -p ~/.config/nvim/ \ 31 | && apt-get clean 32 | 33 | # Install Rust 34 | RUN curl https://sh.rustup.rs -sSf | bash -s -- -y 35 | ENV PATH="/root/.local/bin:/root/.cargo/bin:${PATH}" 36 | 37 | RUN echo "nvim ./src/main.rs" > ~/.bash_history && cd ~/ && cargo new test_app 38 | 39 | CMD ["/bin/bash"] 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # neovim-rust 2 | 3 | Collection of Neovim and Vim configurations to kickstart your 4 | Rust development experience. 5 | 6 | # Examples 7 | 8 | Each example provides `Prerequisites` and `Steps` as comments at the top of 9 | each file. 10 | 11 | The only maintained file is `neovim-init-lsp-cmp-rust-tools.lua`, other examples are in `./unmaintained/` 12 | 13 | # Try for yourself! 14 | 15 | Each example can be tested with the provided Dockerfile! This allows you to 16 | test a configuration without changing your system. The Dockerfile 17 | provides all the dependencies required to run each setup. 18 | 19 | See the `run.sh` script for details. This will start a docker instance and run `PlugInstall`. 20 | 21 | For example, `./run.sh ./neovim-init-lsp-cmp-rust-tools.lua` to test this configuration. 22 | 23 | Once in the container, navigate to `~/test_app` to try the configuration on some rust code. 24 | -------------------------------------------------------------------------------- /neovim-init-lsp-cmp-rust-tools.lua: -------------------------------------------------------------------------------- 1 | -- This is an example on how rust-analyzer can be configured using rust-tools 2 | -- 3 | -- Prerequisites: 4 | -- - neovim >= 0.8 5 | -- - rust-analyzer: https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary 6 | 7 | local ensure_packer = function() 8 | local fn = vim.fn 9 | local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim" 10 | if fn.empty(fn.glob(install_path)) > 0 then 11 | fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path }) 12 | vim.cmd([[packadd packer.nvim]]) 13 | return true 14 | end 15 | return false 16 | end 17 | 18 | local packer_bootstrap = ensure_packer() 19 | 20 | require("packer").init({ 21 | autoremove = true, 22 | }) 23 | require("packer").startup(function(use) 24 | -- Packer can manage itself 25 | use("wbthomason/packer.nvim") 26 | -- Collection of common configurations for the Nvim LSP client 27 | use("neovim/nvim-lspconfig") 28 | -- Visualize lsp progress 29 | use({ 30 | "j-hui/fidget.nvim", 31 | config = function() 32 | require("fidget").setup() 33 | end 34 | }) 35 | 36 | -- Autocompletion framework 37 | use("hrsh7th/nvim-cmp") 38 | use({ 39 | -- cmp LSP completion 40 | "hrsh7th/cmp-nvim-lsp", 41 | -- cmp Snippet completion 42 | "hrsh7th/cmp-vsnip", 43 | -- cmp Path completion 44 | "hrsh7th/cmp-path", 45 | "hrsh7th/cmp-buffer", 46 | after = { "hrsh7th/nvim-cmp" }, 47 | requires = { "hrsh7th/nvim-cmp" }, 48 | }) 49 | -- See hrsh7th other plugins for more great completion sources! 50 | -- Snippet engine 51 | use('hrsh7th/vim-vsnip') 52 | -- Adds extra functionality over rust analyzer 53 | use("simrat39/rust-tools.nvim") 54 | 55 | -- Optional 56 | use("nvim-lua/popup.nvim") 57 | use("nvim-lua/plenary.nvim") 58 | use("nvim-telescope/telescope.nvim") 59 | 60 | -- Some color scheme other then default 61 | use("arcticicestudio/nord-vim") 62 | end) 63 | 64 | -- the first run will install packer and our plugins 65 | if packer_bootstrap then 66 | require("packer").sync() 67 | return 68 | end 69 | 70 | vim.cmd([[ colorscheme nord ]]) 71 | 72 | -- Set completeopt to have a better completion experience 73 | -- :help completeopt 74 | -- menuone: popup even when there's only one match 75 | -- noinsert: Do not insert text until a selection is made 76 | -- noselect: Do not auto-select, nvim-cmp plugin will handle this for us. 77 | vim.o.completeopt = "menuone,noinsert,noselect" 78 | 79 | -- Avoid showing extra messages when using completion 80 | vim.opt.shortmess = vim.opt.shortmess + "c" 81 | 82 | local function on_attach(client, buffer) 83 | local keymap_opts = { buffer = buffer } 84 | -- Code navigation and shortcuts 85 | vim.keymap.set("n", "", vim.lsp.buf.definition, keymap_opts) 86 | vim.keymap.set("n", "K", vim.lsp.buf.hover, keymap_opts) 87 | vim.keymap.set("n", "gD", vim.lsp.buf.implementation, keymap_opts) 88 | vim.keymap.set("n", "", vim.lsp.buf.signature_help, keymap_opts) 89 | vim.keymap.set("n", "1gD", vim.lsp.buf.type_definition, keymap_opts) 90 | vim.keymap.set("n", "gr", vim.lsp.buf.references, keymap_opts) 91 | vim.keymap.set("n", "g0", vim.lsp.buf.document_symbol, keymap_opts) 92 | vim.keymap.set("n", "gW", vim.lsp.buf.workspace_symbol, keymap_opts) 93 | vim.keymap.set("n", "gd", vim.lsp.buf.definition, keymap_opts) 94 | vim.keymap.set("n", "ga", vim.lsp.buf.code_action, keymap_opts) 95 | 96 | -- Show diagnostic popup on cursor hover 97 | local diag_float_grp = vim.api.nvim_create_augroup("DiagnosticFloat", { clear = true }) 98 | vim.api.nvim_create_autocmd("CursorHold", { 99 | callback = function() 100 | vim.diagnostic.open_float(nil, { focusable = false }) 101 | end, 102 | group = diag_float_grp, 103 | }) 104 | 105 | -- Goto previous/next diagnostic warning/error 106 | vim.keymap.set("n", "g[", vim.diagnostic.goto_prev, keymap_opts) 107 | vim.keymap.set("n", "g]", vim.diagnostic.goto_next, keymap_opts) 108 | end 109 | 110 | -- Configure LSP through rust-tools.nvim plugin. 111 | -- rust-tools will configure and enable certain LSP features for us. 112 | -- See https://github.com/simrat39/rust-tools.nvim#configuration 113 | local opts = { 114 | tools = { 115 | runnables = { 116 | use_telescope = true, 117 | }, 118 | inlay_hints = { 119 | auto = true, 120 | show_parameter_hints = false, 121 | parameter_hints_prefix = "", 122 | other_hints_prefix = "", 123 | }, 124 | }, 125 | 126 | -- all the opts to send to nvim-lspconfig 127 | -- these override the defaults set by rust-tools.nvim 128 | -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer 129 | server = { 130 | -- on_attach is a callback called when the language server attachs to the buffer 131 | on_attach = on_attach, 132 | settings = { 133 | -- to enable rust-analyzer settings visit: 134 | -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc 135 | ["rust-analyzer"] = { 136 | -- enable clippy on save 137 | checkOnSave = { 138 | command = "clippy", 139 | }, 140 | }, 141 | }, 142 | }, 143 | } 144 | 145 | require("rust-tools").setup(opts) 146 | 147 | -- Setup Completion 148 | -- See https://github.com/hrsh7th/nvim-cmp#basic-configuration 149 | local cmp = require("cmp") 150 | cmp.setup({ 151 | snippet = { 152 | expand = function(args) 153 | vim.fn["vsnip#anonymous"](args.body) 154 | end, 155 | }, 156 | mapping = { 157 | [""] = cmp.mapping.select_prev_item(), 158 | [""] = cmp.mapping.select_next_item(), 159 | -- Add tab support 160 | [""] = cmp.mapping.select_prev_item(), 161 | [""] = cmp.mapping.select_next_item(), 162 | [""] = cmp.mapping.scroll_docs(-4), 163 | [""] = cmp.mapping.scroll_docs(4), 164 | [""] = cmp.mapping.complete(), 165 | [""] = cmp.mapping.close(), 166 | [""] = cmp.mapping.confirm({ 167 | behavior = cmp.ConfirmBehavior.Insert, 168 | select = true, 169 | }), 170 | }, 171 | 172 | -- Installed sources 173 | sources = { 174 | { name = "nvim_lsp" }, 175 | { name = "vsnip" }, 176 | { name = "path" }, 177 | { name = "buffer" }, 178 | }, 179 | }) 180 | 181 | -- have a fixed column for the diagnostics to appear in 182 | -- this removes the jitter when warnings/errors flow in 183 | vim.wo.signcolumn = "yes" 184 | 185 | -- " Set updatetime for CursorHold 186 | -- " 300ms of no cursor movement to trigger CursorHold 187 | -- set updatetime=300 188 | vim.opt.updatetime = 100 189 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo docker build -t vim-rust . 4 | 5 | CONFIG_FILE="$1" 6 | 7 | if [[ `basename $CONFIG_FILE` == neovim*.lua ]] 8 | then 9 | EDITOR_BIN="nvim" 10 | MOUNT_PATH="/root/.config/nvim/init.lua" 11 | PLUGIN_SYS="packer" 12 | elif [[ `basename $CONFIG_FILE` == neovim*.vim ]] 13 | then 14 | EDITOR_BIN="nvim" 15 | MOUNT_PATH="/root/.config/nvim/init.vim" 16 | PLUGIN_SYS="plug" 17 | elif [[ `basename $CONFIG_FILE` == vim* ]] 18 | then 19 | EDITOR_BIN="vim" 20 | MOUNT_PATH="/root/.vimrc" 21 | PLUGIN_SYS="plug" 22 | else 23 | echo "Does not start with 'neovim' or 'vim' cannot select editor" 24 | fi 25 | 26 | CONFIG_FILE=`readlink -f $CONFIG_FILE` 27 | 28 | echo "Editor: $EDITOR_BIN" 29 | echo "Mount: $CONFIG_FILE -> $MOUNT_PATH" 30 | 31 | if [[ $PLUGIN_SYS == "packer" ]] 32 | then 33 | sudo docker run -v $CONFIG_FILE:$MOUNT_PATH -it vim-rust /bin/bash -c "cd ~/test_app && nvim --headless -c 'sleep 5' +qa && /bin/bash" 34 | elif [[ $PLUGIN_SYS == "plug" ]] 35 | then 36 | sudo docker run -v $CONFIG_FILE:$MOUNT_PATH -it vim-rust /bin/bash -c "cd ~/test_app && $EDITOR_BIN -E -s -u NONE $MOUNT_PATH +so +PlugInstall +qa || /bin/bash" 37 | else 38 | echo "Error: Could not determine how to run." 39 | fi 40 | -------------------------------------------------------------------------------- /stylua.toml: -------------------------------------------------------------------------------- 1 | indent_type = "Spaces" 2 | indent_width = 2 3 | column_width = 120 4 | -------------------------------------------------------------------------------- /unmaintained/neovim-init-lsp-cmp-rust-tools.vim: -------------------------------------------------------------------------------- 1 | " This is an example on how rust-analyzer can be configured using rust-tools 2 | 3 | " Prerequisites: 4 | " - neovim >= 0.8 5 | " - rust-analyzer: https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary 6 | 7 | " Steps: 8 | " - :PlugInstall 9 | " - Restart 10 | 11 | call plug#begin('~/.vim/plugged') 12 | 13 | " Collection of common configurations for the Nvim LSP client 14 | Plug 'neovim/nvim-lspconfig' 15 | 16 | " Autocompletion framework 17 | Plug 'hrsh7th/nvim-cmp' 18 | " cmp LSP completion 19 | Plug 'hrsh7th/cmp-nvim-lsp' 20 | " cmp Snippet completion 21 | Plug 'hrsh7th/cmp-vsnip' 22 | " cmp Path completion 23 | Plug 'hrsh7th/cmp-path' 24 | Plug 'hrsh7th/cmp-buffer' 25 | " See hrsh7th other plugins for more great completion sources! 26 | 27 | " Adds extra functionality over rust analyzer 28 | Plug 'simrat39/rust-tools.nvim' 29 | 30 | " Snippet engine 31 | Plug 'hrsh7th/vim-vsnip' 32 | 33 | " Optional 34 | Plug 'nvim-lua/popup.nvim' 35 | Plug 'nvim-lua/plenary.nvim' 36 | Plug 'nvim-telescope/telescope.nvim' 37 | 38 | " Some color scheme other then default 39 | Plug 'arcticicestudio/nord-vim' 40 | 41 | call plug#end() 42 | 43 | colorscheme nord 44 | 45 | 46 | " Set completeopt to have a better completion experience 47 | " :help completeopt 48 | " menuone: popup even when there's only one match 49 | " noinsert: Do not insert text until a selection is made 50 | " noselect: Do not select, force user to select one from the menu 51 | set completeopt=menuone,noinsert,noselect 52 | 53 | " Avoid showing extra messages when using completion 54 | set shortmess+=c 55 | 56 | " Configure LSP through rust-tools.nvim plugin. 57 | " rust-tools will configure and enable certain LSP features for us. 58 | " See https://github.com/simrat39/rust-tools.nvim#configuration 59 | lua < lua vim.lsp.buf.definition() 102 | nnoremap K lua vim.lsp.buf.hover() 103 | nnoremap gD lua vim.lsp.buf.implementation() 104 | nnoremap lua vim.lsp.buf.signature_help() 105 | nnoremap 1gD lua vim.lsp.buf.type_definition() 106 | nnoremap gr lua vim.lsp.buf.references() 107 | nnoremap g0 lua vim.lsp.buf.document_symbol() 108 | nnoremap gW lua vim.lsp.buf.workspace_symbol() 109 | nnoremap gd lua vim.lsp.buf.definition() 110 | 111 | " Quick-fix 112 | nnoremap ga lua vim.lsp.buf.code_action() 113 | 114 | " Setup Completion 115 | " See https://github.com/hrsh7th/nvim-cmp#basic-configuration 116 | lua <'] = cmp.mapping.select_prev_item(), 126 | [''] = cmp.mapping.select_next_item(), 127 | -- Add tab support 128 | [''] = cmp.mapping.select_prev_item(), 129 | [''] = cmp.mapping.select_next_item(), 130 | [''] = cmp.mapping.scroll_docs(-4), 131 | [''] = cmp.mapping.scroll_docs(4), 132 | [''] = cmp.mapping.complete(), 133 | [''] = cmp.mapping.close(), 134 | [''] = cmp.mapping.confirm({ 135 | behavior = cmp.ConfirmBehavior.Insert, 136 | select = true, 137 | }) 138 | }, 139 | 140 | -- Installed sources 141 | sources = { 142 | { name = 'nvim_lsp' }, 143 | { name = 'vsnip' }, 144 | { name = 'path' }, 145 | { name = 'buffer' }, 146 | }, 147 | }) 148 | EOF 149 | 150 | " have a fixed column for the diagnostics to appear in 151 | " this removes the jitter when warnings/errors flow in 152 | set signcolumn=yes 153 | 154 | " Set updatetime for CursorHold 155 | " 300ms of no cursor movement to trigger CursorHold 156 | set updatetime=300 157 | " Show diagnostic popup on cursor hover 158 | autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) 159 | 160 | " Goto previous/next diagnostic warning/error 161 | nnoremap g[ lua vim.diagnostic.goto_prev() 162 | nnoremap g] lua vim.diagnostic.goto_next() 163 | 164 | -------------------------------------------------------------------------------- /unmaintained/neovim-init-lsp.vim: -------------------------------------------------------------------------------- 1 | " This is an example on how rust-analyzer can be configured using lsp-config 2 | 3 | " Prerequisites: 4 | " - neovim >= 0.8 5 | " - rust-analyzer: https://rust-analyzer.github.io/manual.html#rust-analyzer-language-server-binary 6 | 7 | " Steps: 8 | " - :PlugInstall 9 | " - Restart 10 | 11 | call plug#begin('~/.vim/plugged') 12 | 13 | " Collection of common configurations for the Nvim LSP client 14 | Plug 'neovim/nvim-lspconfig' 15 | 16 | " Extentions to built-in LSP, for example, providing type inlay hints 17 | Plug 'nvim-lua/lsp_extensions.nvim' 18 | 19 | " Autocompletion framework 20 | Plug 'hrsh7th/nvim-cmp' 21 | " cmp LSP completion 22 | Plug 'hrsh7th/cmp-nvim-lsp' 23 | " cmp Snippet completion 24 | Plug 'hrsh7th/cmp-vsnip' 25 | " cmp Path completion 26 | Plug 'hrsh7th/cmp-path' 27 | Plug 'hrsh7th/cmp-buffer' 28 | " See hrsh7th other plugins for more great completion sources! 29 | 30 | " Snippet engine 31 | Plug 'hrsh7th/vim-vsnip' 32 | 33 | " Some color scheme other then default 34 | Plug 'arcticicestudio/nord-vim' 35 | 36 | call plug#end() 37 | 38 | colorscheme nord 39 | 40 | 41 | " Set completeopt to have a better completion experience 42 | " :help completeopt 43 | " menuone: popup even when there's only one match 44 | " noinsert: Do not insert text until a selection is made 45 | " noselect: Do not select, force user to select one from the menu 46 | set completeopt=menuone,noinsert,noselect 47 | 48 | " Avoid showing extra messages when using completion 49 | set shortmess+=c 50 | 51 | 52 | " Configure lsp 53 | " https://github.com/neovim/nvim-lspconfig#rust_analyzer 54 | lua < lua vim.lsp.buf.definition() 92 | nnoremap K lua vim.lsp.buf.hover() 93 | nnoremap gD lua vim.lsp.buf.implementation() 94 | nnoremap lua vim.lsp.buf.signature_help() 95 | nnoremap 1gD lua vim.lsp.buf.type_definition() 96 | nnoremap gr lua vim.lsp.buf.references() 97 | nnoremap g0 lua vim.lsp.buf.document_symbol() 98 | nnoremap gW lua vim.lsp.buf.workspace_symbol() 99 | nnoremap gd lua vim.lsp.buf.definition() 100 | 101 | " Quick-fix 102 | nnoremap ga lua vim.lsp.buf.code_action() 103 | 104 | " Setup Completion 105 | " See https://github.com/hrsh7th/nvim-cmp#basic-configuration 106 | lua <'] = cmp.mapping.select_prev_item(), 116 | [''] = cmp.mapping.select_next_item(), 117 | -- Add tab support 118 | [''] = cmp.mapping.select_prev_item(), 119 | [''] = cmp.mapping.select_next_item(), 120 | [''] = cmp.mapping.scroll_docs(-4), 121 | [''] = cmp.mapping.scroll_docs(4), 122 | [''] = cmp.mapping.complete(), 123 | [''] = cmp.mapping.close(), 124 | [''] = cmp.mapping.confirm({ 125 | behavior = cmp.ConfirmBehavior.Insert, 126 | select = true, 127 | }) 128 | }, 129 | 130 | -- Installed sources 131 | sources = { 132 | { name = 'nvim_lsp' }, 133 | { name = 'vsnip' }, 134 | { name = 'path' }, 135 | { name = 'buffer' }, 136 | }, 137 | }) 138 | EOF 139 | 140 | " have a fixed column for the diagnostics to appear in 141 | " this removes the jitter when warnings/errors flow in 142 | set signcolumn=yes 143 | 144 | " Set updatetime for CursorHold 145 | " 300ms of no cursor movement to trigger CursorHold 146 | set updatetime=300 147 | " Show diagnostic popup on cursor hover 148 | autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) 149 | 150 | 151 | " Goto previous/next diagnostic warning/error 152 | nnoremap g[ lua vim.diagnostic.goto_prev() 153 | nnoremap g] lua vim.diagnostic.goto_next() 154 | 155 | " Enable type inlay hints 156 | autocmd CursorMoved,InsertLeave,BufEnter,BufWinEnter,TabEnter,BufWritePost *.rs 157 | \ lua require'lsp_extensions'.inlay_hints{ prefix = '', highlight = "Comment", enabled = {"TypeHint", "ChainingHint", "ParameterHint"} } 158 | -------------------------------------------------------------------------------- /unmaintained/vim-vimrc-coc.vim: -------------------------------------------------------------------------------- 1 | " Prerequisites: 2 | " - coc needs vim >= 8.1.1719 to support features like popup and text property 3 | " - nodejs: curl -sL install-node.now.sh/lts | bash 4 | 5 | " Steps: 6 | " - :PlugInstall 7 | " - :CocInstall coc-rust-analyzer 8 | " - Restart 9 | 10 | call plug#begin('~/.vim/plugged') 11 | 12 | " coc: Conquer of completion 13 | Plug 'neoclide/coc.nvim', {'branch': 'release'} 14 | 15 | call plug#end() 16 | 17 | syntax enable 18 | filetype plugin indent on 19 | 20 | " This is a highly configurable plugin. 21 | " 22 | " For features such as goto definition, tab completion, documentation preview 23 | " and more, see the sample configuration: 24 | " https://github.com/neoclide/coc.nvim#example-vim-configuration 25 | 26 | " Set completeopt to have a better completion experience 27 | set completeopt=menuone,noinsert,noselect 28 | 29 | " Avoid showing extra messages when using completion 30 | set shortmess+=c 31 | 32 | " Code navigation 33 | nmap gd (coc-definition) 34 | nmap gy (coc-type-definition) 35 | nmap gi (coc-implementation) 36 | nmap gr (coc-references) 37 | 38 | " Trigger completion with 39 | " found in :help completion 40 | function! s:check_back_space() abort 41 | let col = col('.') - 1 42 | return !col || getline('.')[col - 1] =~ '\s' 43 | endfunction 44 | 45 | inoremap 46 | \ pumvisible() ? "\" : 47 | \ check_back_space() ? "\" : 48 | \ completion#trigger_completion() 49 | 50 | 51 | " Goto previous/next diagnostic warning/error 52 | nmap [g (coc-diagnostic-prev) 53 | nmap ]g (coc-diagnostic-next) 54 | 55 | " Use K to show documentation in preview window. 56 | nnoremap K :call show_documentation() 57 | 58 | function! s:show_documentation() 59 | if (index(['vim','help'], &filetype) >= 0) 60 | execute 'h '.expand('') 61 | else 62 | call CocActionAsync('doHover') 63 | endif 64 | endfunction 65 | -------------------------------------------------------------------------------- /unmaintained/vim-vimrc.vim: -------------------------------------------------------------------------------- 1 | " Prerequisites: 2 | " - vim-plug: https://github.com/junegunn/vim-plug 3 | " - For tagbar: a tag generator (i.e. apt-get install exuberant-ctags) 4 | 5 | " Steps: 6 | " - :PlugInstall 7 | " - Restart 8 | 9 | call plug#begin('~/.vim/plugged') 10 | 11 | " Syntastic is a syntax checking plugin 12 | " It runs files through external syntax checkers and displays any 13 | " resulting errors to the user 14 | Plug 'scrooloose/syntastic' 15 | 16 | " Tagbar will generate tags in memory, allowing you to navitage to 17 | " structs, functions, etc. In the current file 18 | Plug 'preservim/tagbar' 19 | 20 | " Rust file detection, syntax highlighting, formatting, 21 | " Syntastic integration, and more 22 | Plug 'rust-lang/rust.vim' 23 | 24 | call plug#end() 25 | 26 | syntax enable 27 | filetype plugin indent on 28 | 29 | " Toggle tagbar 30 | nmap :TagbarToggle 31 | --------------------------------------------------------------------------------