-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
.vimrc
114 lines (105 loc) · 3.52 KB
/
.vimrc
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
set nocompatible " Disable vi compatibilty
set encoding=utf-8 " Use UTF-8
set showmatch " Show matching brackets
set ignorecase " Do case insensitive matching
set incsearch " Show partial matches for a search phrase
set number " Show numbers
set relativenumber " Show relative numbers
set nohlsearch " clear highlights after search
set tabstop=4 " Tab size
set shiftwidth=4 " Indentation size
set softtabstop=4 " Tabs/Spaces interop
set expandtab " Expands tab to spaces
set nomodeline " Disable as a security precaution
set mouse=a " Enable mouse mode
set hlsearch " Enable search highlight
set wildmenu " Enable wildmenu
set path+=** " Search recursively with :find
set splitbelow " Natural splits
set splitright
set autoindent " Enable autoindent
set complete-=i " Better completion
set smarttab " Better tabs
set ttimeout " Set timeout
set ttimeoutlen=100
set synmaxcol=500 " Syntax limit
set laststatus=2 " Always show status line
set ruler " Show cursor position
set scrolloff=8 " Scroll offset
set sidescrolloff=5
set autoread " Reload files on change
set tabpagemax=50 " More tabs
set history=1000 " More history
set viminfo^=! " Better viminfo
set backspace=indent,eol,start " Delete everything
set formatoptions+=j " Delete comment character when joining
set listchars=tab:,nbsp:_,trail:,extends:>,precedes:<
set list " Highlight non whitespace characters
set nrformats-=octal " 007 != 010
set sessionoptions-=options
set viewoptions-=option
set cursorline " Highlight current line
set exrc " Use vimrc from local dir
set hidden " Enable switching with modified buffers
set undolevels=999 " Lots of these
set undodir=$HOME/.local/state/vim/undo " Enable undo dir
set undofile " Enable persistent undos across files
setlocal spell spelllang=en "Set spell check language to en
setlocal spell! " Disable spellchecking by default
syntax enable " Turn on syntax highlighting
" Have Vim jump to the last position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\""
endif
" Remove trailing whitespace on write
if has("autocmd")
autocmd BufWritePre * %s/\s\+$//e
endif
" Load files using fzf
function! FZF() abort
let l:tempname = tempname()
execute 'silent !fzf --multi ' . '| awk ''{ print $1":1:0" }'' > ' . fnameescape(l:tempname)
try
execute 'cfile ' . l:tempname
redraw!
finally
call delete(l:tempname)
endtry
endfunction
command! -nargs=* Files call FZF()
let g:netrw_liststyle = 3
" Keybindings
let mapleader = ' '
inoremap jj <Esc>
nmap Q :qa!<CR>
nmap <leader>e :Lexplore<CR>
nmap <leader>f :Files<cr>
nmap <leader>qq :q<CR>
nmap <leader>r :source ~/.vimrc<CR>
nmap <leader>s :setlocal spell!<CR>
nmap <leader>S :nohlsearch<CR>
nmap <leader>t :term<CR>
nmap <leader>ww :w<CR>
nmap <leader>x :wq<CR>
nmap H :bprevious<CR>
nmap L :bnext<CR>
nmap <C-h> <C-w>h
nmap <C-l> <C-w>l
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
" Copy Paste from X11 Clipboard
vmap <Leader>yy :!xclip -f -sel clip<CR>
map <Leader>pp mz:-1r !xclip -o -sel clip<CR>`z
" Drag Visual selections
vnoremap K xkP`[V`]
vnoremap J xp`[V`]
vnoremap L >gv
vnoremap H <gv
" tmux true color fix
if (has("termguicolors"))
set termguicolors
endif
" Always use terminal background
autocmd ColorScheme * highlight! Normal ctermbg=NONE guibg=NONE
autocmd ColorScheme * highlight! Terminal ctermbg=NONE guibg=NONE
colorscheme slate