Last active
June 4, 2020 12:27
-
-
Save crazyboycjr/c5c7ccc254f90f42ff3824f678ca1ea0 to your computer and use it in GitHub Desktop.
vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if empty(glob('~/.vim/autoload/plug.vim')) | |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs | |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC | |
endif | |
" Specify a directory for plugins | |
" - For Neovim: ~/.local/share/nvim/plugged | |
" - Avoid using standard Vim directory names like 'plugin' | |
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
call plug#begin('~/.vim/plugged') | |
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | |
Plug 'editorconfig/editorconfig-vim' | |
Plug 'rakr/vim-one' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
Plug 'vim-python/python-syntax' | |
Plug 'chriskempson/tomorrow-theme' | |
"Plug 'jeaye/color_coded' | |
Plug 'octol/vim-cpp-enhanced-highlight' | |
"Plug 'vim-syntastic/syntastic' | |
"Plug 'vivien/vim-linux-coding-style' | |
Plug 'skywind3000/asyncrun.vim' | |
"Plug 'w0rp/ale' | |
Plug 'Yggdroot/LeaderF' | |
Plug 'machakann/vim-highlightedyank' | |
"Google vim-codefmt | |
Plug 'google/vim-maktaba' | |
Plug 'google/vim-codefmt' | |
"vim-go | |
Plug 'fatih/vim-go' | |
" haskell indent, just put this before haskell-vim | |
Plug 'itchyny/vim-haskell-indent' | |
"haskell-vim | |
Plug 'neovimhaskell/haskell-vim' | |
Plug 'alx741/vim-hindent' | |
"Plug 'rhysd/vim-clang-format' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'rust-lang/rust.vim' | |
Plug 'morhetz/gruvbox' | |
Plug 'godlygeek/tabular' | |
Plug 'plasticboy/vim-markdown' | |
" All of your Plugins must be added before the following line | |
call plug#end() | |
filetype plugin indent on " required | |
set tags=./tags,tags;$HOME | |
if filereadable("cscope.out") | |
cs add cscope.out | |
elseif $CSOPE_DB != "" | |
cs add $CSOPE_DB | |
endif | |
"set backupdir-=. | |
"set backupdir^=/tmp | |
"set undodir-=. | |
"set undodir^=/tmp | |
syntax on | |
set nu rnu | |
"set cindent | |
set nowrap | |
set si | |
set sw=4 | |
set st=4 | |
set ts=4 | |
set incsearch | |
set hlsearch | |
set mouse=a | |
set ttymouse=sgr | |
set ttimeout " time out for key codes | |
set ttimeoutlen=0 " wait up to 100ms after Esc for special key | |
set splitright | |
set splitbelow | |
autocmd filetype c,h,lex,yacc setlocal st=8 ts=8 sw=8 | |
"autocmd filetype cpp,hpp setlocal st=4 ts=4 sw=4 expandtab | |
autocmd filetype cpp,hpp,cuda setlocal st=2 ts=2 sw=2 expandtab | |
"autocmd filetype python setlocal ts=4 sw=4 st=4 expandtab | |
autocmd filetype javascript setlocal ts=2 sw=2 sts=0 noexpandtab | |
autocmd filetype css,html,htmldjango setlocal st=2 ts=2 sw=2 expandtab | |
autocmd filetype haskell setlocal expandtab | |
autocmd BufNewFile,BufRead *.toml,Gopkg.lock,Cargo.lock,*/.cargo/config,*/.cargo/credentials,Pipfile set filetype=toml | |
autocmd filetype toml setlocal st=2 ts=2 sw=2 expandtab | |
autocmd filetype rust set colorcolumn=100 st=4 sw=4 ts=4 expandtab | |
autocmd filetype tex setlocal spell tw=80 colorcolumn=81 | |
autocmd filetype text setlocal spell tw=72 colorcolumn=73 | |
autocmd filetype markdown setlocal spell tw=72 colorcolumn=73 | |
autocmd filetype gitcommit setlocal spell tw=72 colorcolumn=73 | |
augroup autoformat_settings | |
autocmd FileType bzl AutoFormatBuffer buildifier | |
"autocmd FileType cpp,proto,javascript AutoFormatBuffer clang-format | |
autocmd FileType go AutoFormatBuffer gofmt | |
"autocmd FileType json AutoFormatBuffer js-beautify | |
"autocmd FileTYpe python AutoFormatBuffer yapf | |
augroup END | |
" reliative number | |
augroup numbertoggle | |
autocmd! | |
autocmd BufEnter,FocusGained,InsertLeave * set relativenumber | |
autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber | |
augroup END | |
" set cursorline | |
nnoremap <Leader>c :set cursorline!<CR> | |
augroup CursorLine | |
autocmd! | |
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline | |
autocmd WinLeave * setlocal nocursorline | |
augroup END | |
" Compile various languages | |
func! DoMake() | |
" This function search its super directory to find a Makefile until | |
" this directory contains .git | |
exec "wa" | |
let s:name = "Makefile" | |
let vdir = "./" | |
let s:flag = 1 | |
while filereadable(vdir . s:name) == 0 | |
if filereadable(vdir . ".git") != 0 | |
s:flag = 0 | |
break | |
endif | |
let vdir = "../" . vdir | |
endwhile | |
unlet s:name | |
if s:flag == 1 | |
exec "make -C " . vdir | |
exec "cw" | |
endif | |
unlet s:flag | |
unlet vdir | |
endfunc | |
map <S-F5> :call DoMake()<cr> | |
autocmd filetype go map <F9> :w<cr>:!go run %<cr> | |
autocmd filetype rust map <F9> :w<cr>:!rustc % -g<cr> | |
autocmd filetype python map <F9> :w<cr>:!python2 %<cr> | |
autocmd filetype python map <S-F9> :w<cr>:!python3 %<cr> | |
autocmd filetype javascript map <F9> :w<cr>:!node %<cr> | |
autocmd filetype c map <F9> :w<cr>:!gcc % -o %< -g -Wall -lpthread<cr> | |
autocmd filetype cpp map <F9> :w<cr>:!g++ % -o %< -g -std=c++14 -Wall -I. -lpthread -mcmodel=large -ljsoncpp -lgmpxx -lgmp -lncurses -lglut -lGL -lGLU -lrdmacm -libverbs -lrt<cr> | |
autocmd filetype cpp map <S-F9> :w<cr>:!g++ % -o %< -g -std=c++17 -Wall -lstdc++fs<cr> | |
autocmd filetype tex map <F9> :w<cr>:!xelatex %<cr> | |
autocmd filetype java map <F9> :w<cr>:!javac %<cr> | |
autocmd filetype scala map <F9> :w<cr>:!scalac %<cr> | |
autocmd filetype haskell map <F9> :w<cr>:!runhaskell %<cr> | |
map <F5> :split %<.in<cr> | |
map <F6> :split %<.out<cr> | |
map <F7> :!gdb %< -tu<cr> | |
"map <C-F9> :!time ./%< < %<.in<cr> | |
map <C-F9> :!time ./%< <cr> | |
autocmd filetype tex map <C-F9> :!okular %<.pdf<cr> | |
autocmd filetype java map <C-F9> :!java %< <cr> | |
autocmd filetype scala map <C-F9> :!scala %< <cr> | |
autocmd filetype haskell map <C-F9> :!runhaskell %< <cr> | |
autocmd filetype rust map == :RustFmtRange <cr> | |
"autocmd filetype rust vnoremap = :'<,'>RustFmtRange <cr> | |
autocmd filetype cpp map == :FormatLines <cr> | |
autocmd filetype cpp vnoremap = :'<,'>FormatLines <cr> | |
" Multi panel | |
nnoremap <C-j> <C-w><C-j> | |
nnoremap <C-k> <C-w><C-k> | |
nnoremap <C-l> <C-w><C-l> | |
nnoremap <C-h> <C-w><C-h> | |
map <F8> :let @+=@" <cr> | |
" lshift hurts my little finger | |
map <leader>w :w<cr> | |
" Search result centered | |
noremap <silent> n nzz | |
noremap <silent> N Nzz | |
noremap <silent> * *zz | |
noremap <silent> # #zz | |
noremap <silent> g* g*zz | |
" Disable arrow keys | |
noremap <Up> <nop> | |
noremap <Down> <nop> | |
noremap <Left> <nop> | |
noremap <Right> <nop> | |
" Faster resize | |
noremap <silent> <C-S-Up> :resize +1<cr> | |
noremap <silent> <C-S-Down> :resize -1<cr> | |
noremap <silent> <C-S-Left> :vertical resize +1<cr> | |
noremap <silent> <C-S-Right> :vertical resize -1<cr> | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" NERDTree | |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let NERDTreeMinimalUI=1 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Config Colorscheme, Enable truecolor support | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set background=light | |
let g:one_allow_italics = 1 | |
"colorscheme one | |
colorscheme gruvbox | |
"colorscheme desert | |
"hi! Normal ctermbg=NONE guibg=NONE | |
"map <S-F12> :set background=dark<cr> | |
"Credit joshdick | |
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux. | |
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support | |
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.) | |
function! EnableTrueColor() | |
if ($TERM != 'linux') | |
if (has("nvim")) | |
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
endif | |
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > | |
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > | |
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > | |
if (has("termguicolors")) | |
set t_8f=[38;2;%lu;%lu;%lum | |
set t_8b=[48;2;%lu;%lu;%lum | |
set termguicolors | |
endif | |
endif | |
endfunction | |
call EnableTrueColor() | |
map <S-F12> :call ToggleTransparent()<cr> | |
function! SetTermGuiColors() | |
if (has("termguicolors")) | |
set termguicolors | |
endif | |
endfunction | |
function! SetNoTermGuiColors() | |
if (has("termguicolors")) | |
set notermguicolors | |
endif | |
endfunction | |
let g:is_transparent = 0 | |
function! ToggleTransparent() | |
if g:is_transparent | |
set background=dark | |
call SetTermGuiColors() | |
let g:is_transparent = 0 | |
else | |
hi! Normal ctermbg=NONE guibg=NONE | |
"call SetNoTermGuiColors() | |
let g:is_transparent = 1 | |
endif | |
endfunction | |
"call ToggleTransparent() | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Airline | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:airline_theme='one' | |
let g:airline#extensions#tabline#enabled = 1 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Python Syntax | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:python_highlight_all = 1 | |
let g:python_version_2 = 1 | |
let g:python_highlight_file_headers_as_comments = 1 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" cpp enhanced highlight | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:cpp_class_scope_highlight = 1 | |
let g:cpp_member_variable_highlight = 1 | |
let g:cpp_class_decl_highlight = 1 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" linux coding style | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"let g:linuxsty_patterns = [ "/home/cjr/Developing/c-data-structure" ] | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" AsyncRun | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:asyncrun_open = 6 | |
let g:asyncrun_bell = 1 | |
nnoremap <F10> :call asyncrun#quickfix_toggle(6)<cr> | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" LeaderF | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:Lf_ShortcutF = '<C-p>' | |
let g:Lf_ShortcutB = '<M-n>' | |
noremap <C-n> :LeaderfMru<cr> | |
noremap <M-p> :LeaderfFunction<cr> | |
noremap <M-n> :LeaderfBuffer<cr> | |
noremap <M-m> :LeaderfTag<cr> | |
let g:Lf_StlSeparator = { 'left': '', 'right': '', 'font': '' } | |
let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git'] | |
let g:Lf_WorkingDirectoryMode = 'Ac' | |
let g:Lf_WindowHeight = 0.30 | |
let g:Lf_CacheDirectory = expand('~/.vim/cache') | |
let g:Lf_ShowRelativePath = 0 | |
let g:Lf_HideHelp = 1 | |
let g:Lf_StlColorscheme = 'powerline' | |
let g:Lf_PreviewResult = {'Function':0} | |
let g:Lf_NormalMap = { | |
\ "File": [["<ESC>", ':exec g:Lf_py "fileExplManager.quit()"<CR>']], | |
\ "Buffer": [["<ESC>", ':exec g:Lf_py "bufExplManager.quit()"<CR>']], | |
\ "Mru": [["<ESC>", ':exec g:Lf_py "mruExplManager.quit()"<CR>']], | |
\ "Tag": [["<ESC>", ':exec g:Lf_py "tagExplManager.quit()"<CR>']], | |
\ "Function": [["<ESC>", ':exec g:Lf_py "functionExplManager.quit()"<CR>']], | |
\ "Colorscheme": [["<ESC>", ':exec g:Lf_py "colorschemeExplManager.quit()"<CR>']], | |
\ } | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Syntasitc | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:syntastic_cpp_cpplint_exec = 'cpplint' | |
let g:syntastic_cpp_checkers = ['cpplint', 'gcc'] | |
let g:syntastic_cpp_cpplint_thres = 1 | |
let syntastic_aggregate_errors = 1 | |
let g:syntastic_error_symbol = "✗" | |
let g:syntastic_warning_symbol = "⚠" | |
let g:syntastic_style_error_symbol = '!' | |
let g:syntastic_style_warning_symbol = '?' | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Haskell-vim | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" vim-hindent | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:hindent_on_save = 0 | |
let g:hindent_indent_size = 4 | |
let g:hindent_line_length = 100 | |
let g:hindent_command = "/usr/bin/hindent" | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" codefmt | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let s:plugin = maktaba#plugin#Get('codefmt') | |
call s:plugin.Flag('hindent_indent_size', '4') | |
call s:plugin.Flag('hindent_line_length', '100') | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Highlightedyank | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:highlightedyank_highlight_duration = 250 | |
if !exists('##TextYankPost') | |
map y <Plug>(highlightedyank) | |
endif | |
" hi! HighlightedyankRegion cterm=reverse gui=reverse | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" CoC | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
function! SetupCoc() abort | |
let g:coc_global_extensions = [ 'coc-rust-analyzer', 'coc-clangd', 'coc-highlight' ] | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=300 | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" Use <c-space> to trigger completion. | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current | |
" position. Coc only does snippet and additional edit on confirm. | |
if exists('*complete_info') | |
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>" | |
" Use Enter to choose the first item in the popup menu | |
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : | |
" \ pumvisible() ? "\<C-n><C-y>" : | |
" \ <SID>check_back_space() ? "\<CR>" : | |
" \ "\<C-g>u\<CR>" | |
else | |
imap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" | |
endif | |
" Use <leader>j and <leader>k to navigate diagnostics | |
nmap <silent> <leader>j <Plug>(coc-diagnostic-next) | |
nmap <silent> <leader>k <Plug>(coc-diagnostic-prev) | |
" GoTo code navigation. | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
" Use K to show documentation in preview window. | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
vnoremap <silent> K :call <SID>show_documentation()<CR> | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
else | |
call CocAction('doHover') | |
endif | |
endfunction | |
function! Highlight() abort | |
call CocActionAsync('highlight') | |
endfunction | |
" Highlight the symbol and its references when holding the cursor. | |
augroup CursorHoldHighlight | |
autocmd! | |
autocmd CursorHold * call Highlight() | |
augroup END | |
" Remap for rename current word | |
nmap <leader>rn <Plug>(coc-rename) | |
" Formatting selected code. | |
xmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected) | |
endfunction | |
" This below prevents diagnostic style disappearing after switching | |
" colorscheme | |
function! CocHighlights() abort | |
highlight link CocErrorSign GruvboxRed | |
highlight link CocWarningSign GruvboxYello | |
highlight link CocInfoSign GruvboxBlue | |
highlight link CocHintSign GruvboxGreen | |
highlight CocUnderline cterm=underline gui=underline | |
highlight CocHighlightText term=bold,reverse cterm=bold ctermfg=0 ctermbg=121 gui=bold guifg=bg guibg=LightGreen | |
" use highlight! to overwrite any default | |
highlight! link CocErrorHighlight CocUnderline | |
highlight! link CocWarningHighlight CocUnderline | |
highlight! link CocInfoHighlight CocUnderline | |
highlight! link CocHintHighlight CocUnderline | |
highlight! link CocFloating Pmenu | |
endfunction | |
augroup CocHighlights | |
autocmd! | |
autocmd ColorScheme * call CocHighlights() | |
augroup END | |
call CocHighlights() | |
if has_key(plugs, "coc.nvim") | |
call SetupCoc() | |
endif | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" caenrique / nvim-maximize-window-toggle | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" ToggleOnly | |
"" | |
" @public | |
" Toggles between the current window and the current buffer | |
" opened in a new tab page. | |
"" | |
function! ToggleOnly() | |
if winnr("$") > 1 | |
" There are more than one window in this tab | |
if exists("b:maximized_window_id") | |
call win_gotoid(b:maximized_window_id) | |
else | |
let b:origin_window_id = win_getid() | |
tab sp | |
let b:maximized_window_id = win_getid() | |
endif | |
else | |
" This is the only window in this tab | |
if exists("b:origin_window_id") | |
let l:origin_window_id = b:origin_window_id | |
tabclose | |
call win_gotoid(l:origin_window_id) | |
unlet b:maximized_window_id | |
unlet b:origin_window_id | |
endif | |
endif | |
endfunction | |
"" | |
" Maximize the current buffer as a toggle | |
"" | |
command! ToggleOnly call ToggleOnly() | |
nnoremap <leader>z :ToggleOnly<cr> | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" vim-markdown | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
let g:markdown_fenced_languages = ['html', 'vim', 'ruby', 'python', 'bash=sh', 'rust', 'haskell', 'c', 'cpp'] | |
" let g:clang_include_fixer_path = "clang-include-fixer" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" The Arch Linux global vimrc - setting only a few sane defaults | |
" | |
" DO NOT EDIT THIS FILE. IT'S OVERWRITTEN UPON UPGRADES. | |
" | |
" Use /etc/vimrc for system-wide and $HOME/.vimrc for personal configuration | |
" (for details see ':help initialization'). | |
" | |
" Use :help '<option>' to see the documentation for the given option. | |
" Use Vim defaults instead of 100% vi compatibility | |
" Avoid side-effects when nocompatible has already been set. | |
if &compatible | |
set nocompatible | |
endif | |
set backspace=indent,eol,start | |
set ruler | |
set suffixes+=.aux,.bbl,.blg,.brf,.cb,.dvi,.idx,.ilg,.ind,.inx,.jpg,.log,.out,.png,.toc | |
set suffixes-=.h | |
set suffixes-=.obj | |
" Move temporary files to a secure location to protect against CVE-2017-1000382 | |
if exists('$XDG_CACHE_HOME') | |
let &g:directory=$XDG_CACHE_HOME | |
else | |
let &g:directory=$HOME . '/.cache' | |
endif | |
let &g:undodir=&g:directory . '/vim/undo//' | |
let &g:backupdir=&g:directory . '/vim/backup//' | |
let &g:directory.='/vim/swap//' | |
" Create directories if they doesn't exist | |
if ! isdirectory(expand(&g:directory)) | |
silent! call mkdir(expand(&g:directory), 'p', 0700) | |
endif | |
if ! isdirectory(expand(&g:backupdir)) | |
silent! call mkdir(expand(&g:backupdir), 'p', 0700) | |
endif | |
if ! isdirectory(expand(&g:undodir)) | |
silent! call mkdir(expand(&g:undodir), 'p', 0700) | |
endif | |
" Make shift-insert work like in Xterm | |
if has('gui_running') | |
map <S-Insert> <MiddleMouse> | |
map! <S-Insert> <MiddleMouse> | |
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"suggest.autoTrigger": "always", | |
"suggest.noselect": false, | |
"suggest.timeout": 500, | |
"suggest.detailMaxLength": 1000, | |
"list.maxPreviewHeight": 50, | |
"highlight.document.enable": true, | |
"highlight.color.enable": true, | |
"rust-analyzer.trace.server": "verbose" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" An example for a vimrc file. | |
" | |
" Maintainer: Bram Moolenaar <[email protected]> | |
" Last change: 2015 Mar 24 | |
" | |
" To use it, copy it to | |
" for Unix and OS/2: ~/.vimrc | |
" for Amiga: s:.vimrc | |
" for MS-DOS and Win32: $VIM\_vimrc | |
" for OpenVMS: sys$login:.vimrc | |
" When started as "evim", evim.vim will already have done these settings. | |
runtime! archlinux.vim | |
if v:progname =~? "evim" | |
finish | |
endif | |
" Use Vim settings, rather than Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
" allow backspacing over everything in insert mode | |
set backspace=indent,eol,start | |
if has("vms") | |
set nobackup " do not keep a backup file, use versions instead | |
else | |
set backup " keep a backup file (restore to previous version) | |
set undofile " keep an undo file (undo changes after closing) | |
endif | |
set history=50 " keep 50 lines of command line history | |
set ruler " show the cursor position all the time | |
set showcmd " display incomplete commands | |
set incsearch " do incremental searching | |
" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries | |
" let &guioptions = substitute(&guioptions, "t", "", "g") | |
" Don't use Ex mode, use Q for formatting | |
map Q gq | |
" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, | |
" so that you can undo CTRL-U after inserting a line break. | |
inoremap <C-U> <C-G>u<C-U> | |
" In many terminal emulators the mouse works just fine, thus enable it. | |
if has('mouse') | |
set mouse=a | |
endif | |
" Switch syntax highlighting on, when the terminal has colors | |
" Also switch on highlighting the last used search pattern. | |
if &t_Co > 2 || has("gui_running") | |
syntax on | |
set hlsearch | |
endif | |
" Only do this part when compiled with support for autocommands. | |
if has("autocmd") | |
" Enable file type detection. | |
" Use the default filetype settings, so that mail gets 'tw' set to 72, | |
" 'cindent' is on in C files, etc. | |
" Also load indent files, to automatically do language-dependent indenting. | |
filetype plugin indent on | |
" Put these in an autocmd group, so that we can delete them easily. | |
augroup vimrcEx | |
au! | |
" For all text files set 'textwidth' to 78 characters. | |
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 | |
" (happens when dropping a file on gvim). | |
autocmd BufReadPost * | |
\ if line("'\"") >= 1 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
augroup END | |
else | |
set autoindent " always set autoindenting on | |
endif " has("autocmd") | |
" Convenient command to see the difference between the current buffer and the | |
" file it was loaded from, thus the changes you made. | |
" Only define it when not defined already. | |
if !exists(":DiffOrig") | |
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis | |
\ | wincmd p | diffthis | |
endif | |
if has('langmap') && exists('+langnoremap') | |
" Prevent that the langmap option applies to characters that result from a | |
" mapping. If unset (default), this may break plugins (but it's backward | |
" compatible). | |
set langnoremap | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment