1
0
Fork 0

99% listo nvim 0.7. me faltarian los atajos y autocommands, pero eso queda para otro momento. Tambien actualize una opcion de fd

This commit is contained in:
deadguy 2022-05-14 20:15:05 -03:00
parent 1b78d7bd9a
commit ed86224280
Signed by: dgy
GPG Key ID: 37CA55B52CF63730
14 changed files with 329 additions and 156 deletions

View File

@ -236,6 +236,7 @@ map y
map c
map /
map r
map G
cmap <esc> cmd-escape
@ -282,7 +283,7 @@ map a push A<a-b> # after extention
map B bulkrename
map L :Link
map f fzf_jump
map / $lf -remote "send $id select \"$(FZF_DEFAULT_COMMAND='fd --max-depth=1' fzf)\""
map / $lf -remote "send $id select \"$(FZF_DEFAULT_COMMAND='fd --max-depth=1 --strip-cwd-prefix' fzf)\""
map F $find | lf -remote "send $id select $(fzf --reverse --border --margin 2% --inline-info --color border:#005688,bg+:#16252E,fg+:#26c6da,hl+:#ffffff,hl:#26c6da)"
map Gb :git_branch

View File

@ -1,9 +1,8 @@
vim.g.did_load_filetypes = 1
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.o.termguicolors = true
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/opt/packer.nvim"
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.fn.execute("!git clone --depth 1 https://github.com/wbthomason/packer.nvim " .. install_path)
vim.api.nvim_command([[packadd packer.nvim]])
@ -15,6 +14,8 @@ if not status_ok then
end
packer.init({
enable = true,
threshold= 0,
display = {
open_fn = function()
return require("packer.util").float({ border = "single" })
@ -24,21 +25,19 @@ packer.init({
return packer.startup({
function(use)
use({ "wbthomason/packer.nvim", opt = true })
use({ "wbthomason/packer.nvim" })
use({
"lewis6991/impatient.nvim",
config = function()
require("impatient")
end,
})
use({ "nathom/filetype.nvim" })
use("nvim-lua/plenary.nvim")
use({ "ellisonleao/gruvbox.nvim" })
use({
"kyazdani42/nvim-web-devicons",
after = "gruvbox.nvim",
opt = true,
use({ "kyazdani42/nvim-web-devicons",
config = function()
require("plugins.webdevicons")
require("plugins.icons")
end,
})
use({
@ -50,7 +49,7 @@ return packer.startup({
})
use({
"norcalli/nvim-colorizer.lua",
event = "CursorHold",
event = "BufReadPre",
config = function()
require("plugins.colorizer")
end,
@ -58,7 +57,7 @@ return packer.startup({
use({ "tpope/vim-fugitive", opt = true, cmd = { "Git", "Gdiff", "Gblame", "Glog", "Git mergetool" } })
use({
"lewis6991/gitsigns.nvim",
event = { "BufRead" },
event = "BufReadPre",
config = function()
require("plugins.gitsigns_nvim")
end,
@ -80,7 +79,6 @@ return packer.startup({
})
use({
"neovim/nvim-lspconfig",
event = "BufRead",
config = function()
require("plugins.lsp.lsp-config")
end,
@ -96,7 +94,6 @@ return packer.startup({
use({
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
config = function()
require("plugins.lsp.nvim-cmp")
end,
@ -115,6 +112,7 @@ return packer.startup({
{ "f3fora/cmp-spell", after = "nvim-cmp" },
{ "hrsh7th/cmp-nvim-lua", after = "nvim-cmp" },
{ "saadparwaiz1/cmp_luasnip", after = "LuaSnip"},
{ "hrsh7th/cmp-nvim-lsp-signature-help", after = "lsp_signature.nvim" },
})
use({
"windwp/nvim-autopairs",
@ -124,6 +122,5 @@ return packer.startup({
require("plugins.autopairs")
end,
})
use({ "nathom/filetype.nvim" })
end,
})

View File

@ -14,7 +14,6 @@ require("gitsigns").setup({
},
},
update_debounce = 200,
use_internal_diff = true,
keymaps = {
noremap = true,
["n <leader>}g"] = { expr = true, "&diff ? '}c' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'" },

247
nvim/lua/plugins/icons.lua Normal file
View File

@ -0,0 +1,247 @@
local ok, web_devicons = pcall(require, "nvim-web-devicons")
if not ok then
return
end
web_devicons.setup {
override = {
html = {
icon = "",
name = "html",
},
css = {
icon = "",
name = "css",
},
scss = {
icon = "",
name = "scss",
},
sass = {
icon = "",
name = "sass",
},
js = {
icon = "",
name = "js",
},
ts = {
icon = "",
name = "ts",
},
kt = {
icon = "󱈙",
name = "kt",
},
png = {
icon = "",
name = "png",
},
jpg = {
icon = "",
name = "jpg",
},
jpeg = {
icon = "",
name = "jpeg",
},
mp3 = {
icon = "",
name = "mp3",
},
mp4 = {
icon = "",
name = "mp4",
},
out = {
icon = "",
name = "out",
},
rb = {
icon = "",
name = "rb",
},
vue = {
icon = "",
name = "vue",
},
py = {
icon = "",
name = "py",
},
toml = {
icon = "",
name = "toml",
},
lock = {
icon = "",
name = "lock",
},
zip = {
icon = "",
name = "zip",
},
xz = {
icon = "",
name = "xz",
},
deb = {
icon = "",
name = "deb",
},
rpm = {
icon = "",
name = "rpm",
},
lua = {
icon = "",
name = "lua",
},
txt = {
icon = "",
name = "txt",
},
md = {
icon = "",
name = "markdown",
},
graphql = {
icon = "",
name = "graphql",
},
env = {
icon = "",
name = "dotenvexample",
},
[".env.production"] = {
icon = "",
name = "envprod",
},
[".env.development"] = {
icon = "",
name = "envdev",
},
[".env.testing"] = {
icon = "",
name = "envtest",
},
[".env.example"] = {
icon = "",
name = "dotenvexample",
},
[".env"] = {
icon = "",
name = "dotenv",
},
["docker-compose.yml"] = {
icon = "",
name = "dockercompose",
},
[".dockerignore"] = {
icon = "",
name = "dockerignore",
},
[".prettierignore"] = {
icon = "",
name = "prettierignore",
},
[".prettierrc"] = {
icon = "",
name = "prettier",
},
[".prettierrc.json"] = {
icon = "",
name = "prettierjson",
},
[".prettierrc.js"] = {
icon = "",
name = "prettierrcjs",
},
["prettier.config.js"] = {
icon = "",
name = "prettierjsconfig",
},
[".prettier.yaml"] = {
icon = "",
name = "prettieryaml",
},
["test.js"] = {
icon = "",
name = "javascripttest",
},
["test.jsx"] = {
icon = "",
name = "reactrest",
},
["test.ts"] = {
icon = "",
name = "typescripttest",
},
["test.tsx"] = {
icon = "",
name = "reacttypescripttest",
},
["spec.js"] = {
icon = "",
name = "javascriptspectest",
},
["spec.jsx"] = {
icon = "",
name = "reactspectest",
},
["spec.ts"] = {
icon = "",
name = "typescriptspectest",
},
["spec.tsx"] = {
icon = "",
name = "reacttypescriptspectest",
},
["yarn-error.log"] = {
icon = "",
name = "yarnerrorlog",
},
["yarn.lock"] = {
icon = "",
name = "yarnlock",
},
["package.json"] = {
icon = "",
name = "npm_packagejson",
},
[".gitignore"] = {
icon = "",
name = "gitignore",
},
[".gitattributes"] = {
icon = "",
name = "gitattributes",
},
["Dockerfile"] = {
icon = "",
name = "dockerfilex",
},
[".nvmrc"] = {
icon = "",
name = "nvmrc",
},
[".eslintrc.js"] = {
icon = "",
name = "eslintrcjs",
},
[".travis.yml"] = {
icon = "",
name = "travis",
},
["babel.config.js"] = {
icon = "",
name = "babelconfig",
},
[".commitlintrc.json"] = {
icon = "",
name = "commitlinrcjson",
},
},
default = true,
}

View File

@ -97,7 +97,7 @@ require("lspconfig/configs").ls_emmet = {
},
}
local servers = { "html", "cssls", "gopls", "tailwindcss", "vimls", "jsonls" }
local servers = { "html", "cssls", "tailwindcss", "vimls", "jsonls" }
for _, lsp in ipairs(servers) do
lsconf[lsp].setup({
on_attach = on_attach,

View File

@ -19,7 +19,6 @@ vim.diagnostic.config({
virtual_text = false,
update_in_insert = true,
severity_sort = true,
source = "always",
})
local U = {}

View File

@ -1,6 +1,7 @@
local fmt = require("null-ls").builtins.formatting
local dgn = require("null-ls").builtins.diagnostics
local cda = require("null-ls").builtins.code_actions
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
require("null-ls").setup({
sources = {
@ -15,13 +16,12 @@ require("null-ls").setup({
fmt.eslint_d,
fmt.rustywind,
fmt.stylua,
fmt.goimports,
fmt.gofumpt,
fmt.shfmt,
-- # DIAGNOSTICS #
dgn.eslint_d,
dgn.tidy,
dgn.luacheck,
dgn.shellcheck,
dgn.golangci_lint,
dgn.luacheck.with({
extra_args = { "--globals", "vim", "--std", "luajit" },
}),
@ -33,5 +33,16 @@ require("null-ls").setup({
on_attach = function(client, bufnr)
-- require("plugins.lsp.lsp-utils").fmt_on_save(client)
require("plugins.lsp.lsp-utils").mappings(bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
-- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
vim.lsp.buf.formatting_sync()
end,
})
end
end,
})

View File

@ -26,8 +26,24 @@ local cmp_kinds = {
TypeParameter = "",
}
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
cmp.setup({
enabled = function()
-- disable completion in comments
local context = require 'cmp.config.context'
-- keep command mode completion enabled when cursor is in a comment
if vim.api.nvim_get_mode().mode == 'c' then
return true
else
return not context.in_treesitter_capture("comment")
and not context.in_syntax_group("Comment")
end
end,
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
@ -53,16 +69,18 @@ cmp.setup({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = function(fallback)
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
elseif luasnip.expand_or_locally_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
@ -70,12 +88,13 @@ cmp.setup({
else
fallback()
end
end,
end, {"i", "s"}),
},
sources = cmp.config.sources({
{ name = "luasnip", max_item_count = 5 },
{ name = "nvim_lsp", max_item_count = 5 },
{ name = "path", max_item_count = 10 },
{ name = "buffer", max_item_count = 10 },
{ name = "nvim_lsp_signature_help" },
}),
})

View File

@ -1,27 +1,6 @@
local actions = require("telescope.actions")
local previewers = require("telescope.previewers")
local builtin = require("telescope.builtin")
local Job = require("plenary.job")
local new_maker = function(filepath, bufnr, opts)
filepath = vim.fn.expand(filepath)
Job
:new({
command = "file",
args = { "--mime-type", "-b", filepath },
on_exit = function(j)
local mime_type = vim.split(j:result()[1], "/")[1]
if mime_type == "text" then
previewers.buffer_previewer_maker(filepath, bufnr, opts)
else
vim.schedule(function()
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" })
end)
end
end,
})
:sync()
end
require("telescope").setup({
defaults = require("telescope.themes").get_ivy({
@ -62,14 +41,11 @@ require("telescope").setup({
hidden = true,
},
},
prompt_prefix = "",
prompt_prefix = "",
selection_caret = "",
entry_prefix = " ",
file_ignore_patterns = { "node_modules", ".git/", "dist/" },
color_devicons = true,
file_ignore_patterns = { "node_modules", ".git" },
set_env = { ["COLORTERM"] = "truecolor" },
buffer_previewer_maker = new_maker,
mappings = {
i = {
["<C-x>"] = false,
@ -78,13 +54,12 @@ prompt_prefix = "  ",
["<esc>"] = actions.close,
["<TAB>"] = actions.toggle_selection + actions.move_selection_next,
["<A-p>"] = require("telescope.actions.layout").toggle_preview,
}
},
},
extensions = {
file_browser = {
hidden = true,
theme = "ivy",
dir_icon = "",
},
},
}),
@ -116,9 +91,17 @@ Delta_git_bcommits = function(opts)
builtin.git_bcommits(opts)
end
Project_files = function()
local opts = { show_untracked = false } -- define here if you want to define something
local ok = pcall(require("telescope.builtin").git_files, opts)
if not ok then
require("telescope.builtin").find_files(opts)
end
end
local default_opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<F1>", "<cmd>Telescope help_tags<CR>", default_opts)
vim.api.nvim_set_keymap("n", "<F2>", "<cmd>Telescope file_browser<CR>", default_opts)
vim.api.nvim_set_keymap("n", "<F2>", "<cmd>lua Project_files()<CR>", default_opts)
vim.api.nvim_set_keymap(
"n",
"<F3>",

View File

@ -2,9 +2,6 @@ require("nvim-treesitter.configs").setup({
ensure_installed = {
"bash",
"css",
"go",
"gomod",
"gowork",
"html",
"json",
"json5",

View File

@ -1,11 +0,0 @@
require("trouble").setup()({
use_lsp_diagnostic_signs = true,
})
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>xw", "<cmd>Trouble lsp_workspace_diagnostics<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>xd", "<cmd>Trouble lsp_document_diagnostics<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>", opts)
vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>", opts)
vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>", opts)

View File

@ -1,88 +0,0 @@
local M = {}
function M.init()
require("nvim-web-devicons").setup({
override = {
html = {
icon = "",
color = "#DE8C92",
name = "html",
},
css = {
icon = "",
color = "#61afef",
name = "css",
},
js = {
icon = "",
color = "#EBCB8B",
name = "js",
},
ts = {
color = "#519ABA",
name = "ts",
},
rs = {
icon = "",
color = "#FFAA30",
name = "rs",
},
kt = {
color = "#ffcb91",
name = "kt",
},
png = {
icon = "",
color = "#BD77DC",
name = "png",
},
jpg = {
icon = "",
color = "#BD77DC",
name = "jpg",
},
jpeg = {
icon = "",
color = "#BD77DC",
name = "jpeg",
},
mp3 = {
icon = "",
color = "#C8CCD4",
name = "mp3",
},
mp4 = {
icon = "",
color = "#C8CCD4",
name = "mp4",
},
out = {
icon = "",
color = "#C8CCD4",
name = "out",
},
toml = {
icon = "",
color = "#61afef",
name = "toml",
},
lock = {
icon = "",
color = "#DE6B74",
name = "lock",
},
zip = {
icon = "",
color = "#EBCB8B",
name = "zip",
},
xz = {
icon = "",
color = "#EBCB8B",
name = "xz",
},
},
})
end
return M

View File

@ -9,3 +9,20 @@ hi! LspDiagnosticsLineNrHint guibg=#1E205D guifg=#008bbd gui=bold
hi! TelescopeNormal guibg=#000000
highlight default link TelescopePromptPrefix TelescopeNormal
highlight default link TelescopePromptCounter TelescopeNormal
" gray
highlight! CmpItemAbbrDeprecated guibg=NONE gui=strikethrough guifg=#808080
" blue
highlight! CmpItemAbbrMatch guibg=NONE guifg=#569CD6
highlight! CmpItemAbbrMatchFuzzy guibg=NONE guifg=#569CD6
" light blue
highlight! CmpItemKindVariable guibg=NONE guifg=#9CDCFE
highlight! CmpItemKindInterface guibg=NONE guifg=#9CDCFE
highlight! CmpItemKindText guibg=NONE guifg=#9CDCFE
" pink
highlight! CmpItemKindFunction guibg=NONE guifg=#C586C0
highlight! CmpItemKindMethod guibg=NONE guifg=#C586C0
" front
highlight! CmpItemKindKeyword guibg=NONE guifg=#D4D4D4
highlight! CmpItemKindProperty guibg=NONE guifg=#D4D4D4
highlight! CmpItemKindUnit guibg=NONE guifg=#D4D4D4

View File

@ -1,11 +1,12 @@
#!/usr/bin/perl
# CLI Pipe Viewer 0.1.8 - configuration file
# CLI Pipe Viewer 0.2.0 - configuration file
our $CONFIG = {
api_host => "auto",
auto_captions => 0,
autoplay_mode => 0,
bypass_age_gate_with_proxy => 0,
cache_dir => "/tmp/pipe-viewer",
colors => 1,
comments_order => "top",
@ -82,6 +83,7 @@ our $CONFIG = {
split_videos => 1,
srt_languages => ["en", "es"],
subscribed_channels_file => "$ENV{HOME}/.config/pipe-viewer/subscribed_channels.txt",
subscriptions_lifetime => 600,
subscriptions_limit => 10000,
thousand_separator => ".",
timeout => undef,