some shit

This commit is contained in:
2022-09-02 16:15:54 +02:00
parent 7ec4c850d3
commit d4828f61f1
18 changed files with 353 additions and 598 deletions

View File

@@ -3,8 +3,6 @@ local luasnip = require("luasnip")
local lspkind = require("lspkind")
local cmp = require("cmp")
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local compare = require("cmp.config.compare")
local cmp_buffer = require("cmp_buffer")
local tabnine = require("cmp_tabnine.config")
local source_mapping = {
@@ -29,19 +27,14 @@ tabnine:setup({
})
cmp.setup({
sorting = {
comparators = {
compare.score,
compare.recently_used,
compare.kind,
compare.offset,
},
window = {
documentation = cmp.config.window.bordered(),
},
experimental = {
ghost_text = true,
},
completion = {
completeopt = "menu,menuone",
completeopt = "menu,menuone,noselect",
},
snippet = {
expand = function(args)

View File

@@ -0,0 +1,20 @@
local prettier = require("prettier")
prettier.setup({
bin = "prettier", -- or `prettierd`
filetypes = {
"css",
"graphql",
"html",
"svelte",
"javascript",
"javascriptreact",
"json",
"less",
"markdown",
"scss",
"typescript",
"typescriptreact",
"yaml",
},
})

View File

@@ -159,6 +159,7 @@ lsp.ltex.setup({
cmd = { os.getenv("HOME") .. "/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls" },
settings = {
ltex = {
language = "de",
disabledRules = { ["en-US"] = { "PROFANITY" } },
dictionary = {
["en-US"] = { "perf", "ci", "neovim" },

View File

@@ -7,7 +7,7 @@
-- Credit: glepnir
-- Credit: Elai
local lualine = require "lualine"
local lualine = require("lualine")
-- Color table for highlights
-- stylua: ignore
@@ -27,14 +27,14 @@ local colors = {
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
local filepath = vim.fn.expand("%:p:h")
local gitdir = vim.fn.finddir(".git", filepath .. ";")
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
@@ -43,8 +43,8 @@ local conditions = {
local config = {
options = {
-- Disable sections and component separators
component_separators = '',
section_separators = '',
component_separators = "",
section_separators = "",
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
@@ -95,25 +95,24 @@ end
-- }
-- Icon Of Diffrent Mode: -- normal -- | -- insert -- | -- visual --
ins_left {
ins_left({
-- mode component
function()
return ''
return ""
end,
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.green,
i = colors.blue,
v = colors.magenta,
[''] = colors.blue,
[""] = colors.blue,
V = colors.blue,
c = colors.red,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
[""] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
@@ -121,18 +120,18 @@ ins_left {
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
["r?"] = colors.cyan,
["!"] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
})
-- File Name
ins_left {
'filename',
ins_left({
"filename",
file_status = true, -- Displays file status (readonly status, modified status)
path = 2, -- 0: Just the filename
-- 1: Relative path
@@ -140,11 +139,11 @@ ins_left {
shorting_target = 100, -- Shortens path to leave 40 spaces in the window
-- for other components. (terrible name, any suggestions?)
symbols = {
modified = '', -- Text to show when the file is modified.
readonly = '', -- Text to show when the file is non-modifiable or readonly.
unnamed = '[No Name]', -- Text to show for unnamed buffers.
}
}
modified = "", -- Text to show when the file is modified.
readonly = "", -- Text to show when the file is non-modifiable or readonly.
unnamed = "[No Name]", -- Text to show for unnamed buffers.
},
})
-- Git Diff
local function diff_source()
@@ -153,39 +152,39 @@ local function diff_source()
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed
removed = gitsigns.removed,
}
end
end
ins_right { 'diff', source = diff_source }
ins_right({ "diff", source = diff_source })
-- Git Branch
ins_right {
'branch',
icon = '',
ins_right({
"branch",
icon = "",
-- icon = '',
-- color = { fg = colors.green },
-- padding = { right = 1 },
-- padding = { left = 1 },
}
})
-- File Type
ins_right {
'filetype',
ins_right({
"filetype",
icon_only = true,
padding = { right = 2, left = 1 }
}
padding = { right = 2, left = 1 },
})
-- File Encoding
ins_right {
'o:encoding', -- option component same as &encoding in viml
ins_right({
"o:encoding", -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
padding = { right = 2 },
-- color = { fg = colors.green, gui = 'bold' },
-- Add components to right sections
}
})
-- File Format
-- ins_right {
@@ -198,33 +197,33 @@ ins_right {
-- }
-- File Size
ins_right {
ins_right({
-- filesize component
'filesize',
"filesize",
padding = { right = 2 },
cond = conditions.buffer_not_empty,
}
})
-- Text Progress
ins_right {
'progress',
ins_right({
"progress",
padding = { right = 1 },
-- padding = { left = 1 },
}
})
-- File Location
ins_right {
'location',
ins_right({
"location",
padding = { right = 0 },
}
})
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {
ins_left({
function()
return '%='
return "%="
end,
}
})
-- End Of The Status Bar
-- ins_right {

View File

@@ -11,55 +11,55 @@ local d = ls.dynamic_node
local types = require("luasnip.util.types")
require("luasnip.loaders.from_vscode").load({ include = { "typescript", "javascript", "html" } })
require("luasnip.loaders.from_vscode").load()
-- Every unspecified option will be set to the default.
ls.config.set_config(
{
ls.config.set_config({
history = true,
-- Update more often, :h events for more info.
updateevents = "TextChanged,TextChangedI",
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { "choiceNode", "Comment" } }
}
}
virt_text = { { "choiceNode", "Comment" } },
},
},
},
-- treesitter-hl has 100, use something higher (default is 200).
ext_base_prio = 300,
-- minimal increase in priority.
ext_prio_increase = 1,
enable_autosnippets = true
}
)
enable_autosnippets = true,
})
ls.add_snippets("all", {
s({ trig = "b(%d)", regTrig = true, wordTrig = true }, {
f(function(args) return { "Captured Text: " .. args[1].captures[1] .. "." } end, {}),
i(0)
})
f(function(args)
return { "Captured Text: " .. args[1].captures[1] .. "." }
end, {}),
i(0),
}),
})
ls.add_snippets("svelte", {
s("slt", {
t('<script lang="ts">', '\t'),
t('<script lang="ts">', "\t"),
i(0),
t("</script>")
t("</script>"),
}),
s("sc", {
t('<script context="module" lang="ts">', '\t'),
t('<script context="module" lang="ts">', "\t"),
i(0),
t("</script>")
})
t("</script>"),
}),
})
ls.add_snippets("typescript", {
s("sget", {
t('export async function get({'),
t("export async function get({"),
i(1, "params"),
t("}) {"),
i(2),
t("}"),
})
}),
})

View File

@@ -2,68 +2,68 @@ local telescope = require("telescope")
local actions = require("telescope.actions")
local trouble = require("trouble.providers.telescope")
telescope.setup {
defaults = {
},
}
telescope.setup({
defaults = {},
})
local default = {
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
"--ignore-file",
"workerMain.js"
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8
},
vertical = {
mirror = false
},
width = 0.87,
height = 0.80,
preview_cutoff = 120
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble },
n = { ["<c-t>"] = trouble.open_with_trouble },
},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
use_less = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = 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,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker
}
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
"--ignore-file",
"workerMain.js",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
mappings = {
i = { ["<c-t>"] = trouble.open_with_trouble },
n = { ["<c-t>"] = trouble.open_with_trouble },
},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
use_less = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = 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,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
}
telescope.setup(default)
-- telescope.load_extension("themes");
--
telescope.load_extension("harpoon")
telescope.load_extension("session-lens")
telescope.load_extension("command_center");
telescope.load_extension("notify");
telescope.load_extension("command_center")
telescope.load_extension("notify")

