mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Compare commits
12 Commits
v0.7.2
...
bcdc8d3f66
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcdc8d3f66 | ||
|
|
5498a05bf7 | ||
|
|
644f8b6e2d | ||
|
|
3af7dd51b8 | ||
|
|
e0fc068f2e | ||
|
|
58ed71f870 | ||
|
|
aae9a7b7a7 | ||
|
|
33270f3257 | ||
|
|
99d5a0343b | ||
|
|
3678da1b3c | ||
|
|
a8fdbf3573 | ||
|
|
351ba5fc63 |
@@ -131,9 +131,11 @@ function! utils#Get_titlestr() abort
|
|||||||
if g:is_linux
|
if g:is_linux
|
||||||
let l:title_str = hostname() . ' '
|
let l:title_str = hostname() . ' '
|
||||||
endif
|
endif
|
||||||
let l:title_str = l:title_str . expand('%:p:~') . ' '
|
|
||||||
if &buflisted
|
let l:buf_path = expand('%:p:~')
|
||||||
let l:title_str = l:title_str . strftime('%Y-%m-%d %H:%M',getftime(expand('%')))
|
let l:title_str = l:title_str . l:buf_path . ' '
|
||||||
|
if &buflisted && l:buf_path != ""
|
||||||
|
let l:title_str = l:title_str . strftime('%Y-%m-%d %H:%M:%S%z', getftime(expand('%')))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return l:title_str
|
return l:title_str
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ set shortmess+=c
|
|||||||
" choice, IMHO.
|
" choice, IMHO.
|
||||||
set shortmess+=S
|
set shortmess+=S
|
||||||
|
|
||||||
|
" Disable showing intro message (:intro)
|
||||||
|
set shortmess+=I
|
||||||
|
|
||||||
" Completion behaviour
|
" Completion behaviour
|
||||||
" set completeopt+=noinsert " Auto select the first completion entry
|
" set completeopt+=noinsert " Auto select the first completion entry
|
||||||
set completeopt+=menuone " Show menu even if there is only one item
|
set completeopt+=menuone " Show menu even if there is only one item
|
||||||
@@ -120,7 +123,7 @@ set completeopt-=preview " Disable the preview window
|
|||||||
set pumheight=10 " Maximum number of items to show in popup menu
|
set pumheight=10 " Maximum number of items to show in popup menu
|
||||||
set pumblend=10 " pseudo transparency for completion menu
|
set pumblend=10 " pseudo transparency for completion menu
|
||||||
|
|
||||||
set winblend=5 " pseudo transparency for floating window
|
set winblend=0 " pseudo transparency for floating window
|
||||||
|
|
||||||
" Insert mode key word completion setting
|
" Insert mode key word completion setting
|
||||||
set complete+=kspell complete-=w complete-=b complete-=u complete-=t
|
set complete+=kspell complete-=w complete-=b complete-=u complete-=t
|
||||||
|
|||||||
@@ -425,3 +425,6 @@ function! s:wilder_init() abort
|
|||||||
echohl Error |echomsg "Wilder.nvim missing: run :PackerSync to fix."|echohl None
|
echohl Error |echomsg "Wilder.nvim missing: run :PackerSync to fix."|echohl None
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
""""""""""""""""""""""""""""""vim-auto-save settings""""""""""""""""""""""""""""""
|
||||||
|
let g:auto_save = 1 " enable AutoSave on Vim startup
|
||||||
|
|||||||
@@ -54,6 +54,13 @@ function! s:theme_setup_dict.kanagawa() dict abort
|
|||||||
colorscheme kanagawa
|
colorscheme kanagawa
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:theme_setup_dict.catppuccin() dict abort
|
||||||
|
let g:catppuccin_flavour = "frappe" " latte, frappe, macchiato, mocha
|
||||||
|
|
||||||
|
lua require("catppuccin").setup()
|
||||||
|
colorscheme catppuccin
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Theme to directory name mapping, because theme repo name is not necessarily
|
" Theme to directory name mapping, because theme repo name is not necessarily
|
||||||
" the same as the theme name itself.
|
" the same as the theme name itself.
|
||||||
let s:theme2dir = {
|
let s:theme2dir = {
|
||||||
@@ -67,6 +74,7 @@ let s:theme2dir = {
|
|||||||
\ 'everforest' :'everforest',
|
\ 'everforest' :'everforest',
|
||||||
\ 'nightfox': 'nightfox.nvim',
|
\ 'nightfox': 'nightfox.nvim',
|
||||||
\ 'kanagawa': 'kanagawa.nvim',
|
\ 'kanagawa': 'kanagawa.nvim',
|
||||||
|
\ 'catppuccin': 'catppuccin'
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
let s:theme = utils#RandElement(keys(s:theme2dir))
|
let s:theme = utils#RandElement(keys(s:theme2dir))
|
||||||
@@ -85,7 +93,7 @@ if !s:status
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
execute 'call ' . s:colorscheme_func
|
execute 'call ' . s:colorscheme_func
|
||||||
if g:logging_level == 'info'
|
if g:logging_level == 'debug'
|
||||||
let s:msg1 = "Colorscheme: " . s:theme
|
let s:msg1 = "Colorscheme: " . s:theme
|
||||||
call v:lua.vim.notify(s:msg1, 'info', {'title': 'nvim-config'})
|
call v:lua.vim.notify(s:msg1, 'info', {'title': 'nvim-config'})
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
require("autosave").setup({
|
|
||||||
enabled = true,
|
|
||||||
execution_message = "Autosaved at " .. vim.fn.strftime("%H:%M:%S"),
|
|
||||||
events = { "InsertLeave", "TextChanged" },
|
|
||||||
conditions = {
|
|
||||||
exists = true,
|
|
||||||
filename_is_not = {"plugins.lua"},
|
|
||||||
filetype_is_not = {},
|
|
||||||
modifiable = true,
|
|
||||||
},
|
|
||||||
write_all_buffers = false,
|
|
||||||
on_off_commands = true,
|
|
||||||
clean_command_line_interval = 1000,
|
|
||||||
debounce_delay = 135,
|
|
||||||
})
|
|
||||||
@@ -33,7 +33,6 @@ cmp.setup({
|
|||||||
sources = {
|
sources = {
|
||||||
{ name = 'nvim_lsp' }, -- For nvim-lsp
|
{ name = 'nvim_lsp' }, -- For nvim-lsp
|
||||||
{ name = 'ultisnips' }, -- For ultisnips user.
|
{ name = 'ultisnips' }, -- For ultisnips user.
|
||||||
{ name = 'nvim_lua' }, -- for nvim lua function
|
|
||||||
{ name = 'path' }, -- for path completion
|
{ name = 'path' }, -- for path completion
|
||||||
{ name = 'buffer', keyword_length = 4 }, -- for buffer word completion
|
{ name = 'buffer', keyword_length = 4 }, -- for buffer word completion
|
||||||
{ name = 'omni' },
|
{ name = 'omni' },
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ end
|
|||||||
|
|
||||||
-- Load packer.nvim
|
-- Load packer.nvim
|
||||||
vim.cmd("packadd packer.nvim")
|
vim.cmd("packadd packer.nvim")
|
||||||
local util = require('packer.util')
|
|
||||||
|
|
||||||
require("packer").startup({
|
local packer = require("packer")
|
||||||
|
local packer_util = require('packer.util')
|
||||||
|
|
||||||
|
packer.startup({
|
||||||
function(use)
|
function(use)
|
||||||
-- it is recommened to put impatient.nvim before any other plugins
|
-- it is recommened to put impatient.nvim before any other plugins
|
||||||
use {'lewis6991/impatient.nvim', config = [[require('impatient')]]}
|
use {'lewis6991/impatient.nvim', config = [[require('impatient')]]}
|
||||||
@@ -30,7 +32,7 @@ require("packer").startup({
|
|||||||
|
|
||||||
-- nvim-cmp completion sources
|
-- nvim-cmp completion sources
|
||||||
use {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"}
|
use {"hrsh7th/cmp-nvim-lsp", after = "nvim-cmp"}
|
||||||
use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"}
|
-- use {"hrsh7th/cmp-nvim-lua", after = "nvim-cmp"}
|
||||||
use {"hrsh7th/cmp-path", after = "nvim-cmp"}
|
use {"hrsh7th/cmp-path", after = "nvim-cmp"}
|
||||||
use {"hrsh7th/cmp-buffer", after = "nvim-cmp"}
|
use {"hrsh7th/cmp-buffer", after = "nvim-cmp"}
|
||||||
use { "hrsh7th/cmp-omni", after = "nvim-cmp" }
|
use { "hrsh7th/cmp-omni", after = "nvim-cmp" }
|
||||||
@@ -119,6 +121,7 @@ require("packer").startup({
|
|||||||
use({"sainnhe/everforest", opt = true})
|
use({"sainnhe/everforest", opt = true})
|
||||||
use({"EdenEast/nightfox.nvim", opt = true})
|
use({"EdenEast/nightfox.nvim", opt = true})
|
||||||
use({"rebelot/kanagawa.nvim", opt = true})
|
use({"rebelot/kanagawa.nvim", opt = true})
|
||||||
|
use({"catppuccin/nvim", as = "catppuccin", opt = true})
|
||||||
|
|
||||||
-- Show git change (change, delete, add) signs in vim sign column
|
-- Show git change (change, delete, add) signs in vim sign column
|
||||||
use({"mhinz/vim-signify", event = 'BufEnter'})
|
use({"mhinz/vim-signify", event = 'BufEnter'})
|
||||||
@@ -183,13 +186,7 @@ require("packer").startup({
|
|||||||
-- use 'mg979/vim-visual-multi'
|
-- use 'mg979/vim-visual-multi'
|
||||||
|
|
||||||
-- Autosave files on certain events
|
-- Autosave files on certain events
|
||||||
use({
|
use({"907th/vim-auto-save", event = "InsertEnter"})
|
||||||
"Pocco81/AutoSave.nvim",
|
|
||||||
event = "VimEnter",
|
|
||||||
config = function()
|
|
||||||
vim.defer_fn(function() require('config.autosave') end, 1500)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Show undo history visually
|
-- Show undo history visually
|
||||||
use({"simnalamburt/vim-mundo", cmd = {"MundoToggle", "MundoShow"}})
|
use({"simnalamburt/vim-mundo", cmd = {"MundoToggle", "MundoShow"}})
|
||||||
@@ -356,10 +353,12 @@ require("packer").startup({
|
|||||||
requires = { 'kyazdani42/nvim-web-devicons' },
|
requires = { 'kyazdani42/nvim-web-devicons' },
|
||||||
config = [[require('config.nvim-tree')]]
|
config = [[require('config.nvim-tree')]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use { 'ii14/emmylua-nvim', ft = 'lua' }
|
||||||
end,
|
end,
|
||||||
config = {
|
config = {
|
||||||
max_jobs = 16,
|
max_jobs = 16,
|
||||||
compile_path = util.join_paths(fn.stdpath('data'), 'site', 'lua', 'packer_compiled.lua'),
|
compile_path = packer_util.join_paths(fn.stdpath('data'), 'site', 'lua', 'packer_compiled.lua'),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -8,3 +8,40 @@ call utils#Cabbrev('man', 'Man')
|
|||||||
|
|
||||||
" show current date and time in human readable format
|
" show current date and time in human readable format
|
||||||
command! -nargs=? Datetime echo utils#iso_time(<q-args>)
|
command! -nargs=? Datetime echo utils#iso_time(<q-args>)
|
||||||
|
|
||||||
|
" Convert Markdown file to PDF
|
||||||
|
command! ToPDF call s:md_to_pdf()
|
||||||
|
|
||||||
|
function! s:md_to_pdf() abort
|
||||||
|
" check if pandoc is installed
|
||||||
|
if executable('pandoc') != 1
|
||||||
|
echoerr "pandoc not found"
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:md_path = expand("%:p")
|
||||||
|
let l:pdf_path = fnamemodify(l:md_path, ":r") .. ".pdf"
|
||||||
|
|
||||||
|
let l:header_path = stdpath('config') . '/resources/head.tex'
|
||||||
|
|
||||||
|
let l:cmd = "pandoc --pdf-engine=xelatex --highlight-style=zenburn --table-of-content " .
|
||||||
|
\ "--include-in-header=" . l:header_path . " -V fontsize=10pt -V colorlinks -V toccolor=NavyBlue " .
|
||||||
|
\ "-V linkcolor=red -V urlcolor=teal -V filecolor=magenta -s " .
|
||||||
|
\ l:md_path . " -o " . l:pdf_path
|
||||||
|
|
||||||
|
if g:is_mac
|
||||||
|
let l:cmd = l:cmd . '&& open ' . l:pdf_path
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:is_win
|
||||||
|
let l:cmd = l:cmd . '&& start ' . l:pdf_path
|
||||||
|
endif
|
||||||
|
|
||||||
|
" echomsg l:cmd
|
||||||
|
|
||||||
|
let l:id = jobstart(l:cmd)
|
||||||
|
|
||||||
|
if l:id == 0 || l:id == -1
|
||||||
|
echoerr "Error running command"
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|||||||
78
resources/head.tex
Normal file
78
resources/head.tex
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
\usepackage{fancyvrb,newverbs}
|
||||||
|
\usepackage[top=2cm, bottom=1.5cm, left=2cm, right=2cm]{geometry}
|
||||||
|
|
||||||
|
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
|
||||||
|
\usepackage{hyperref}
|
||||||
|
|
||||||
|
% begin a new page for each section (first level header),
|
||||||
|
% we need to combine this with `-V subparagraph` when invoking pandc
|
||||||
|
% \usepackage{titlesec}
|
||||||
|
% \newcommand{\sectionbreak}{\clearpage}
|
||||||
|
|
||||||
|
% change background color for inline code in markdown files.
|
||||||
|
% The following code does not work well for long text, because the text will exceed the page boundary.
|
||||||
|
\definecolor{bgcolor}{HTML}{DADADA}
|
||||||
|
\let\oldtexttt\texttt
|
||||||
|
|
||||||
|
\renewcommand{\texttt}[1]{
|
||||||
|
\colorbox{bgcolor}{\oldtexttt{#1}}
|
||||||
|
}
|
||||||
|
|
||||||
|
% change style of quote, see also https://tex.stackexchange.com/a/436253/114857
|
||||||
|
\usepackage[most]{tcolorbox}
|
||||||
|
|
||||||
|
\definecolor{linequote}{RGB}{224,215,188}
|
||||||
|
\definecolor{backquote}{RGB}{249,245,233}
|
||||||
|
\definecolor{bordercolor}{RGB}{221,221,221}
|
||||||
|
|
||||||
|
% change left border: https://tex.stackexchange.com/a/475716/114857
|
||||||
|
% change left margin: https://tex.stackexchange.com/a/457936/114857
|
||||||
|
\newtcolorbox{myquote}[1][]{%
|
||||||
|
enhanced,
|
||||||
|
breakable,
|
||||||
|
size=minimal,
|
||||||
|
left=10pt,
|
||||||
|
top=5pt,
|
||||||
|
bottom=5pt,
|
||||||
|
frame hidden,
|
||||||
|
boxrule=0pt,
|
||||||
|
sharp corners=all,
|
||||||
|
colback=backquote,
|
||||||
|
borderline west={2pt}{0pt}{bordercolor},
|
||||||
|
#1
|
||||||
|
}
|
||||||
|
|
||||||
|
% redefine quote environment to use the myquote environment, see https://tex.stackexchange.com/a/337587/114857
|
||||||
|
\renewenvironment{quote}{\begin{myquote}}{\end{myquote}}
|
||||||
|
|
||||||
|
% start a new page after toc, we need to save the old command before defining
|
||||||
|
% new one to avoid recursive command calls,
|
||||||
|
% see https://tex.stackexchange.com/questions/47351/can-i-redefine-a-command-to-contain-itself
|
||||||
|
\let\oldtoc\tableofcontents
|
||||||
|
\renewcommand{\tableofcontents}{\oldtoc\newpage}
|
||||||
|
|
||||||
|
% fix header level issue
|
||||||
|
\usepackage{enumitem}
|
||||||
|
\setlistdepth{9}
|
||||||
|
|
||||||
|
\setlist[itemize,1]{label=$\bullet$}
|
||||||
|
\setlist[itemize,2]{label=$\bullet$}
|
||||||
|
\setlist[itemize,3]{label=$\bullet$}
|
||||||
|
\setlist[itemize,4]{label=$\bullet$}
|
||||||
|
\setlist[itemize,5]{label=$\bullet$}
|
||||||
|
\setlist[itemize,6]{label=$\bullet$}
|
||||||
|
\setlist[itemize,7]{label=$\bullet$}
|
||||||
|
\setlist[itemize,8]{label=$\bullet$}
|
||||||
|
\setlist[itemize,9]{label=$\bullet$}
|
||||||
|
\renewlist{itemize}{itemize}{9}
|
||||||
|
|
||||||
|
\setlist[enumerate,1]{label=$\arabic*.$}
|
||||||
|
\setlist[enumerate,2]{label=$\alph*.$}
|
||||||
|
\setlist[enumerate,3]{label=$\roman*.$}
|
||||||
|
\setlist[enumerate,4]{label=$\arabic*.$}
|
||||||
|
\setlist[enumerate,5]{label=$\alpha*$}
|
||||||
|
\setlist[enumerate,6]{label=$\roman*.$}
|
||||||
|
\setlist[enumerate,7]{label=$\arabic*.$}
|
||||||
|
\setlist[enumerate,8]{label=$\alph*.$}
|
||||||
|
\setlist[enumerate,9]{label=$\roman*.$}
|
||||||
|
\renewlist{enumerate}{enumerate}{9}
|
||||||
Reference in New Issue
Block a user