aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2024-10-01 23:23:09 +0900
committerA Farzat <a@farzat.xyz>2024-10-01 23:38:17 +0900
commit6504a7df972c7a937ab58b103edb8c8f3ebb594b (patch)
treecea196370c87763f8f5e545a6d65fa597f552baf
parent8eb1e973395e2231cc0843ce09e4d5d6410cec8d (diff)
downloadnvim-6504a7df972c7a937ab58b103edb8c8f3ebb594b.tar.gz
nvim-6504a7df972c7a937ab58b103edb8c8f3ebb594b.zip
Add more plugin settings
-rw-r--r--plugin-settings/luasnip.lua32
-rw-r--r--plugin-settings/nnn.nvim.lua18
-rw-r--r--plugin-settings/null-ls.lua8
-rw-r--r--plugin-settings/nvim-cmp.lua56
-rw-r--r--plugin-settings/nvim-miniyank.vim10
5 files changed, 124 insertions, 0 deletions
diff --git a/plugin-settings/luasnip.lua b/plugin-settings/luasnip.lua
new file mode 100644
index 0000000..c8cd578
--- /dev/null
+++ b/plugin-settings/luasnip.lua
@@ -0,0 +1,32 @@
+local luasnip = require("luasnip")
+
+require("luasnip.loaders.from_vscode").lazy_load()
+
+local opts = { noremap = true, silent = true }
+
+vim.keymap.set("i", "<C-l>", function()
+ luasnip.expand()
+end, opts)
+vim.keymap.set("s", "<C-l>", function()
+ luasnip.expand()
+end, opts)
+vim.keymap.set("i", "<C-k>", function()
+ if luasnip.jumpable(1) then
+ luasnip.jump(1)
+ end
+end, opts)
+vim.keymap.set("s", "<C-k>", function()
+ if luasnip.jumpable(1) then
+ luasnip.jump(1)
+ end
+end, opts)
+vim.keymap.set("i", "<C-j>", function()
+ if luasnip.jumpable(-1) then
+ luasnip.jump(-1)
+ end
+end, opts)
+vim.keymap.set("s", "<C-j>", function()
+ if luasnip.jumpable(-1) then
+ luasnip.jump(-1)
+ end
+end, opts)
diff --git a/plugin-settings/nnn.nvim.lua b/plugin-settings/nnn.nvim.lua
new file mode 100644
index 0000000..dbdf7b2
--- /dev/null
+++ b/plugin-settings/nnn.nvim.lua
@@ -0,0 +1,18 @@
+local builtin = require("nnn").builtin
+require("nnn").setup({
+ explorer = {
+ cmd = "n3", -- command overrride (-F1 flag is implied, -a flag is invalid!)
+ },
+ picker = {
+ cmd = "n3 -a -Pp", -- command override (-p flag is implied)
+ },
+ mappings = {
+ { "<C-t>", builtin.open_in_tab }, -- open file(s) in tab
+ { "<C-s>", builtin.open_in_split }, -- open file(s) in split
+ { "<C-v>", builtin.open_in_vsplit }, -- open file(s) in vertical split
+ { "<C-p>", builtin.open_in_preview }, -- open file in preview split keeping nnn focused
+ { "<C-y>", builtin.copy_to_clipboard }, -- copy file(s) to clipboard
+ { "<C-w>", builtin.cd_to_path }, -- cd to file directory
+ { "<C-e>", builtin.populate_cmdline }, -- populate cmdline (:) with file(s)
+ },
+})
diff --git a/plugin-settings/null-ls.lua b/plugin-settings/null-ls.lua
new file mode 100644
index 0000000..4895ee3
--- /dev/null
+++ b/plugin-settings/null-ls.lua
@@ -0,0 +1,8 @@
+local null_ls = require("null-ls")
+
+null_ls.setup({
+ sources = {
+ null_ls.builtins.formatting.stylua,
+ null_ls.builtins.diagnostics.markdownlint,
+ },
+})
diff --git a/plugin-settings/nvim-cmp.lua b/plugin-settings/nvim-cmp.lua
new file mode 100644
index 0000000..defc39e
--- /dev/null
+++ b/plugin-settings/nvim-cmp.lua
@@ -0,0 +1,56 @@
+local cmp = require("cmp")
+local luasnip = require("luasnip")
+
+cmp.setup({
+ enabled = true,
+ snippet = {
+ expand = function(args) -- REQUIRED - you must specify a snippet engine
+ require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
+ end,
+ },
+ mapping = cmp.mapping.preset.insert({
+ ["<C-b>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-f>"] = cmp.mapping.scroll_docs(4),
+ ["<C-Space>"] = cmp.mapping.complete(),
+ ["<C-e>"] = cmp.mapping.abort(),
+ ["<C-n>"] = cmp.mapping.select_next_item(),
+ ["<C-p>"] = cmp.mapping.select_prev_item(),
+ ["<C-l>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
+ ["<C-k>"] = cmp.mapping(function()
+ if luasnip.jumpable(1) then
+ luasnip.jump(1)
+ end
+ end, { "i", "s" }),
+ ["<C-j>"] = cmp.mapping(function()
+ if luasnip.jumpable(-1) then
+ luasnip.jump(-1)
+ end
+ end, { "i", "s" }),
+ }),
+ sources = cmp.config.sources({
+ { name = "nvim_lsp" },
+ { name = "luasnip" },
+ { name = "nvim_lua" },
+ }, {
+ { name = "buffer" },
+ { name = "path" },
+ }),
+})
+
+-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline({ "/", "?" }, {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = {
+ { name = "buffer" },
+ },
+})
+
+-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
+cmp.setup.cmdline(":", {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = "path" },
+ }, {
+ { name = "cmdline" },
+ }),
+})
diff --git a/plugin-settings/nvim-miniyank.vim b/plugin-settings/nvim-miniyank.vim
new file mode 100644
index 0000000..6f44087
--- /dev/null
+++ b/plugin-settings/nvim-miniyank.vim
@@ -0,0 +1,10 @@
+nmap <c-n> <plug>(miniyank-cycle)
+nmap <c-p> <plug>(miniyank-cycleback)
+map p <plug>(miniyank-autoput)
+map P <plug>(miniyank-autoPut)
+map <leader>p <Plug>(miniyank-startput)
+map <leader>P <Plug>(miniyank-startPut)
+map <Leader>yc <Plug>(miniyank-tochar)
+map <Leader>yl <Plug>(miniyank-toline)
+map <Leader>yb <Plug>(miniyank-toblock)
+let g:miniyank_filename = stdpath("cache") .. "/.miniyank.mpack"