View File

@@ -9,7 +9,7 @@ g.mapleader = " "
map("n", "<C-o>", ":Telescope git_files<CR>", options)
map("n", "<C-f>", ":lua require'telescope.builtin'.live_grep{ cwd = vim.fn.getcwd() }<CR>", options)
map("n", "<C-p>", ":Telescope command_center<CR>", options)
map("n", "<Leader-Leader>", "za", remap)
map("n", "<Leader><Leader>", "za", remap)
-- LSP Functionality
map("n", "<Leader>n", ":lua vim.diagnostic.goto_next()<CR>", options)
@@ -39,6 +39,10 @@ map("n", "<Leader>3", "3gt", options)
map("n", "<Leader>4", "4gt", options)
map("n", "<Leader>0", ":tablast<CR>", options)
map("n", "<C-t>", ":lua require('harpoon.mark').add_file()<CR>", options)
-- Navigate Files
map("n", "<S-t>", ":Telescope harpoon marks<CR>", options)
-- Handling Splits
map("n", "<C-w>h", ":sp<CR>", remap) -- horizontal
map("n", "<C-w>v", ":vs<CR>", remap) -- vertical
@@ -101,6 +105,3 @@ map("n", "<C-n>", ":NvimTreeToggle<CR>", options)
-- Make ctrl+s work
map("n", "<C-s>", "<Esc>:w<CR>", options)
map("i", "<C-s>", "<Esc>:w<CR>i", options)
-- Update vim config
map("n", "<C-u>", "<Esc>:source $MYVIMRC<CR>", options)

View File

@@ -47,6 +47,9 @@ set.laststatus = 3 -- Always display the status line
set.title = true -- Show current txt that you editing
set.relativenumber = false -- Vims absolute, relative and hybrid line numbers
set.cursorline = false -- Enable highlighting of the current line
set.synmaxcol = 128
vim.cmd("syntax sync minlines=256")
set.mousescroll = "ver:1,hor:1"
set.shiftwidth = 2 -- Change the number of space characters inserted for indentation
set.showtabline = 1 -- Always show tabs
set.cmdheight = 1 -- More space for displaying messages

View File

@@ -2,135 +2,140 @@ local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
local packer_bootstrap = false
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap =
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd("packadd packer.nvim")
packer_bootstrap =
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
vim.cmd("packadd packer.nvim")
end
local packer = require("packer")
packer.init({
display = {
open_fn = function()
return require("packer.util").float({ border = "rounded" })
end,
},
display = {
open_fn = function()
return require("packer.util").float({ border = "rounded" })
end,
},
})
return packer.startup(function(use)
-- Let packer manage itself
use("wbthomason/packer.nvim")
use("lewis6991/impatient.nvim")
-- Let packer manage itself
use("wbthomason/packer.nvim")
use("lewis6991/impatient.nvim")
-- General Helper Functions
use("nvim-lua/plenary.nvim")
-- General Helper Functions
use("nvim-lua/plenary.nvim")
-- Theming Section
use("rktjmp/fwatch.nvim") -- Used to check dark/light theme
use("EdenEast/nightfox.nvim")
use("nvim-lualine/lualine.nvim")
-- Theming Section
use("rktjmp/fwatch.nvim") -- Used to check dark/light theme
use("EdenEast/nightfox.nvim")
use({ "catppuccin/nvim", as = "catppuccin" })
use("nvim-lualine/lualine.nvim")
-- Layout Plugins
use("dstein64/nvim-scrollview") -- ScrollBars
use("akinsho/nvim-toggleterm.lua")
use({
"folke/zen-mode.nvim",
config = function()
require("zen-mode").setup({})
end,
})
use("rcarriga/nvim-notify")
use("kyazdani42/nvim-web-devicons")
use("kyazdani42/nvim-tree.lua")
use("nvim-lua/popup.nvim")
use("goolord/alpha-nvim")
use({
"terrortylor/nvim-comment",
config = function()
require("nvim_comment").setup()
end,
})
use({
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup()
end,
})
use("gfeiyou/command-center.nvim")
-- Layout Plugins
use("dstein64/nvim-scrollview") -- ScrollBars
use("akinsho/nvim-toggleterm.lua")
use({
"folke/zen-mode.nvim",
config = function()
require("zen-mode").setup({})
end,
})
use("rcarriga/nvim-notify")
use("kyazdani42/nvim-web-devicons")
use("kyazdani42/nvim-tree.lua")
use("nvim-lua/popup.nvim")
use("goolord/alpha-nvim")
use({
"terrortylor/nvim-comment",
config = function()
require("nvim_comment").setup()
end,
})
use({
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup()
end,
})
use("gfeiyou/command-center.nvim")
-- Code Navigation
use("junegunn/fzf")
use("nvim-telescope/telescope.nvim")
-- Code Navigation
use("junegunn/fzf")
use("nvim-telescope/telescope.nvim")
-- Lsp Errors
use("folke/lsp-colors.nvim")
use("kosayoda/nvim-lightbulb")
use({
"folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("trouble").setup({})
end,
})
use({
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
config = function()
require("lsp_lines").setup()
end,
})
-- Lsp Errors
use("folke/lsp-colors.nvim")
use("kosayoda/nvim-lightbulb")
use({
"folke/trouble.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require("trouble").setup({})
end,
})
use({
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
config = function()
require("lsp_lines").setup()
end,
})
-- Syntax / Autocomplete
use("tpope/vim-surround")
use("neovim/nvim-lspconfig")
use("hrsh7th/nvim-cmp")
use("onsails/lspkind.nvim")
use({ "tzachar/cmp-tabnine", run = "./install.sh", requires = "hrsh7th/nvim-cmp" })
-- use({ "hrsh7th/cmp-copilot", requires = "github/copilot.vim" })
use("hrsh7th/cmp-nvim-lsp")
use("hrsh7th/cmp-path")
use("hrsh7th/cmp-calc")
use("hrsh7th/cmp-buffer")
use("hrsh7th/cmp-cmdline")
use("rafamadriz/friendly-snippets")
use("L3MON4D3/LuaSnip")
use("saadparwaiz1/cmp_luasnip")
-- Syntax / Autocomplete
use("tpope/vim-surround")
use("neovim/nvim-lspconfig")
use("hrsh7th/nvim-cmp")
use("onsails/lspkind.nvim")
use({ "tzachar/cmp-tabnine", run = "./install.sh", requires = "hrsh7th/nvim-cmp" })
-- use({ "hrsh7th/cmp-copilot", requires = "github/copilot.vim" })
use("hrsh7th/cmp-nvim-lsp")
use("hrsh7th/cmp-path")
use("hrsh7th/cmp-calc")
use("hrsh7th/cmp-buffer")
use("hrsh7th/cmp-cmdline")
use("rafamadriz/friendly-snippets")
use("L3MON4D3/LuaSnip")
use("saadparwaiz1/cmp_luasnip")
use({ "williamboman/mason.nvim" })
use({ "williamboman/mason-lspconfig.nvim" })
use({ "jose-elias-alvarez/null-ls.nvim" })
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
use({ "williamboman/mason.nvim" })
use({ "williamboman/mason-lspconfig.nvim" })
use({ "jose-elias-alvarez/null-ls.nvim" })
use("MunifTanjim/prettier.nvim")
use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
-- Dap Debugger
use({ "mfussenegger/nvim-dap" })
use({ "rcarriga/nvim-dap-ui" })
-- Dap Debugger
use({ "mfussenegger/nvim-dap" })
use({ "rcarriga/nvim-dap-ui" })
-- More IDE like features
use({
"rmagatti/session-lens",
requires = { "rmagatti/auto-session", "nvim-telescope/telescope.nvim" },
config = function()
require("session-lens").setup({ path_display = { "shorten" } })
end,
})
-- FIle Navigation
use({ "ThePrimeagen/harpoon" })
use({
"edluffy/hologram.nvim",
config = function() end,
})
-- More IDE like features
use({
"rmagatti/session-lens",
requires = { "rmagatti/auto-session", "nvim-telescope/telescope.nvim" },
config = function()
require("session-lens").setup({ path_display = { "shorten" } })
end,
})
use({
"nvim-neotest/neotest",
requires = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",
},
})
use({
"edluffy/hologram.nvim",
config = function() end,
})
-- Database Feature
use("tpope/vim-dadbod")
use("kristijanhusak/vim-dadbod-ui")
use({
"nvim-neotest/neotest",
requires = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",
},
})
if packer_bootstrap then
packer.sync()
end
-- Database Feature
use("tpope/vim-dadbod")
use("kristijanhusak/vim-dadbod-ui")
if packer_bootstrap then
packer.sync()
end
end)

View File

@@ -1,9 +1,48 @@
-- Enable Theming / Syntax
vim.g.catppuccin_flavour = "mocha" -- latte, frappe, macchiato, mocha
local cat = require("catppuccin")
cat.setup({
transparent_background = true,
compile = {
enabled = true,
path = vim.fn.stdpath("cache") .. "/catppuccin",
},
styles = {
comments = { "italic" },
strings = { "italic" },
},
integrations = {
gitsigns = true,
telescope = true,
treesitter = true,
cmp = true,
nvimtree = {
enabled = true,
show_root = false,
},
dap = {
enabled = true,
enable_ui = true,
},
native_lsp = {
enabled = true,
},
ts_rainbow = true,
indent_blankline = {
enabled = true,
colored_indent_levels = false,
},
},
})
require("nightfox").setup({
options = {
transparent = true
}
transparent = true,
},
})
vim.cmd("colorscheme nightfox")
require "utils.theme-reloader"
require "configs.lualine"
vim.cmd("colorscheme catppuccin")
require("utils.theme-reloader")
require("configs.lualine")

View File

@@ -1,30 +1,36 @@
-- see if the file exists
local function file_exists(file)
local f = io.open(file, "rb")
if f then f:close() end
if f then
f:close()
end
return f ~= nil
end
-- get all lines from a file, returns an empty
-- list/table if the file does not exist
local function line_from(file)
if not file_exists(file) then return "" end
if not file_exists(file) then
return ""
end
local f = io.open(file) -- 'r' is unnecessary because it's a default value.
if f == nil then return "" end
if f == nil then
return ""
end
local line = f:read() -- '*l' is unnecessary because it's a default value.
f:close()
return line;
return line
end
local filePath = os.getenv("HOME") .. "/.cache/dark-mode";
local filePath = os.getenv("HOME") .. "/.cache/dark-mode"
local function updateTheme()
local line = line_from(filePath);
local line = line_from(filePath)
if line then
local light = string.find(line, "light");
local light = string.find(line, "light")
if light then
vim.cmd("colorscheme dayfox")
-- vim.cmd("colorscheme dayfox")
else
vim.cmd("colorscheme nightfox")
-- vim.cmd("colorscheme nightfox")
end
end
end