-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxvimrc
152 lines (113 loc) · 3.12 KB
/
xvimrc
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
" leader
let mapleader = ";"
" proper search
set incsearch
set ignorecase
set smartcase
set wrap
set wrapscan
" no bells
set noerrorbells
" use system pasteboard
set pasteboard
" ======= Keys ========
" quicker indentation
nnoremap > >>
nnoremap < <<
nnoremap = ==
" dont loose selection on indenting
vnoremap > >gv
vnoremap < <gv
" dot works in visual selection mode!
vnoremap . :norm.<cr>
" D deletes to the end of the line
nnoremap D d$
" Y yanks to the end of the line
nnoremap Y y$
" better line begin (H) and end (L)
noremap H ^
noremap L $
vnoremap L g_
" apply macros with Q
nnoremap Q @q
vnoremap Q :norm @q<cr>
" delete word
map ;c caw
imap jj <Esc>
map <Enter> o<ESC>
" change cursor position in insert mode
inoremap <C-h> <left>
inoremap <C-l> <right>
inoremap <C-j> <down>
inoremap <C-k> <up>
" ======= Xcode ========
" show standard editor to close assistant editor
" map ;sa :xccmd changeToGeniusEditor<CR>
" map ;aa :xccmd addAssistantEditor<CR>
" map ;ca :xccmd removeAssistantEditor<CR>
" move between assistant editors
" nnoremap <C-j> <C-w>j
" nnoremap <C-k> <C-w>k
" nnoremap <C-l> <C-w>l
" nnoremap <C-h> <C-w>h
" debug console
" map ;d :xcmenucmd Activate Console<CR>
" issue
map ;jd :xcmenucmd Jump to Definition<CR> " vim cmd:gd
map ;jn :xcmenucmd Jump to Next Issue<CR>
map ;ni :xcmenucmd Fix Next Issue<CR>
map ;jp :xcmenucmd Jump to Previous Issue<CR>
map ;pi :xcmenucmd Fix Previous Issue<CR>
" placeholder
map ;np :xccmd selectNextPlaceholder<CR>
map ;pp :xccmd selectPreviousPlaceholder<CR>
" show file or symbol
" map ;rn :xccmd revealInProjectNavigator<CR>
" map ;rs :xccmd revealInSymbolNavigator<CR>
" show in Finder
map ;in :xccmd showInFinder<CR>
" edit all in scope
" map ;ea :xccmd toggleTokenizedEditing<CR>
" fold
map ;f :xccmd fold<CR>
map ;uf :xccmd unfold<CR>
map ;ufa :xccmd unfoldAll<CR>
map ;fm :xccmd foldAllMethods<CR>
map ;ufm :xccmd unfoldAllMethods<CR>
map ;fc :xccmd foldAllComments<CR>
map ;ufc :xccmd unfoldAllComments<CR>
" project
map ;R :run<CR>
map ;S :xcmenucmd Stop<CR>
map ;B :xcmenucmd Build<CR>
map ;C :xcmenucmd Clean<CR>
" search word
map ;s viw:xccmd findSelectedTextInWorkspace<CR>
" refactor word
map ;r vim:xccmd refactorRename<CR>
" git commands
" map ;sc :xccmd commitCommand<CR>
" open Documentation and API Reference
" map ;doc :xccmd showDeveloperDocumentation<CR>
" show quick help for current word
map ;h :xhelp<CR>
" search document for text cursor points to.
" map ;sh :xccmd searchDocumentationForSelectedText<CR>
" snapshot
" map ;cs :xccmd createSnapshot<CR>
" map ;rs :xccmd restoreSnapshot<CR>
" quick open
map <C-p> :xccmd openQuickly<CR>
" navigator
nnoremap <C-n> :xccmd toggleNavigatorsVisibility<CR>
" comments
nnoremap gc :xccmd commentAndUncommentCurrentLines<CR>
vnoremap gc :xccmd commentAndUncommentCurrentLines<CR>
" ======= Miscellaneous =======
" remove whitespace
command! KillWhitespace :normal :%s/\s\+$//g<cr>
nnoremap <silent> <leader>kw :KillWhitespace<cr>:nohlsearch<cr>
" select whole buffer
nnoremap <silent> <leader>va ggVG
" yank whole buffer
nnoremap <leader>ya :let yank_view=winsaveview()<cr>ggyG<cr>:call winrestview(yank_view)<cr>