diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-08-11 08:39:41 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-08-11 08:39:41 +0200 |
| commit | a6eb3f300d3237fa111e30fa21b5084ed7636327 (patch) | |
| tree | ca893f2a6d3e304152f872ce9181dfb5d9a7b2a9 /lua/alpha | |
| parent | f61af678dd5da523340c71f57eb95d8d8a76d780 (diff) | |
| download | nvim-conf-a6eb3f300d3237fa111e30fa21b5084ed7636327.tar.gz nvim-conf-a6eb3f300d3237fa111e30fa21b5084ed7636327.zip | |
updates on libraries
Diffstat (limited to 'lua/alpha')
| -rw-r--r-- | lua/alpha/dap.lua | 2 | ||||
| -rw-r--r-- | lua/alpha/plugins.lua | 5 | ||||
| -rw-r--r-- | lua/alpha/scratchs/behat-test.lua | 8 | ||||
| -rw-r--r-- | lua/alpha/scratchs/sample.lua | 34 | ||||
| -rw-r--r-- | lua/alpha/settings.lua | 2 | ||||
| -rw-r--r-- | lua/alpha/snips/ft/lua.lua | 65 | ||||
| -rw-r--r-- | lua/alpha/snips/ft/php.lua | 2 | ||||
| -rw-r--r-- | lua/alpha/telescope/init.lua | 1 | ||||
| -rw-r--r-- | lua/alpha/telescope/setup.lua | 328 |
9 files changed, 227 insertions, 220 deletions
diff --git a/lua/alpha/dap.lua b/lua/alpha/dap.lua index 1a4fc6f..f6dc44e 100644 --- a/lua/alpha/dap.lua +++ b/lua/alpha/dap.lua @@ -1,6 +1,6 @@ local dap, dapui, dap_go = require("dap"), require("dapui"), require("dap-go") -require("nvim-dap-virtual-text").setup() +require("nvim-dap-virtual-text").setup({}) -- dap.set_log_level('TRACE') dapui.setup({ diff --git a/lua/alpha/plugins.lua b/lua/alpha/plugins.lua index 021a893..17dcaf3 100644 --- a/lua/alpha/plugins.lua +++ b/lua/alpha/plugins.lua @@ -169,7 +169,7 @@ return require("packer").startup(function(use) use("tpope/vim-dotenv") use("tpope/vim-fugitive") use("tpope/vim-repeat") - use("tpope/vim-obsession") + -- use("tpope/vim-obsession") -- usefull for unix functions use("tpope/vim-eunuch") @@ -207,8 +207,9 @@ return require("packer").startup(function(use) -- Local plugins can be included local_use("telescope-projectionist.nvim") - local_use("telescope-laravel.nvim") + -- local_use("telescope-laravel.nvim") local_use("php-code-actions.nvim") + local_use("laravel.nvim") use("habamax/vim-godot") diff --git a/lua/alpha/scratchs/behat-test.lua b/lua/alpha/scratchs/behat-test.lua index f07faf3..0fadb43 100644 --- a/lua/alpha/scratchs/behat-test.lua +++ b/lua/alpha/scratchs/behat-test.lua @@ -44,8 +44,8 @@ vim.api.nvim_create_user_command("Behat", function() local current_win = vim.api.nvim_get_current_win() vim.cmd("vsplit") - winh = vim.api.nvim_get_current_win() - bufh = vim.api.nvim_create_buf(true, true) + local winh = vim.api.nvim_get_current_win() + local bufh = vim.api.nvim_create_buf(true, true) vim.api.nvim_win_set_buf(winh, bufh) vim.api.nvim_set_current_win(current_win) vim.api.nvim_buf_set_name(bufh, string.format("Behat %s:%s", fname, line)) @@ -64,8 +64,8 @@ vim.api.nvim_create_user_command("BehatFile", function() local current_win = vim.api.nvim_get_current_win() vim.cmd("vsplit") - winh = vim.api.nvim_get_current_win() - bufh = vim.api.nvim_create_buf(true, true) + local winh = vim.api.nvim_get_current_win() + local bufh = vim.api.nvim_create_buf(true, true) vim.api.nvim_win_set_buf(winh, bufh) vim.api.nvim_set_current_win(current_win) vim.api.nvim_buf_set_name(bufh, string.format("Behat Test")) diff --git a/lua/alpha/scratchs/sample.lua b/lua/alpha/scratchs/sample.lua index 052f9dd..a2d783e 100644 --- a/lua/alpha/scratchs/sample.lua +++ b/lua/alpha/scratchs/sample.lua @@ -1,22 +1,12 @@ -vim.api.nvim_create_user_command("Sailup", function () - vim.fn.jobstart( - {"sail", "up", "-d"}, - { - stdout_buffered = true, - stderr_buffered = true, - on_exit = function () - require("notify").notify("Sail up is done", "info", {}) - end, - on_stdout = function (_, data) - if data then - P(data) - end - end, - on_stderr = function (_, data) - if data then - P(data) - end - end, - } - ) -end, {}) +local scandir = require("plenary.scandir") + + + +local dirs = scandir.scan_dir( + { "/home/alpha/code/php" }, + { depth = 1, only_dirs = true } +) + +for _, dir in ipairs(dirs) do + P(vim.fs.basename(dir)) +end diff --git a/lua/alpha/settings.lua b/lua/alpha/settings.lua index 2bec2a8..919ece8 100644 --- a/lua/alpha/settings.lua +++ b/lua/alpha/settings.lua @@ -35,3 +35,5 @@ options.listchars = "tab:\\ ,trail:-" options.laststatus = 3 options.cmdheight = 1 options.updatetime = 50 + +vim.g.neovide_transparency = 0.9 diff --git a/lua/alpha/snips/ft/lua.lua b/lua/alpha/snips/ft/lua.lua index 3a4fe52..5ea789e 100644 --- a/lua/alpha/snips/ft/lua.lua +++ b/lua/alpha/snips/ft/lua.lua @@ -1,45 +1,60 @@ -local ls = require "luasnip" +local ls = require("luasnip") -- local snippet = ls.s local snippet_from_nodes = ls.sn local c = ls.choice_node local d = ls.dynamic_node local i = ls.insert_node +local f = ls.function_node local t = ls.text_node local fmt = require("luasnip.extras.fmt").fmt local require_var = function(args, _) - local text = args[1][1] or "" - local split = vim.split(text, ".", { plain = true }) + local text = args[1][1] or "" + local split = vim.split(text, ".", { plain = true }) - local options = {} - for len = 0, #split - 1 do - table.insert(options, t(table.concat(vim.list_slice(split, #split - len, #split), "_"))) - end + local options = {} + for len = 0, #split - 1 do + table.insert(options, t(table.concat(vim.list_slice(split, #split - len, #split), "_"))) + end - return snippet_from_nodes(nil, { - c(1, options), - }) + return snippet_from_nodes(nil, { + c(1, options), + }) end local newline = function(text) - return t { "", text } + return t({ "", text }) end return { - req = fmt([[local {} = require("{}")]], { - d(2, require_var, { 1 }), - i(1), - }), - lf = { - desc = "table function", - "local ", - i(1), - " = function(", - i(2), ")", - newline " ", - i(0), - newline "end", - }, + req = fmt([[local {} = require("{}")]], { + d(2, require_var, { 1 }), + i(1), + }), + lf = { + desc = "table function", + "local ", + i(1), + " = function(", + i(2), + ")", + newline(" "), + i(0), + newline("end"), + }, + + preq = fmt( + [[local ok, {} = pcall(require, "{}") +if not ok then + return +end]], + { + f(function(args) + return args[1][1] + end, { 1 }), + i(1) + } + ), } diff --git a/lua/alpha/snips/ft/php.lua b/lua/alpha/snips/ft/php.lua index 5e95eda..27993d8 100644 --- a/lua/alpha/snips/ft/php.lua +++ b/lua/alpha/snips/ft/php.lua @@ -3,7 +3,7 @@ local ls = require("luasnip") local snippet_from_nodes = ls.sn local c = ls.choice_node local t = ls.text_node -local d = ls.dynamic_node +-- local d = ls.dynamic_node local f = ls.function_node local i = ls.insert_node local fmt = require("luasnip.extras.fmt").fmt diff --git a/lua/alpha/telescope/init.lua b/lua/alpha/telescope/init.lua index 4f15ddb..62055e4 100644 --- a/lua/alpha/telescope/init.lua +++ b/lua/alpha/telescope/init.lua @@ -73,7 +73,6 @@ function M.projectionist() end function M.laravel() - vim.env.NO_TTY = 1 return require("telescope").extensions.laravel.laravel() end diff --git a/lua/alpha/telescope/setup.lua b/lua/alpha/telescope/setup.lua index 00e6ebf..819da4a 100644 --- a/lua/alpha/telescope/setup.lua +++ b/lua/alpha/telescope/setup.lua @@ -1,174 +1,174 @@ -local actions = require "telescope.actions" -local action_state = require "telescope.actions.state" -local action_layout = require "telescope.actions.layout" +local actions = require("telescope.actions") +local action_state = require("telescope.actions.state") +local action_layout = require("telescope.actions.layout") local set_prompt_to_entry_value = function(prompt_bufnr) - local entry = action_state.get_selected_entry() - if not entry or not type(entry) == "table" then - return - end + local entry = action_state.get_selected_entry() + if not entry or not type(entry) == "table" then + return + end - action_state.get_current_picker(prompt_bufnr):reset_prompt(entry.ordinal) + action_state.get_current_picker(prompt_bufnr):reset_prompt(entry.ordinal) end -require("telescope").setup { - defaults = { - prompt_prefix = "❯ ", - selection_caret = "❯ ", - - winblend = 0, - - layout_strategy = "horizontal", - layout_config = { - width = 0.95, - height = 0.85, - -- preview_cutoff = 120, - prompt_position = "top", - - horizontal = { - preview_width = function(_, cols, _) - if cols > 200 then - return math.floor(cols * 0.4) - else - return math.floor(cols * 0.6) - end - end, - }, - - vertical = { - width = 0.9, - height = 0.95, - preview_height = 0.5, - }, - - flex = { - horizontal = { - preview_width = 0.9, - }, - }, - }, - - selection_strategy = "reset", - sorting_strategy = "descending", - scroll_strategy = "cycle", - color_devicons = true, - - mappings = { - i = { - ["<C-x>"] = false, - ["<C-s>"] = actions.select_horizontal, - ["<C-n>"] = "move_selection_next", - - ["<C-y>"] = set_prompt_to_entry_value, - - -- These are new :) - ["<M-p>"] = action_layout.toggle_preview, - ["<M-m>"] = action_layout.toggle_mirror, - -- ["<M-p>"] = action_layout.toggle_prompt_position, - - -- ["<M-m>"] = actions.master_stack, - - -- ["<C-q>"] = actions.send_to_qflist + actions.open_qflist, - -- ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist, - - -- This is nicer when used with smart-history plugin. - ["<C-k>"] = actions.cycle_history_next, - ["<C-j>"] = actions.cycle_history_prev, - - ["<c-space>"] = function(prompt_bufnr) - local opts = { - callback = actions.toggle_selection, - loop_callback = actions.send_selected_to_qflist, - } - require("telescope").extensions.hop._hop_loop(prompt_bufnr, opts) - end, - - ["<C-w>"] = function() - vim.api.nvim_input "<c-s-w>" - end, - }, - }, - - -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - -- file_ignore_patterns = nil, - - file_previewer = require("telescope.previewers").vim_buffer_cat.new, - grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - - history = { - path = "~/.local/share/nvim/databases/telescope_history.sqlite3", - limit = 100, - }, - }, - - pickers = { - fd = { - mappings = { - n = { - ["kj"] = "close", - }, - }, - }, - - git_branches = { - mappings = { - i = { - ["<C-a>"] = false, - }, - }, - }, - }, - - extensions = { - fzy_native = { - override_generic_sorter = true, - override_file_sorter = true, - }, - - fzf_writer = { - use_highlighter = false, - minimum_grep_characters = 6, - }, - - hop = { - -- keys define your hop keys in order; defaults to roughly lower- and uppercased home row - keys = { "a", "s", "d", "f", "g", "h", "j", "k", "l", ";" }, -- ... and more - - -- Highlight groups to link to signs and lines; the below configuration refers to demo - -- sign_hl typically only defines foreground to possibly be combined with line_hl - sign_hl = { "WarningMsg", "Title" }, - - -- optional, typically a table of two highlight groups that are alternated between - line_hl = { "CursorLine", "Normal" }, - - -- options specific to `hop_loop` - -- true temporarily disables Telescope selection highlighting - clear_selection_hl = false, - -- highlight hopped to entry with telescope selection highlight - -- note: mutually exclusive with `clear_selection_hl` - trace_entry = true, - -- jump to entry where hoop loop was started from - reset_selection = true, - }, - - ["ui-select"] = { - require("telescope.themes").get_dropdown { - -- even more opts - }, - }, - }, -} -_ = require("telescope").load_extension "dap" -_ = require("telescope").load_extension "notify" -_ = require("telescope").load_extension "file_browser" +require("telescope").setup({ + defaults = { + prompt_prefix = "❯ ", + selection_caret = "❯ ", + + winblend = 0, + + layout_strategy = "horizontal", + layout_config = { + width = 0.95, + height = 0.85, + -- preview_cutoff = 120, + prompt_position = "top", + + horizontal = { + preview_width = function(_, cols, _) + if cols > 200 then + return math.floor(cols * 0.4) + else + return math.floor(cols * 0.6) + end + end, + }, + + vertical = { + width = 0.9, + height = 0.95, + preview_height = 0.5, + }, + + flex = { + horizontal = { + preview_width = 0.9, + }, + }, + }, + + selection_strategy = "reset", + sorting_strategy = "descending", + scroll_strategy = "cycle", + color_devicons = true, + + mappings = { + i = { + ["<C-x>"] = false, + ["<C-s>"] = actions.select_horizontal, + ["<C-n>"] = "move_selection_next", + + ["<C-y>"] = set_prompt_to_entry_value, + + -- These are new :) + ["<M-p>"] = action_layout.toggle_preview, + ["<M-m>"] = action_layout.toggle_mirror, + -- ["<M-p>"] = action_layout.toggle_prompt_position, + + -- ["<M-m>"] = actions.master_stack, + + -- ["<C-q>"] = actions.send_to_qflist + actions.open_qflist, + -- ["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist, + + -- This is nicer when used with smart-history plugin. + ["<C-k>"] = actions.cycle_history_next, + ["<C-j>"] = actions.cycle_history_prev, + + ["<c-space>"] = function(prompt_bufnr) + local opts = { + callback = actions.toggle_selection, + loop_callback = actions.send_selected_to_qflist, + } + require("telescope").extensions.hop._hop_loop(prompt_bufnr, opts) + end, + + ["<C-w>"] = function() + vim.api.nvim_input("<c-s-w>") + end, + }, + }, + + -- borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + -- file_ignore_patterns = nil, + + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + + history = { + path = "~/.local/share/nvim/databases/telescope_history.sqlite3", + limit = 100, + }, + }, + + pickers = { + fd = { + mappings = { + n = { + ["kj"] = "close", + }, + }, + }, + + git_branches = { + mappings = { + i = { + ["<C-a>"] = false, + }, + }, + }, + }, + + extensions = { + fzy_native = { + override_generic_sorter = true, + override_file_sorter = true, + }, + + fzf_writer = { + use_highlighter = false, + minimum_grep_characters = 6, + }, + + hop = { + -- keys define your hop keys in order; defaults to roughly lower- and uppercased home row + keys = { "a", "s", "d", "f", "g", "h", "j", "k", "l", ";" }, -- ... and more + + -- Highlight groups to link to signs and lines; the below configuration refers to demo + -- sign_hl typically only defines foreground to possibly be combined with line_hl + sign_hl = { "WarningMsg", "Title" }, + + -- optional, typically a table of two highlight groups that are alternated between + line_hl = { "CursorLine", "Normal" }, + + -- options specific to `hop_loop` + -- true temporarily disables Telescope selection highlighting + clear_selection_hl = false, + -- highlight hopped to entry with telescope selection highlight + -- note: mutually exclusive with `clear_selection_hl` + trace_entry = true, + -- jump to entry where hoop loop was started from + reset_selection = true, + }, + + ["ui-select"] = { + require("telescope.themes").get_dropdown({ + -- even more opts + }), + }, + }, +}) +_ = require("telescope").load_extension("dap") +_ = require("telescope").load_extension("notify") +_ = require("telescope").load_extension("file_browser") -- makes the selection like lsp code actions in telescope -_ = require("telescope").load_extension "ui-select" -_ = require("telescope").load_extension "fzf" -_ = require("telescope").load_extension "git_worktree" +_ = require("telescope").load_extension("ui-select") +_ = require("telescope").load_extension("fzf") +_ = require("telescope").load_extension("git_worktree") -- _ = require("telescope").load_extension "neoclip" -- _ = require("telescope").load_extension "frecency" -- _ = require("telescope").load_extension "smart_history" -_ = require("telescope").load_extension "projectionist" -_ = require("telescope").load_extension "laravel" +_ = require("telescope").load_extension("projectionist") +_ = require("telescope").load_extension("laravel") _ = require("telescope").load_extension("refactoring") |