From 1b828ace39305ec591f9592f3a51f2d04aa88115 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Thu, 16 Nov 2017 16:34:43 +0100 Subject: [PATCH] Did Stuff --- gvimrc | 16 +++++++++++++--- vimrc | 25 ++++++++++++++++--------- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/gvimrc b/gvimrc index 0ddb96a..960654b 100644 --- a/gvimrc +++ b/gvimrc @@ -2,12 +2,24 @@ set guioptions-=T set guioptions-=m set guioptions-=e -let g:colors=['slate', 'desert', 'blue', 'ron', 'elflord', 'murphy', 'torte'] +if !exists("g:colors") + let g:colors=['slate', 'desert', 'blue', 'ron', 'elflord', 'murphy', 'torte'] +end function! Randomcolor() let random = localtime() % len(g:colors) execute "colorscheme ".g:colors[random] endfunction +function! SetFont() + if exists("g:font_size_template") && exists("g:font_size") + let &guifont=substitute(g:font_size_template, "%%", g:font_size, "g") + end +endfun +function! SetFontSize(size) + let g:font_size=a:size + call SetFont() +endfun + " Color list can be extended after including (sourcing) this file with " :let g:colors = extend(['list', 'of', 'color', 'schemes'], g:colors) @@ -26,5 +38,3 @@ nnoremap :exe "colorscheme ".g:colors[8 % len(g:colors)] nnoremap :exe "colorscheme ".g:colors[9 % len(g:colors)] nnoremap :exe "colorscheme ".g:colors[10 % len(g:colors)] nnoremap :call Randomcolor() - -call Randomcolor() diff --git a/vimrc b/vimrc index aab6182..13bbb2e 100644 --- a/vimrc +++ b/vimrc @@ -230,6 +230,11 @@ function! ShiftSelection(n) call ShiftMarker(">", a:n) endfunc +" Auto-close quickfix list when leaving it +function! s:autobd() + au! WinLeave bd! +endfun + " === GENERAL COMMANDS === command! L lopen | set number | set norelativenumber command! LAddLine call LocationAddLine(expand("%"), line("."), getline(".")) @@ -284,10 +289,10 @@ noremap :echo "Calm the fuck down! There's \ no need to save every 10 seconds FFS!" nnoremap :bnext nnoremap :bprevious -nnoremap n :lnext -nnoremap p :lNext -nnoremap n :cnext -nnoremap p :cNext +nnoremap j :lnext +nnoremap k :lNext +nnoremap j :cnext +nnoremap k :cNext nnoremap Bi i nnoremap Ea a " This one does nothing, but I'm adding it to remember not to remap the tab key @@ -466,6 +471,8 @@ function! AddWinMinWidth(num) endfunc +" === GENERIC AUTOCOMMANDS === + if has("autocmd") " Enable file type detection. @@ -477,7 +484,7 @@ if has("autocmd") " Put these in an autocmd group, so that we can delete them easily. " For all text files set 'textwidth' to 78 characters. - autocmd FileType text setlocal textwidth=78 + " autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler @@ -487,7 +494,6 @@ if has("autocmd") \ exe "normal! g`\"" | \ endif - augroup END endif " === FILETYPE SPECIFIC STUFF === @@ -528,11 +534,12 @@ au BufNewFile,BufRead *.c,*.cpp,*.h,*.hpp :nnoremap ; m'$a;`' au BufNewFile,BufRead *.rb :call init_ruby_file() function! s:init_ruby_file() - command! -buffer Defines lex MatchingLines("^\\s*def\\>\\s\\+\\zs.*$") + command! -buffer Defines lex MatchingLines("^\\s*def\\>\\s\\+\\zs.*$") | lopen command! -buffer Functions Defines " Alias command! -buffer Methods Defines " Alias - command! -buffer Classes lex MatchingLines("^\\s*class\\>\\s\\+\\zs.*$") - command! -buffer Modules lex MatchingLines("^\\s*module\\>\\s\\+\\zs.*$") + command! -buffer Classes lex MatchingLines("^\\s*class\\>\\s\\+\\zs.*$") | lopen + command! -buffer Modules lex MatchingLines("^\\s*module\\>\\s\\+\\zs.*$") | lopen + command! -buffer Requires lex MatchingLines("^\\s*require\\(_relative\\)\\?\\>\\s\\+\\zs.*$") | lopen nnoremap ic oclass m'end`'a nnoremap id odef m'()end`'a