diff options
| -rw-r--r-- | .exrc | 9 | ||||
| -rw-r--r-- | after/syntax/c.vim | 4 | ||||
| -rw-r--r-- | init.lua | 13 | ||||
| -rw-r--r-- | vimrc | 30 | ||||
| -rw-r--r-- | vimrc-common | 197 |
5 files changed, 133 insertions, 120 deletions
| @@ -0,0 +1,9 @@ | |||
| 1 | " vim: tabstop=2 softtabstop=2 shiftwidth=2 | ||
| 2 | set tabstop=2 | ||
| 3 | set softtabstop=2 | ||
| 4 | set shiftwidth=2 | ||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | |||
| 9 | |||
diff --git a/after/syntax/c.vim b/after/syntax/c.vim index cbdd42b..4c3b3f0 100644 --- a/after/syntax/c.vim +++ b/after/syntax/c.vim | |||
| @@ -34,6 +34,10 @@ set formatoptions+=1 " Don't break a line after a one-letter word. | |||
| 34 | " open a corresponding header file | 34 | " open a corresponding header file |
| 35 | nnorem <leader>gh :execute 'edit '.findfile(substitute(expand('%:t'),'\.[ch]$','.h',''))<CR> | 35 | nnorem <leader>gh :execute 'edit '.findfile(substitute(expand('%:t'),'\.[ch]$','.h',''))<CR> |
| 36 | 36 | ||
| 37 | if filereadable("/usr/bin/vendor_perl/ack") | ||
| 38 | autocmd FileType c,cpp set grepprg=/usr/bin/vendor_perl/ack\ --type=cc\ --nogroup\ --column\ $* | ||
| 39 | autocmd FileType c,cpp set grepformat=%f:%l:%c:%m | ||
| 40 | endif | ||
| 37 | 41 | ||
| 38 | " multiple single line comments in a row " broken! | 42 | " multiple single line comments in a row " broken! |
| 39 | " syn region myCComment start="/\*" end="\*/" fold keepend transparent | 43 | " syn region myCComment start="/\*" end="\*/" fold keepend transparent |
| @@ -1,13 +1,17 @@ | |||
| 1 | vim.cmd('source ~/.vim/vimrc') | 1 | vim.cmd('source ~/.vim/vimrc') |
| 2 | 2 | ||
| 3 | vim.o.termguicolors = true | 3 | vim.opt.termguicolors = true |
| 4 | vim.o.exrc = true | 4 | vim.opt.exrc = true |
| 5 | vim.opt.foldmethod = 'syntax' | ||
| 5 | 6 | ||
| 6 | if vim.fn.has("win32") then | 7 | if vim.fn.has("win32") then |
| 7 | vim.opt.rtp:append(vim.fn.expand("$HOME\\scoop\\shims")) | 8 | vim.opt.rtp:append(vim.fn.expand("$HOME\\scoop\\shims")) |
| 8 | end | 9 | end |
| 9 | 10 | ||
| 10 | vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") | 11 | vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") |
| 12 | vim.keymap.set('n', '<F12>', ':Buffers<CR>') | ||
| 13 | |||
| 14 | |||
| 11 | 15 | ||
| 12 | -- vim.o.shadafile = "/tmp/shada" | 16 | -- vim.o.shadafile = "/tmp/shada" |
| 13 | 17 | ||
| @@ -201,4 +205,9 @@ require'nvim-treesitter.configs'.setup { | |||
| 201 | }, | 205 | }, |
| 202 | } | 206 | } |
| 203 | 207 | ||
| 208 | -- vim.wo.foldtext = 'v:lua.vim.treesitter.foldtext()' -- not available yet in my installation | ||
| 209 | vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' | ||
| 210 | vim.wo.foldlevel = 1 | ||
| 211 | |||
| 212 | |||
| 204 | -- vim: tabstop=2 shiftwidth=2 softtabstop=2 | 213 | -- vim: tabstop=2 shiftwidth=2 softtabstop=2 |
| @@ -1,12 +1,19 @@ | |||
| 1 | exec ':source '.fnamemodify($MYVIMRC,':h').'/'.'vimrc-common' | 1 | exec ':source '.fnamemodify($MYVIMRC,':h').'/'.'vimrc-common' |
| 2 | set packpath+=pack/submodules | 2 | set packpath+=pack/submodules |
| 3 | 3 | ||
| 4 | set isfname-== | 4 | if has("nvim") |
| 5 | set modeline | 5 | set shadafile="/tmp/shada" |
| 6 | 6 | endif | |
| 7 | set signcolumn=yes | ||
| 8 | set foldcolumn=1 | ||
| 9 | 7 | ||
| 8 | if exists("g:neovide") | ||
| 9 | " neovide specific | ||
| 10 | set guifont=monospace:h11:b | ||
| 11 | " :#e-subpixelantialias:#h-full | ||
| 12 | let g:neovide_cursor_animation_length=0.03 | ||
| 13 | let g:neovide_cursor_trail_size=0.8 | ||
| 14 | let g:neovide_scroll_animation_length = 0.05 | ||
| 15 | let g:neovide_transparency = 0.9 | ||
| 16 | endif | ||
| 10 | 17 | ||
| 11 | " if ($XDG_SESSION_TYPE ==# 'wayland' || ! empty($WAYLAND_DISPLAY)) | 18 | " if ($XDG_SESSION_TYPE ==# 'wayland' || ! empty($WAYLAND_DISPLAY)) |
| 12 | " autocmd TextYankPost * call system("wl-copy", get(v:event, 'regcontents')) | 19 | " autocmd TextYankPost * call system("wl-copy", get(v:event, 'regcontents')) |
| @@ -14,19 +21,6 @@ set foldcolumn=1 | |||
| 14 | " nnoremap P :silent put! =system('wl-paste')<CR> | 21 | " nnoremap P :silent put! =system('wl-paste')<CR> |
| 15 | " endif | 22 | " endif |
| 16 | 23 | ||
| 17 | |||
| 18 | if has("nvim") | ||
| 19 | set shadafile="/tmp/shada" | ||
| 20 | endif | ||
| 21 | |||
| 22 | " neovide specific | ||
| 23 | set guifont=monospace:h11:b | ||
| 24 | " :#e-subpixelantialias:#h-full | ||
| 25 | let g:neovide_cursor_animation_length=0.03 | ||
| 26 | let g:neovide_cursor_trail_size=0.8 | ||
| 27 | let g:neovide_scroll_animation_length = 0.05 | ||
| 28 | let g:neovide_transparency = 0.9 | ||
| 29 | |||
| 30 | " scripts from the default vim installation, which do not get loaded by default, but are useful. | 24 | " scripts from the default vim installation, which do not get loaded by default, but are useful. |
| 31 | " if filereadable($VIMRUNTIME.'/macros/editexisting.vim') | 25 | " if filereadable($VIMRUNTIME.'/macros/editexisting.vim') |
| 32 | " packadd! editexisting | 26 | " packadd! editexisting |
diff --git a/vimrc-common b/vimrc-common index fb760cb..dc48045 100644 --- a/vimrc-common +++ b/vimrc-common | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | "======================================================================================================================= | 1 | "======================================================================================================================= |
| 2 | " GENERAL: | 2 | " GENERAL |
| 3 | " It is likely, that you will want to overwrite these settings with a | ||
| 4 | " project-local .vimrc file (activated with exrc setting) | ||
| 5 | "======================================================================================================================= | 3 | "======================================================================================================================= |
| 6 | 4 | ||
| 7 | filetype on | 5 | filetype on |
| @@ -9,97 +7,28 @@ filetype plugin on | |||
| 9 | filetype indent on | 7 | filetype indent on |
| 10 | 8 | ||
| 11 | syntax on | " enable syntax highlighting | 9 | syntax on | " enable syntax highlighting |
| 12 | syntax sync minlines=60 | " how many preceding lines will be parsed? (has performance impact) | 10 | syntax sync minlines=60 | " how many preceding lines will be parsed? (high performance impact) |
| 13 | 11 | ||
| 14 | set secure | " to ensure, that modelines do not contain executable code | 12 | set secure | " to ensure, that modelines do not contain executable code |
| 15 | set noexrc | " exrc was nice, but has too many security problems. Now using editorconfig instead (see plugins) | 13 | set noexrc | " exrc was nice, but has too many security problems. Now using editorconfig instead (see plugins) |
| 16 | set modeline | " set variables specific to a file, like indentation by adding a comment (TODO: should probably be replaced by editorconfig) | 14 | set modeline | " set variables specific to a file, like indentation by adding a comment (TODO: should probably be replaced by editorconfig) |
| 17 | set ts=4 sts=4 sw=4 expandtab textwidth=0 | " better done with a modeline or local exrc | ||
| 18 | set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against | 15 | set virtualedit=all | " virtual edit should be default behaviour, because I don't see any reason against |
| 19 | set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis | 16 | set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis |
| 20 | set ignorecase smartcase | " search with ignore case by default, but use case sensitive search when one capital char is contained and highlight while typing (even though its slower) | 17 | set ignorecase smartcase | " search with ignore case by default, but use case sensitive search when one capital char is contained and highlight while typing (even though its slower) |
| 21 | set hlsearch incsearch | " highlight pattern while entering it (performance wise this isn't that good) | 18 | set hlsearch incsearch | " highlight pattern while entering it (performance wise this isn't that good) |
| 22 | " set cindent cinoptions+=(0 | " indent at parentheses | ||
| 23 | 19 | ||
| 24 | 20 | ||
| 25 | "======================================================================================================================= | 21 | "======================================================================================================================= |
| 26 | " PATH -- where to search for includes (e.g. `gf` or `:find`) | 22 | " BASIC CODE STYLE |
| 27 | "======================================================================================================================= | ||
| 28 | set path+=**4 | " allow recursive searches for files (limit depth by 4) | ||
| 29 | let &path = &path.",/usr/lib/modules/".substitute(system('uname -r'), "\n", "", "")."/build/include" | " TODO: could fail under windows (no uname) | ||
| 30 | |||
| 31 | "======================================================================================================================= | ||
| 32 | " SPELL_CHECKING: | ||
| 33 | "======================================================================================================================= | ||
| 34 | let g:spellfile_URL='http://ftp.vim.org/vim/runtime/spell' | ||
| 35 | " add local user default spell file as primary source for words | ||
| 36 | let &spellfile=fnamemodify($MYVIMRC, ":p:h")."/spell/spellfile-user.UTF-8.add" | ||
| 37 | |||
| 38 | set nospell | " disable spell checker by default | ||
| 39 | set spelllang=en,de | " languages for the spell checker | ||
| 40 | set spellsuggest=10 | " how many words will z= suggest? | ||
| 41 | set thesaurus+=~/.vim/thesaurus/php.txt | ||
| 42 | |||
| 43 | |||
| 44 | "======================================================================================================================= | ||
| 45 | " UNDO: | ||
| 46 | " Persistent undo behaviour, also keeps undo history between starts | ||
| 47 | "======================================================================================================================= | ||
| 48 | if has('persistent_undo') | ||
| 49 | if isdirectory('/dev/shm') | ||
| 50 | set undodir=/dev/shm/ | " save undo file in memory. That is volatile, but fast and we have GIT for longer lasting undoes | ||
| 51 | set directory=/dev/shm/ | " swap file directory to RAM | ||
| 52 | set swapfile | ||
| 53 | elseif isdirectory('/tmp/') | ||
| 54 | set undodir=/tmp/ | ||
| 55 | endif | ||
| 56 | set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistence) | ||
| 57 | endif | ||
| 58 | |||
| 59 | |||
| 60 | "======================================================================================================================= | ||
| 61 | " MULTI_BYTE: | ||
| 62 | "======================================================================================================================= | 23 | "======================================================================================================================= |
| 63 | if has("multi_byte") | 24 | " set cindent cinoptions+=(0 | " indents at the level of parentheses -- if desired |
| 64 | scriptencoding utf-8 | " tell vim that we are using UTF-8 here | 25 | set expandtab | " replace tabs with spaces |
| 65 | set encoding=utf-8 | " we need default UTF-8 encoding to use cool chars as line break and so on (see below) | 26 | set textwidth=0 | " should be set file type specific, colorcolumns is there to assist anyways |
| 66 | set termencoding=utf-8 | " we just assume that this is supported. | 27 | set tabstop=4 |
| 67 | 28 | set shiftwidth=4 | |
| 68 | set fillchars= | " initialize empty fillchars | 29 | set softtabstop=4 |
| 69 | set listchars= | " initialize empty listchars | ||
| 70 | |||
| 71 | if &term ==# 'linux' | ||
| 72 | set fillchars+=vert:\│ | " cool vertical split char | ||
| 73 | else | ||
| 74 | set fillchars+=vert:\║ | " cool vertical split char | ||
| 75 | endif | ||
| 76 | |||
| 77 | set fillchars+=fold:\ | " | ||
| 78 | set fillchars+=diff:\ | " a white space gets used here | ||
| 79 | |||
| 80 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
| 81 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
| 82 | |||
| 83 | set listchars+=tab:▏\ | " | ||
| 84 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 85 | " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
| 86 | " set listchars+=space:⸳ | " · | " symbols used when using :set list (which displays non-printable chars) | ||
| 87 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
| 88 | |||
| 89 | " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective) | ||
| 90 | set nolist | ||
| 91 | |||
| 92 | autocmd InsertEnter * set list | ||
| 93 | autocmd InsertLeave * set list& | ||
| 94 | |||
| 95 | |||
| 96 | autocmd InsertEnter * set colorcolumn=80,120 | ||
| 97 | autocmd InsertLeave * set colorcolumn& | ||
| 98 | 30 | ||
| 99 | 31 | ||
| 100 | " set fillchars+=stlnc:\― | " | ||
| 101 | end | ||
| 102 | |||
| 103 | " ====================================================================================================================== | 32 | " ====================================================================================================================== |
| 104 | " SETTINGS: | 33 | " SETTINGS: |
| 105 | " ====================================================================================================================== | 34 | " ====================================================================================================================== |
| @@ -144,7 +73,7 @@ set writedelay=0 | |||
| 144 | " display and performance | 73 | " display and performance |
| 145 | set lazyredraw | " disables redraw during macro execution (improves performance, but causes problems with solid backgrounds) | 74 | set lazyredraw | " disables redraw during macro execution (improves performance, but causes problems with solid backgrounds) |
| 146 | set cmdheight=2 | " sets the command line's height | 75 | set cmdheight=2 | " sets the command line's height |
| 147 | set signcolumn=auto | " auto=auto hide, yes=always, no=never show the column with error indicators | 76 | set signcolumn=yes | " auto=auto hide, yes=always, no=never show the column with error indicators |
| 148 | set nocursorcolumn | " turn visual cursor column off (improves performance) | 77 | set nocursorcolumn | " turn visual cursor column off (improves performance) |
| 149 | set updatetime=80 | " updates the screen more often | 78 | set updatetime=80 | " updates the screen more often |
| 150 | set redrawtime=1500 | " Timeout in milliseconds for redrawing the screen (switches syntax off when ssh too slow) / CTRL+L to retry | 79 | set redrawtime=1500 | " Timeout in milliseconds for redrawing the screen (switches syntax off when ssh too slow) / CTRL+L to retry |
| @@ -158,6 +87,7 @@ set wildmode=longest:full | " do not preselect any entry and show all possib | |||
| 158 | 87 | ||
| 159 | " code completion | 88 | " code completion |
| 160 | " set dictionary=/usr/share/dict/cracklib-small | 89 | " set dictionary=/usr/share/dict/cracklib-small |
| 90 | set isfname-== | " remove = as char in filenames, because most FSs do not support it | ||
| 161 | set complete+=d | " scan current and included files for defined name or macro | 91 | set complete+=d | " scan current and included files for defined name or macro |
| 162 | set complete+=i | " scan current and included files for completions | 92 | set complete+=i | " scan current and included files for completions |
| 163 | set complete+=k | " make default completer <C-N> respect the dictionary | 93 | set complete+=k | " make default completer <C-N> respect the dictionary |
| @@ -178,20 +108,19 @@ set foldcolumn=0 | " I think I don't need this second indicator | |||
| 178 | " set foldmethod=syntax | " foldlevel: syntax, indent, manual / foldmethod=syntax makes Vim incredible slow | 108 | " set foldmethod=syntax | " foldlevel: syntax, indent, manual / foldmethod=syntax makes Vim incredible slow |
| 179 | set foldnestmax=1 | " top level folding only | 109 | set foldnestmax=1 | " top level folding only |
| 180 | set foldopen=block,hor,search | " when do we unfold? | 110 | set foldopen=block,hor,search | " when do we unfold? |
| 181 | set foldtext=printf('%*s%.*S',indent(v:foldstart),'',&textwidth-indent(v:foldstart),substitute(substitute(join(getline(v:foldstart,v:foldend),'\ '),'[[:space:]*/]\\+','\ ','g'),'^[[:space:]*]','','g')) | 111 | " set foldtext=printf('%*s%.*S',indent(v:foldstart),'',&textwidth-indent(v:foldstart),substitute(substitute(join(getline(v:foldstart,v:foldend),'\ '),'[[:space:]*/]\\+','\ ','g'),'^[[:space:]*]','','g')) |
| 112 | set foldtext=repeat('\ ',indent(v:foldstart)-1).join(getline(v:foldstart,v:foldend))[:winwidth(0)]->substitute('[[:space:]]\\+','\ ','g') | ||
| 182 | 113 | ||
| 183 | " works ... | 114 | " works ... |
| 184 | " set foldexpr=match(synIDattr(synID(v:lnum,indent(v:lnum)+1,0),'name'),'Comment')>-1 | 115 | " set foldexpr=match(synIDattr(synID(v:lnum,indent(v:lnum)+1,0),'name'),'Comment')>-1 |
| 185 | set foldexpr=!empty(filter(synstack(v:lnum,indent(v:lnum)+1),{_,val->match(synIDattr(val,'name'),'Comment')>-1})) | 116 | set foldexpr=!empty(filter(synstack(v:lnum,indent(v:lnum)+1),{_,val->match(synIDattr(val,'name'),'Comment')>-1})) |
| 186 | 117 | ||
| 187 | |||
| 188 | " vim window behaviour | 118 | " vim window behaviour |
| 189 | set splitbelow | " open new windows below the current one (i find that more intuitive) | 119 | set splitbelow | " open new windows below the current one (i find that more intuitive) |
| 190 | set splitright | " this also works for me and makes better use of the scren space I think | 120 | set splitright | " this also works for me and makes better use of the scren space I think |
| 191 | set winminwidth=0 | " (and all other windows, so TODO: watch out) | 121 | set winminwidth=0 | " (and all other windows, so TODO: watch out) |
| 192 | set winwidth=30 | " keep NERDTreeWindow at least this size | 122 | set winwidth=30 | " keep NERDTreeWindow at least this size |
| 193 | 123 | ||
| 194 | |||
| 195 | " vim session handling and restore behaviour | 124 | " vim session handling and restore behaviour |
| 196 | set viminfo+=% | " restore buffer list | 125 | set viminfo+=% | " restore buffer list |
| 197 | set sessionoptions= | 126 | set sessionoptions= |
| @@ -213,6 +142,88 @@ set noshiftround | " indent/un-indent sna=ps to multiple of shiftwi | |||
| 213 | set noequalalways | " do not evenly size windows when opening new or closing old | 142 | set noequalalways | " do not evenly size windows when opening new or closing old |
| 214 | set nocursorline | " turn visual cursor line off (improves performance) | 143 | set nocursorline | " turn visual cursor line off (improves performance) |
| 215 | 144 | ||
| 145 | |||
| 146 | "======================================================================================================================= | ||
| 147 | " PATH -- where to search for includes (e.g. `gf` or `:find`) | ||
| 148 | "======================================================================================================================= | ||
| 149 | set path+=**4 | " allow recursive searches for files (limit depth by 4) | ||
| 150 | if executable("uname") " does not work under Windows | ||
| 151 | let &path = &path.",/usr/lib/modules/".substitute(system('uname -r'), "\n", "", "")."/build/include" | ||
| 152 | endif | ||
| 153 | |||
| 154 | |||
| 155 | "======================================================================================================================= | ||
| 156 | " SPELL_CHECKING: | ||
| 157 | "======================================================================================================================= | ||
| 158 | let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell' | ||
| 159 | " add local user default spell file as primary source for words | ||
| 160 | let &spellfile=fnamemodify($MYVIMRC, ":p:h")."/spell/spellfile-user.UTF-8.add" | ||
| 161 | |||
| 162 | set nospell | " disable spell checker by default | ||
| 163 | set spelllang=en,de | " languages for the spell checker | ||
| 164 | set spellsuggest=10 | " how many words will z= suggest? | ||
| 165 | set thesaurus+=~/.vim/thesaurus/php.txt | ||
| 166 | |||
| 167 | |||
| 168 | "======================================================================================================================= | ||
| 169 | " UNDO: | ||
| 170 | " Persistent undo behaviour, also keeps undo history between starts | ||
| 171 | "======================================================================================================================= | ||
| 172 | if has('persistent_undo') | ||
| 173 | if isdirectory('/dev/shm') | ||
| 174 | set undodir=/dev/shm/ | " save undo file in memory. That is volatile, but fast and we have GIT for longer lasting undoes | ||
| 175 | set directory=/dev/shm/ | " swap file directory to RAM | ||
| 176 | set swapfile | ||
| 177 | elseif isdirectory('/tmp/') | ||
| 178 | set undodir=/tmp/ | ||
| 179 | endif | ||
| 180 | set undofile | " preserve undo history when closing and reopening buffers (see :help undo-persistence) | ||
| 181 | endif | ||
| 182 | |||
| 183 | |||
| 184 | "======================================================================================================================= | ||
| 185 | " DISPLAY & MULTI_BYTE | ||
| 186 | "======================================================================================================================= | ||
| 187 | if has("multi_byte") | ||
| 188 | scriptencoding utf-8 | " tell vim that we are using UTF-8 here | ||
| 189 | set encoding=utf-8 | " we need default UTF-8 encoding to use cool chars as line break and so on (see below) | ||
| 190 | set termencoding=utf-8 | " we just assume that this is supported. | ||
| 191 | |||
| 192 | set fillchars= | " initialize empty fillchars | ||
| 193 | set listchars= | " initialize empty listchars | ||
| 194 | |||
| 195 | if &term ==# 'linux' | ||
| 196 | set fillchars+=vert:\│ | " cool vertical split char | ||
| 197 | else | ||
| 198 | set fillchars+=vert:\║ | " cool vertical split char | ||
| 199 | endif | ||
| 200 | |||
| 201 | set fillchars+=fold:\ | " | ||
| 202 | set fillchars+=diff:\ | " a white space gets used here | ||
| 203 | |||
| 204 | set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) | ||
| 205 | set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) | ||
| 206 | |||
| 207 | set listchars+=tab:▏\ | " | ||
| 208 | set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) | ||
| 209 | " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars) | ||
| 210 | " set listchars+=space:⸳ | " · | " symbols used when using :set list (which displays non-printable chars) | ||
| 211 | set showbreak+=› | " symbol used in the beginning of a wrapped line | ||
| 212 | |||
| 213 | " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective) | ||
| 214 | set nolist | ||
| 215 | |||
| 216 | autocmd InsertEnter * set list | ||
| 217 | autocmd InsertLeave * set list& | ||
| 218 | |||
| 219 | autocmd InsertEnter * set colorcolumn=80,120 | ||
| 220 | autocmd InsertLeave * set colorcolumn& | ||
| 221 | " set fillchars+=stlnc:\― | " | ||
| 222 | end | ||
| 223 | |||
| 224 | |||
| 225 | "======================================================================================================================= | ||
| 226 | " AUTOCMDs and FileType specific stuff | ||
| 216 | "======================================================================================================================= | 227 | "======================================================================================================================= |
| 217 | if has("autocmd") | 228 | if has("autocmd") |
| 218 | " use the shada/viminfo file to return the cursor to where it was... | 229 | " use the shada/viminfo file to return the cursor to where it was... |
| @@ -263,23 +274,11 @@ if has("autocmd") | |||
| 263 | \ :nnoremap | 274 | \ :nnoremap |
| 264 | \ <leader>= | 275 | \ <leader>= |
| 265 | \ vat:'<,'>!tidy -xml --wrap 0 --sort-attributes alpha 2>/dev/null<CR>vat= | 276 | \ vat:'<,'>!tidy -xml --wrap 0 --sort-attributes alpha 2>/dev/null<CR>vat= |
| 266 | |||
| 267 | if filereadable("/usr/bin/vendor_perl/ack") | ||
| 268 | autocmd FileType c,cpp set grepprg=/usr/bin/vendor_perl/ack\ --type=cc\ --nogroup\ --column\ $* | ||
| 269 | autocmd FileType c,cpp set grepformat=%f:%l:%c:%m | ||
| 270 | endif | ||
| 271 | augroup END | 277 | augroup END |
| 272 | endif | 278 | endif |
| 273 | 279 | ||
| 274 | " ====================================================================================================================== | 280 | " ====================================================================================================================== |
| 275 | augroup CUSTOM_COMMANDS | 281 | augroup CUSTOM_COMMANDS |
| 276 | command! Vimls | ||
| 277 | \ call setloclist(0, map(getbufinfo({'buflisted':1}), | ||
| 278 | \ "{'bufnr': v:val.bufnr, | ||
| 279 | \ 'lnum': v:val.lnum, | ||
| 280 | \ 'text': '='.printf('%*s, % 3d: %s [%s]', winwidth(0) / 2, '', v:val.bufnr, v:val.name, getbufvar(v:val.bufnr, '&buftype')), | ||
| 281 | \ 'pattern': 'not loaded'} | ||
| 282 | \ ")) | ||
| 283 | command! Qfls call setqflist([],'r',{ 'title':'listed buffers', 'items':map(getbufinfo({"buflisted":1}), '{"bufnr":get(v:val,"bufnr"),"lnum":get(v:val,"lnum"),"module":printf("%-*s",winwidth(0)-4,fnamemodify(get(v:val,"name"),":t"))}') }) | 282 | command! Qfls call setqflist([],'r',{ 'title':'listed buffers', 'items':map(getbufinfo({"buflisted":1}), '{"bufnr":get(v:val,"bufnr"),"lnum":get(v:val,"lnum"),"module":printf("%-*s",winwidth(0)-4,fnamemodify(get(v:val,"name"),":t"))}') }) |
| 284 | command! Ctoggle | 283 | command! Ctoggle |
| 285 | \ if(get(getqflist({'winid':1}), 'winid') == win_getid())|cclose|else|botright copen|endif | 284 | \ if(get(getqflist({'winid':1}), 'winid') == win_getid())|cclose|else|botright copen|endif |
| @@ -304,16 +303,14 @@ augroup KEYBOARD_MAPPING | |||
| 304 | nnoremap <S-PageUp> :N<CR> | 303 | nnoremap <S-PageUp> :N<CR> |
| 305 | nnoremap <S-PageDown> :n<CR> | 304 | nnoremap <S-PageDown> :n<CR> |
| 306 | 305 | ||
| 307 | |||
| 308 | nnoremap <F4> :wincmd c<CR> | 306 | nnoremap <F4> :wincmd c<CR> |
| 309 | |||
| 310 | nnoremap <F5> :make!<CR> | 307 | nnoremap <F5> :make!<CR> |
| 311 | nnoremap <F6> :silent syntax sync fromstart<CR>:nohlsearch<CR>:silent match<CR>:silent 2match<CR>:silent 3match<CR> | 308 | nnoremap <F6> :silent syntax sync fromstart<CR>:nohlsearch<CR>:silent match<CR>:silent 2match<CR>:silent 3match<CR> |
| 312 | nnoremap <F7> :Ltoggle<CR> | 309 | nnoremap <F7> :Ltoggle<CR> |
| 313 | nnoremap <F8> :Ctoggle<CR> | 310 | nnoremap <F8> :Ctoggle<CR> |
| 314 | |||
| 315 | nnoremap <F9> :TagbarToggle<CR> | 311 | nnoremap <F9> :TagbarToggle<CR> |
| 316 | nnoremap <F12> :Vimls<CR>:Ltoggle<CR> | 312 | "" remap <..> |
| 313 | nnoremap <F12> :Qfls<CR>:Ctoggle<CR> | ||
| 317 | 314 | ||
| 318 | " close current buffer with <leader>q... | 315 | " close current buffer with <leader>q... |
| 319 | nnoremap <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. | 316 | nnoremap <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>. |
