Addd snippets for vim, update i3 hotkeys

This commit is contained in:
Smirnov Olexandr 2021-01-12 16:47:13 +02:00
parent f7c0cef79f
commit 25b4e80c8d
10 changed files with 195 additions and 47 deletions

View file

@ -19,17 +19,17 @@ hide_edge_borders smart
set $terminal alacritty
set $browser firefox
set $filemanager thunar
set $guieditor emacs
set $codeeditor alacritty -e nvim
############ Autostart ############
exec --no-startup-id exec picom --experimental-backends -b
exec --no-startup-id exec nitrogen --restore
exec --no-startup-id exec setxkbmap "us,ua" ",winkeys" "grp:alt_shift_toggle" -option "ctrl:nocaps"
exec --no-startup-id exec org.telegram.desktop
exec --no-startup-id exec lxsession
exec_always --no-startup-id exec $HOME/.script/autolock
exec --no-startup-id exec picom --experimental-backends -b
exec_always --no-startup-id exec $HOME/.config/i3/bar.sh
exec --no-startup-id exec discord
exec --no-startup-id exec nitrogen --restore
exec --no-startup-id exec lxsession
exec --no-startup-id exec $HOME/.script/autolock
#exec --no-startup-id exec org.telegram.desktop
#exec --no-startup-id exec discord
#exec --no-startup-id exec conky
#exec --no-startup-id exec redshift-gtk
@ -42,21 +42,18 @@ bindsym --release $mod+Shift+q exec xkill
# Restart i3wm
bindsym $mod+Control+r restart
# Reload i3wm
bindsym $mod+Shift+r reload
# Floating layout
bindsym $mod+Tab floating toggle
bindsym $mod+Shift+Tab floating toggle
# Tab layout
bindsym $mod+Shift+w layout tabbed
bindsym $mod+Control+w layout tabbed
# Split layout
bindsym $mod+Shift+e layout toggle split
bindsym $mod+Control+e layout toggle split
# Splits
bindsym $mod+b split h
bindsym $mod+v split v
#bindsym $mod+b split h
#bindsym $mod+v split v
# Scratchpad
bindsym $mod+Shift+grave move scratchpad
@ -73,26 +70,29 @@ bindsym $mod+Control+i exec passmenu -b -h 24 -p Passwords
# Apps
bindsym $mod+Return exec $terminal
bindsym $mod+F2 exec $browser
bindsym $mod+f exec $filemanager
bindsym $mod+d exec $guieditor
bindsym $mod+Shift+w exec $browser
bindsym $mod+Shift+f exec $filemanager
bindsym $mod+Shift+e exec $codeeditor
# Toogle polybar
bindsym $mod+b exec ~/.script/polybar-toggle
# Sceenshot
bindsym --release Print exec "scrot -s /home/${USER}/$(date +%Y-%m-%d-%H-%M-%S).png"
bindsym --release Shift+Print exec "scrot /home/${USER}/$(date +%Y-%m-%d-%H-%M-%S).png"
bindsym --release Print exec scrot -s /home/${USER}/$(date +%Y-%m-%d-%H-%M-%S).png
bindsym --release Shift+Print exec scrot /home/${USER}/$(date +%Y-%m-%d-%H-%M-%S).png
# Lockscreen
bindsym $mod+Shift+z exec betterlockscreen --off 180 -t \"Computer is lockerd\" -l
bindsym $mod+Shift+z exec betterlockscreen --off 180 -t "Computer is lockerd" -l
# Volume
bindsym $mod+plus exec "pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo +2%"
bindsym $mod+minus exec "pactl set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo -2%"
bindsym $mod+Shift+minus exec "pactl set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo toggle"
bindsym $mod+plus exec "amixer sset Master 2%+"
bindsym $mod+minus exec "amixer sset Master 2%-"
bindsym $mod+Shift+minus exec "amixer sset Master toggle"
######### Window preferens ########
assign [class="(?i)telegram|discord"] $ws6
for_window [class="(?i)telegram|discord"] layout tabbed
#focus_on_window_activation focus
focus_on_window_activation focus
########## Change focus ###########
bindsym $mod+h focus left

View file

