mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Update config for handling large files
This commit is contained in:
parent
95d3b2f2d8
commit
3904cd4ccf
@ -101,16 +101,14 @@ augroup END
|
|||||||
|
|
||||||
" ref: https://vi.stackexchange.com/a/169/15292
|
" ref: https://vi.stackexchange.com/a/169/15292
|
||||||
function! s:handle_large_file() abort
|
function! s:handle_large_file() abort
|
||||||
let g:large_file = 10485760 " 10MB
|
let g:file_size_limit = 524288 " 0.5MB
|
||||||
let f = expand("<afile>")
|
let f = expand("<afile>")
|
||||||
|
|
||||||
if getfsize(f) > g:large_file || getfsize(f) == -2
|
if getfsize(f) > g:file_size_limit || getfsize(f) == -2
|
||||||
set eventignore+=all
|
setlocal eventignore=all
|
||||||
" turning off relative number helps a lot
|
" turning off relative number helps a lot
|
||||||
set norelativenumber
|
setlocal norelativenumber
|
||||||
setlocal noswapfile bufhidden=unload buftype=nowrite undolevels=-1
|
setlocal noswapfile bufhidden=unload undolevels=-1
|
||||||
else
|
|
||||||
set eventignore-=all relativenumber
|
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user