Merge remote-tracking branch 'origin/main' into vision-five-2
This commit is contained in:
commit
5f1f5dc322
14 changed files with 46 additions and 458 deletions
|
@ -1,4 +0,0 @@
|
|||
augroup det_snippet
|
||||
autocmd!
|
||||
autocmd BufRead,BufNewFile *.snippets set filetype=snippets
|
||||
augroup END
|
19
config/programs/vim/config/lua/config/cmp-ai.lua
Normal file
19
config/programs/vim/config/lua/config/cmp-ai.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local cmp_ai = require('cmp_ai.config')
|
||||
|
||||
cmp_ai:setup({
|
||||
max_lines = 100,
|
||||
provider = 'Ollama',
|
||||
provider_options = {
|
||||
model = 'codellama:13b-code-q6_K',
|
||||
},
|
||||
notify = true,
|
||||
notify_callback = function(msg)
|
||||
vim.notify(msg)
|
||||
end,
|
||||
run_on_every_keystroke = true,
|
||||
ignored_file_types = {
|
||||
-- default is not to ignore
|
||||
-- uncomment to ignore in lua:
|
||||
-- lua = true
|
||||
},
|
||||
})
|
|
@ -1,6 +1,6 @@
|
|||
local api = vim.api
|
||||
|
||||
local exclude_ft = { "help", "git", "markdown", "snippets", "text", "gitconfig", "alpha", "dashboard" }
|
||||
local exclude_ft = { "help", "git", "markdown", "text", "gitconfig", "alpha", "dashboard" }
|
||||
|
||||
require("ibl").setup {
|
||||
indent = {
|
||||
|
|
|
@ -3,12 +3,6 @@ local cmp = require("cmp")
|
|||
local lspkind = require("lspkind")
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
-- For `ultisnips` user.
|
||||
vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
|
@ -29,10 +23,19 @@ cmp.setup {
|
|||
["<Esc>"] = cmp.mapping.close(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
['<C-x>'] = cmp.mapping(
|
||||
cmp.mapping.complete({
|
||||
config = {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'cmp_ai' },
|
||||
}),
|
||||
},
|
||||
}),
|
||||
{ 'i' }
|
||||
),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" }, -- For nvim-lsp
|
||||
{ name = "ultisnips" }, -- For ultisnips user.
|
||||
{ name = "path" }, -- for path completion
|
||||
{ name = "buffer", keyword_length = 2 }, -- for buffer word completion
|
||||
{ name = "emoji", insert = true }, -- emoji completion
|
||||
|
@ -49,7 +52,6 @@ cmp.setup {
|
|||
mode = "symbol_text",
|
||||
menu = {
|
||||
nvim_lsp = "[LSP]",
|
||||
ultisnips = "[US]",
|
||||
nvim_lua = "[Lua]",
|
||||
path = "[Path]",
|
||||
buffer = "[Buffer]",
|
||||
|
@ -63,7 +65,6 @@ cmp.setup {
|
|||
cmp.setup.filetype("tex", {
|
||||
sources = {
|
||||
{ name = "omni" },
|
||||
{ name = "ultisnips" }, -- For ultisnips user.
|
||||
{ name = "buffer", keyword_length = 2 }, -- for buffer word completion
|
||||
{ name = "path" }, -- for path completion
|
||||
},
|
||||
|
|
|
@ -161,10 +161,10 @@ keymap.set("n", "gB", '<cmd>call buf_utils#GoToBuffer(v:count, "backward")<cr>',
|
|||
})
|
||||
|
||||
-- Switch windows
|
||||
keymap.set("n", "<left>", "<c-w>h")
|
||||
keymap.set("n", "<Right>", "<C-W>l")
|
||||
keymap.set("n", "<Up>", "<C-W>k")
|
||||
keymap.set("n", "<Down>", "<C-W>j")
|
||||
keymap.set("n", "<c-left>", "<c-w>h")
|
||||
keymap.set("n", "<c-Right>", "<C-W>l")
|
||||
keymap.set("n", "<c-Up>", "<C-W>k")
|
||||
keymap.set("n", "<c-Down>", "<C-W>j")
|
||||
|
||||
-- Text objects for URL
|
||||
keymap.set({ "x", "o" }, "iu", "<cmd>call text_obj#URL()<cr>", { desc = "URL text object" })
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
snippet "(?<!\w)ltx" "LaTeX symbol" r
|
||||
LaTeX
|
||||
endsnippet
|
||||
|
||||
snippet arw "Right-pointed arrow"
|
||||
--> $1
|
||||
endsnippet
|
|
@ -1,182 +0,0 @@
|
|||
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <stack>
|
||||
#include <queue>
|
||||
#include <numeric>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
using std::map;
|
||||
using std::unordered_map;
|
||||
using std::set;
|
||||
using std::unordered_set;
|
||||
using std::stack;
|
||||
using std::queue;
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet icd "#include directive" b
|
||||
#include <$1>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet plist "print vector" w
|
||||
template <class T>
|
||||
void printList(const T& arr, const string& desc){
|
||||
std::cout << desc << ": [";
|
||||
|
||||
for (auto it = arr.begin(); it != arr.end(); it++){
|
||||
std::cout << *it << ((std::next(it) != arr.end()) ? ", " : "");
|
||||
}
|
||||
std::cout << "]\n";
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pmat "print list of list" w
|
||||
template <class T>
|
||||
void printMat(const vector<vector<T>>& mat, const string& desc){
|
||||
cout << desc << ": " << endl;
|
||||
|
||||
for (auto it1 = mat.begin(); it1 != mat.end(); it1++){
|
||||
auto cur_vec = *it1;
|
||||
cout << "[";
|
||||
for (auto it2 = cur_vec.begin(); it2 != cur_vec.end(); it2++){
|
||||
cout << *it2 << ((std::next(it2) != cur_vec.end()) ? ", " : "]\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pqueue "print queue"
|
||||
template <class T>
|
||||
void printQueue(T q){
|
||||
while(!q.empty()){
|
||||
std::cout << q.top() << " ";
|
||||
q.pop();
|
||||
}
|
||||
std::cout << '\n';
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet cout "print a variable" w
|
||||
cout << "$1: " << $2 << endl;
|
||||
endsnippet
|
||||
|
||||
snippet random "Generate a random list" b
|
||||
// Generate a random sequence of length len, in range(low, high) (inclusive).
|
||||
// need to #include<random>
|
||||
vector<int> genRandom(int low, int high, int len){
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
std::uniform_int_distribution<int> distribution(low, high);
|
||||
|
||||
vector<int> arr(len, 0);
|
||||
for (int i = 0; i != len; ++i){
|
||||
arr[i] = distribution(gen);
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet incset "Use set" b
|
||||
#include <set>
|
||||
|
||||
using std::set;
|
||||
endsnippet
|
||||
|
||||
snippet incmap "Use map" b
|
||||
#include <map>
|
||||
|
||||
using std::map;
|
||||
endsnippet
|
||||
|
||||
snippet incqueue "Use queue" b
|
||||
#include <queue>
|
||||
|
||||
using std::queue;
|
||||
endsnippet
|
||||
|
||||
snippet incstr "Use string" b
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
endsnippet
|
||||
|
||||
snippet incvec "Use vector" b
|
||||
#include <vector>
|
||||
|
||||
using std::vector;
|
||||
endsnippet
|
||||
|
||||
snippet incstack "Use stack" b
|
||||
#include <stack>
|
||||
|
||||
using std::stack;
|
||||
endsnippet
|
||||
|
||||
snippet vec "std::vector" w
|
||||
vector<$1> ${2:vec}
|
||||
endsnippet
|
||||
|
||||
snippet map "std::map" w
|
||||
map<$1, $2> ${3:mymap}
|
||||
endsnippet
|
||||
|
||||
snippet umap "std::unordered_map"
|
||||
unordered_map<$1, $2> ${3:mymap}
|
||||
endsnippet
|
||||
|
||||
snippet set "std::set" w
|
||||
set<$1> ${2:myset}
|
||||
endsnippet
|
||||
|
||||
snippet uset "std::unordered_set" w
|
||||
unordered_set<$1> ${2:myset}
|
||||
endsnippet
|
||||
|
||||
snippet queue "std::queue" w
|
||||
queue<$1> ${2:q}
|
||||
endsnippet
|
||||
|
||||
snippet stack "std::stack" w
|
||||
stack<$1> ${2:mystack}
|
||||
endsnippet
|
||||
|
||||
snippet sol "solution" w
|
||||
auto solution = Solution();
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet for "for loop" w
|
||||
for ($1; $2; $3){
|
||||
$4
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet if "if condition" w
|
||||
if ($1){
|
||||
$2
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ifelse "if else condition"
|
||||
if ($1){
|
||||
$2
|
||||
}else{
|
||||
|
||||
}
|
||||
endsnippet
|
|
@ -1,168 +0,0 @@
|
|||
global !p
|
||||
def gen_header(snip):
|
||||
placeholders_string = snip.buffer[snip.line].strip()
|
||||
level = int(placeholders_string[0])
|
||||
|
||||
# erase current line
|
||||
snip.buffer[snip.line] = ""
|
||||
line_content = "#"*level + " ${1:Section Name}"
|
||||
line_content += '\n$0'
|
||||
|
||||
snip.expand_anon(line_content)
|
||||
endglobal
|
||||
|
||||
snippet "(k1|kbd)" "HTML kbd tag" rw
|
||||
<kbd>${1:KEY}</kbd>$0
|
||||
endsnippet
|
||||
|
||||
snippet k2 "Two key strokes shortcut"
|
||||
<kbd>${1:KEY}</kbd> + <kbd>${2:KEY}</kbd>
|
||||
endsnippet
|
||||
|
||||
snippet k3 "Three key strokes shortcut"
|
||||
<kbd>${1:KEY}</kbd> + <kbd>${2:KEY}</kbd> + <kbd>${3:KEY}</kbd>
|
||||
endsnippet
|
||||
|
||||
snippet meta "Markdown front matter (YAML format)" b
|
||||
---
|
||||
title: "$1"
|
||||
date: `!p from datetime import datetime
|
||||
if not snip.c:
|
||||
snip.rv=datetime.now().astimezone().strftime("%Y-%m-%d %H:%M:%S%z")`
|
||||
tags: [$2]
|
||||
categories: [$3]
|
||||
---
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet more "HTML more tag"
|
||||
<!--more-->
|
||||
endsnippet
|
||||
|
||||
snippet img "Aligned image using HTML tag"
|
||||
<p align="center">
|
||||
<img src="${1:URL}" width="${2:800}">
|
||||
</p>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet font "HTML font tag"
|
||||
<font color="${1:blue}">${2:TEXT}</font>
|
||||
endsnippet
|
||||
|
||||
snippet link "Markdown links"
|
||||
[$1]($2)$0
|
||||
endsnippet
|
||||
|
||||
post_jump "gen_header(snip)"
|
||||
snippet "h([1-6])" "Markdown header" br
|
||||
`!p snip.rv = match.group(1)`
|
||||
endsnippet
|
||||
|
||||
snippet detail "Clickable details" b
|
||||
<details>
|
||||
<summary><font size="2" color="red">${1:Click to show the code.}</font></summary>
|
||||
|
||||
$2
|
||||
</details>
|
||||
endsnippet
|
||||
|
||||
snippet yh "直角引号" w
|
||||
「$1」
|
||||
endsnippet
|
||||
|
||||
snippet info "info box"
|
||||
<style type="text/css">
|
||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
|
||||
|
||||
.info-msg {
|
||||
color: #059;
|
||||
background-color: #BEF;
|
||||
margin: 5px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
border: 2px solid transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="info-msg">
|
||||
<i class="fa fa-info-circle"> Info</i></br>
|
||||
${1:info text}
|
||||
</div>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet warn "warning box"
|
||||
<style type="text/css">
|
||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
|
||||
|
||||
.warning-msg {
|
||||
color: #9F6000;
|
||||
background-color: #FEEFB3;
|
||||
margin: 5px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
border: 2px solid transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="warning-msg">
|
||||
<i class="fa fa-warning"> Warning</i></br>
|
||||
${1:warning text}
|
||||
</div>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet error "error box"
|
||||
<style type="text/css">
|
||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
|
||||
|
||||
.error-msg {
|
||||
color: #D8000C;
|
||||
background-color: #FFBABA;
|
||||
margin: 5px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
border: 2px solid transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="error-msg">
|
||||
<i class="fa fa-times-circle"> Error</i></br>
|
||||
${1:error text}
|
||||
</div>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet success "success box"
|
||||
<style type="text/css">
|
||||
@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css');
|
||||
|
||||
.success-msg {
|
||||
color: #270;
|
||||
background-color: #DFF2BF;
|
||||
margin: 5px 0;
|
||||
margin-bottom: 20px;
|
||||
padding: 10px;
|
||||
border-radius: 5px 5px 5px 5px;
|
||||
border: 2px solid transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="success-msg">
|
||||
<i class="fa fa-check"></i>
|
||||
${1:success text}
|
||||
</div>
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet td "too long do not read" bw
|
||||
tl;dr: $1
|
||||
endsnippet
|
|
@ -1,30 +0,0 @@
|
|||
snippet head "Python source file header" b
|
||||
"""
|
||||
Description: $1
|
||||
Author: Jie-dong Hao (jdhao@hotmail.com)
|
||||
Created: `!v strftime("%Y-%m-%d %H:%M:%S%z")`
|
||||
"""
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet print "Print value of some variable"
|
||||
print("$1".format($2))
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet impa "import FOO as BAR" b
|
||||
import ${1:FOO} as ${2:BAR}
|
||||
endsnippet
|
||||
|
||||
snippet main "Main function boilerplate" b
|
||||
def main():
|
||||
$0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
endsnippet
|
||||
|
||||
snippet sol "solution" b
|
||||
solution = Solution()
|
||||
endsnippet
|
|
@ -1,6 +0,0 @@
|
|||
# copied from https://github.com/honza/vim-snippets/blob/master/UltiSnips/snippets.snippets
|
||||
snippet snip "Ultisnips snippet definition" b
|
||||
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
|
||||
${0:${VISUAL}}
|
||||
`!p snip.rv = "endsnippet"`
|
||||
endsnippet
|
|
@ -1,9 +0,0 @@
|
|||
snippet use "usepackage" b
|
||||
\usepackage{${1:package}}
|
||||
endsnippet
|
||||
|
||||
snippet eqa "equation environment" b
|
||||
\begin{equation}\label{$1}
|
||||
$2
|
||||
\end{equation}
|
||||
endsnippet
|
|
@ -1,14 +0,0 @@
|
|||
snippet fun "vim function"
|
||||
function! ${1:MyFunc}(${2}) abort
|
||||
$3
|
||||
endfunction
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet aug "vim augroup" b
|
||||
augroup ${1:GROUP_NAME}
|
||||
autocmd!
|
||||
autocmd ${2:EVENT} ${3:PATTERN} $4
|
||||
augroup END
|
||||
$0
|
||||
endsnippet
|
|
@ -13,21 +13,6 @@ call utils#Cabbrev('ps', 'Lazy sync')
|
|||
" configurations for vim script plugin "
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
"""""""""""""""""""""""""UltiSnips settings"""""""""""""""""""
|
||||
" Trigger configuration. Do not use <tab> if you use YouCompleteMe
|
||||
let g:UltiSnipsExpandTrigger='<c-j>'
|
||||
|
||||
" Do not look for SnipMate snippets
|
||||
let g:UltiSnipsEnableSnipMate = 0
|
||||
|
||||
" Shortcut to jump forward and backward in tabstop positions
|
||||
let g:UltiSnipsJumpForwardTrigger='<c-j>'
|
||||
let g:UltiSnipsJumpBackwardTrigger='<c-k>'
|
||||
|
||||
" Configuration for custom snippets directory, see
|
||||
" https://jdhao.github.io/2019/04/17/neovim_snippet_s1/ for details.
|
||||
let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
|
||||
|
||||
"""""""""""""""""""""""""" vlime settings """"""""""""""""""""""""""""""""
|
||||
command! -nargs=0 StartVlime call jobstart(printf("sbcl --load %s/vlime/lisp/start-vlime.lisp", g:package_home))
|
||||
|
||||
|
@ -403,4 +388,4 @@ function! s:wilder_init() abort
|
|||
endfunction
|
||||
|
||||
""""""""""""""""""""""""""""""vim-auto-save settings""""""""""""""""""""""""""""""
|
||||
let g:auto_save = 1 " enable AutoSave on Vim startup
|
||||
let g:auto_save = 1 " enable AutoSave on Vim startup
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
asyncrun-vim
|
||||
bufferline-nvim
|
||||
catppuccin-nvim
|
||||
cmp-ai
|
||||
cmp-buffer
|
||||
cmp-emoji
|
||||
cmp-nvim-lsp
|
||||
cmp-nvim-ultisnips
|
||||
cmp-omni
|
||||
cmp-path
|
||||
committia-vim
|
||||
|
@ -57,7 +57,6 @@
|
|||
targets-vim
|
||||
telescope-nvim
|
||||
telescope-symbols-nvim
|
||||
UltiSnips
|
||||
unicode-vim
|
||||
vim-auto-save
|
||||
vim-commentary
|
||||
|
@ -73,7 +72,6 @@
|
|||
vim-repeat
|
||||
vim-sandwich
|
||||
vim-scriptease
|
||||
vim-snippets
|
||||
vim-swap
|
||||
vim-toml
|
||||
vimtex
|
||||
|
@ -106,12 +104,20 @@
|
|||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-omni",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"quangnguyen30192/cmp-nvim-ultisnips",
|
||||
"tzachar/cmp-ai"
|
||||
},
|
||||
config = function()
|
||||
require("config.nvim-cmp")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"tzachar/cmp-ai",
|
||||
event = "VeryLazy",
|
||||
dependencies = {'nvim-lua/plenary.nvim'},
|
||||
config = function()
|
||||
require("config.cmp-ai")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufRead", "BufNewFile" },
|
||||
|
@ -216,10 +222,6 @@
|
|||
end,
|
||||
cmd = "Vista",
|
||||
},
|
||||
-- Snippet engine and snippet template
|
||||
{ "SirVer/ultisnips", dependencies = {
|
||||
"honza/vim-snippets",
|
||||
}, event = "InsertEnter" },
|
||||
-- Automatic insertion and deletion of a pair of characters
|
||||
{ "Raimondi/delimitMate", event = "InsertEnter" },
|
||||
-- Comment plugin
|
||||
|
@ -443,6 +445,7 @@
|
|||
"stevearc",
|
||||
"tpope",
|
||||
"tyru",
|
||||
"tzachar",
|
||||
"wellle",
|
||||
"Yggdroot",
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue