Saving a file with :w takes several seconds for me, and I can't figure out the culprit. This is my .vimrc
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
Plug 'lifepillar/vim-solarized8'
" Initialize plugin system
call plug#end()
""""""""""""""""""""""
" Settings "
""""""""""""""""""""""
set nocompatible " Enables us Vim specific features
filetype off " Reset filetype detection first ...
filetype plugin indent on " ... and enable filetype detection
set ttyfast " Indicate fast terminal conn for faster redraw
set ttymouse=xterm2 " Indicate terminal type for mouse codes
set ttyscroll=3 " Speedup scrolling
set laststatus=2 " Show status line always
set encoding=utf-8 " Set default encoding to UTF-8
set autoread " Automatically read changed files
set autoindent " Enabile Autoindent
set backspace=indent,eol,start " Makes backspace key more powerful.
set incsearch " Shows the match while typing
set hlsearch " Highlight found searches
set noerrorbells " No beeps
set number " Show line numbers
set showcmd " Show me what I'm typing
set noswapfile " Don't use swapfile
set nobackup " Don't create annoying backup files
set splitright " Vertical windows should be split to right
set splitbelow " Horizontal windows should split to bottom
set autowrite " Automatically save before :next, :make etc.
" Don't need to write before calling :GoBuild!
set hidden " Buffer should still exist if window is closed
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats
set noshowmatch " Do not show matching brackets by flickering
set noshowmode " We show the mode with airline or lightline
set ignorecase " Search case insensitive...
set smartcase " ... but not it begins with upper case
set completeopt=menu,menuone " Show popup menu, even if there is one entry
set pumheight=10 " Completion window max size
set nocursorcolumn " Do not highlight column (speeds up highlighting)
set nocursorline " Do not highlight cursor (speeds up highlighting)
set lazyredraw " Wait to redraw
set belloff=all
" Strips trailing whitespace
autocmd BufWritePre * %s/\s\+$//e
" Clears search buffer with ,/
nmap <silent> ,/ :nohlsearch<CR>
" Turn off search highlight
nnoremap <leader><space> :nohlsearch<CR>
" Enable to copy to clipboard for operations like yank, delete, change and put
" http://stackoverflow.com/questions/20186975/vim-mac-how-to-copy-to-clipboard-without-pbcopy
if has('unnamedplus')
set clipboard^=unnamed
set clipboard^=unnamedplus
else
set clipboard=unnamed
endif
" Colorscheme
let g:solarized_use16 = 1
set background=light
colorscheme solarized8
""""""""""""""""""""""
" Mappings "
""""""""""""""""""""""
" Set leader shortcut to a comma ','. By default it's the backslash
let mapleader = " "
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
nnoremap n nzzzv
nnoremap N Nzzzv
" Act like D and C
nnoremap Y y$
" Settings: Mouse & Scrolling
set mouse=a
nnoremap <2-LeftMouse> <nop>
inoremap <2-LeftMouse> <nop>
vnoremap <2-LeftMouse> <nop>
nnoremap <ScrollWheelUp> <C-y>
nnoremap <ScrollWheelDown> <C-e>
nnoremap <Up> <C-y>
nnoremap <Down> <C-e>
"""""""""""""""""""""
" Plugins "
"""""""""""""""""""""
" vim-go
let g:go_fmt_command = "goimports"
let g:go_def_mode='gopls'
What can I do to speed this up?
goimportsand/or a Go linter. See if disabling vim-go helps. – Martin Tournoij Jun 19 '19 at 10:51:noa :wworks faster. If it does, inspect theau BufWritePostandau BufWritePreautocommands – Christian Brabandt Jun 19 '19 at 12:06:h :noautocmdthat's a very cool command! – statox Jun 19 '19 at 12:22