forked from ctadel/linux_
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
188 lines (157 loc) · 4.79 KB
/
vimrc
File metadata and controls
188 lines (157 loc) · 4.79 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
" ################################################ "
" ## __ .___ .__ ## "
" ## _____/ |______ __| _/____ | | ## "
" ## _/ ___\ __\__ \ / __ |/ __ \| | ## "
" ## \ \___| | / __ \_/ /_/ \ ___/| |__ ## "
" ## \___ >__| (____ /\____ |\___ >____/ ## "
" ## \/ \/ \/ \/ ## "
" ## ---------------------- Prajwal Dev ---- ## "
" ## ## "
" ################################################ "
filetype plugin on
let mapleader = ","
set nocompatible
set path+=$PWD/**
if !empty(glob("~/.vim/plugged/fzf.vim"))
call plug#begin()
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
call plug#end()
"Map Ctrl + / to fzf search for all files in current directory.
nnoremap :Files<cr>
"nnoremap :FZF -m --prompt ~/ --expect=ctrl-v,ctrl-x,ctrl-t --no-height<CR>
"Map Ctrl + \ to fzf search for git files in current directory.
nnoremap :GFiles?<cr>
"nnoremap :FZF -m --prompt ~/ 'gitfiles?> ' --expect=ctrl-v,ctrl-x,ctrl-t --no-height<CR>
endif
"Custom undo file.
set nobackup
set noswapfile
set undodir=~/.vim/undodir
set undofile
" set nowritebackup
set relativenumber
set number
" iskeyword to set a character as a part of key
"set iskeyword+=\:
set isfname+=:
set modelines=0
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set encoding=utf-8
set scrolloff=8
set autoindent
set showcmd
set wildmenu
set wildmode=list:longest,full
set ttyfast
set backspace=indent,eol,start
set laststatus=2
set ignorecase
set smartcase
set gdefault
set incsearch
set hlsearch
set nowrap
set nocursorline
function! Nun()
let cb = @%
let line_no = line(".")
if cb == ''
let cmd = "rm ~/.vim/undodir/*"
let op = system(cmd)
else
vsp new "creating new temporary buffer
wincmd l "switching to new buffer
wq "closing main buffer
let cmd = "rm ~/.vim/undodir/*"
let op = system(cmd) "performing CLEAN operation
execute "vsp".cb
wincmd l "opened and now switching to main buffer
q! "closing the temporary 'new' buffer
silent execute ":".line_no
endif
endfunction
"
"nnoremap <silent> <leader>nun :call Nun()<CR><C-g>:echo "Deleted undo files.."<CR>
:command! Clear :call Nun()
" GIT EDITS
function! GitWindow()
"tabnew
let cwd = getcwd()
let cmd = "bash ~/.vim/scripts/gs_symln.sh " . cwd
let op = system(cmd)
e ~/tmp/git_files
endfunction
nnoremap <leader>/ :call GitWindow()<cr>
" Quick Escape
inoremap jk <Esc>cal cursor(line('.'),virtcol('.'))<cr>
inoremap kj <Esc>cal cursor(line('.'),virtcol('.'))<cr>
"Quick movements
inoremap II <Esc>I
inoremap AA <Esc>A
"inoremap OO <Esc>O
"inoremap oo <Esc>o
inoremap OM <Esc>O
nnoremap OO O<Esc>
nnoremap oo o<Esc>
nnoremap j gj
nnoremap k gk
nnoremap <space> :noh<cr><C-g>
"TAB OPERATIONS HERE
nnoremap <C-a> :tabprevious<CR>
nnoremap <C-d> :tabnext<CR>
nnoremap <C-t> :tabnew<CR>
inoremap <C-a> <Esc>:tabprevious<CR>i
inoremap <C-d> <Esc>:tabnext<CR>i
inoremap <C-t> <Esc>:tabnew<CR>
function! CloseBuffer()
let cb = @%
if cb != ''
:bdelete
else
:q
endif
endfunction
nnoremap <C-w> :call CloseBuffer()<CR>:echo "Buffer closed.."<cr>
"inoremap <C-w> <Esc>:q<CR>
nnoremap <C-s> :w<CR>:echo "File Saved.."<CR>
"inoremap <C-s> <Esc>:w<CR>:echo "File Saved.."<CR>a
"Windows operations here
nnoremap <leader>a :wincmd h<CR>
nnoremap <leader>d :wincmd l<CR>
nnoremap <leader>w :wincmd k<CR>
nnoremap <leader>s :wincmd j<CR>
nnoremap <silent> <leader>+ :vertical resize +10<CR>
nnoremap <silent> <leader>- :vertical resize -10<CR>
nnoremap <leader>ps :Lex<cr> :vertical resize 30<CR>
nnoremap <leader>pg :Rg<SPACE>
nnoremap <leader>ev :vsplit $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>:echo $MYVIMRC "sourced.."<CR>
" nnoremap <leader>/ :noh<cr>
" nnoremap <tab> %
" vnoremap <tab> %
"Visual mode movements
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv
vnoremap <space> <esc>
vnoremap <leader>cp :s!^!# !<CR>:nohlsearch<CR>
vnoremap <leader>cm :s!^!%# !<CR>:nohlsearch<CR>
vnoremap <leader>cj :s!^!// !<CR>:nohlsearch<CR>
nnoremap <leader>cp :s!^!# !<CR>:nohlsearch<CR>
nnoremap <leader>cm :s!^!%# !<CR>:nohlsearch<CR>
nnoremap <leader>cj :s!^!// !<CR>:nohlsearch<CR>
"nnoremap <leader>w :w!<CR>
nnoremap <leader>ft vatzf
nnoremap <leader>fB va{zf
nnoremap <leader>fb va(zf
nnoremap N Nzz
nnoremap n nzz
"Command mode remaps
cnoremap jk <C-u><esc><C-g>
"highlight current line
"set cul
"hi CursorLine term=none cterm=none ctermbg=195
nnoremap <leader>gf :wincmd gf<cr>