feat: friendly snippets for ultisnips

This commit is contained in:
max_richter 2022-03-01 23:25:44 +01:00
parent b33502bf54
commit ceded2bb2a
19 changed files with 126 additions and 62 deletions

7
.luarc.json Normal file
View File

@ -0,0 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"Lua.diagnostics.globals": [
"require",
"vim"
]
}

View File

@ -21,6 +21,7 @@ plugins=(
eval `dircolors ~/.dircolors` eval `dircolors ~/.dircolors`
export FPATH=$FPATH:~/.dotfiles/completions export FPATH=$FPATH:~/.dotfiles/completions
export NVIM_HOME=$HOME/.config/nvim
# Load oh my zsh # Load oh my zsh
export ZSH=~/.oh-my-zsh export ZSH=~/.oh-my-zsh

View File

@ -85,6 +85,12 @@ if u.has_plugin("cmp") then
} }
) )
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
vim.cmd [[
set foldlevel=99
]]
require("telescope").setup { require("telescope").setup {
defaults = { defaults = {
vimgrep_arguments = { vimgrep_arguments = {
@ -154,6 +160,8 @@ if u.has_plugin("cmp") then
} }
) )
g.markdown_fenced_languages = {"html", "python", "bash=sh"}
-- Remove background color -- Remove background color
cmd("highlight Normal guibg=none") cmd("highlight Normal guibg=none")
cmd("highlight NonText guibg=none") cmd("highlight NonText guibg=none")

View File

@ -11,3 +11,11 @@ cmd [[
au ColorScheme * hi Normal ctermbg=none guibg=none au ColorScheme * hi Normal ctermbg=none guibg=none
au ColorScheme myspecialcolors hi Normal ctermbg=red guibg=red au ColorScheme myspecialcolors hi Normal ctermbg=red guibg=red
]] ]]
cmd [[
augroup SaveManualFolds
autocmd!
au BufWinLeave, BufLeave ?* silent! mkview
au BufWinEnter ?* silent! loadview
augroup END
]]

View File

@ -1,5 +1,4 @@
-- luasnip setup -- luasnip setup
local cmd = vim.cmd
local luasnip = require "luasnip" local luasnip = require "luasnip"
local lspkind = require "lspkind" local lspkind = require "lspkind"
local cmp = require "cmp" local cmp = require "cmp"

View File

@ -9,6 +9,7 @@ g.mapleader = " "
map("n", "<C-p>", ":Telescope find_files<CR>", options) map("n", "<C-p>", ":Telescope find_files<CR>", options)
map("n", "<C-f>", ":Telescope live_grep<CR>", options) map("n", "<C-f>", ":Telescope live_grep<CR>", options)
map("n", "<Shift>", "za", options)
-- LSP Functionality -- LSP Functionality
map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options) map("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", options)

View File

@ -49,18 +49,27 @@ require "lspconfig".sumneko_lua.setup {
} }
-- Ltex Language Server -- Ltex Language Server
lsp.ltex.setup { require("grammar-guard").init()
ltex = { -- setup LSP config
completionEnabled = true, require("lspconfig").grammar_guard.setup(
language = {"de", "en", "es"}, {
configurationTarget = {}, cmd = {vim.fn.expand("~/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls")},
statusBarItem = true, settings = {
dictionary = { ltex = {
["de"] = {"~/test.txt"}, enabled = {"latex", "tex", "bib", "markdown"},
["en"] = {"~/test.txt"} language = "de",
diagnosticSeverity = "information",
additionalRules = {
enablePickyRules = true,
motherTongue = "de"
},
dictionary = {},
disabledRules = {},
hiddenFalsePositives = {}
}
} }
} }
} )
-- Go Language Server -- Go Language Server
lsp.gopls.setup { lsp.gopls.setup {

View File

@ -60,12 +60,13 @@ return require("packer").startup(
use "hrsh7th/cmp-calc" use "hrsh7th/cmp-calc"
use "hrsh7th/cmp-buffer" use "hrsh7th/cmp-buffer"
use "hrsh7th/cmp-cmdline" use "hrsh7th/cmp-cmdline"
use "rafamadriz/friendly-snippets"
use "L3MON4D3/LuaSnip" use "L3MON4D3/LuaSnip"
use "saadparwaiz1/cmp_luasnip" use "saadparwaiz1/cmp_luasnip"
use "rafamadriz/friendly-snippets"
use "williamboman/nvim-lsp-installer" use "williamboman/nvim-lsp-installer"
use "nvim-lua/lsp-status.nvim" use "nvim-lua/lsp-status.nvim"
use "neoclide/jsonc.vim" use "neoclide/jsonc.vim"
use "brymer-meneses/grammar-guard.nvim"
use { use {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
run = ":TSUpdate" run = ":TSUpdate"

View File

@ -11,35 +11,39 @@ local d = ls.dynamic_node
local types = require("luasnip.util.types") local types = require("luasnip.util.types")
-- Every unspecified option will be set to the default. require("luasnip.loaders.from_vscode").load({include = {"typescript", "javascript", "html"}}) -- Load only python snippets
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" } },
},
},
},
-- 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,
})
-- Every unspecified option will be set to the default.
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"}}
}
}
},
-- 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
}
)
ls.snippets = { ls.snippets = {
all = { all = {},
svelte = {
}, s(
svelte = { "slt",
s("slt", { {
t('<script lang="ts">'), t('<script lang="ts">'),
i(0), i(0),
t('</script>'), t("</script>")
}), }
} )
}
} }

View File

View File

View File

View File

