From 01cac0167f09867cbaf7656702acd45b817e9752 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 28 Oct 2021 11:41:53 +0200 Subject: [PATCH 1/9] [scripts] feat: improve dmenuopen speed don't look into every folder in $HOME filter using `find`, not `grep` --- .local/bin/dmenuopen | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.local/bin/dmenuopen b/.local/bin/dmenuopen index 9ac96a1..531d7bb 100755 --- a/.local/bin/dmenuopen +++ b/.local/bin/dmenuopen @@ -10,22 +10,22 @@ ###################################################################### -filetypes=".pdf .png .jpg .txt .mom .tex .mkv" # could be augmented +filetypes="pdf png jpg txt mom tex mkv" # could be augmented filetype=$(printf "$filetypes" | sed "s| |\n|g" | dmenu -i -p "type of the file?") if [ -z "$filetype" ]; then exit 0 fi -file=$(find $HOME/ -type f | grep "$filetype" | dmenu -i -l 20 -p "open") +file=$(find $HOME/{documents,downloads} -type f -path "*.$filetype" | dmenu -i -l 20 -p "open") if [ -z "$file" ]; then exit 0 fi case "$filetype" in - *.pdf) zathura "$file" ;; - *.png|.jpg) sxiv "$file" ;; - *.txt|*.mom|*.tex) "$TERMINAL" -e nvim "$file" ;; - *.mkv) mpv "$file";; + pdf) zathura "$file" ;; + png|jpg) sxiv "$file" ;; + txt|mom|tex) "$TERMINAL" -e nvim "$file" ;; + mkv) mpv "$file";; esac From ce6a7026d7425d31bdc26b554030bd9aa8e2b153 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Thu, 28 Oct 2021 11:44:46 +0200 Subject: [PATCH 2/9] [scripts] fix: error codes dmenuopen: don't return 0 in case of actual errors switch-colors: no need to exit 0 if everything went well --- .local/bin/dmenuopen | 9 +++------ .local/bin/switch-colors | 2 -- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.local/bin/dmenuopen b/.local/bin/dmenuopen index 531d7bb..6894892 100755 --- a/.local/bin/dmenuopen +++ b/.local/bin/dmenuopen @@ -13,15 +13,12 @@ filetypes="pdf png jpg txt mom tex mkv" # could be augmented filetype=$(printf "$filetypes" | sed "s| |\n|g" | dmenu -i -p "type of the file?") -if [ -z "$filetype" ]; then - exit 0 -fi +[ -z "$filetype" ] && exit 1 + file=$(find $HOME/{documents,downloads} -type f -path "*.$filetype" | dmenu -i -l 20 -p "open") -if [ -z "$file" ]; then - exit 0 -fi +[ -z "$file" ] && exit 2 case "$filetype" in pdf) zathura "$file" ;; diff --git a/.local/bin/switch-colors b/.local/bin/switch-colors index 7652b17..2a77336 100755 --- a/.local/bin/switch-colors +++ b/.local/bin/switch-colors @@ -46,5 +46,3 @@ else switch_scheme fi fi - -exit 0 From ee9e0e819d54d27427f1f554ea2f4fd787a19c07 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Fri, 29 Oct 2021 22:59:24 +0200 Subject: [PATCH 3/9] [nvim] astronomy: add static colors for coq --- .local/src/astronomy.nvim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.local/src/astronomy.nvim b/.local/src/astronomy.nvim index c329ff4..d77e1cf 160000 --- a/.local/src/astronomy.nvim +++ b/.local/src/astronomy.nvim @@ -1 +1 @@ -Subproject commit c329ff44d3aef42e8347563bf7ae119b5a2a2d70 +Subproject commit d77e1cfe127418ab00c6d5fb076f89cdf9b49e94 From 73ac47a77356266eb670729d963a434375f68825 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 30 Oct 2021 15:28:22 +0200 Subject: [PATCH 4/9] [npm] introducing npm --- .config/npm/npmrc | 4 ++++ .config/zsh/.zprofile | 1 + 2 files changed, 5 insertions(+) create mode 100644 .config/npm/npmrc diff --git a/.config/npm/npmrc b/.config/npm/npmrc new file mode 100644 index 0000000..fc84b78 --- /dev/null +++ b/.config/npm/npmrc @@ -0,0 +1,4 @@ +prefix=${XDG_DATA_HOME}/npm +cache=${XDG_CACHE_HOME}/npm +tmp=${XDG_RUNTIME_DIR}/npm +init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index c52b485..a072d61 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -21,6 +21,7 @@ export TEXMFHOME="$XDG_DATA_HOME/texmf" export CARGO_HOME="$XDG_DATA_HOME/cargo" export OPAMROOT="$XDG_DATA_HOME/opam" export COQBIN="$OPAMROOT/default/bin/" +export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" ## default programs export SUDO_ASKPASS="$HOME/.local/bin/dmenupass" From a532830d7788270f0aa0e76c39d3b5589e9a97e8 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 30 Oct 2021 15:29:14 +0200 Subject: [PATCH 5/9] [nvim] new plugin : autopairs --- .config/nvim/lua/plugin/cmp.lua | 4 ++++ .config/nvim/lua/plugins.lua | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/.config/nvim/lua/plugin/cmp.lua b/.config/nvim/lua/plugin/cmp.lua index fee7dda..c620fec 100644 --- a/.config/nvim/lua/plugin/cmp.lua +++ b/.config/nvim/lua/plugin/cmp.lua @@ -5,6 +5,7 @@ local cmp = require("cmp") local luasnip = require("luasnip") +local cmp_autopairs = require('nvim-autopairs.completion.cmp') local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) @@ -17,6 +18,9 @@ local check_backspace = function() sub(col, col):match('%s') == nil end +-- If you want insert `(` after select function or method item +cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) + cmp.setup { completion = { autocomplete = false diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 6ee4b19..d9b0148 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -86,6 +86,12 @@ return require("packer").startup(function() config = function() require("plugin.comment") end } + -- autopairs + use { + "windwp/nvim-autopairs", + config = function() require('nvim-autopairs').setup() end + } + -- display colors directly in editor use { "norcalli/nvim-colorizer.lua", From a137ededaaf796550affab3da2ee0f0682adf759 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 30 Oct 2021 15:29:45 +0200 Subject: [PATCH 6/9] [nvim] update lua_lsp config --- .config/nvim/lua/lsp/lua.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.config/nvim/lua/lsp/lua.lua b/.config/nvim/lua/lsp/lua.lua index 7e55549..7328492 100644 --- a/.config/nvim/lua/lsp/lua.lua +++ b/.config/nvim/lua/lsp/lua.lua @@ -11,6 +11,10 @@ local sumneko_root_path = vim.fn.stdpath("data") .. local sumneko_binary = sumneko_root_path .. "/bin/" .. system_name .. "/lua-language-server" +local runtime_path = vim.split(package.path, ';') +table.insert(runtime_path, "lua/?.lua") +table.insert(runtime_path, "lua/?/init.lua") + require'lspconfig'.sumneko_lua.setup { cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}; settings = { @@ -19,7 +23,7 @@ require'lspconfig'.sumneko_lua.setup { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) version = 'LuaJIT', -- Setup your lua path - path = vim.split(package.path, ';'), + path = runtime_path, }, diagnostics = { -- Get the language server to recognize the `vim` global @@ -27,10 +31,7 @@ require'lspconfig'.sumneko_lua.setup { }, workspace = { -- Make the server aware of Neovim runtime files - library = { - [vim.fn.expand('$VIMRUNTIME/lua')] = true, - [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true, - }, + library = vim.api.nvim_get_runtime_file("", true), }, -- Do not send telemetry data containing a randomized but unique identifier telemetry = { From 05e1b49a2013f71931de35310f1ac077d261f7bf Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 30 Oct 2021 15:30:07 +0200 Subject: [PATCH 7/9] [nvim] fix verilog/coq maps --- .config/nvim/after/ftplugin/verilog.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/nvim/after/ftplugin/verilog.lua b/.config/nvim/after/ftplugin/verilog.lua index a41731d..4f3a743 100644 --- a/.config/nvim/after/ftplugin/verilog.lua +++ b/.config/nvim/after/ftplugin/verilog.lua @@ -7,7 +7,8 @@ utils.map("n", "", "CoqInterrupt") utils.map("n", "j", "CoqNext") utils.map("n", "k", "CoqUndo") utils.map("n", "", "CoqToLine") -utils.map("n", "a", "Coq About") -utils.map("n", "G", "CoqJumpToEnd") +utils.map("n", "a", ":Coq About") +utils.map("n", "s", ":Coq Search") +utils.map("n", "G", "CoqJumpToEnd") utils.map("i", "//", "∥") From 2a5d513a00a4f3f5218c2b1627638599fecd83a8 Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 30 Oct 2021 15:31:39 +0200 Subject: [PATCH 8/9] [nvim] add c and lua filetype settings --- .config/nvim/after/ftplugin/c.lua | 9 +++++++++ .config/nvim/after/ftplugin/lua.lua | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 .config/nvim/after/ftplugin/c.lua create mode 100644 .config/nvim/after/ftplugin/lua.lua diff --git a/.config/nvim/after/ftplugin/c.lua b/.config/nvim/after/ftplugin/c.lua new file mode 100644 index 0000000..6dfd3f6 --- /dev/null +++ b/.config/nvim/after/ftplugin/c.lua @@ -0,0 +1,9 @@ +-- Author : swytch +-- Created : Saturday Oct. 30, 2021 11:43:34 CET +-- License : GPLv3 +-- Description : c settings file + +local opt = vim.opt +local g = vim.g + +opt.formatoptions = "trq1jp" diff --git a/.config/nvim/after/ftplugin/lua.lua b/.config/nvim/after/ftplugin/lua.lua new file mode 100644 index 0000000..698ac52 --- /dev/null +++ b/.config/nvim/after/ftplugin/lua.lua @@ -0,0 +1,9 @@ +-- Author : swytch +-- Created : Saturday Oct. 30, 2021 11:43:21 CET +-- License : GPLv3 +-- Description : lua settings file + +local opt = vim.opt +local g = vim.g + +opt.formatoptions = "trq1jp" From 555cb3e04e0e25188f3006211a1d1119af228d7a Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Sat, 30 Oct 2021 15:31:59 +0200 Subject: [PATCH 9/9] [nvim] change packersync map --- .config/nvim/lua/maps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/nvim/lua/maps.lua b/.config/nvim/lua/maps.lua index ee37983..0764807 100644 --- a/.config/nvim/lua/maps.lua +++ b/.config/nvim/lua/maps.lua @@ -7,7 +7,7 @@ utils.map("n", "", "") utils.map("n", "y", "\"+y") utils.map("n", "p", "\"+P") utils.map("n", "", "w! | !compiler %") -utils.map("n", "s", "PackerSync") +utils.map("n", "u", "PackerSync") utils.map("n", "c", "ColorizerToggle") -- LSP