feat: some stuff

This commit is contained in:
max_richter 2022-01-14 16:14:57 +01:00
parent dd42271f78
commit 47c9f5702b
7 changed files with 1836 additions and 18 deletions

View File

@ -16,7 +16,7 @@ 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.lsp.diagnostic.show_line_diagnostics()<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)

View File

@ -1,9 +1,21 @@
local lsp = require "lspconfig"
local lsp_status = require("lsp-status")
_G.lsp_organize_imports = function()
local params = {
command = "_typescript.organizeImports",
arguments = {vim.api.nvim_buf_get_name(0)},
title = ""
}
vim.lsp.buf.execute_command(params)
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
local system_name = ""
@ -76,25 +88,9 @@ lsp.svelte.setup {
}
-- Typescript Language Server
local function organize_imports()
local params = {
command = "_typescript.organizeImports",
arguments = {vim.api.nvim_buf_get_name(bufnr)},
title = ""
}
vim.lsp.buf_request_sync(bufnr, "workspace/executeCommand", params, 500)
end
lsp.tsserver.setup {
on_attach = on_attach,
capabilities = lsp_status.capabilities,
commands = {
OrganizeImports = {
organize_imports,
description = "Organize Imports"
}
}
}
-- JSON ls setup

View File

@ -36,6 +36,7 @@ set $toggle_layout ~/.config/sway/toggle_layout.sh
set $toggle_gaps ~/.config/sway/toggle_gaps.sh
set $web_search $wofi_scripts/web-search.sh
set $select_window ~/.config/sway/select_window.sh
set $select_emoji $wofi_scripts/wofi-emoji
# Input configuration
input * {
@ -216,7 +217,7 @@ output * bg `find ~/.customization/background -type f | shuf -n 1` fill
# -- Entire Screen
bindsym $mod+s exec $screenshot
bindsym $mod+i exec $select_emoji
bindsym $mod+Tab exec $select_window
#
# Scratchpad:

1810
configs/wofi/wofi-emoji Executable file

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,8 @@ alias zshi="cd ~/.dotfiles && vim configs/init.lua && cd -"
alias zshc="cd ~/.dotfiles && vim configs/.zshrc && cd -"
alias zshu="source ~/.zshrc"
alias online="ping 1.1.1.1"
alias vim="nvim"
alias v="nvim"

View File

@ -6,3 +6,4 @@ source $(dirname "$0")/functions/fp.zsh;
source $(dirname "$0")/functions/rn.zsh;
source $(dirname "$0")/functions/sum.zsh;
source $(dirname "$0")/functions/mke.zsh;
source $(dirname "$0")/functions/myip.zsh;

View File

@ -0,0 +1,8 @@
function myip(){
RES="$(curl -s ifconfig.co/json)"
echo $RES | jq -r ' .ip '
if [ "$1" = "-a" ]; then
echo "$(echo $RES | jq -r '.country') | $(echo $RES | jq -r '.city')"
echo "$(echo $RES | jq -r '.time_zone')"
fi
}