diff options
Diffstat (limited to 'nvim/init.vim')
-rwxr-xr-x | nvim/init.vim | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/nvim/init.vim b/nvim/init.vim index 5cdb9b7..2f07f38 100755 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -24,7 +24,6 @@ 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 -set cursorline " Highlight current line " Keybindings " Set leader-key to comma @@ -49,19 +48,24 @@ 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 ($HOME) == '/root' +if ($USER) == 'root' colorscheme zellner else - set bg=dark - let g:gruvbox_contrast_dark = 'hard' - colorscheme gruvbox-timmy + if empty($DISPLAY) + colorscheme default + else + set bg=dark + let g:gruvbox_contrast_dark = 'hard' + colorscheme gruvbox-timmy + endif endif -" Behavior's exclusive to either the tty or a terminal emulator in a graphical environment +" Behaviors exclusive to either the tty or a terminal emulator in a graphical environment if empty($DISPLAY) - " Then clear the tty screen after exiting vim - autocmd VimLeave * :!clear + " 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 "!~/Scripts/st/settitle Vim" @@ -76,12 +80,12 @@ 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 +"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 |