diff --git a/nvim/after/plugin/coq.vim b/nvim/after/plugin/coq.vim new file mode 100644 index 00000000..34181a85 --- /dev/null +++ b/nvim/after/plugin/coq.vim @@ -0,0 +1,13 @@ +lua << EOF +vim.g.coq_settings = { + keymap = { + recommended = false, + jump_to_mark = '', + manual_complete = ';;', + }, +} + +require("coq_3p")({ + { src = "copilot", short_name = "COP", accept_key = "" }, +}) +EOF diff --git a/nvim/after/plugin/jeskape.lua b/nvim/after/plugin/jeskape.lua index a7468630..2448b5b2 100644 --- a/nvim/after/plugin/jeskape.lua +++ b/nvim/after/plugin/jeskape.lua @@ -4,10 +4,6 @@ require("jeskape").setup({ p = "call fzf#vim#complete#path('fd')", w = "call fzf#vim#complete#word({'window': { 'width': 0.2, 'height': 0.9, 'xoffset': 1 }})", }, - [";"] = { - [";"] = "A;", - [","] = "A,", - }, k = { k = "", j = "", diff --git a/nvim/after/plugin/lsp_config.lua b/nvim/after/plugin/lsp_config.lua new file mode 100644 index 00000000..196c2d06 --- /dev/null +++ b/nvim/after/plugin/lsp_config.lua @@ -0,0 +1,36 @@ +-- Mappings. +-- See `:help vim.diagnostic.*` for documentation on any of the below functions +local opts = { noremap = true, silent = true } +vim.api.nvim_set_keymap("n", "e", "lua vim.diagnostic.open_float()", opts) +vim.api.nvim_set_keymap("n", "[d", "lua vim.diagnostic.goto_prev()", opts) +vim.api.nvim_set_keymap("n", "]d", "lua vim.diagnostic.goto_next()", opts) +vim.api.nvim_set_keymap("n", "d", "lua vim.diagnostic.setloclist()", opts) + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +local on_attach = function(client, bufnr) + -- Enable completion triggered by + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "lua vim.lsp.buf.implementation()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.signature_help()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) + vim.api.nvim_buf_set_keymap( + bufnr, + "n", + "wl", + "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", + opts + ) + vim.api.nvim_buf_set_keymap(bufnr, "n", "D", "lua vim.lsp.buf.type_definition()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "rn", "lua vim.lsp.buf.rename()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "f", "lua vim.lsp.buf.formatting()", opts) +end diff --git a/nvim/after/plugin/lsp_installer.lua b/nvim/after/plugin/lsp_installer.lua new file mode 100644 index 00000000..9ab673b2 --- /dev/null +++ b/nvim/after/plugin/lsp_installer.lua @@ -0,0 +1,6 @@ +local lsp_installer = require("nvim-lsp-installer") + +lsp_installer.on_server_ready(function(server) + local opts = {} + server:setup(opts) +end) diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json deleted file mode 100644 index 0bd69bc2..00000000 --- a/nvim/coc-settings.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "snippets.userSnippetsDirectory": "~/dotfiles/nvim/snips", - "coc.preferences.useQuickfixForLocations": true, - "diagnostic.warningSign": "", - "diagnostic.errorSign": "", - "diagnostic.infoSign": "", - "diagnostic.hintSign": "ﯦ", - "suggest.completionItemKindLabels": { - "keyword": "", - "variable": "", - "value": "", - "operator": "Ψ", - "constructor": "", - "function": "ƒ", - "reference": "渚", - "constant": "", - "method": "", - "struct": "פּ", - "class": "", - "interface": "", - "text": "", - "enum": "", - "enumMember": "", - "module": "", - "color": "", - "property": "", - "field": "料", - "unit": "", - "event": "鬒", - "file": "", - "folder": "", - "snippet": "", - "typeParameter": "", - "default": "" - }, - "typescript.showUnused": true, - "javascript.showUnused": true, - "suggest.noselect": true, -} diff --git a/nvim/coq-user-snippets/*.snip b/nvim/coq-user-snippets/*.snip new file mode 100644 index 00000000..d5402ac6 --- /dev/null +++ b/nvim/coq-user-snippets/*.snip @@ -0,0 +1,69 @@ +snippet date_YYYY-MM-DD + $CURRENT_YEAR$CURRENT_MONTH$CURRENT_DATE + +snippet uniqueIdUsingDateTimeFormat + $CURRENT_YEAR$CURRENT_MONTH$CURRENT_DATE$CURRENT_HOUR$CURRENT_MINUTE$CURRENT_SECOND + +snippet unlicense + This is free and unencumbered software released into the public domain. + + Anyone is free to copy, modify, publish, use, compile, sell, or + distribute this software, either in source code form or as a compiled + binary, for any purpose, commercial or non-commercial, and by any + means. + + In jurisdictions that recognize copyright laws, the author or authors + of this software dedicate any and all copyright interest in the + software to the public domain. We make this dedication for the benefit + of the public at large and to the detriment of our heirs and + successors. We intend this dedication to be an overt act of + relinquishment in perpetuity of all present and future rights to this + software under copyright law. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + For more information, please refer to + +snippet import_sh + #! /usr/bin/env sh + +snippet import_py + #! /usr/bin/env python3 + +snippet import_fish + #! /usr/bin/env fish + +snippet import_wolframscript + #! /usr/bin/env wolframscript + +snippet import_cpp + #include + + int main() { + return 0; + } + +snippet import_html + + + + + + + + + + +snippet todo + @todo $0 + @body @thuanpham2311 $1 + +snippet snip + snippet $1 + $0 diff --git a/nvim/coq-user-snippets/cpp.snippets b/nvim/coq-user-snippets/cpp.snippets new file mode 100644 index 00000000..ac1e9b9a --- /dev/null +++ b/nvim/coq-user-snippets/cpp.snippets @@ -0,0 +1,177 @@ +snippet if + if ( $1 ) { + $2 + } + + +snippet for + for (int ${1:i} = 0; $1 < ${2:n}; $1++) { + $0 + } + +snippet do + do { + $1; + } while ($2); + +snippet while + while ($1) { + $2; + } + +snippet main +#include + using namespace std; + + int main() { + return 0; + } + +snippet nhapSoNguyenDuong + int nhapSoNguyenDuong(int &n) { + do { + cin >> n; + } while (n <= 0); + + return n; + } + +snippet kiemTraSoHoangThien + bool kiemTraSoHoangThien(int number) { + int sum = 0; + int flag = false; + + for (int i = 1; i < number; i++) { + if (number % i == 0) { + sum += i; + } + } + + if (sum == number) { + flag = true; + } else { + flag = false; + } + + return flag; + } + +snippet max + const int MAX = $1; + +snippet struct + struct $1 { + $2 + }; + $0 + +snippet structDaySo + const int MAX = $1; + + struct DaySo { + int list[MAX]; + int n; + }; + +snippet nhapXuatDaySo + int nhapSoNguyenDuong(int &n) { + do { + cin >> n; + } while (n <= 0); + + return n; + } + + void nhapDaySo(DaySo &a) { + cout << "\nSố lượng phần tử của dẫy số: "; + nhapSoNguyenDuong(a.n); + for (int i = 0; i < a.n; i++) { + cout << "\n[" << i << "]: "; + cin >> a.list[i]; + } + } + + void xuatDaySo(DaySo a) { + for (int i = 0; i < a.n; i++) { + cout << "\n[" << i << "]: " << a.list[i] << endl; + } + } + +snippet nhapXuatMaTranVuong + int nhapSoNguyenDuong(int &n) { + do { + cin >> n; + } while (n <= 0); + + return n; + } + + void nhapMaTranVuong(MaTranVuong &a) { + cout << "Nhập bật của ma trận vuông (≤10): "; + nhapSoNguyenDuong(a.n); + for (int i = 0; i < a.n; i++) { + for (int j = 0; j < a.n; j++) { + cout << "[" << i << "\][" << j << "\]: "; + cin >> a.list[i\][j\]; + } + } + } + + void xuatMaTranVuong(MaTranVuong a) { + for (int i = 0; i < a.n; i++) { + for (int j = 0; j < a.n; j++) { + cout << a.list[i\][j\] << " "; + } + cout << endl; + } + } + +snippet bubbleSort + void swap(int *x, int *y) { + int tmp = *x; + *x = *y; + *y = tmp; + } + +void bubbleSort(int array[], int n) { + for (int i = 0; i < n - 1; i++) + for (int j = 0; j < n - i - 1; j++) { + if (array[j] > array[j + 1]) { + swap(array[j], array[j + 1]); + } + } + } + +snippet menu + int menuNumber; + + do { + cout << "\n\n Nhập bạn số bạn muốn thực thi (nhập 0 để thoát)" << endl; + cout << "1: $1\n" << endl; + + cout << "=> ? = "; + cin >> menuNumber; + + switch (menuNumber) { + case 0: + break; + case 1: + $2 + + break; + } + } while (menuNumber != 0); + +snippet kiemTraSoNguyenTo + bool kiemTraSoNguyenTo(int number) { + if (number < 2) { + return = false; + } else { + for (int i = 2; i <= number / 2; i++) { + if (number % i == 0) { + return false; + } + } + } + return true; + } diff --git a/nvim/coq-user-snippets/cs.snippets b/nvim/coq-user-snippets/cs.snippets new file mode 100644 index 00000000..93313af2 --- /dev/null +++ b/nvim/coq-user-snippets/cs.snippets @@ -0,0 +1,17 @@ +snippet NhapMang + public static void NhapMang(int[] array, int number) { + for (int i = 0; i < number; i++) { + Console.Write("Nhập phần tử thứ " + (i + 1) + ": "); + array[i] = Convert.ToInt32(Console.ReadLine()); + } + } + +snippet XuatMang + public static void XuatMang(int[] array, int number) { + for (int i = 0; i < number; i++) { + Console.Write(array[i] + "\t"); + } + } + +snippet cw + Console.WriteLine($1); diff --git a/nvim/coq-user-snippets/gitcommit.snip b/nvim/coq-user-snippets/gitcommit.snip new file mode 100644 index 00000000..31d6590d --- /dev/null +++ b/nvim/coq-user-snippets/gitcommit.snip @@ -0,0 +1,38 @@ +snippet feat + 🌟feature($1): $2 + +snippet fix + 🐞fix($1): $2 + +snippet doc + 📚documents($1): $2 + +snippet style + 💄style($1): $2 + +snippet ref + 🎨refactor($1): $2 + +snippet perf + ⚡️performance($1): $2 + +snippet test + ✅test($1): $2 + +snippet chore + 🔩chore($1): $2 + +snippet build + 🔨build($1): $2 + +snippet ci + 🤖ci($1): $2 + +snippet clean + 💄style($1): clean code + +snippet revert + ⏪revert($1): $2 + +snippet todo + 🤖ci(todo): add || clean diff --git a/nvim/coq-user-snippets/javascript.snippets b/nvim/coq-user-snippets/javascript.snippets new file mode 100644 index 00000000..857f8007 --- /dev/null +++ b/nvim/coq-user-snippets/javascript.snippets @@ -0,0 +1,29 @@ +snippet cl + console.log( $1 ); + $0 + +snippet for + for (let ${1:i} = 0; $1 < $2; $1++) { + ${0:${VISUAL}} + } + +snippet random + Math.floor(Math.random() * $2) + $1 + +snippet quickSort + function quicksort(array) { + if (array.length <= 1) { + return array; + } + + let pivot = array[0\]; + + let left = [\]; + let right = [\]; + + for (let i = 1; i < array.length; i++) { + array[i\] < pivot ? left.push(array[i\]) : right.push(array[i\]); + } + + return quicksort(left).concat(pivot, quicksort(right)); + } diff --git a/nvim/coq-user-snippets/markdown.snip b/nvim/coq-user-snippets/markdown.snip new file mode 100644 index 00000000..c36ea7a0 --- /dev/null +++ b/nvim/coq-user-snippets/markdown.snip @@ -0,0 +1,135 @@ +snippet ** + **$1** $0 + +snippet * + *$1* $0 + +snippet < + <$1> $0 + +snippet ~~ + ~~$1~~ $0 + +snippet link + [$2](<$1>) $0 + +snippet img + ![$2](<$1>) $0 + +snippet youtubeDefaultDescription + 👋 Hi folks + • I'm a random nerd, finding something fun to do every day. + • Filming yourself for fun while I live in the earth. + • I disable comment by default. So if you have something want to talk with me go to the link below. + • Connect with me: https://bio.link/thuanpham2311 + + ==DISCLAIMER== + My stories, lessons, and advice are my personal experience, not reflecting opinions from any organization or company. + + ==© copyright== + • There is no need to email me for permission. + • Use my content however you want! Email it, share it, reprint it with or without credit. + • Change it around, put in a bunch of swear words and attribute them to me. + ⇒ It's okay! You just DO WHAT THE F**K YOU WANT TO. + + #thuanpham2311 + +snippet talk-show + # Talk show $CURRENT_MONTH_NAME_SHORT $CURRENT_DATE, $CURRENT_YEAR: $1 + + 📚 Chapters + + - 0:00 Hi + - $2 + + 📓 Note: + + - $0 + + 👋 Hi folks + • I'm a random nerd, finding something fun to do every day. + • Filming yourself for fun while I live in the earth. + • I disable comment by default. So if you have something want to talk with me go to the link below. + • Connect with me: https://bio.link/thuanpham2311 + + ==DISCLAIMER== + My stories, lessons, and advice are my personal experience, not reflecting opinions from any organization or company. + + ==© copyright== + • There is no need to email me for permission. + • Use my content however you want! Email it, share it, reprint it with or without credit. + • Change it around, put in a bunch of swear words and attribute them to me. + ⇒ It's okay! You just DO WHAT THE F##K YOU WANT TO. + + #thuanpham2311 #thinkWithMe + +snippet post + --- + title: $1 + author: thuanpham2311 + date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DAY $CURRENT_HOUR:$CURRENT_MINUTE + categories: [Blogging] + tags: [$2] + --- + + $3 + + **Reference** + + - Thông tin về tui: + + --- + + **DISCLAIMER** + + Những câu chuyện, bài học và lời khuyên của tui là những trải nghiệm riêng của cá nhân, không phản ánh ý kiến từ những tổ chức hay công ty nào. Đa phần lời tui viết là chém gió, nên mấy chế nên suy ngẫm nó có phù hợp với hoàn cảnh của bản thân không nha. + +snippet video + + --- + - Author: $1 + - Link: <$2> + > #video + +snippet article + + --- + - Author: $1 + - Link: <$2> + > #article + +snippet shortLink "short link" + --- + redirect_to: $1 + --- + +snippet human + # $1 + + - $0 + + --- + > #human $2 + +snippet note + [${1:note name}]($CURRENT_YEAR$CURRENT_MONTH$CURRENT_DATE$CURRENT_HOUR$CURRENT_MINUTE$CURRENT_SECOND.md) $0 + +snippet cpp + ```cpp + $0 + ``` + +snippet js + ```js + $0 + ``` + +snippet sh + ```sh + $0 + ``` + +snippet bash + ```bash + $0 + ``` diff --git a/nvim/coq-user-snippets/vim.snip b/nvim/coq-user-snippets/vim.snip new file mode 100644 index 00000000..d66163b8 --- /dev/null +++ b/nvim/coq-user-snippets/vim.snip @@ -0,0 +1,7 @@ +snippet Plug + Plug '$1' + +snippet lua + lua << EOF + $0 + EOF diff --git a/nvim/coq-user-snippets/zsh.snip b/nvim/coq-user-snippets/zsh.snip new file mode 100644 index 00000000..5290a4c9 --- /dev/null +++ b/nvim/coq-user-snippets/zsh.snip @@ -0,0 +1,4 @@ +snippet function + function $1() { + $0 + } diff --git a/nvim/init.vim b/nvim/init.vim index e42b8041..63df6839 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,84 +1,9 @@ call plug#begin() -Plug 'https://github.com/neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'} -set hidden -set shortmess+=c -set signcolumn=yes -set updatetime=10 -let g:coc_global_extensions = [ - \ "coc-snippets", - \ "coc-json", - \ "coc-html", - \ "coc-htmlhint", - \ "coc-html-css-support", - \ "coc-eslint", - \ "coc-emmet", - \ "coc-dot-complete", - \ "coc-diagnostic", - \ "coc-dash-complete", - \ "coc-tsserver", - \ "coc-sql", - \ "coc-sh", - \ "coc-calc", - \ "coc-omnisharp", - \ "coc-go", - \ "coc-vetur", - \ "coc-lua", - \ "coc-deno", - \ "coc-css", - \ "coc-vimlsp", - \ "coc-java", - \ "coc-clangd"] - -inoremap - \ pumvisible() ? "\" : - \ check_back_space() ? "\" : - \ coc#refresh() -inoremap pumvisible() ? "\" : "\" - -function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~# '\s' -endfunction - -nmap [d :call CocAction('diagnosticNext') -nmap ]d :call CocAction('diagnosticPrevious') - -command! ShowDocumentation :call show_documentation() - -function! s:show_documentation() - if (index(['vim','help'], &filetype) >= 0) - execute 'h '.expand('') - else - call CocAction('doHover') - endif -endfunction - -nmap i :%s/\<\>/ -nmap I (coc-rename) - -nmap c :CocAction -noremap ; :CocCommand +Plug 'https://github.com/ms-jpq/coq_nvim' +Plug 'https://github.com/ms-jpq/coq.thirdparty', {'branch': '3p'} -imap (coc-snippets-expand) -vmap (coc-snippets-select) - -let g:coc_snippet_prev = '' - -xmap x (coc-convert-snippet) - -inoremap (coc-snippets-expand-jump) -imap (coc-snippets-expand-jump) - -command! -nargs=0 EditSnippets :call CocAction('runCommand', 'snippets.editSnippets') - -xmap if (coc-funcobj-i) -omap if (coc-funcobj-i) -xmap af (coc-funcobj-a) -omap af (coc-funcobj-a) -xmap ic (coc-classobj-i) -omap ic (coc-classobj-i) -xmap ac (coc-classobj-a) -omap ac (coc-classobj-a) +Plug 'https://github.com/neovim/nvim-lspconfig' +Plug 'https://github.com/williamboman/nvim-lsp-installer' Plug 'https://github.com/mhartington/formatter.nvim' @@ -456,3 +381,5 @@ command! DeleteDosLineEngdingChar execute "%s/\r$/ /g" command! PlugCleanWithReloadConfigFile execute "silent source ~/.config/nvim/init.vim | silent !tmux source-file ~/.tmux.conf" | execute "PlugClean" command! PlugInstallWithReloadConfigFile execute "silent source ~/.config/nvim/init.vim | silent !tmux source-file ~/.tmux.conf" | execute "PlugInstall" command! ShowFileType execute "set filetype?" + +let g:coq_settings = { 'auto_start': 'shut-up' } diff --git a/nvim/snips/all.snippets b/nvim/snips/all.snippets deleted file mode 100644 index 6c985296..00000000 --- a/nvim/snips/all.snippets +++ /dev/null @@ -1,76 +0,0 @@ -snippet date "YYYY-MM-DD" -`!v strftime("%Y-%m-%d")` -endsnippet - -snippet uid "unique ID using date time format" -`!v strftime("%Y%m%d%H%M%S")` -endsnippet - -snippet unlicense -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to -endsnippet - -snippet import_sh -#! /usr/bin/env sh -endsnippet - -snippet import_py -#! /usr/bin/env python3 -endsnippet - -snippet import_fish -#! /usr/bin/env fish -endsnippet - -snippet import_wolframscript -#! /usr/bin/env wolframscript -endsnippet - -snippet import_cpp -#include -using namespace std; - -int main() { - return 0; -} -endsnippet - -snippet import_html - - - - - - - - - -endsnippet - -snippet todo -@todo $1 -@body @thuanpham2311 -endsnippet diff --git a/nvim/snips/cpp.snippets b/nvim/snips/cpp.snippets deleted file mode 100644 index 13faacff..00000000 --- a/nvim/snips/cpp.snippets +++ /dev/null @@ -1,191 +0,0 @@ -snippet if -if ( $1 ) { - $2 -} -endsnippet - -snippet for -for (int ${1:i} = 0; $1 < ${2:n}; $1++) { - $0 -} -endsnippet - -snippet do -do { - $1; -} while ($2); -endsnippet - -snippet while -while ($1) { - $2; -} -endsnippet - -snippet main -#include -using namespace std; - -int main() { - return 0; -} -endsnippet - -snippet nhapSoNguyenDuong -int nhapSoNguyenDuong(int &n) { - do { - cin >> n; - } while (n <= 0); - - return n; -} -endsnippet - -snippet kiemTraSoHoangThien -bool kiemTraSoHoangThien(int number) { - int sum = 0; - int flag = false; - - for (int i = 1; i < number; i++) { - if (number % i == 0) { - sum += i; - } - } - - if (sum == number) { - flag = true; - } else { - flag = false; - } - - return flag; -} -endsnippet - -snippet max -const int MAX = $1; -endsnippet - -snippet struct -struct $1 { - $2 -}; -$0 -endsnippet - -snippet structDaySo -const int MAX = $1; - -struct DaySo { - int list[MAX]; - int n; -}; -endsnippet - -snippet nhapXuatDaySo -int nhapSoNguyenDuong(int &n) { - do { - cin >> n; - } while (n <= 0); - - return n; -} - -void nhapDaySo(DaySo &a) { - cout << "\nSố lượng phần tử của dẫy số: "; - nhapSoNguyenDuong(a.n); - for (int i = 0; i < a.n; i++) { - cout << "\n[" << i << "]: "; - cin >> a.list[i]; - } -} - -void xuatDaySo(DaySo a) { - for (int i = 0; i < a.n; i++) { - cout << "\n[" << i << "]: " << a.list[i] << endl; - } -} -endsnippet - -snippet nhapXuatMaTranVuong -int nhapSoNguyenDuong(int &n) { -do { - cin >> n; -} while (n <= 0); - -return n; -} - -void nhapMaTranVuong(MaTranVuong &a) { -cout << "Nhập bật của ma trận vuông (≤10): "; -nhapSoNguyenDuong(a.n); -for (int i = 0; i < a.n; i++) { - for (int j = 0; j < a.n; j++) { - cout << "[" << i << "\][" << j << "\]: "; - cin >> a.list[i\][j\]; - } -} -} - -void xuatMaTranVuong(MaTranVuong a) { -for (int i = 0; i < a.n; i++) { - for (int j = 0; j < a.n; j++) { - cout << a.list[i\][j\] << " "; - } - cout << endl; -} -} -endsnippet - -snippet bubbleSort -void swap(int *x, int *y) { - int tmp = *x; - *x = *y; - *y = tmp; -} - -void bubbleSort(int array[], int n) { -for (int i = 0; i < n - 1; i++) - for (int j = 0; j < n - i - 1; j++) { - if (array[j] > array[j + 1]) { - swap(array[j], array[j + 1]); - } - } -} -endsnippet - -snippet menu -int menuNumber; - -do { -cout << "\n\n Nhập bạn số bạn muốn thực thi (nhập 0 để thoát)" << endl; -cout << "1: $1\n" << endl; - -cout << "=> ? = "; -cin >> menuNumber; - -switch (menuNumber) { - case 0: - break; - case 1: - $2 - - break; -} -} while (menuNumber != 0); -endsnippet - -snippet kiemTraSoNguyenTo -bool kiemTraSoNguyenTo(int number) { - if (number < 2) { - return = false; - } else { - for (int i = 2; i <= number / 2; i++) { - if (number % i == 0) { - return false; - } - } - } - return true; -} -endsnippet diff --git a/nvim/snips/cs.snippets b/nvim/snips/cs.snippets deleted file mode 100644 index c8f67bdc..00000000 --- a/nvim/snips/cs.snippets +++ /dev/null @@ -1,20 +0,0 @@ -snippet NhapMang -public static void NhapMang(int[] array, int number) { - for (int i = 0; i < number; i++) { - Console.Write("Nhập phần tử thứ " + (i + 1) + ": "); - array[i] = Convert.ToInt32(Console.ReadLine()); - } -} -endsnippet - -snippet XuatMang -public static void XuatMang(int[] array, int number) { - for (int i = 0; i < number; i++) { - Console.Write(array[i] + "\t"); - } -} -endsnippet - -snippet cw -Console.WriteLine($1); -endsnippet diff --git a/nvim/snips/gitcommit.snippets b/nvim/snips/gitcommit.snippets deleted file mode 100644 index d18fdc21..00000000 --- a/nvim/snips/gitcommit.snippets +++ /dev/null @@ -1,51 +0,0 @@ -snippet feat "A new feature" -🌟feature($1): $2 -endsnippet - -snippet fix "A bug fix" -🐞fix($1): $2 -endsnippet - -snippet doc "Documentation only changes" -📚documents($1): $2 -endsnippet - -snippet style "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)" -💄style($1): $2 -endsnippet - -snippet ref "A code change that neither fixes a bug or adds a feature" -🎨refactor($1): $2 -endsnippet - -snippet perf "A code change that improves performance" -⚡️performance($1): $2 -endsnippet - -snippet test "Adding missing tests" -✅test($1): $2 -endsnippet - -snippet chore "Changes to the build process or auxiliary tools and libraries such as documentation generation" -🔩chore($1): $2 -endsnippet - -snippet build "Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)" -🔨build($1): $2 -endsnippet - -snippet ci "Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)" -🤖ci($1): $2 -endsnippet - -snippet clean -💄style($1): clean code -endsnippet - -snippet revert "Reverts a previous commit" -⏪revert($1): $2 -endsnippet - -snippet todo -🤖ci(todo): add || clean -endsnippet diff --git a/nvim/snips/javascript.snippets b/nvim/snips/javascript.snippets deleted file mode 100644 index 4417e59f..00000000 --- a/nvim/snips/javascript.snippets +++ /dev/null @@ -1,33 +0,0 @@ -snippet cl -console.log( $1 ); -$2 -endsnippet - -snippet for - for (let ${1:i} = 0; $1 < $2; $1++) { - ${0:${VISUAL}} - } -endsnippet - -snippet ran "random number form end : start" -Math.floor(Math.random() * $2) + $1 -endsnippet - -snippet quickSort -function quicksort(array) { -if (array.length <= 1) { - return array; -} - -let pivot = array[0\]; - -let left = [\]; -let right = [\]; - -for (let i = 1; i < array.length; i++) { - array[i\] < pivot ? left.push(array[i\]) : right.push(array[i\]); -} - -return quicksort(left).concat(pivot, quicksort(right)); -} -endsnippet diff --git a/nvim/snips/markdown.snippets b/nvim/snips/markdown.snippets deleted file mode 100644 index 2d4da698..00000000 --- a/nvim/snips/markdown.snippets +++ /dev/null @@ -1,153 +0,0 @@ -snippet ** -**$1** $0 -endsnippet - -snippet * -*$1* $0 -endsnippet - -snippet < -<$1> $0 -endsnippet - -snippet ~~ -~~$1~~ $0 -endsnippet - -snippet link -[$2](<$1>) $0 -endsnippet - -snippet img -![$2](<$1>) $0 -endsnippet - -snippet youtubeDefaultDescription -👋 Hi folks -• I'm a random nerd, finding something fun to do every day. -• Filming yourself for fun while I live in the earth. -• I disable comment by default. So if you have something want to talk with me go to the link below. -• Connect with me: https://bio.link/thuanpham2311 - -==DISCLAIMER== -My stories, lessons, and advice are my personal experience, not reflecting opinions from any organization or company. - -==© copyright== -• There is no need to email me for permission. -• Use my content however you want! Email it, share it, reprint it with or without credit. -• Change it around, put in a bunch of swear words and attribute them to me. -⇒ It's okay! You just DO WHAT THE F**K YOU WANT TO. - -#thuanpham2311 -endsnippet - -snippet talk-show -# Talk show `!v strftime("%b %d, %Y")`: $1 - -📚 Chapters - -- 0:00 Hi -- $2 - -📓 Note: - -- $0 - -👋 Hi folks -• I'm a random nerd, finding something fun to do every day. -• Filming yourself for fun while I live in the earth. -• I disable comment by default. So if you have something want to talk with me go to the link below. -• Connect with me: https://bio.link/thuanpham2311 - -==DISCLAIMER== -My stories, lessons, and advice are my personal experience, not reflecting opinions from any organization or company. - -==© copyright== -• There is no need to email me for permission. -• Use my content however you want! Email it, share it, reprint it with or without credit. -• Change it around, put in a bunch of swear words and attribute them to me. -⇒ It's okay! You just DO WHAT THE F##K YOU WANT TO. - -#thuanpham2311 #thinkWithMe -endsnippet - -snippet post ---- -title: $1 -author: thuanpham2311 -date: `!v strftime("%Y-%m-%d %H:%M")` -categories: [Blogging] -tags: [$2] ---- - -$3 - -**Reference** - -- Thông tin về tui: - ---- - -**DISCLAIMER** - -Những câu chuyện, bài học và lời khuyên của tui là những trải nghiệm riêng của cá nhân, không phản ánh ý kiến từ những tổ chức hay công ty nào. Đa phần lời tui viết là chém gió, nên mấy chế nên suy ngẫm nó có phù hợp với hoàn cảnh của bản thân không nha. -endsnippet - -snippet video - ---- -- Author: $1 -- Link: <$2> -> #video -endsnippet - -snippet article - ---- -- Author: $1 -- Link: <$2> -> #article -endsnippet - -snippet shortLink "short link" ---- -redirect_to: $1 ---- -endsnippet - -snippet human -# $1 - -- $0 - ---- -> #human $2 -endsnippet - -snippet note -[$1](`!v strftime("%Y%m%d%H%M%S")`.md) $0 -endsnippet - -snippet cpp -\`\`\`cpp -$0 -\`\`\` -endsnippet - -snippet js -\`\`\`js -$0 -\`\`\` -endsnippet - -snippet sh -\`\`\`sh -$0 -\`\`\` -endsnippet - -snippet bash -\`\`\`bash -$0 -\`\`\` -endsnippet diff --git a/nvim/snips/vim.snippets b/nvim/snips/vim.snippets deleted file mode 100644 index 5b4c2355..00000000 --- a/nvim/snips/vim.snippets +++ /dev/null @@ -1,13 +0,0 @@ -snippet plug -Plug '$1' -endsnippet - -snippet Plug -Plug '$1' -endsnippet - -snippet lua -lua << EOF -$0 -EOF -endsnippet diff --git a/nvim/snips/zsh.snippets b/nvim/snips/zsh.snippets deleted file mode 100644 index fdc10bb2..00000000 --- a/nvim/snips/zsh.snippets +++ /dev/null @@ -1,5 +0,0 @@ -snippet f -function $1() { - $0 -} -endsnippet