-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase.vim
82 lines (67 loc) · 1.82 KB
/
base.vim
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
syntax on
set noerrorbells
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set startofline
set number
set cursorline
set ignorecase
set smartcase
set wrap
set noswapfile
set nobackup
set undodir=~/.vim/undodir
set undofile
set incsearch
set exrc " enables reading of '.nvimrc' or '.exrc' in cd
set noshowmode
set updatetime=100
"
set hidden "" dont have to write files to disk to switch from them in buffer
" let $RTP=split(&runtimepath, ',')[0]
" let $RC="$HOME/.vim/vimrc"
"setlocal colorcolumn=80
"set path=.,** " path is current file and working directory and all of its children
set cmdheight=2 " give more space for displaying messages
" LaTeX glyphify disable
let g:tex_conceal = 0 " dont glyphify characters
" Set default shell for neovim terminal buffer
set shell=/opt/homebrew/bin/zsh
" Asterisk works same in visual mode as normal mode.
function! s:getSelectedText()
let l:old_reg = getreg('"')
let l:old_regtype = getregtype('"')
norm gvy
let l:ret = getreg('"')
call setreg('"', l:old_reg, l:old_regtype)
exe "norm \<Esc>"
return l:ret
endfunction
vnoremap <silent> * :call setreg("/",
\ substitute(<SID>getSelectedText(),
\ '\_s\+',
\ '\\_s\\+', 'g')
\ )<Cr>n
vnoremap <silent> # :call setreg("?",
\ substitute(<SID>getSelectedText(),
\ '\_s\+',
\ '\\_s\\+', 'g')
\ )<Cr>n
" Change \<Tab> behavior based on location for incsearch functionality
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-N>"
endif
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>
" :Spell => enable spelling command
command Spell :setlocal spell spelllang=en_us
" Remember cursor pos
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif