-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
71 lines (53 loc) · 1.31 KB
/
init.vim
File metadata and controls
71 lines (53 loc) · 1.31 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
" Vimrc
" => General
" Set history max
set history=500
" Filetype plugins
filetype plugin on
filetype indent on
" Set numbers on
set number
" Cursor
set cursorline
" Set automatic reloading when files are changed externally
set autoread
au FocusGained,BufEnter * checktime
" Leader key mapping
let mapleader = "\\"
" Fast saving
nmap <leader>w :w!<cr>
" Tabular stuff
set expandtab
set smarttab
set shiftwidth=4
set tabstop=4
set softtabstop=4
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
" => Searching
set hlsearch
set ignorecase
set incsearch
" Visual mode search
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
" Clear search
nnoremap <CR> :let @/ = ""<CR>
" Helper functions
function! VisualSelection(direction, extra_filter) range
let l:saved_reg = @"
execute "normal! vgvy"
let l:pattern = escape(@", "\\/.*'$^~[]")
let l:pattern = substitute(l:pattern, "\n$", "", "")
if a:direction == 'gv'
call CmdLine("Ack '" . l:pattern . "' " )
elseif a:direction == 'replace'
call CmdLine("%s" . '/'. l:pattern . '/')
endif
let @/ = l:pattern
let @" = l:saved_reg
endfunction
" Sourcing
source ~/.config/nvim/plugins.vim
source ~/.config/nvim/conf.vim