summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rwxr-xr-xnvim/init.vim66
m---------nvim/plugged/Colorizer0
m---------nvim/plugged/vim-closetag0
m---------nvim/plugged/vim-css-color0
4 files changed, 42 insertions, 24 deletions
diff --git a/nvim/init.vim b/nvim/init.vim
index 65e980e..58b0141 100755
--- a/nvim/init.vim
+++ b/nvim/init.vim
@@ -7,45 +7,51 @@ if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autolo
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'
+Plug 'junegunn/goyo.vim'
+Plug 'alvan/vim-closetag'
+Plug 'ap/vim-css-color'
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 autochdir " Always change directory to current file
+set autoindent " Keeps indentation on new lines
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 linebreak " Word wrap
set mouse=a " Because sometimes it's just easier to use the mouse
-set autochdir " Always change directory to current file
+set number relativenumber " Enable relative line numbers
+set smartcase " ...Unless the search term is capital
+set splitbelow splitright " Open splits on bottom/right instead of top/left
+set wildmode=longest,list,full " Enable file auto-complete
+syntax on " Enable syntax highlighting
" Keybindings
" Set leader-key to comma
let mapleader =","
" Invoke goyo with comma-m
-map <leader>m :Goyo<CR>
+nmap <leader>m :Goyo<CR>
" Invoke spellcheck mode with comma-o
-map <leader>l :setlocal spell! spelllang=en_us<CR>
+nmap <leader>l :setlocal spell! spelllang=en_us<CR>
" Invoke spellcheck mode with comma-o
-map <leader>c :set cursorcolumn!<CR>
+nmap <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> $
+ " Navigate faster than hjkl with ctrl-hjlk
+nmap <C-h> 0
+nmap <C-j> <C-d>
+nmap <C-k> <C-u>
+nmap <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
+ " Streamlined tab navigation with chromium inspired keybindings
+nmap <TAB> gt
+nmap <S-TAB> gT
+nmap <C-T> :tabnew<CR>
" Colorscheme for root and normal users (since vimrc is just symlinked to the root user's home)
if ($USER) == 'root'
@@ -79,13 +85,25 @@ 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
+" Automatically deletes all trailing whitespace on save
+function DelWS()
+ :let ccc=col('.') " Set current cursor column
+ :let ccl=line('.') " Set current cursor line
+ :%s/\s\+$//e " Find and remove trailing whitespace on each line
+ :call cursor(ccl,ccc) " Move cursor to previous position
+endfunction
+autocmd BufWritePre * call DelWS()
+
+" Disables automatic commenting on newline:
+ autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
+" Perform dot commands over visual blocks:
+ vnoremap . :normal .<CR>
+" Save file as sudo on files that require root permission
+ cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
+
+" Plugin options
+ " closetag
+let g:closetag_filenames = '*.html,*.xhtml,*.phtml'
" Get rid of the pointless .viminfo files that clutter the home directory
let skip_defaults_vim=1
diff --git a/nvim/plugged/Colorizer b/nvim/plugged/Colorizer
deleted file mode 160000
-Subproject 826d5691ac7d36589591314621047b1b9d89ed3
diff --git a/nvim/plugged/vim-closetag b/nvim/plugged/vim-closetag
new file mode 160000
+Subproject c0779ef575d5c239162f4ca3506cfb4a95d45a5
diff --git a/nvim/plugged/vim-css-color b/nvim/plugged/vim-css-color
new file mode 160000
+Subproject 7337c35588e9027b516f80f03c3b9621a271e16