VIM: Cleanup

- .vimrc:
        Restructured the settings.
        Moved the Rmarkdown settings to a new config file
        'config/filetypes.vim'

- config/plugin.vim:
        Fixed spacing

- .gitmodules: moved traces.vim down

Signed-off-by: Tobias Manske <tobias.manske@mailbox.org>
This commit is contained in:
Tobias Manske 2018-09-01 11:17:30 +02:00
parent b98cc52343
commit 5cbb3a63c6
No known key found for this signature in database
GPG Key ID: 978D99F12D4E041F
4 changed files with 50 additions and 53 deletions

6
.gitmodules vendored
View File

@ -148,12 +148,12 @@
[submodule "vim/plugins/ansible-vim"] [submodule "vim/plugins/ansible-vim"]
path = vim/plugins/ansible-vim path = vim/plugins/ansible-vim
url = https://github.com/pearofducks/ansible-vim url = https://github.com/pearofducks/ansible-vim
[submodule "vim/plugins/traces.vim"]
path = vim/plugins/traces.vim
url = https://github.com/markonm/traces.vim
[submodule "vim/plugins/vim-window-resize-easy"] [submodule "vim/plugins/vim-window-resize-easy"]
path = vim/plugins/vim-window-resize-easy path = vim/plugins/vim-window-resize-easy
url = https://github.com/roxma/vim-window-resize-easy url = https://github.com/roxma/vim-window-resize-easy
[submodule "vim/plugins/traces.vim"]
path = vim/plugins/traces.vim
url = https://github.com/markonm/traces.vim
[submodule "vim/plugins/nerdtree"] [submodule "vim/plugins/nerdtree"]
path = vim/plugins/nerdtree path = vim/plugins/nerdtree
url = https://github.com/scrooloose/nerdtree url = https://github.com/scrooloose/nerdtree

View File

@ -1,68 +1,54 @@
set encoding=utf-8 " Plugin Manager
execute pathogen#infect('plugins/{}') execute pathogen#infect('plugins/{}')
execute pathogen#infect('snippets/{}') execute pathogen#infect('snippets/{}')
autocmd vimenter * Helptags
syntax on
filetype plugin on
filetype plugin indent on
set number
set relativenumber
set autochdir
set expandtab
" Prepare central backup/swap/undo directory
let &undodir = expand('~/.vim/.undo') let &undodir = expand('~/.vim/.undo')
let &backupdir = expand('~/.vim/.backup//') let &backupdir = expand('~/.vim/.backup//')
let &directory = expand('~/.vim/.swp//') let &directory = expand('~/.vim/.swp//')
set undofile
colorscheme happy_hacking syntax on
source ~/.vim/config/plugin.vim filetype plugin on
source ~/.vim/config/keybindings.vim filetype plugin indent on
" General editor settings set encoding=utf-8
" Use whitespace instead of tab
set expandtab
" Make a tabulator equal 4 spaces
set tabstop=4 set tabstop=4
set shiftwidth=4 set shiftwidth=4
" Enable persistent undo
set undofile
" Use relative line numbers
set number
set relativenumber
" Set linelength indicator to 120 characters
set cc=120 set cc=120
" Natural window splitting
set splitbelow set splitbelow
set splitright set splitright
" Set colors
let g:netrw_liststyle = 3 colorscheme happy_hacking
let g:netrw_browse_split = 4
let g:netrw_winsize = 20
let g:netrw_altv = 0
let g:netrw_banner = 0
let g:tex_conceal = ""
function! ForceResizeNetrw()
let curWin = winnr()
for winnr in range(1, winnr('$'))
if getwinvar(winnr, '&ft')=="netrw"
if curWin != winnr
silent noautocmd exec winnr 'wincmd w'
silent noautocmd exec 'vertical resize ' . g:netrw_winsize
silent noautocmd exec curWin 'wincmd w'
else
silent noautocmd exec 'vertical resize ' . g:netrw_winsize
endif
endif
endfor
endfunction
autocmd WinEnter * call ForceResizeNetrw() " Apply plugin configurations
autocmd BufNew * call ForceResizeNetrw() source ~/.vim/config/plugin.vim
" R Markdown " Apply custom keybindings
function Rmarkdown() source ~/.vim/config/keybindings.vim
set filetype=markdown
set conceallevel=0
let g:markdown_syntax_conceal=0
let g:markdown_fenced_languages=['r', 'python', 'html', 'sql', 'bash=sh']
endfunction
autocmd BufNewFile,BufReadPost *.Rmd call Rmarkdown()
autocmd BufNewFile,BufReadPost *.rmd call Rmarkdown()
" Apply settings for custom filetypes
source ~/.vim/config/filetypes.vim
" Rebuild help files on startup
autocmd vimenter * Helptags
" Transparency " Transparency
hi Normal guibg=NONE ctermbg=NONE hi Normal guibg=NONE ctermbg=NONE

13
vim/config/filetypes.vim Normal file
View File

@ -0,0 +1,13 @@
" This config includes custom settings for special filetypes
" Rmarkdown / .rmd
function Rmarkdown()
set filetype=markdown
set conceallevel=0
let g:markdown_syntax_conceal=0
let g:markdown_fenced_languages=['r', 'python', 'html', 'sql', 'bash=sh']
endfunction
autocmd BufNewFile,BufReadPost *.Rmd call Rmarkdown()
autocmd BufNewFile,BufReadPost *.rmd call Rmarkdown()

View File

@ -21,8 +21,6 @@ let g:airline_theme="minimalist"
autocmd TextChanged * GitGutter autocmd TextChanged * GitGutter
" JavaComplete " JavaComplete
if has("autocmd") if has("autocmd")
autocmd Filetype java setlocal omnifunc=javacomplete#CompleteParamsInfo autocmd Filetype java setlocal omnifunc=javacomplete#CompleteParamsInfo