Merge branch 'master' of ssh://git.yorune.pl/y0rune/myhome

This commit is contained in:
Marcin Woźniak 2022-08-01 18:51:33 +02:00
commit d44dadd0e0
5 changed files with 135 additions and 36 deletions

View File

@ -266,16 +266,6 @@
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [
{
"from": {
"key_code": "right_command"
},
"to": [
{
"key_code": "right_option"
}
]
},
{
"from": {
"key_code": "non_us_backslash"
@ -285,6 +275,16 @@
"key_code": "grave_accent_and_tilde"
}
]
},
{
"from": {
"key_code": "right_command"
},
"to": [
{
"key_code": "right_option"
}
]
}
]
},
@ -408,6 +408,32 @@
]
}
]
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 631,
"vendor_id": 1452
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": []
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 0,
"vendor_id": 4152
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": []
}
],
"fn_function_keys": [

View File

@ -185,7 +185,7 @@ local handlers = {
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'pyright', 'bashls', 'ansiblels', 'gopls', 'solargraph'}
local servers = { 'pyright', 'bashls', 'ansiblels', 'gopls', 'solargraph', 'terraformls'}
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {
on_attach = on_attach,
@ -322,7 +322,7 @@ autocmd! CursorHold,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=fals
let g:neoformat_try_formatprg = 1
let g:neoformat_basic_format_trim = 1
let g:neoformat_only_msg_on_error = 1
autocmd BufWritePre * undojoin | Neoformat
autocmd BufWritePre * silent! undojoin | Neoformat
let g:neoformat_python_black = {
\ 'exe': 'black',
\ 'stdin': 1,
@ -407,6 +407,10 @@ set completeopt-=preview
let mapleader = "\<Space>"
nmap <leader>2 :w!<cr>
" Adding print message
autocmd FileType python nmap <leader>f i print(--------DEBUG--------)<CR>print()<CR>print(--------END DEBUG--------)<UP><LEFT>
autocmd FileType sh nmap <leader>f i echo -e "--------DEBUG--------"<CR>echo -e ""<CR>echo -e "--------END DEBUG--------"<UP><LEFT>
" Adding commentary
xmap <leader>c <Plug>Commentary
nmap <leader>c <Plug>Commentary
@ -476,6 +480,11 @@ vnoremap f <C-v>0I
nnoremap <F7> :tabprevious<CR>
nnoremap <F8> :tabnext<CR>
nnoremap <C-t> :tabnew<CR>
inoremap <F7> <Esc>:tabprevious<CR>i
inoremap <F8> <Esc>:tabnext<CR>i
inoremap <C-t> <Esc>:tabnew<CR>
" Better moving
nnoremap J }
nnoremap K {
@ -502,7 +511,6 @@ nnoremap ee :!mupdf $(echo % \| sed 's/tex$/pdf/') & disown<CR><CR>
map <C-d> :NvimTreeToggle<CR>
nnoremap <leader>r :NvimTreeRefresh<CR>
nnoremap <leader>n :NvimTreeFindFile<CR>
nnoremap <silent> <C-t> :tabnew <CR>
nnoremap <F11> :Goyo <CR>
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
map <F3> :setlocal spell! spelllang=en_gb<CR>
@ -553,6 +561,10 @@ au BufNewFile,BufRead *.conf setfiletype conf
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritepre * %s/\n\+\%$//e
" Source: https://vi.stackexchange.com/questions/20077/automatically-highlight-all-occurrences-of-the-selected-text-in-visual-mode
" highlight the visual selection after pressing enter.
xnoremap <silent> <cr> "*y:silent! let searchTerm = '\V'.substitute(escape(@*, '\/'), "\n", '\\n', "g") <bar> let @/ = searchTerm <bar> echo '/'.@/ <bar> call histadd("search", searchTerm) <bar> set hls<cr>
""""""""""""""""""""""""""""""""
" FZF
""""""""""""""""""""""""""""""""

View File

@ -1,10 +1,66 @@
#!/bin/bash
npm -g i pyright --force
npm -g i bash-language-server --force
npm -g i yaml-language-server --force
npm -g i @ansible/ansible-language-server --force
function timestamp() {
echo "[+] $(date +'%F %T') [INFO] $*"
}
function err() {
echo "[-] $(date +'%F %T') [ERROR] $*" >&2
}
function command_start() {
timestamp "Command $* has been started."
if ! "$*"; then
err "Command $* went wrong."
exit
fi
timestamp "Command $* has been ended."
}
function install_pyright() {
# Install pyright
sudo npm -g i pyright --force
}
function install_bash-language-server() {
# Install bash-language-server
sudo npm -g i bash-language-server --force
}
function install_yaml-language-server() {
# Install yaml-language-server
sudo npm -g i yaml-language-server --force
}
function install_ansible-language-server() {
# Install ansible-language-server
sudo npm -g i @ansible/ansible-language-server --force
}
function install_shfmt() {
# Install shfmt
GO111MODULE=on go install mvdan.cc/sh/v3/cmd/shfmt@latest
}
function install_gopls() {
# Install gopls
GO111MODULE=on go install golang.org/x/tools/gopls@latest
}
function install_black() {
# Install black
pip install black
pip3 install black
}
function main() {
command_start install_pyright
command_start install_bash-language-server
command_start install_yaml-language-server
command_start install_ansible-language-server
command_start install_shfmt
command_start install_gopls
command_start install_black
}
main

BIN
.local/bin/terraform-ls Executable file

Binary file not shown.

35
.zshrc
View File

@ -3,8 +3,13 @@
CONFIG=$HOME/.config
parse_git_branch() {
command=$(git symbolic-ref --short HEAD 2> /dev/null)
[ -z $command ] && echo -e "$ " || echo -e "$(git symbolic-ref --short HEAD 2> /dev/null) $ "
command=$(git branch \
2> /dev/null \
| sed -n -e 's/^\* \(.*\)/\1/p' \
| awk 'NF{print $NF}' \
| sed 's/)//g' \
2> /dev/null)
[ -z $command ] && echo -e "$ " || echo -e "$command $ "
}
gbranch() {
@ -42,7 +47,7 @@ FPATH=/usr/local/share/zsh/site-functions:$FPATH
# If command execution time above min. time, plugins will not output time.
ZSH_COMMAND_TIME_MIN_SECONDS=10
ZSH_COMMAND_TIME_MSG="Execution time: %s sec"
ZSH_COMMAND_TIME_EXCLUDE=(ranger git nvim fzf vim mcedit v ssh)
ZSH_COMMAND_TIME_EXCLUDE=(ranger git nvim fzf vim mcedit v ssh lg lazygit)
export GPG_TTY=$(tty)
# export TERM=xterm-256color
@ -72,7 +77,7 @@ alias emerge="sudo emerge"
alias channel-check='sudo iwlist wlan0 scan | egrep -i "essid|frequency"'
alias grep="grep"
alias egrep="egrep"
[[ "$(uname)" == "Darwin" ]] && alias ls="ls -Gh" || alias ls="ls -h --color=auto"
alias ls="ls -h --color=auto"
alias ll='ls -lha'
alias cp='cp -v'
alias mv='mv -v'
@ -99,21 +104,16 @@ alias gnew="git checkout -b"
alias glog="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches"
alias cal="cal -3"
alias code="vscodium-bin"
alias vpn="sudo /root/.local/bin/protonvpn c -f"
alias vpnch="sudo /root/.local/bin/protonvpn c --cc CH"
alias vpnd="sudo /root/.local/bin/protonvpn d"
alias tv="~/MEGA/tv/tv.sh"
alias newswork="newsboat --url=$HOME/.config/newsboat/urlswork"
alias vim="nvim -p"
alias denpl="trans en:pl"
alias dplen="trans pl:en"
alias notes="nvim $HOME/git/notes/index.md"
alias mgr="cd $HOME/Documents/Mega-Documents/Magisterka-Marcin/Semestr1/"
[[ "$(uname)" == "Darwin" ]] && alias mpv="mpv --no-resume-playback" || alias mpv="__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 mpv --vo=x11 --hwdec=no --ytdl-raw-options="yes-playlist=" --no-resume-playback --ytdl-format='bestvideo[height<=?1080]+bestaudio/best'"
alias mpv="__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 mpv --vo=x11 --hwdec=no --ytdl-raw-options="yes-playlist=" --no-resume-playback --ytdl-format='bestvideo[height<=?1080]+bestaudio/best'"
alias aria2c="aria2c --seed-time=0 --disable-ipv6 --max-upload-limit=1k"
alias lg="lazygit"
alias update-brew="brew upgrade --cask"
alias cl="cd $HOME/Documents/Collage/Semestr2"
alias irc="ssh mikrus -t 'screen -r'"
alias rsync="rsync --progress"
@ -121,7 +121,7 @@ alias rsync="rsync --progress"
export PATH=$HOME/.local/bin:$PATH
export PATH=/sbin:$PATH
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export GOROOT=/usr/lib/go
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
export PATH=$PATH:$HOME/.gem/ruby/2.6.0/bin
@ -135,18 +135,23 @@ fi
# Export for Mac
if [[ "$(uname)" == "Darwin" ]]; then
# Resolve problem with GOPATH
# https://stackoverflow.com/questions/66284870/go-get-not-downloading-to-src-folder
export GO111MODULE=off
# Other export
export PATH="/usr/local/opt/openssl@3/bin:$PATH"
export PATH=$PATH:$HOME/Library/Python/3.9/bin
export PATH=$PATH:/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin
export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"
alias lsblk="diskutil list"
alias Update="brew update; brew upgrade"
# Resolve problem with GOPATH
# https://stackoverflow.com/questions/66284870/go-get-not-downloading-to-src-folder
export GO111MODULE=off
alias ls="ls -Gh"
alias mpv="mpv --no-resume-playback"
alias code="open -a 'Visual Studio Code'"
fi
# Resolve problem with