-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌟feature(nvim): moving to nvim lsp
- Loading branch information
Showing
22 changed files
with
537 additions
and
664 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
lua << EOF | ||
vim.g.coq_settings = { | ||
keymap = { | ||
recommended = false, | ||
jump_to_mark = '<c-e>', | ||
manual_complete = ';;', | ||
}, | ||
} | ||
|
||
require("coq_3p")({ | ||
{ src = "copilot", short_name = "COP", accept_key = "<c-f>" }, | ||
}) | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", "<space>e", "<cmd>lua vim.diagnostic.open_float()<CR>", opts) | ||
vim.api.nvim_set_keymap("n", "[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts) | ||
vim.api.nvim_set_keymap("n", "]d", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts) | ||
vim.api.nvim_set_keymap("n", "<space>d", "<cmd>lua vim.diagnostic.setloclist()<CR>", 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 <c-x><c-o> | ||
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", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap( | ||
bufnr, | ||
"n", | ||
"<space>wl", | ||
"<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", | ||
opts | ||
) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) | ||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
local lsp_installer = require("nvim-lsp-installer") | ||
|
||
lsp_installer.on_server_ready(function(server) | ||
local opts = {} | ||
server:setup(opts) | ||
end) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <https://unlicense.org> | ||
|
||
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 <iostream> | ||
|
||
int main() { | ||
return 0; | ||
} | ||
|
||
snippet import_html | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title></title> | ||
</head> | ||
<body> | ||
</body> | ||
</html> | ||
|
||
snippet todo | ||
@todo $0 | ||
@body @thuanpham2311 $1 | ||
|
||
snippet snip | ||
snippet $1 | ||
$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <iostream> | ||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
Oops, something went wrong.