Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirecting the leader key to run my script #1957

Closed
MartinDelille opened this issue Sep 9, 2018 · 2 comments
Closed

Redirecting the leader key to run my script #1957

MartinDelille opened this issue Sep 9, 2018 · 2 comments

Comments

@MartinDelille
Copy link

What did you do? (required. The issue will be closed when not provided.)

I edited ~/.vim/ftplugin/go.vim to map the leader key:

map <Leader>m :!clear;go run %<Enter>

What did you expect to happen?

When pressing <leader>+m, my script should run.

What happened instead?

I have the following output:

make: *** No targets specified and no makefile found.  Stop.

shell returned 2

Press ENTER or type command to continue

This is due to the fact that <leader>+m is configure to run make in .vimrc.

Configuration (MUST fill this out):

  • vim-go version:

  • vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

  • Vim version (first three lines from :version):

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Nov 29 2017 18:37:46)
Included patches: 1-503, 505-680, 682-1283
Compiled by root@apple.com
  • Go version (go version):
go version go1.10.3 darwin/amd64
  • Go environment (go env):
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/martin/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/martin/dev/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10.3/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rv/x9flf_k97zq_bfv790jhhtwc0000gn/T/go-build932926580=/tmp/go-build -gno-record-gcc-switches -fno-common"
@arp242
Copy link
Contributor

arp242 commented Sep 9, 2018

I am a bit confused how this is a vim-go issue? vim-go doesn't map <Leader>m, and you're not calling any vim-go functions?

You can use :GoRun or :GoRun %.

As for why your mapping is wrong? That'll be difficult to say anything meaningful about without seeing what you're doing exactly.

@arp242 arp242 closed this as completed Sep 9, 2018
@MartinDelille
Copy link
Author

Ok the problem was that I am using vim-plug to manage my plugin and the ftplugin folder was ignored.

I created my own plugin and add it here to fix my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants