mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
No commits in common. "64a7a23309e272bccf0e1009cd90eda72344b611" and "2880d7bce353e5e96e8f3f44e38982bf80ba6d69" have entirely different histories.
64a7a23309
...
2880d7bce3
@ -135,23 +135,3 @@ augroup auto_create_dir
|
||||
autocmd!
|
||||
autocmd BufWritePre * lua require('utils').may_create_dir()
|
||||
augroup END
|
||||
|
||||
" ref: https://vi.stackexchange.com/a/169/15292
|
||||
function! s:handle_large_file() abort
|
||||
let g:large_file = 10485760 " 10MB
|
||||
let f = expand("<afile>")
|
||||
|
||||
if getfsize(f) > g:large_file || getfsize(f) == -2
|
||||
set eventignore+=all
|
||||
" turning off relative number helps a lot
|
||||
set norelativenumber
|
||||
setlocal noswapfile bufhidden=unload buftype=nowrite undolevels=-1
|
||||
else
|
||||
set eventignore-=all relativenumber
|
||||
endif
|
||||
endfunction
|
||||
|
||||
augroup LargeFile
|
||||
autocmd!
|
||||
autocmd BufReadPre * call s:handle_large_file()
|
||||
augroup END
|
||||
|
||||
@ -371,16 +371,9 @@ if exists('g:started_by_firenvim') && g:started_by_firenvim
|
||||
\ }
|
||||
\ }
|
||||
|
||||
function! s:setup_firenvim() abort
|
||||
set noruler noshowcmd
|
||||
set laststatus=0 showtabline=0
|
||||
endfunction
|
||||
|
||||
augroup firenvim
|
||||
autocmd!
|
||||
autocmd FileType text call s:setup_firenvim()
|
||||
autocmd BufNewFile github.com_*.txt set filetype=markdown
|
||||
autocmd BufNewFile stackoverflow.com_*.txt set filetype=markdown
|
||||
autocmd BufEnter *.txt setlocal filetype=markdown laststatus=0 nonumber noshowcmd noruler showtabline=1
|
||||
augroup END
|
||||
endif
|
||||
|
||||
|
||||
9
init.lua
9
init.lua
@ -8,14 +8,11 @@
|
||||
-- Email: jdhao@hotmail.com
|
||||
-- Blog: https://jdhao.github.io/
|
||||
|
||||
-- check if we have the latest stable version of nvim
|
||||
local expected_ver = "0.7.2"
|
||||
|
||||
local utils = require "utils"
|
||||
local nvim_ver = utils.get_nvim_version()
|
||||
local match_res = utils.check_version_match()
|
||||
|
||||
if nvim_ver ~= expected_ver then
|
||||
local msg = string.format("Unsupported nvim version: expect %s, but got %s instead!", expected_ver, nvim_ver)
|
||||
if not match_res.match then
|
||||
local msg = string.format("Nvim version mistmatch: %s expected, but got %s instead!", match_res.expected, match_res.actual)
|
||||
vim.api.nvim_echo({ { msg, "ErrorMsg" } }, false, {})
|
||||
return
|
||||
end
|
||||
|
||||
@ -1,11 +1,8 @@
|
||||
local keymap = vim.keymap
|
||||
|
||||
-- Go to the beginning and end of current line in insert mode quickly
|
||||
-- Go to the begining and end of current line in insert mode quickly
|
||||
keymap.set('i', '<C-A>', '<HOME>')
|
||||
keymap.set('i', '<C-E>', '<END>')
|
||||
|
||||
-- Go to beginning of command in command-line mode
|
||||
keymap.set('c', '<C-A>', '<HOME>')
|
||||
|
||||
-- Delete the character to the right of the cursor
|
||||
keymap.set('i', '<C-D>', '<DEL>')
|
||||
|
||||
@ -25,11 +25,23 @@ function M.may_create_dir()
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_nvim_version()
|
||||
function M.check_version_match()
|
||||
-- check if we have the lastest stable version of nvim
|
||||
local expected_ver = {major = 0, minor = 7, patch = 2}
|
||||
local actual_ver = vim.version()
|
||||
|
||||
local nvim_ver_str = string.format("%d.%d.%d", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
||||
return nvim_ver_str
|
||||
local ver_match = true
|
||||
for key, val in pairs(expected_ver) do
|
||||
if val ~= actual_ver[key] then
|
||||
ver_match = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local expect_ver_str = string.format("%s.%s.%s", expected_ver.major, expected_ver.minor, expected_ver.patch)
|
||||
local nvim_ver_str = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
|
||||
|
||||
return {match=ver_match, expected=expect_ver_str, actual=nvim_ver_str}
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user