Undo not working on go files when auto-save is enabled.
First off - this is a great plugin and always ensures all my buffers are in sync with the disk.
However with go files (I use fatih/vim-go plugin), whenever I do any change, the auto-save plugin saves my work and the go plugins run a sanity check and linting.
Post that, I am not able to perform any undo action. Undo is working absolutely fine in all other files, just not with go files.
Here is my vimrc
packadd! matchit set ruler filetype plugin indent on filetype plugin on set nocompatible set history=100 if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif set autowrite set tabstop=4 set softtabstop=4 set expandtab set showcmd filetype indent on set wildmenu set showmatch set undofile set undodir=/Users/akshay/.vim/undo if empty(glob('/Users/akshay/.vim/autoload/plug.vim')) silent !curl -fLo /Users/akshay/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif call plug#begin('~/.vim/plugged') Plug 'junegunn/vim-plug' Plug 'dkarter/bullets.vim' Plug 'fatih/vim-go' Plug 'tpope/vim-fugitive' Plug '907th/vim-auto-save' Plug 'vim-airline/vim-airline' Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'ctrlpvim/ctrlp.vim' call plug#end()
let mapleader=","
nnoremap
autocmd vimenter * NERDTree autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
function! s:build_go_files() let l:file = expand('%') if l:file =~# '^\f+_test.go$' call go#test#Test(0, 1) elseif l:file =~# '^\f+.go$' call go#cmd#Build(0) endif endfunction
autocmd FileType go nmap
Sample go file
package main import ( "os" "text/template" ) type Test struct { Name string } func main() { tmp := template.New("SMS").Option("missingkey=zero").Delims("${", "}") tmp, _ = tmp.Parse("${.otp} is your OTP for ${.company} Freight") par := make(map[string]string) par["otp"] = "1234" tmp.Execute(os.Stdout, par) }
I've got absolutely the same problem. Quite annoying.