@ -0,0 +1,45 @@
snippet pkg "Package"
package ${1:main}
endsnippet
snippet import "Import section"
import (
${1}
)
endsnippet
snippet for "For loop"
for ${1:i\:\=1}; ${2:i\<\=10}; ${3:\i\+\+} {
${4}
}
endsnippet
snippet var "Variable declaration"
var ${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value}}
endsnippet
snippet vars "Variables declaration"
var (
${1:name}${2/(.+)/ /}${2:type}${3: = ${0:value} }
)
endsnippet
snippet const "Constant declaration"
const ${1:name}${2/(.+)/ /}${2:type} = ${0:value}
endsnippet
snippet consts "Constants declaration"
const (
${1:constant}${2/(.+)/ /}${2:type} = ${0:value}
)
endsnippet
snippet err "Rrror handling"
if err != nil {
log.${1:Fatal}(err)
}
endsnippet
snippet ;= ";= to :="
:= $1
endsnippet

View file

@ -0,0 +1,23 @@
priority -50
snippet `py "Python code block"
```python
${1}
```
endsnippet
snippet `sh "Bash code block"
```bash
${1}
```
endsnippet
snippet `go "GO code block"
```go
${1}
```
endsnippet
snippet // "Comment"
<!-- ${1:${VISUAL}} -->
endsnippet

View file

@ -0,0 +1,10 @@
priority -50
snippet #! "Shebang"
#!/usr/bin/env python
endsnippet
snippet ifmain "If __main...."
if __name__ == "__main__":
${1:code}
endsnippet

View file

@ -0,0 +1,39 @@
snippet !sh "SH Shebang"
#!/bin/sh
${1}
endsnippet
snippet !bash "BASH Shebang"
#!/bin/bash
${1}
endsnippet
snippet if "If declaration"
if [ ${1} ]; then
${2}
fi
endsnippet
snippet for "For loop"
for (( i=0; i < ${1:10}; i++ )); do
${2}
done
endsnippet
snippet while "While loop"
while ${1:true}; do
${2}
done
endsnippet
snippet case "Case"
case "${1:$variable}" in
"${2}") ${3} ;;
esac
endsnippet
snippet fn "Function declaration"
function ${1:name}(${2}) {
${3}
}
endsnippet

View file

@ -7,6 +7,8 @@ call plug#begin('~/.vim/plugged')
Plug 'ap/vim-css-color' " CSS color preview
Plug 'airblade/vim-gitgutter' " Git indicator
Plug 'preservim/nerdcommenter' " Code commenter
Plug 'junegunn/goyo.vim'
Plug 'voldikss/vim-floaterm' " Terminal
" Project/file navigation
Plug 'scrooloose/nerdtree', {'on': 'NERDTreeToggle'}
@ -25,7 +27,7 @@ call plug#begin('~/.vim/plugged')
Plug 'vim-python/python-syntax', {'for': 'python'}
Plug 'alaviss/nim.nvim', {'for': 'nim'}
Plug 'fatih/vim-go', {'for': 'go'}
"Plug 'nsf/gocode', {'for': 'go'}
Plug 'nsf/gocode', {'for': 'go'}
Plug 'PotatoesMaster/i3-vim-syntax', {'for': 'i3'}
Plug 'kovetskiy/sxhkd-vim', {'for': 'sxhkd'}
call plug#end()
@ -101,6 +103,7 @@ let g:lightline = {
" Markdown
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_frontmatter=1
let g:markdown_fenced_languages = ['go', 'python', 'bash', 'sh=bash']
let g:ficus_dir = "~/Documents/Notes"
@ -110,15 +113,22 @@ let g:rainbow_active = 1
" Python
let g:python_higlight_all = 1
" YouCompleteMe
let g:ycm_key_list_previous_completion=['<Up>']
" Floaterm
let g:floaterm_title = ""
let g:floaterm_wintype = "floating"
let g:floaterm_position = "bottomright"
let g:floaterm_borderchars = ""
let g:floaterm_height = 0.4
let g:floaterm_width = 0.5
let g:floaterm_autoclose = 2
nmap <A-t> :FloatermNew<CR>
" UltiSnipts
let g:UltiSnipsExpandTrigger="<c-tab>"
let g:UltiSnipsListSnippets="<c-s-tab>"
"let g:UltiSnipsJumpForwardTrigger="<c-j>"
"let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:UltiSnipsExpandTrigger="<C-a>"
let g:UltiSnipsEditSplit="vertical"
let g:UltiSnipsJumpForwardTrigger="<C-a>"
let g:UltiSnipsJumpBackwardTrigger="<C-s>"
" Go
let g:go_template_autocreate = 0
@ -187,5 +197,6 @@ noremap <leader>p :bnext<CR>
noremap <leader>o :bprev<CR>
" Plugins
map <leader>gg :Goyo 80%x95% <CR>
map <F9> :TagbarToggle<CR>
map <C-b> :NERDTreeToggle<CR>

View file

@ -1,4 +1,5 @@
[settings]
enable-ipc = true
screenchange-reload = true
pseudo-transparency = true
@ -9,6 +10,7 @@ secondary = #008DCD
alert = #FF6C6B
[bar/i3bar]
monitor = ${env:MONITOR_MIDDLE}
width = 100%
height = 24
bottom = true

View file

@ -1,8 +1,10 @@
#!/bin/sh
declare options=("i3
declare options=("exit
i3
qtile
berry
openbox
dwm
alacritty
kitty
picom
@ -18,6 +20,7 @@ rofi")
choice=$(echo -e "${options[@]}"|dmenu -p "Config edit" $@)
case "$choice" in
exit) exit 0 ;;
i3)
case "$(echo -e "config\npolybar"|dmenu -p "I3wm" $@)" in
config) choice="$HOME/.config/i3/config" ;;
@ -38,13 +41,20 @@ case "$choice" in
esac
;;
openbox)
case "$(echo -p "config\nautostart\nmenu\ntint2|dmenu -p "OpenBox" $@")" in
case "$(echo -e "config\nautostart\nmenu\ntint2"|dmenu -p "OpenBox" $@)" in
config) choice="$HOME/.config/openbox/rc.xml" ;;
autostart) choice="$HOME/.config/openbox/autostart" ;;
menu) choice="$HOME/.config/openbox/menu.xml" ;;
tint2) choice="$HOME/.config/tint2/tint2rc" ;;
esac
;;
dwm)
case "$(echo -e "config\nautostart\nbar"|dmenu -p "DWM" $@)" in
config) choice="$HOME/.config/dwm/config.def.h " ;;
autostart) choice="$HOME/.config/dwm/autostart.sh" ;;
bar) choice="$HOME/.script/dwmbar.sh" ;;
esac
;;
alacritty) choice="$hoME/.config/alacritty.yml" ;;
kitty) choice="$HOME/.config/kitty/kitty.conf" ;;
picom) choice="$HOME/.config/picom.conf" ;;
@ -56,19 +66,19 @@ case "$choice" in
esac
;;
emacs)
case "$(echo -e "config.el\ncustom.el\ninit.el\npackages.el"|dmenu -p "Doom emacs" $@)" in
config.el) choice="$HOME/.doom.d/config.el" ;;
init.el) choice="$HOME/.doom.d/init.el" ;;
custom.el) choice="$HOME/.doom.d/custom.el" ;;
packages.el) choice="$HOME/.doom.d/packages.el" ;;
case "$(echo -e "config\ncustom\ninit\npackages"|dmenu -p "Doom emacs" $@)" in
config) choice="$HOME/.doom.d/config.el" ;;
init) choice="$HOME/.doom.d/init.el" ;;
custom) choice="$HOME/.doom.d/custom.el" ;;
packages) choice="$HOME/.doom.d/packages.el" ;;
esac
;;
nvim) choice="$HOME/.config/nvim/init.vim" ;;
tmux) choice="$HOME/.tmux.conf" ;;
dunst) choice="$HOME/.config/dunst/dunstrc" ;;
zsh) choice="$HOME/.zshrc" ;;
castero) choice="$HOME/.config/castero/castero.conf" ;;
redshift) choice="$HOME/.config/redshift.conf" ;;
nvim) choice="$HOME/.config/nvim/init.vim" ;;
tmux) choice="$HOME/.tmux.conf" ;;
dunst) choice="$HOME/.config/dunst/dunstrc" ;;
zsh) choice="$HOME/.zshrc" ;;
castero) choice="$HOME/.config/castero/castero.conf" ;;
redshift) choice="$HOME/.config/redshift.conf" ;;
rofi)
case "$(echo -e "config\nnten-dmenu"|dmenu -p "Rofi" $@)" in
config) choice="$HOME/.config/rofi/config" ;;

9
script/polybar-toggle Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
if [ $(pgrep polybar) ]
then
polybar i3bar >/dev/null
#~/.config/polybar/launch.sh
else
killall -q polybar
pkill polybar
fi

1
zshrc
View file

@ -72,4 +72,3 @@ alias doomsync="$HOME/.emacs.d/bin/doom sync"
alias doomupgrade="$HOME/.emacs.d/bin/doom upgrade"
alias doomdoctor="$HOME/.emacs.d/bin/doom doctor"
alias doom="$HOME/.emacs.d/bin/doom"