feat: some shit

This commit is contained in:
max_richter 2022-09-19 20:32:50 +02:00
parent 3857fb86af
commit d7f36e407c
11 changed files with 156 additions and 91 deletions

View File

@ -1,5 +1,6 @@
set-option -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
set -g default-terminal "tmux-256color"
set-option -g focus-events on
set-option -sg escape-time 10
@ -30,7 +31,13 @@ bind -Tcopy-mode WheelDownPane send -N1 -X scroll-down
set -g mode-keys vi
# Enable mouse mode (tmux 2.1 and above)
set -g mouse off
bind-key M \
set-option -g mouse on \;\
display-message 'Mouse: ON'
# Toggle mouse off
bind-key m \
set-option -g mouse off \;\
display-message 'Mouse: OFF'
bind h select-pane -L
bind j select-pane -D

View File

@ -84,6 +84,11 @@ if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
export MOZ_ENABLE_WAYLAND=1
fi
# If podman is installed load the autocompletion
if type podman &> /dev/null; then
source <(podman completion zsh)
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

View File

@ -17,6 +17,7 @@ require("configs.telescope")
require("configs.tree")
require("configs.treesitter")
require("configs.autocomplete")
require("configs.neotest")
require("configs.snippets")
require("overlays")

View File

@ -3,7 +3,7 @@ local luasnip = require("luasnip")
local lspkind = require("lspkind")
local cmp = require("cmp")
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local tabnine = require("cmp_tabnine.config")
-- local tabnine = require("cmp_tabnine.config")
local source_mapping = {
buffer = "[Buffer]",
@ -13,18 +13,18 @@ local source_mapping = {
path = "[Path]",
}
tabnine:setup({
max_lines = 1000,
max_num_results = 20,
sort = true,
run_on_every_keystroke = true,
snippet_placeholder = "..",
ignored_file_types = { -- default is not to ignore
-- uncomment to ignore in lua:
-- lua = true
},
show_prediction_strength = false,
})
-- tabnine:setup({
-- max_lines = 1000,
-- max_num_results = 20,
-- sort = true,
-- run_on_every_keystroke = true,
-- snippet_placeholder = "..",
-- ignored_file_types = { -- default is not to ignore
-- -- uncomment to ignore in lua:
-- -- lua = true
-- },
-- show_prediction_strength = false,
-- })
cmp.setup({
window = {
@ -79,7 +79,7 @@ cmp.setup({
sources = {
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "cmp_tabnine", max_item_count = 3 },
-- { name = "cmp_tabnine", max_item_count = 3 },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer", max_item_count = 3 },

View File

@ -6,7 +6,7 @@ require("null-ls").setup({
sources = {
require("null-ls").builtins.formatting.stylua,
require("null-ls").builtins.diagnostics.eslint,
require("null-ls").builtins.completion.spell,
-- require("null-ls").builtins.completion.spell,
},
})
@ -134,20 +134,45 @@ lsp.intelephense.setup({
capabilities = capabilities,
on_attach = on_attach,
})
lsp.cssls.setup({
capabilities = capabilities,
on_attach = on_attach,
})
lsp.zls.setup({
capabilities = capabilities,
on_attach = on_attach,
})
lsp.bashls.setup({
capabilities = capabilities,
filetypes = { "sh", "bash" },
on_attach = on_attach,
})
lsp.rust_analyzer.setup({
on_attach = on_attach,
settings = {
["rust-analyzer"] = {
imports = {
granularity = {
group = "module",
},
prefix = "self",
},
cargo = {
buildScripts = {
enable = true,
},
},
procMacro = {
enable = true,
},
},
},
})
-- lsp.remark_ls.setup {
-- filetypes = { "markdown" },
-- on_attach = on_attach

View File

@ -0,0 +1,5 @@
require("neotest").setup({
adapters = {
require("neotest-vitest")({}),
},
})

View File

@ -43,23 +43,33 @@ ls.add_snippets("all", {
ls.add_snippets("svelte", {
s("slt", {
t('<script lang="ts">', "\t"),
t({ '<script lang="ts">', "" }),
i(0),
t("</script>"),
t({ "", "</script>" }),
}),
s("sc", {
t('<script context="module" lang="ts">', "\t"),
t({ '<script context="module" lang="ts">', "" }),
i(0),
t("</script>"),
t({ "", "</script>" }),
}),
})
ls.add_snippets("typescript", {
s("sget", {
t("export async function get({"),
t('export const GET: import("./$types").RequestHandler = async function get({'),
i(1, "params"),
t("}) {"),
i(2),
t("}"),
}),
s("spost", {
t('export const POST: import("./$types").RequestHandler = async function get({'),
i(1, "params"),
t("}) {"),
i(2),
t("}"),
}),
s("ssess", {
t({ "const {userId} = locals.session.data", "if(!userId) throw redirect(307, '/login')" }),
}),
})

View File

@ -1,5 +1,4 @@
local telescope = require("telescope")
local actions = require("telescope.actions")
local trouble = require("trouble.providers.telescope")
telescope.setup({
@ -55,8 +54,6 @@ local default = {
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,
},
}

View File

@ -1,12 +1,16 @@
local map = vim.api.nvim_set_keymap
-- local map = vim.api.nvim_set_keymap
local map = vim.keymap.set
local g = vim.g
local saga = require("lspsaga")
saga.init_lsp_saga()
local options = { noremap = true, silent = true }
local remap = { noremap = false }
g.mapleader = " "
map("n", "<C-o>", ":Telescope git_files<CR>", options)
map("n", "<C-o>", ":Telescope find_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)
@ -16,17 +20,24 @@ map("n", "<Leader>n", ":lua vim.diagnostic.goto_next()<CR>", options)
map("n", "<Leader>p", ":lua vim.diagnostic.goto_prev()<CR>", options)
map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options)
map("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", options)
map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", options)
map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", options)
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", "K", "<cmd>Lspsaga hover_doc<CR>", { silent = true })
map("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", { silent = true })
map("n", "<leader>e", "<cmd>Lspsaga show_cursor_diagnostics<CR>", { silent = true })
map("n", "<Leader>rn", "<cmd>Lspsaga rename<CR>", options)
map({ "n", "v" }, "<leader>c", "<cmd>Lspsaga code_action<CR>", { silent = true })
map({ "n", "v" }, "gr", "Lspsaga lsp_finder<CR>", options)
map("n", "<leader>t", ":TroubleToggle<CR>", remap)
-- DAP Functionality
map("n", "<Leader>b", ":lua require('dap').toggle_breakpoint()", options)
-- Test Functionality
map("n", "tt", ":lua require('neotest').run.run()<CR>", options)
map("n", "to", ":lua require('neotest').summary.open()<CR>", options)
-- Navigate Buffers
map("n", "<C-h>", "<C-w>h", options)
map("n", "<C-j>", "<C-w>j", options)
@ -39,7 +50,7 @@ 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)
map("n", "m", ":lua require('harpoon.mark').add_file()<CR>", options)
-- Navigate Files
map("n", "<S-t>", ":Telescope harpoon marks<CR>", options)

View File

@ -50,13 +50,8 @@ return packer.startup(function(use)
require("nvim_comment").setup()
end,
})
use({
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup()
end,
})
use("gfeiyou/command-center.nvim")
use("glepnir/lspsaga.nvim")
-- Code Navigation
use("junegunn/fzf")
@ -84,8 +79,12 @@ return packer.startup(function(use)
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({
"windwp/nvim-autopairs",
config = function()
require("nvim-autopairs").setup()
end,
})
use("hrsh7th/cmp-nvim-lsp")
use("hrsh7th/cmp-path")
use("hrsh7th/cmp-calc")
@ -125,6 +124,8 @@ return packer.startup(function(use)
use({
"nvim-neotest/neotest",
requires = {
"haydenmeade/neotest-jest",
"KaiSpencer/neotest-vitest",
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"antoinemadec/FixCursorHold.nvim",

View File

@ -4,6 +4,9 @@ function conf(){
if [ "$1" = "u" ]; then
source ~/.zshrc
elif [ "$1" = "ssh" ]; then
cd $HOME/.ssh/
nvim config
else
cd ~/.dotfiles/