blob: 65e980e57dfbd693a44e65bb422fa28a5b94bc4d (
plain)
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
|
" Manage plugins using vim-plug
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
autocmd VimEnter * PlugInstall
endif
call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"'))
Plug 'chrisbra/Colorizer'
Plug 'junegunn/goyo.vim'
Plug 'jiangmiao/auto-pairs'
call plug#end()
" Basic options
syntax on " Enable syntax highlighting
set number relativenumber " Enable relative line numbers
set linebreak " Word wrap
set wildmode=longest,list,full " Enable file auto-complete
set splitbelow splitright " Open splits on bottom/right instead of top/left
set hlsearch " Highlight search hits
set ignorecase " Case-insensitive search...
set smartcase " ...Unless the search term is capital
set autoindent " Keeps indentation on new lines
set mouse=a " Because sometimes it's just easier to use the mouse
set autochdir " Always change directory to current file
" Keybindings
" Set leader-key to comma
let mapleader =","
" Invoke goyo with comma-m
map <leader>m :Goyo<CR>
" Invoke spellcheck mode with comma-o
map <leader>l :setlocal spell! spelllang=en_us<CR>
" Invoke spellcheck mode with comma-o
map <leader>c :set cursorcolumn!<CR>
" Send cursor to top or bottom currently visible line with ctrl-jk
" map <C-j> :call cursor(line('w$'),col('.'))<CR>
" map <C-k> :call cursor(line('w0'),col('.'))<CR>
map <C-j> <C-d>
map <C-k> <C-u>
map <C-h> 0
map <C-l> $
" Faster split navigation (alt-hjlk, as opposed to ctrl-w + hjlk)
"map <A-h> <C-w>h
"map <A-j> <C-w>j
"map <A-k> <C-w>k
"map <A-l> <C-w>l
" Colorscheme for root and normal users (since vimrc is just symlinked to the root user's home)
if ($USER) == 'root'
colorscheme zellner
else
if empty($DISPLAY)
colorscheme default
else
set bg=dark
let g:gruvbox_contrast_dark = 'hard'
colorscheme gruvbox-timmy
endif
endif
" Behaviors exclusive to either the tty or a terminal emulator in a graphical environment
if empty($DISPLAY)
" Clear the tty screen after exiting vim
"autocmd QuitPre * :!clear
else
set cursorline " Highlight current line
" Change the terminal emulator's window title and class name to vim
autocmd BufEnter * :set title
autocmd VimEnter * :silent exec "!/home/timmy/scripts/st/settitle Vim"
autocmd VimLeave * :silent exec "!/home/timmy/scripts/st/settitle st"
let &titleold="st"
endif
" Set the cursor on a per-mode basis
let &t_SI.="\<Esc>[6 q" " Insert mode
let &t_SR.="\<Esc>[4 q" " Replace mode
let &t_EI.="\<Esc>[2 q" " Normal mode
let &t_ti.="\<Esc>[2 q" " Cursor on startup
" Automatically deletes all trailing whitespace and newlines at end of file on save
"autocmd BufWritePre * let ccc=col('.') " Set current cursor column
"autocmd BufWritePre * let ccl=line('.') " Set current cursor line
"autocmd BufWritePre * %s/\s\+$//e " \/
"autocmd BufWritePre * %s/\n\+\%$//e " Remove white space
"autocmd BufWritePre *.[ch] %s/\%$/\r/e " /\
"autocmd BufWritePre * call cursor(ccl,ccc) " Move cursor to previous position
" Get rid of the pointless .viminfo files that clutter the home directory
let skip_defaults_vim=1
set viminfo=""
|