-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvim guide for go.txt
137 lines (90 loc) · 2.32 KB
/
vim guide for go.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
## https://github.com/leblancd/vim-go-ide
##
# install vim-gnome
sudo apt-get install vim-gnome
# change default editor
sudo update-alternatives --config editor
# install ctags
mkdir ~/.local/src
cd ~/.local/src
wget https://sourceforge.net/projects/ctags/files/ctags/5.8/ctags-5.8.tar.gz
tar -xzf ctags-5.8.tar.gz
cd ctags-5.8
./configure --prefix=$HOME/.local
make
make install
# check if ctags is ok
ctags --version | grep Exuberant
# install vim ide
git clone https://github.com/diverdane/vim-go-ide.git ~/.vim_runtime
~/.vim_runtime/install.sh
# ensure all dependencies are installed
:GoInstallBinaries
:GoUpdateBinaries
#####################################################
## vim windows
# horizontal split current buffer
:split
Ctrl-w s
# horizontal split new buffer
Ctrl-w n
# horizontal split filename
:split <FILENAME>
# vertical split current buffer
:vsplit
Ctrl-w v
# vertical split filename
:vsplit <FILENAME>
# closing
Ctrl-w c -> close current window
Ctrl-w o -> close all other windows except this one
# navigation
Ctrl-w w -> next window
Ctrl-w p -> previous window
Ctrl-w UP
Ctrl-w LEFT
Ctrl-w DOWN
Ctrl-w RIGHT
## vim tabs
# create tab
:tabnew
:tabedit <FILENAME>
# navigation
:tabn -> next tab
:tabp -> previous tab
# closing
:tabc -> close current tab
:tabo -> close all other tabs except currently open
# goto tab by number
1gt
2gt
#############################################################################
#### function key mappings ####
<F2> Directory tree window (open/close)
<F3> Line numbering (on/off)
<F4> Go to definition for a Go function, struct, etc.
<F5> Show callers for a Go function
<S-F5> Set scope (top directory) for Go callers search
<F6> Show callstack(s) for a Go function
<F7> Show this function key mapping info
<F8> Tag bar window (open/close)
<F9> Show Go snippets
<F10> Show Go key mappings
<F11> Maximize/minimize window
<F12> Scroll through installed Vim colorschemes
############################################################
#### nerd tree ####
o: open at cursor
O: open recursively
### GO commands ####
# documentation
,kk
# refactoring
,e
# definitions
,dd -> jump to
,ds -> jump to horizontal split
,dv -> jump to vertical split
,dt -> jump to in new tab
# directory tree
,T -> show current file in directory tree