diff options
author | Johannes <stoelp@rhrk.uni-kl.de> | 2016-04-23 19:24:08 +0200 |
---|---|---|
committer | Johannes <stoelp@rhrk.uni-kl.de> | 2016-04-23 19:24:08 +0200 |
commit | ee94dc4bdba3fd5b0458bfd61f5638444a379618 (patch) | |
tree | e9509fa184fce8671518ad2b95c7c8f02977b1fc | |
parent | 86d0e679128f06cde2be79fb006b9adc6f7f32ca (diff) | |
download | dotfiles-ee94dc4bdba3fd5b0458bfd61f5638444a379618.tar.gz dotfiles-ee94dc4bdba3fd5b0458bfd61f5638444a379618.zip |
split vimrc in different files and added/reordered configuration
-rw-r--r-- | .vim/vimrc_files/colors.vim | 1 | ||||
-rw-r--r-- | .vim/vimrc_files/functions.vim | 18 | ||||
-rw-r--r-- | .vim/vimrc_files/highlight.vim | 10 | ||||
-rw-r--r-- | .vim/vimrc_files/keymaps.vim | 49 | ||||
-rw-r--r-- | .vimrc | 93 |
5 files changed, 140 insertions, 31 deletions
diff --git a/.vim/vimrc_files/colors.vim b/.vim/vimrc_files/colors.vim new file mode 100644 index 0000000..678e440 --- /dev/null +++ b/.vim/vimrc_files/colors.vim @@ -0,0 +1 @@ +hi x226_Yellow1 ctermfg=226 guifg=#ffff00 "rgb=255,255,0 diff --git a/.vim/vimrc_files/functions.vim b/.vim/vimrc_files/functions.vim new file mode 100644 index 0000000..a2c0f9a --- /dev/null +++ b/.vim/vimrc_files/functions.vim @@ -0,0 +1,18 @@ +" Split Window and scroll down +fu! SplitScroll() + :wincmd v + :wincmd w + execute "normal! \<C-d>" + :set scrollbind + :wincmd w + :set scrollbind +endfu + +" toggle relative line number mode +function! ToggleRelativeNumber() + if(&relativenumber == 1) + set norelativenumber + else + set relativenumber + endif +endfunc diff --git a/.vim/vimrc_files/highlight.vim b/.vim/vimrc_files/highlight.vim new file mode 100644 index 0000000..768708e --- /dev/null +++ b/.vim/vimrc_files/highlight.vim @@ -0,0 +1,10 @@ +" hi clear CursorLine +" augroup CLClear +" autocmd! ColorScheme * hi clear CursorLine +" augroup END + +" Highlight color of current line +hi CursorLineNR cterm=bold ctermfg=226 +augroup CLNRSet + autocmd! ColorScheme * hi CursorLineNR cterm=bold ctermfg=226 +augroup END diff --git a/.vim/vimrc_files/keymaps.vim b/.vim/vimrc_files/keymaps.vim new file mode 100644 index 0000000..75dffca --- /dev/null +++ b/.vim/vimrc_files/keymaps.vim @@ -0,0 +1,49 @@ +let ArrowDisableMessage = "Arrow Keys disabled! Better learn hjkl ;)" + +" Disable arrow keys -- train jklh +nnoremap <Left> :echo ArrowDisableMessage<CR> +nnoremap <Right> :echo ArrowDisableMessage<CR> +nnoremap <Up> :echo ArrowDisableMessage<CR> +nnoremap <Down> :echo ArrowDisableMessage<CR> + +vnoremap <Left> :<c-u>echo ArrowDisableMessage<CR> +vnoremap <Right> :<c-u>echo ArrowDisableMessage<CR> +vnoremap <Up> :<c-u>echo ArrowDisableMessage<CR> +vnoremap <Down> :<c-u>echo ArrowDisableMessage<CR> + +inoremap <Left> <c-o>:echo ArrowDisableMessage<CR> +inoremap <Right> <c-o>:echo ArrowDisableMessage<CR> +inoremap <Up> <c-o>:echo ArrowDisableMessage<CR> +inoremap <Down> <c-o>:echo ArrowDisableMessage<CR> + +" ctrl-jklm move to different splits +map <c-j> <c-w>j +map <c-k> <c-w>k +map <c-l> <c-w>l +map <c-h> <c-w>h + +" ctrl-hjkl move in insert mode +inoremap <c-h> <Left> +inoremap <c-j> <Down> +inoremap <c-k> <Up> +inoremap <c-l> <Right> + +" ctrl-jk movement in command window +cnoremap <c-h> <Left> +cnoremap <c-j> <Down> +cnoremap <c-k> <Up> +cnoremap <c-l> <Right> + +" shift-hl change to left/right Tab +nnoremap <s-h> :tabprev<CR> +nnoremap <s-l> :tabnext<CR> + +" ctrl-ae jump to line start/end +nnoremap <c-a> 0 +nnoremap <c-e> $d + +inoremap <c-a> <c-o>0 +inoremap <c-e> <c-o>$ + +" Shortcut to toggle relative numbering mode +nnoremap <c-n> :call ToggleRelativeNumber()<CR> @@ -1,6 +1,14 @@ runtime! debian.vim -set nocompatible +set nocompatible " make Vim less Vi + +" +----------------------------+ +" | Source Extrenal Files | +" +----------------------------+ +source ~/.vim/vimrc_files/colors.vim +source ~/.vim/vimrc_files/highlight.vim +source ~/.vim/vimrc_files/keymaps.vim +source ~/.vim/vimrc_files/functions.vim " +----------------------------+ " | Color Settings | @@ -16,39 +24,62 @@ colorscheme solarized "colorscheme buddy "colorscheme gruvbox -set autoindent "Copy indent from current line when starting a new line -set showcmd " Show (partial) command in status line. -set showmatch " Show matching brackets. -set ignorecase " Do case insensitive matching -set smartcase " Do smart case matching -set incsearch " Incremental search -set mouse=a " Enable mouse usage (all modes) -set encoding=utf-8 " Set default encoding to UTF-8. -set history=1000 " Sets how many lines of history VIM has to remember + +" +----------------------------+ +" | Basic Settings | +" +----------------------------+ +filetype on " try to detect filetypes +filetype plugin indent on " enable loading indent file for filetype +set ffs=unix,dos,mac " Try recognizing dos, unix, and mac line endings. + +set number " Display line numbers +set relativenumber " Display relative line numbers +set title " show title in console title bar +set cursorline " cursor line highlighting +set cursorcolumn " cursor column highlighting +set confirm " Y-N-C prompt if closing with unsaved changes. + +set mouse=a " Enable mouse usage (all modes) +set encoding=utf-8 " Set default encoding to UTF-8. +set history=1000 " Sets how many lines of history VIM has to remember +set tabpagemax=100 " Sets how many tabs will be opened +set scrolloff=7 " set vertical scroll distance to 7 lines +set tabstop=4 " set Tab-length +set expandtab " expand tabs to spaces +set shiftwidth=4 " but an indent level is 2 spaces wide. +set softtabstop=4 " <BS> over an autoindent deletes both spaces. +set shiftround " rounds indent to a multiple of shiftwidth + +set nowrap " don't wrap text +set noautowrite " Never write a file unless I request it. +set noautowriteall " NEVER. +set noautoread " Don't automatically re-read changed files. +set shortmess+=a " Use [+]/[RO]/[w] for modified/readonly/written. + +set smarttab " Handle tabs more intelligently +set smartcase " Do smart case matching +set autoindent "Copy indent from current line when starting a new line +set smartindent " use smart indent if there is no indent file +set showmatch " Show matching brackets. +set mat=2 " how many tenths of a second to blink when matching brackets +set matchpairs+=<:> " show matching <> as well +set hlsearch " highlight search results +set ignorecase " Do case insensitive matching +set incsearch " Incremental search +set magic " for regular expressions turn magic on + + set ruler " display cursor position set laststatus=2 " always show status line -set wildignore=*.o,*~,*.pyc " ignore compiled files -set scrolloff=7 " set vertical scroll distance to 7 lines -set wildmenu " turn on the wild menu -set hlsearch " highlight search results -set magic " for regular expressions turn magic on -set mat=2 " how many tenths of a second to blink when matching brackets +set showcmd " Show (partial) command in status line. + + +set wildmenu " turn on the wild menu +set wildmode=full " <Tab> cycles between all matching choices. +" Ignore these files when completing +set wildignore+=*.o,*.obj,.git,*.pyc,*~ + " No annoying sound on errors set noerrorbells set novisualbell set tm=500 - -set number " Display line numbers -set tabstop=4 " set Tab-length -set expandtab " expand tabs to spaces -set tabpagemax=100 " Sets how many tabs will be opened - -" +----------------------------+ -" | Own Functions and Key Maps | -" +----------------------------+ - -function! ToggleRelativeNumber() - set invrelativenumber -endfunc - -nnoremap <C-n> :call ToRelativeNumber()<CR> |