uff
This commit is contained in:
parent
7ba32f03f5
commit
041b6cd367
@ -38,6 +38,7 @@
|
||||
autoload -Uz is-at-least && is-at-least 5.1 || return
|
||||
|
||||
# Prompt colors.
|
||||
local main='242'
|
||||
local grey='242'
|
||||
local red='1'
|
||||
local yellow='3'
|
||||
@ -76,7 +77,7 @@
|
||||
typeset -g POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
|
||||
|
||||
# Magenta prompt symbol if the last command succeeded.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$grey
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_OK_{VIINS,VICMD,VIVIS}_FOREGROUND=$main
|
||||
# Red prompt symbol if the last command failed.
|
||||
typeset -g POWERLEVEL9K_PROMPT_CHAR_ERROR_{VIINS,VICMD,VIVIS}_FOREGROUND=$red
|
||||
# Default prompt symbol.
|
||||
|
0
configs/init.lua
Normal file
0
configs/init.lua
Normal file
@ -10,8 +10,6 @@ local opt = vim.opt
|
||||
require("plugins")
|
||||
|
||||
if u.has_plugin("cmp") then
|
||||
vim.g.did_load_filetypes = 150
|
||||
|
||||
-- Global options
|
||||
o.number = true -- show line number
|
||||
o.showmatch = true -- show matching brackets
|
||||
@ -28,6 +26,7 @@ if u.has_plugin("cmp") then
|
||||
g.hidden = true -- unload buffers when hidden
|
||||
g.filetype = true -- execute autocommands based on filetype
|
||||
o.autoread = true
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Search
|
||||
o.inccommand = "nosplit" -- show substitutions incrementally
|
||||
@ -68,6 +67,31 @@ if u.has_plugin("cmp") then
|
||||
|
||||
g.ale_fixers = {"prettier", "eslint"}
|
||||
|
||||
vim.notify = require("notify")
|
||||
|
||||
require("notify").setup(
|
||||
{
|
||||
stages = "fade_in_slide_out",
|
||||
render = "minimal",
|
||||
background_colour = "#000000",
|
||||
icons = {
|
||||
ERROR = "",
|
||||
WARN = "",
|
||||
INFO = "",
|
||||
DEBUG = "",
|
||||
TRACE = "✎"
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
require("telescope").setup {
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- Enable Theming / Syntax
|
||||
o.syntax = "enable"
|
||||
o.termguicolors = true
|
||||
@ -82,10 +106,12 @@ if u.has_plugin("cmp") then
|
||||
}
|
||||
)
|
||||
|
||||
require("transparent").setup({
|
||||
require("transparent").setup(
|
||||
{
|
||||
enable = true,
|
||||
extra_groups = "All"
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
-- Remove background color
|
||||
cmd("highlight Normal guibg=none")
|
||||
@ -169,6 +195,8 @@ if u.has_plugin("cmp") then
|
||||
-- KeyBindings
|
||||
require "keymappings"
|
||||
|
||||
require "overlays"
|
||||
|
||||
require "nvim-tmux-navigation".setup {
|
||||
keybindings = {
|
||||
left = "<C-h>",
|
||||
|
@ -1,4 +1,4 @@
|
||||
local cmd = vim.cmd;
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd [[
|
||||
augroup highlight_yank
|
||||
@ -6,3 +6,8 @@ cmd [[
|
||||
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 150 }
|
||||
augroup END
|
||||
]]
|
||||
|
||||
cmd [[
|
||||
au ColorScheme * hi Normal ctermbg=none guibg=none
|
||||
au ColorScheme myspecialcolors hi Normal ctermbg=red guibg=red
|
||||
]]
|
||||
|
@ -1,25 +1,30 @@
|
||||
-- luasnip setup
|
||||
local cmd = vim.cmd;
|
||||
local cmd = vim.cmd
|
||||
local luasnip = require "luasnip"
|
||||
local lspkind = require "lspkind"
|
||||
local cmp = require "cmp"
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
cmp.setup {
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({with_text = true, menu = ({
|
||||
format = lspkind.cmp_format(
|
||||
{
|
||||
with_text = true,
|
||||
menu = ({
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lua = "[Lua]",
|
||||
latex_symbols = "[Latex]",
|
||||
})}),
|
||||
latex_symbols = "[Latex]"
|
||||
})
|
||||
}
|
||||
)
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
ghost_text = true
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menu,menuone",
|
||||
completeopt = "menu,menuone"
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
@ -27,7 +32,7 @@ cmp.setup {
|
||||
end
|
||||
},
|
||||
mapping = {
|
||||
['<C-Leader>'] = cmp.mapping.complete(),
|
||||
["<C-Leader>"] = cmp.mapping.complete(),
|
||||
["<Tab>"] = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
@ -42,13 +47,15 @@ cmp.setup {
|
||||
fallback()
|
||||
end
|
||||
end,
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
["<CR>"] = cmp.mapping.confirm(
|
||||
{
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
select = true
|
||||
}
|
||||
)
|
||||
},
|
||||
sources = {
|
||||
{name = "nvim-lua"},
|
||||
{name = "nvim_lua"},
|
||||
{name = "nvim_lsp"},
|
||||
{name = "luasnip"},
|
||||
{name = "path"},
|
||||
@ -58,27 +65,35 @@ cmp.setup {
|
||||
}
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline('/', {
|
||||
cmp.setup.cmdline(
|
||||
"/",
|
||||
{
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
{name = "buffer"}
|
||||
}
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup.cmdline(
|
||||
":",
|
||||
{
|
||||
sources = cmp.config.sources(
|
||||
{
|
||||
{name = "path"}
|
||||
},
|
||||
{
|
||||
{name = "cmdline"}
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
|
||||
-- Setup lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require'lspconfig'.html.setup {
|
||||
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require "lspconfig".html.setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({map_char = {tex = ""}}))
|
||||
|
@ -1,8 +1,59 @@
|
||||
local cmd = vim.cmd
|
||||
local util = require "vim.lsp.util"
|
||||
local utils = require("utils")
|
||||
|
||||
function tablelength(T)
|
||||
local count = 0
|
||||
for _ in pairs(T) do
|
||||
count = count + 1
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
local function select_client(method)
|
||||
local all_clients = vim.tbl_values(vim.lsp.buf_get_clients())
|
||||
|
||||
local supported_client
|
||||
local found_client = false
|
||||
for _, client in ipairs(all_clients) do
|
||||
local supports = client.supports_method(method)
|
||||
if supports then
|
||||
found_client = true
|
||||
supported_client = client
|
||||
end
|
||||
end
|
||||
|
||||
if not found_client then
|
||||
return nil
|
||||
end
|
||||
|
||||
return supported_client
|
||||
end
|
||||
|
||||
function FormattingSync()
|
||||
vim.cmd("Neoformat")
|
||||
|
||||
-- local client = select_client("textDocument/formatting")
|
||||
-- if client == nil then
|
||||
-- vim.notify("No LSP Client with formatting connected")
|
||||
-- end
|
||||
|
||||
-- vim.notify("Formatting with LSP")
|
||||
|
||||
-- local params = util.make_formatting_params({})
|
||||
-- local result, err = client.request_sync("textDocument/formatting", params, 500, vim.api.nvim_get_current_buf())
|
||||
-- if result and result.result then
|
||||
-- util.apply_text_edits(result.result)
|
||||
-- elseif err then
|
||||
-- vim.notify("vim.lsp.buf.formatting_sync: " .. err, vim.log.levels.WARN)
|
||||
-- end
|
||||
end
|
||||
|
||||
vim.cmd [[command! Format lua FormattingSync()]]
|
||||
|
||||
cmd [[
|
||||
augroup auto_format
|
||||
au!
|
||||
au BufWritePre * Neoformat
|
||||
au BufWritePre * lua FormattingSync()
|
||||
augroup END
|
||||
]]
|
||||
|
@ -1,6 +1,6 @@
|
||||
local map = vim.api.nvim_set_keymap
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd;
|
||||
local cmd = vim.cmd
|
||||
|
||||
local options = {noremap = true}
|
||||
local remap = {noremap = false}
|
||||
@ -19,7 +19,7 @@ map("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", options)
|
||||
map("n", "<Leader>e", "<cmd>lua vim.diagnostic.open_float()<CR>", options)
|
||||
map("n", "<Leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", options)
|
||||
map("n", "<Leader>c", "<cmd>lua vim.lsp.buf.code_action()<CR>", options)
|
||||
map("n", "<Leader><C-f>", ":Format<CR>", options)
|
||||
map("n", "<Leader><C-f>", ":Neoformat<CR>", options)
|
||||
map("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", options)
|
||||
map("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", options)
|
||||
map("n", "<leader>t", ":TroubleToggle<CR>", remap)
|
||||
@ -41,8 +41,8 @@ map("i", "<A-j>", "<cmd>move +1<CR>", options)
|
||||
map("i", "<A-k>", "<cmd>move -2<CR>", options)
|
||||
map("v", "<A-j>", ":m '>+1<CR>gv=gv", options)
|
||||
map("v", "<A-k>", ":m '<-2<CR>gv=gv", options)
|
||||
map("n", "<A-S-k>", "YP", options);
|
||||
map("n", "<A-S-j>", "Yp", options);
|
||||
map("n", "<A-S-k>", "YP", options)
|
||||
map("n", "<A-S-j>", "Yp", options)
|
||||
|
||||
-- Faster git merge
|
||||
map("n", "<Leader>gd", ":Gvdiffsplit!<CR>", options)
|
||||
|
@ -13,7 +13,6 @@ end
|
||||
-- function to attach completion when setting up lsp
|
||||
local function on_attach()
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
vim.cmd("command! LspOrganize lua lsp_organize_imports()")
|
||||
vim.api.nvim_buf_map(bufnr, "n", "gs", ":LspOrganize<CR>", {silent = true})
|
||||
end
|
||||
@ -91,6 +90,12 @@ lsp.svelte.setup {
|
||||
lsp.tsserver.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = lsp_status.capabilities,
|
||||
commands = {
|
||||
OrganizeImports = {
|
||||
organize_imports,
|
||||
description = "Organize Imports"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- JSON ls setup
|
||||
|
@ -63,6 +63,20 @@ end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<Leader><C-i>", "<cmd>lua _nvimConfig_toggle()<CR>", {noremap = true, silent = true})
|
||||
|
||||
local chtConfig =
|
||||
Terminal:new(
|
||||
{
|
||||
cmd = "cht",
|
||||
direction = "float"
|
||||
}
|
||||
)
|
||||
|
||||
function _chtConfig_toggle()
|
||||
chtConfig:toggle()
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<Leader><C-l>", "<cmd>lua _chtConfig_toggle()<CR>", {noremap = true, silent = true})
|
||||
|
||||
require("toggleterm").setup {
|
||||
shade_terminals = true
|
||||
}
|
||||
|
@ -10,8 +10,6 @@ return require("packer").startup(
|
||||
use "nathom/filetype.nvim"
|
||||
use "alexghergh/nvim-tmux-navigation"
|
||||
|
||||
use "lervag/vimtex"
|
||||
|
||||
-- Theming Section
|
||||
-- use 'folke/tokyonight.nvim'
|
||||
use "EdenEast/nightfox.nvim"
|
||||
@ -22,12 +20,11 @@ return require("packer").startup(
|
||||
use "kyazdani42/nvim-tree.lua"
|
||||
use "nvim-lua/popup.nvim"
|
||||
use "mhinz/vim-startify"
|
||||
use "karb94/neoscroll.nvim"
|
||||
|
||||
use "tpope/vim-fugitive"
|
||||
use "tpope/vim-commentary"
|
||||
use "tpope/vim-surround"
|
||||
use "lambdalisue/suda.vim"
|
||||
use "editorconfig/editorconfig-vim"
|
||||
use "windwp/nvim-autopairs"
|
||||
|
||||
-- Code Navigation
|
||||
use "dense-analysis/ale"
|
||||
@ -35,14 +32,14 @@ return require("packer").startup(
|
||||
use "junegunn/fzf"
|
||||
use "nvim-telescope/telescope.nvim"
|
||||
|
||||
use "sakhnik/nvim-gdb"
|
||||
|
||||
-- Postman like features
|
||||
use "NTBBloodbath/rest.nvim"
|
||||
|
||||
-- Obsidian / Roam like features
|
||||
-- use "lervag/wiki.vim"
|
||||
|
||||
use "rcarriga/nvim-notify"
|
||||
|
||||
-- Lsp Errors
|
||||
use "folke/lsp-colors.nvim"
|
||||
use "onsails/lspkind-nvim"
|
||||
@ -56,7 +53,6 @@ return require("packer").startup(
|
||||
|
||||
-- Syntax / Autocomplete
|
||||
use "neovim/nvim-lspconfig"
|
||||
-- use "github/copilot.vim"
|
||||
use "hrsh7th/nvim-cmp"
|
||||
use "hrsh7th/cmp-nvim-lsp"
|
||||
use "hrsh7th/cmp-nvim-lua"
|
||||
@ -67,22 +63,17 @@ return require("packer").startup(
|
||||
use "L3MON4D3/LuaSnip"
|
||||
use "saadparwaiz1/cmp_luasnip"
|
||||
use "rafamadriz/friendly-snippets"
|
||||
|
||||
use "beyondmarc/glsl.vim"
|
||||
|
||||
use "tpope/vim-commentary"
|
||||
|
||||
use "williamboman/nvim-lsp-installer"
|
||||
use "nvim-lua/lsp-status.nvim"
|
||||
use "windwp/nvim-autopairs"
|
||||
use "neoclide/jsonc.vim"
|
||||
use {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate"
|
||||
}
|
||||
|
||||
-- Preview Markdown
|
||||
use "ellisonleao/glow.nvim"
|
||||
-- Language Supports
|
||||
use "beyondmarc/glsl.vim" -- GLSL
|
||||
use "ellisonleao/glow.nvim" -- MARKDOWN
|
||||
|
||||
-- Autoformat
|
||||
use "sbdchd/neoformat"
|
||||
|
@ -28,7 +28,8 @@ local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
"javascript",
|
||||
"go",
|
||||
"lua",
|
||||
"yaml"
|
||||
"yaml",
|
||||
"prisma"
|
||||
},
|
||||
highlight = {enable = true}
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ local function dump(o)
|
||||
end
|
||||
end
|
||||
|
||||
M.dump = dump
|
||||
|
||||
function M.has_plugin(pluginName)
|
||||
local status = pcall(require, pluginName)
|
||||
return status
|
||||
|
@ -7,3 +7,4 @@ source $(dirname "$0")/functions/rn.zsh;
|
||||
source $(dirname "$0")/functions/sum.zsh;
|
||||
source $(dirname "$0")/functions/mke.zsh;
|
||||
source $(dirname "$0")/functions/myip.zsh;
|
||||
source $(dirname "$0")/functions/cht.zsh;
|
||||
|
13
configs/zsh/functions/cht.zsh
Normal file
13
configs/zsh/functions/cht.zsh
Normal file
@ -0,0 +1,13 @@
|
||||
languages=`echo "golang lua cpp c typescript nodejs" | tr ' ' '\n'`
|
||||
core_utils=`echo "xargs find mv sed awk" | tr ' ' '\n'`
|
||||
|
||||
function cht(){
|
||||
selected=`printf "$languages\n$core_utils" | fzf`
|
||||
read query\?"query:"
|
||||
|
||||
if printf $languages | grep -qs $selected; then
|
||||
curl cht.sh/$selected/`echo $query | tr ' ' '+'`
|
||||
else
|
||||
curl cht.sh/$selected~$query
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue
Block a user