@ -1,4 +1,4 @@
# vi: ft=conf # vi: ft=confj
# /go # /go
# Default config for sway # Default config for sway
@ -7,7 +7,7 @@
# #
# Read `man 5 sway` for a complete reference. # Read `man 5 sway` for a complete reference.
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway exec export $(dbus-launch --exit-with-session);
### Variables ### Variables
# #
@ -43,11 +43,13 @@ set $web_search $wofi_scripts/web-search.sh
set $select_window ~/.config/sway/select_window.sh set $select_window ~/.config/sway/select_window.sh
set $lock_screen ~/.config/sway/lock_screen.sh set $lock_screen ~/.config/sway/lock_screen.sh
set $select_emoji $wofi_scripts/wofi-emoji set $select_emoji $wofi_scripts/wofi-emoji
set $password_mngr rofi-rbw --selector wofi
# Input configuration # Input configuration
input * { input * {
xkb_layout de xkb_layout de
xkb_variant nodeadkeys xkb_capslock disabled
tap enabled
} }
smart_gaps off smart_gaps off
@ -108,7 +110,8 @@ exec swayidle -w \
bindsym $mod+b exec $browser bindsym $mod+b exec $browser
bindsym $mod+Shift+Comma exec $config_editor bindsym $mod+Shift+Comma exec $config_editor
bindsym $mod+a exec $web_search bindsym $mod+a exec $web_search
bindsym $mod+p exec $password_mngr
# Drag and resize floating windows with mouse right/left drag # Drag and resize floating windows with mouse right/left drag
floating_modifier $mod normal floating_modifier $mod normal
@ -116,9 +119,9 @@ exec swayidle -w \
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
# Multimedia Audio Keys # Multimedia Audio Keys
bindsym XF86AudioMute exec "pactl list sinks | grep -q Mute:.no && pactl set-sink-mute 0 1 || pactl set-sink-mute 0 0" bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioLowerVolume exec "pactl -- set-sink-volume 0 -10%" bindsym --locked XF86AudioLowerVolume exec "pactl -- set-sink-volume @DEFAULT_SINK@ -10%"
bindsym XF86AudioRaiseVolume exec "pactl -- set-sink-volume 0 +10%" bindsym --locked XF86AudioRaiseVolume exec "pactl -- set-sink-volume @DEFAULT_SINK@ +10%"
#Increase brightness #Increase brightness
bindsym XF86MonBrightnessUp exec brightnessctl -d intel_backlight set +10 bindsym XF86MonBrightnessUp exec brightnessctl -d intel_backlight set +10
@ -269,12 +272,17 @@ mode "resize" {
} }
bindsym $mod+r mode "resize" bindsym $mod+r mode "resize"
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
# Do we need that? # Do we need that?
exec_always nm-applet --indicator exec_always nm-applet --indicator
# Handles notifications # Handles notifications
exec_always mako exec_always mako
exec_always wlsunset -l 39.47 -L -0.3821346
# #
# Status Bar: # Status Bar:
# #
@ -284,3 +292,4 @@ bar {
} }
include @sysconfdir@/sway/config.d/* include @sysconfdir@/sway/config.d/*
exec systemctl --user import-environment

View File

@ -1,13 +1,3 @@
#!/usr/bin/sh #!/usr/bin/sh
swaylock \ swaylock -c 000000
--screenshots \
--indicator-radius 500 \
--effect-blur 7x5 \
--effect-pixelate 7 \
--ring-color ffffff \
--line-color 000000 \
--inside-color ffffff \
--separator-color 00000000 \
--grace 2 \
--fade-in 2

View File

@ -12,5 +12,5 @@ case $selected in
reboot) reboot)
exec systemctl reboot;; exec systemctl reboot;;
shutdown) shutdown)
exec systemctl poweroff -i;; exec shutdown now;;
esac esac

View File

@ -25,9 +25,10 @@ alias gcm="git commit -m "
alias czi="commitizen init cz-conventional-changelog --yarn --dev --exact" alias czi="commitizen init cz-conventional-changelog --yarn --dev --exact"
alias cz="git-cz" alias cz="git-cz"
alias D="pnpm dev" alias D="run dev"
alias B="pnpm build" alias B="run build"
alias T="pnpm test" alias T="run test"
alias P="git push" alias P="git push"
alias p="git pull" alias p="git pull"

View File

@ -8,3 +8,5 @@ source $(dirname "$0")/functions/sum.zsh;
source $(dirname "$0")/functions/mke.zsh; source $(dirname "$0")/functions/mke.zsh;
source $(dirname "$0")/functions/myip.zsh; source $(dirname "$0")/functions/myip.zsh;
source $(dirname "$0")/functions/cht.zsh; source $(dirname "$0")/functions/cht.zsh;
source $(dirname "$0")/functions/dv.zsh;
source $(dirname "$0")/functions/run.zsh;

View File

@ -0,0 +1,13 @@
function dv(){
tmux splitw -v -p20
tmux splitw -h
# tmux splitw -p90
# tmux splitw -dp22 # 20/90
# tmux splitw -h
# tmux selectp -t'{right}'
# tmux splitw -p80
# tmux splitw -p56 # (15+15+15)/80
# tmux splitw -p50
tmux selectp -t'{top-left}'
nvim .
}

View File

@ -0,0 +1,11 @@
function run(){
HAS_MAKE="$(ls | grep Makefile)"
HAS_PACKAGE="$(ls | grep package.json)"
if [ "$HAS_PACKAGE" != "" ]; then
pnpm $1
elif [ "$HAS_MAKE" != "" ]; then
make $1
fi
}