From 554068c22c5167c0498c2d0b90e6e8e9c4f2dc19 Mon Sep 17 00:00:00 2001 From: Laily Date: Tue, 1 Mar 2022 10:12:33 +0800 Subject: [PATCH] feat: open md --- .zshrc | 7 ++++ git/.gitconfig | 45 ++++++++++++----------- nvim/lua/pluginconfig/nvim-tree.lua | 4 +- nvim/lua/pluginconfig/nvim-treesitter.lua | 6 +-- nvim/lua/pluginconfig/which-key.lua | 1 + nvim/lua/plugins.lua | 9 ++++- nvim/lua/settings.lua | 2 +- nvim/lua/utils/init.lua | 5 +++ 8 files changed, 51 insertions(+), 28 deletions(-) diff --git a/.zshrc b/.zshrc index 3e782db..e0740b9 100644 --- a/.zshrc +++ b/.zshrc @@ -100,10 +100,17 @@ source $ZSH/oh-my-zsh.sh bindkey "^b" backward-word bindkey "^f" forward-word +# Turn off all beeps +unsetopt BEEP +# Turn off autocomplete beeps +# unsetopt LIST_BEEP + # brew export HOMEBREW_NO_AUTO_UPDATE=true # 禁止 brew 每次安装软件都 upate # go +export GOPATH=$HOME/go +export PATH=$PATH:$GOPATH/bin export GOPROXY=goproxy.cn export GOSUMDB="sum.golang.google.cn" diff --git a/git/.gitconfig b/git/.gitconfig index a29dc19..4ab77b5 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -1,27 +1,30 @@ [user] -name = Laily -email = i@laily.net + name = Laily + email = i@laily.net [core] -autocrlf = input -quotepath = false -editor = /usr/local/bin/nvim -excludesfile = ~/.dotfile/git/.gitignore + autocrlf = input + quotepath = false + editor = /usr/local/bin/nvim + excludesfile = ~/.dotfile/git/.gitignore [alias] -au = add -u -co = checkout -cm = commit -m -st = status -ap = add -p -br = branch -pl = pull -pt = push origin --tags -merge2 = "!f() { git checkout $1 && git merge $2 && git checkout -; }; f" -bg = "!f() { git branch | grep $1; }; f" -delbr = "!f(){ git branch -D $(git branch | grep \"\b$1\"); };f" -can = commit --amend --no-edit + au = add -u + co = checkout + cm = commit -m + st = status + ap = add -p + br = branch + pl = pull + pt = push origin --tags + merge2 = "!f() { git checkout $1 && git merge $2 && git checkout -; }; f" + bg = "!f() { git branch | grep $1; }; f" + delbr = "!f(){ git branch -D $(git branch | grep \"\b$1\"); };f" + can = commit --amend --no-edit + cleanbr = "!git branch --merged master | grep -v '\\*\\|master\\|main' | xargs -n 1 git branch -d" [push] -default = current + default = current [merge] -tool = vimdiff + tool = vimdiff [include] -path = ~/.subgitconfig + path = ~/.subgitconfig +[branch] + autoSetupMerge = always diff --git a/nvim/lua/pluginconfig/nvim-tree.lua b/nvim/lua/pluginconfig/nvim-tree.lua index 30af1d2..8637a24 100644 --- a/nvim/lua/pluginconfig/nvim-tree.lua +++ b/nvim/lua/pluginconfig/nvim-tree.lua @@ -14,10 +14,10 @@ require'nvim-tree'.setup { }, update_focused_file = { -- enables the feature - enable = false, + enable = true, -- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory -- only relevant when `update_focused_file.enable` is true - update_cwd = false, + update_cwd = true, -- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory -- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true ignore_list = {} diff --git a/nvim/lua/pluginconfig/nvim-treesitter.lua b/nvim/lua/pluginconfig/nvim-treesitter.lua index 65c0221..efcd8be 100644 --- a/nvim/lua/pluginconfig/nvim-treesitter.lua +++ b/nvim/lua/pluginconfig/nvim-treesitter.lua @@ -1,6 +1,5 @@ local treesitter = { ensure_installed = "all", - ignore_install = {"haskell","markdown"}, highlight = {enabled = true}, playground = {enabled = true}, rainbow = {enabled = false}, @@ -8,13 +7,14 @@ local treesitter = { require'nvim-treesitter.configs'.setup { ensure_installed = treesitter.ensure_installed, -- one of "all", "maintained" (parsers with maintainers), or a list of languages - ignore_install = treesitter.ignore_install, + ignore_install = {"haskell", "markdown"}, matchup = { enable = true, -- mandatory, false will disable the whole extension -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled }, highlight = { - enable = treesitter.highlight.enabled -- false will disable the whole extension + enable = treesitter.highlight.enabled, -- false will disable the whole extension + disable = { "markdown" }, }, context_commentstring = { enable = true, diff --git a/nvim/lua/pluginconfig/which-key.lua b/nvim/lua/pluginconfig/which-key.lua index 761fb0a..1f1dd94 100644 --- a/nvim/lua/pluginconfig/which-key.lua +++ b/nvim/lua/pluginconfig/which-key.lua @@ -131,6 +131,7 @@ local mappings = { }, f = { name = "+File", + m = {"lua require'utils'.open_md()", "open a markdown file in vscode"}, s = {"w", "save file"}, t = {"NvimTreeToggle", "toggle nvim tree"}, r = {"RnvimrToggle", "toggle rnvimr"}, diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index c0b4b18..4dccfac 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -173,7 +173,14 @@ return require("packer").startup(function(use) end } - use {'SidOfc/mkdx'} + -- markdown + use {'godlygeek/tabular'} + use {'preservim/vim-markdown'} + use { + 'iamcco/markdown-preview.nvim', + run = function() vim.fn['mkdp#util#install']() end, + ft = {'markdown'} + } --use 'EdenEast/nightfox.nvim' -- use {'godlygeek/tabular', opt=true} diff --git a/nvim/lua/settings.lua b/nvim/lua/settings.lua index 08ea8d4..2d3070f 100644 --- a/nvim/lua/settings.lua +++ b/nvim/lua/settings.lua @@ -6,7 +6,7 @@ vim.o.title = true TERMINAL = vim.fn.expand('$TERMINAL') vim.cmd('let &titleold="'..TERMINAL..'"') vim.o.titlestring="%<%F%=%l/%L - nvim" -vim.wo.wrap = false -- Display long lines as just one line +vim.wo.wrap = true -- Display long lines as just one line vim.cmd('set whichwrap+=<,>,[,],h,l') -- move to next line with theses keys vim.cmd('syntax on') -- syntax highlighting vim.o.pumheight = 10 -- Makes popup menu smaller diff --git a/nvim/lua/utils/init.lua b/nvim/lua/utils/init.lua index 3f56f4d..77e8211 100644 --- a/nvim/lua/utils/init.lua +++ b/nvim/lua/utils/init.lua @@ -8,6 +8,11 @@ function lv_utils.yank_filepath() vim.fn.setreg('+',p) end +function lv_utils.open_md() + local p = vim.fn.expand('%:p') + vim.fn.system("open -a typora "..p) +end + function lv_utils.define_augroups(definitions) -- {{{1 -- Create autocommand groups based on the passed definitions --