diff options
author | Sergey Nazaryev <sergey@nazaryev.ru> | 2020-10-02 01:11:50 +0300 |
---|---|---|
committer | Sergey Nazaryev <sergey@nazaryev.ru> | 2020-10-02 02:19:20 +0300 |
commit | e2ae1c1b2a6845a89afd1d7aa5b635adf2ebdbd1 (patch) | |
tree | 24a2962faa8df80f45858fc4fe7f18beee963b38 | |
parent | f310168d26d933315d9cfd079dd575d66971f6e5 (diff) | |
download | dotfiles-e2ae1c1b2a6845a89afd1d7aa5b635adf2ebdbd1.zip dotfiles-e2ae1c1b2a6845a89afd1d7aa5b635adf2ebdbd1.tar.gz dotfiles-e2ae1c1b2a6845a89afd1d7aa5b635adf2ebdbd1.tar.bz2 |
Major refactoring
-rw-r--r-- | Xdefaults (renamed from Xresources) | 2 | ||||
-rw-r--r-- | bash_aliases | 35 | ||||
-rw-r--r-- | bash_beeper | 3 | ||||
-rw-r--r-- | bash_dircolors | 6 | ||||
-rw-r--r-- | bash_env | 14 | ||||
-rw-r--r-- | bash_fc | 5 | ||||
-rw-r--r-- | bash_history | 3 | ||||
-rw-r--r-- | bash_open | 6 | ||||
-rw-r--r-- | bash_path | 3 | ||||
-rw-r--r-- | bash_profile | 8 | ||||
-rw-r--r-- | bash_term (renamed from bash_ps1) | 1 | ||||
-rw-r--r-- | bash_wayland | 6 | ||||
-rw-r--r-- | bash_xrdb | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | bashrc | 14 | ||||
-rw-r--r-- | foot.ini | 102 | ||||
-rwxr-xr-x | install.sh | 175 | ||||
-rw-r--r-- | sway-config | 26 | ||||
-rw-r--r-- | vimrc | 89 |
18 files changed, 289 insertions, 214 deletions
@@ -19,7 +19,7 @@ *color14 : #6bc1d0 *color15 : #cdcdcd *foreground : #cbcbc9 -*background : #101010 +*background : #000002 *cursorColor : #8faf9f URxvt.font : xft:SF Mono:style=Medium:size=20 URxvt.scrollBar : false diff --git a/bash_aliases b/bash_aliases index 4656218..b83e038 100644 --- a/bash_aliases +++ b/bash_aliases @@ -1,24 +1,29 @@ -#!/bin/bash - -alias mc='mc -b' -alias ls='LC_COLLATE=C ls -F -h -w 80 --color --group-directories-first' +command_exists() { + cmd=$1 + command -v "${cmd}" >/dev/null 2>&1 +} -EDITOR=vim -VISUAL=vim +command_exists mc && alias mc='mc -b' +command_exists ls && alias ls='LC_COLLATE=C ls -F -h -w 80 --color --group-directories-first' +command_exists ag && alias grep=ag +command_exists neomutt && alias mutt=neomutt +command_exists imv && alias feh=imv -command -v open >/dev/null 2>&1 && alias o='open' -command -v ag >/dev/null 2>&1 && alias grep='ag' -command -v neomutt >/dev/null 2>&1 && alias mutt='neomutt' -if command -v nvim >/dev/null 2>&1; then - alias vim='nvim' +if command_exists nvim; then + alias vi=nvim + alias vim=nvim alias vimdiff='nvim -d' EDITOR=nvim VISUAL=nvim + export EDITOR + export VISUAL +elif command_exists vim; then + alias vi=vim + EDITOR=vim + VISUAL=vim + export EDITOR + export VISUAL fi -command -v vim >/dev/null 2>&1 && alias vi='vim' - -export EDITOR -export VISUAL cd() { builtin cd "$@" && ls diff --git a/bash_beeper b/bash_beeper deleted file mode 100644 index d277e95..0000000 --- a/bash_beeper +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -xset b off diff --git a/bash_dircolors b/bash_dircolors index f0edfaf..68f1247 100644 --- a/bash_dircolors +++ b/bash_dircolors @@ -1,5 +1 @@ -#!/bin/bash - -if which dircolors >/dev/null; then - dircolors -b > /dev/null 2>&1 -fi +eval "$(dircolors -b)" @@ -1,15 +1,5 @@ -#!/bin/bash - -XKB_DEFAULT_LAYOUT=us,ru -XKB_DEFAULT_OPTIONS=grp:caps_toggle,grp_led:scroll,compose:ralt -LANG="en_US.UTF-8" +LANG=en_US.UTF-8 PATH="$HOME/.local/bin:$PATH" - -TERM=xterm-256color - -HISTSIZE=-1 -HISTFILESIZE=-1 NO_AT_BRIDGE=1 -export XKB_DEFAULT_LAYOUT XKB_DEFAULT_OPTIONS LANG TERM \ - HISTSIZE HISTFILESIZE PATH NO_AT_BRIDGE +export LANG PATH NO_AT_BRIDGE diff --git a/bash_fc b/bash_fc deleted file mode 100644 index a6cde16..0000000 --- a/bash_fc +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if which fc-cache >/dev/null; then - (fc-cache >/dev/null 2>&1 &) -fi diff --git a/bash_history b/bash_history index 156aeac..7e9598f 100644 --- a/bash_history +++ b/bash_history @@ -1,7 +1,4 @@ -#!/bin/bash - shopt -s histappend PROMPT_COMMAND="history -a;$PROMPT_COMMAND" HISTSIZE=-1 HISTFILESIZE=-1 -export HISTSIZE HISTFILESIZE @@ -1,6 +1,4 @@ -#!/bin/bash - -open() { +open_func() { file="$1" IFS='/' read -r major minor < <(file -ib "$file" 2>/dev/null | cut -d ';' -f 1) @@ -20,3 +18,5 @@ open() { /usr/bin/xdg-open "$file";; esac } + +command -v open >/dev/null 2>&1 && alias o=open || alias o=open_func diff --git a/bash_path b/bash_path deleted file mode 100644 index ed363b1..0000000 --- a/bash_path +++ /dev/null @@ -1,3 +0,0 @@ -path() { - readlink -f "$1" | tee /dev/stderr | tr -d '\n' | xsel -} diff --git a/bash_profile b/bash_profile index 507b5bf..5f231cc 100644 --- a/bash_profile +++ b/bash_profile @@ -1,3 +1,7 @@ -#!/bin/bash +for script in ${HOME}/.bash_profile.d/*; do + if [ -r "${script}" ]; then + . "${script}" + fi +done -[ -f ~/.bashrc ] && . ~/.bashrc +[ -f "${HOME}/.bashrc" ] && . "${HOME}/.bashrc" @@ -3,4 +3,5 @@ gitbranch() { [ -n "$branch" ] && printf " (${branch})" } +TERM=xterm-256color PS1="\[\e[32m\]\u@\[\e[0m\]\[\e[00;33m\]\h\[\e[0m\]\[\e[00;37m\] in \[\e[0m\]\[\e[00;36m\]\w\[\e[0m\]\[\e[00;37m\]\[\e[0m\]\[\e[00;32m\]\$(gitbranch)\n→\[\e[0m\]\[\e[00;37m\] \[\e[0m\]" diff --git a/bash_wayland b/bash_wayland index 50dca90..fe56ef6 100644 --- a/bash_wayland +++ b/bash_wayland @@ -1,2 +1,4 @@ -export GDK_BACKEND=wayland -export QT_QPA_PLATFORM=wayland +GDK_BACKEND=wayland +QT_QPA_PLATFORM=wayland + +export GDK_BACKEND QT_QPA_PLATFORM diff --git a/bash_xrdb b/bash_xrdb deleted file mode 100644 index 278ba13..0000000 --- a/bash_xrdb +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -if [ -f $HOME/.Xresources ] && [ -x /usr/bin/xrdb ]; then - /usr/bin/xrdb $HOME/.Xresources >/dev/null 2>&1 -fi @@ -1,9 +1,5 @@ -sourcesdir="$HOME/.bashrc.d/" -if [ -d "$sourcesdir" ]; then - sources=`/bin/ls -1 "$sourcesdir"` - for file in $sources; do - if [ -f "$sourcesdir/$file" ]; then - . "$sourcesdir/$file" - fi - done -fi +for script in ${HOME}/.bashrc.d/*; do + if [ -r "${script}" ]; then + . "${script}" + fi +done diff --git a/foot.ini b/foot.ini new file mode 100644 index 0000000..6d0cc57 --- /dev/null +++ b/foot.ini @@ -0,0 +1,102 @@ +# -*- conf -*- + +font=Fira Mono:style=Medium:size=20 +# geometry=700x500 +# pad=2x2 +# initial-window-mode=windowed +# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd) +# term=foot +# login-shell=no +# workers=<number of logical CPUs> + +[scrollback] +lines=100000 +multiplier=5.0 +# indicator-position=relative +# indicator-format= + +[cursor] +# style=block +# color=111111 dcdccc +# blink=no + +[mouse] +# hide-when-typing=no + +[colors] +alpha=0.6 +foreground=cbcbc9 +background=000002 +# regular0=222222 # black +# regular1=cc9393 # red +# regular2=7f9f7f # green +# regular3=d0bf8f # yellow +# regular4=6ca0a3 # blue +# regular5=dc8cc3 # magenta +# regular6=93e0e3 # cyan +# regular7=dcdccc # white +# bright0=666666 # bright black +# bright1=dca3a3 # bright red +# bright2=bfebbf # bright green +# bright3=f0dfaf # bright yellow +# bright4=8cd0d3 # bright blue +# bright5=fcace3 # bright magenta +# bright6=b3ffff # bright cyan +# bright7=ffffff # bright white +# selection-foreground=<inverse foreground/background> +# selection-background=<inverse foreground/background> + +[csd] +# preferred=server +# size=26 +# color=<foreground color> +# button-width=26 +# button-minimize-color=ff0000ff +# button-maximize-color=ff00ff00 +# button-close-color=ffff0000 + +[key-bindings] +primary-paste=Shift+Insert +# scrollback-up=Shift+Page_Up +# scrollback-down=Shift+Page_Down +# clipboard-copy=Control+Shift+C +# clipboard-paste=Shift+Insert +# search-start=Control+Shift+R +# font-increase=Control+plus Control+equal Control+KP_Add +# font-decrease=Control+minus Control+KP_Subtract +# font-reset=Control+0 Control+KP_0 +# spawn-terminal=Control+Shift+N +# minimize=none +# maximize=none +# fullscreen=none +# pipe-visible=[sh -c "xurls | bemenu | xargs -r firefox"] none +# pipe-scrollback=[sh -c "xurls | bemenu | xargs -r firefox"] none +# pipe-selected=[xargs -r firefox] none + + +[search-bindings] +# cancel=Control+g Escape +# commit=Return +# find-prev=Control+r +# find-next=Control+s +# cursor-left=Left Control+b +# cursor-left-word=Control+Left Mod1+b +# cursor-right=Right Control+f +# cursor-right-word=Control+Right Mod1+f +# cursor-home=Home Control+a +# cursor-end=End Control+e +# delete-prev=BackSpace +# delete-prev-word=Mod1+BackSpace Control+BackSpace +# delete-next=Delete +# delete-next-word=Mod1+d Control+Delete +# extend-to-word-boundary=Control+w +# extend-to-next-whitespace=Control+Shift+W + +[mouse-bindings] +# primary-paste=BTN_MIDDLE +# select-begin=BTN_LEFT +# select-begin-block=Control+BTN_LEFT +# select-extend=BTN_RIGHT +# select-word=BTN_LEFT-2 +# select-word-whitespace=Control+BTN_LEFT-2 +# select-row=BTN_LEFT-3 @@ -1,4 +1,5 @@ -#!/bin/bash -efu +#!/bin/bash +set -efu progpath="$0" prog="${prog:-${0##*/}}" @@ -75,14 +76,16 @@ e.g. install_dotfiles \"bash xterm\" \"/etc/profile\" \"\$HOME/.bashrc\"\n" local ret=0 - for app in $apps; do - command -v "$app" >/dev/null 2>&1 || ret=$? - if [ $ret -ne 0 ]; then - info '>> %s is not found on this server. Skipping %s...\n' \ - "$app" "$srcpath" - return - fi - done + if [ -n "${apps}" ]; then + for app in $apps; do + command -v "$app" >/dev/null 2>&1 || ret=$? + if [ $ret -ne 0 ]; then + info ">> %s is not installed. Skipping %s...\n" \ + "$app" "$srcpath" + return + fi + done + fi if [ -e "$srcpath" ]; then if [ -L $dstpath ]; then @@ -164,14 +167,55 @@ fi info "Installing dotfiles...\n" -install_dotfile "vim" \ - "$dotfilesdir/vimrc" \ - "$HOME/.vimrc" - install_dotfile "nvim" \ "$dotfilesdir/vimrc" \ "$HOME/.config/nvim/init.vim" +install_dotfile "waybar" \ + "$dotfilesdir/waybar-config" \ + "$HOME/.config/waybar/config" + +install_dotfile "waybar" \ + "$dotfilesdir/waybar-style" \ + "$HOME/.config/waybar/style.css" + +install_dotfile "i3status" \ + "$dotfilesdir/i3status-config" \ + "$HOME/.config/i3status/config" + +# Don't create "Desktop" and "Downloads" directories +install_dotfile "" \ + "$dotfilesdir/user-dirs.dirs" \ + "$HOME/.config/user-dirs.dirs" + +install_dotfile "alacritty" \ + "$dotfilesdir/alacritty.yml" \ + "$HOME/.config/alacritty/alacritty.yml" + +install_dotfile "sway" \ + "$dotfilesdir/sway-config" \ + "$HOME/.config/sway/config" + +install_dotfile "" \ + "$dotfilesdir/xkb-birman-ru" \ + "$HOME/.config/xkb/symbols/birman-ru" + +install_dotfile "" \ + "$dotfilesdir/xkb-birman-us" \ + "$HOME/.config/xkb/symbols/birman-us" + +install_dotfile "htop" \ + "$dotfilesdir/htoprc" \ + "$HOME/.config/htop/htoprc" + +install_dotfile "foot" \ + "$dotfilesdir/foot.ini" \ + "$HOME/.config/foot/foot.ini" + +install_dotfile "dunst" \ + "$dotfilesdir/dunstrc" \ + "$HOME/.config/dunstrc" + install_dotfile "bash" \ "$dotfilesdir/bashrc" \ "$HOME/.bashrc" @@ -186,11 +230,11 @@ install_dotfile "bash" \ install_dotfile "bash" \ "$dotfilesdir/bash_env" \ - "$HOME/.bashrc.d/02-bash_env" + "$HOME/.bash_profile.d/02-bash_env" install_dotfile "bash" \ - "$dotfilesdir/bash_ps1" \ - "$HOME/.bashrc.d/02-bash_ps1" + "$dotfilesdir/bash_term" \ + "$HOME/.bashrc.d/02-bash_term" install_dotfile "bash" \ "$dotfilesdir/bash_aliases" \ @@ -204,67 +248,31 @@ install_dotfile "bash" \ "/usr/share/bash-completion/bash_completion" \ "$HOME/.bashrc.d/01-bash_completion" -install_dotfile "bash" \ - "/etc/profile" \ - "$HOME/.bashrc.d/01-profile" - -install_dotfile "bash" \ - "$dotfilesdir/bash_beeper" \ - "$HOME/.bashrc.d/02-bash_beeper" - install_dotfile "bash sway" \ "$dotfilesdir/bash_wayland" \ - "$HOME/.bashrc.d/99-wayland" + "$HOME/.bash_profile.d/99-wayland" install_dotfile "sway mako" \ "$dotfilesdir/sway-mako" \ "$HOME/.swayrc.d/03-mako" -install_dotfile "sway setxkbmap" \ - "$dotfilesdir/xinitrc-xkbmap" \ - "$HOME/.swayrc.d/00-xkbmap" - install_dotfile "sway mako notify-send inotifywait neomutt" \ "$dotfilesdir/xinitrc-mailnotify" \ "$HOME/.swayrc.d/00-mailnotify" -install_dotfile "waybar" \ - "$dotfilesdir/waybar-config" \ - "$HOME/.config/waybar/config" - -install_dotfile "waybar" \ - "$dotfilesdir/waybar-style" \ - "$HOME/.config/waybar/style.css" - -install_dotfile "i3status" \ - "$dotfilesdir/i3status-config" \ - "$HOME/.config/i3status/config" - install_dotfile "bash" \ "/usr/share/doc/pkgfile/command-not-found.bash" \ "$HOME/.bashrc.d/02-command-not-found" -install_dotfile "bash xrdb" \ - "$dotfilesdir/bash_xrdb" \ - "$HOME/.bashrc.d/02-bash_xrdb" - -install_dotfile "bash fc-cache" \ - "$dotfilesdir/bash_fc" \ - "$HOME/.bashrc.d/02-bash_fc" - install_dotfile "bash dircolors" \ "$dotfilesdir/bash_dircolors" \ - "$HOME/.bashrc.d/02-bash_dircolors" + "$HOME/.bash_profile.d/02-bash_dircolors" install_dotfile "bash" \ "$dotfilesdir/bash_open" \ "$HOME/.bashrc.d/04-bash_open" install_dotfile "bash" \ - "$dotfilesdir/bash_path" \ - "$HOME/.bashrc.d/04-bash_path" - -install_dotfile "bash" \ "$dotfilesdir/inputrc" \ "$HOME/.inputrc" @@ -272,12 +280,12 @@ install_dotfile "tmux" \ "$dotfilesdir/tmux.conf" \ "$HOME/.tmux.conf" -install_dotfile "xrdb" \ - "$dotfilesdir/Xresources" \ - "$HOME/.Xresources" +install_dotfile "Xorg" \ + "$dotfilesdir/Xdefaults" \ + "$HOME/.Xdefaults" -install_dotfile "xrdb" \ - "$dotfilesdir/Xresources" \ +install_dotfile "Xwayland" \ + "$dotfilesdir/Xdefaults" \ "$HOME/.Xdefaults" install_dotfile "git" \ @@ -292,20 +300,23 @@ install_dotfile "fc-cache" \ "$dotfilesdir/fonts.conf" \ "$HOME/.fonts.conf" -# Don't create "Desktop" and "Downloads" directories -install_dotfile "firefox" \ - "$dotfilesdir/user-dirs.dirs" \ - "$HOME/.config/user-dirs.dirs" +install_dotfile "vim" \ + "$dotfilesdir/vimrc" \ + "$HOME/.vimrc" + +install_dotfile "i3" \ + "$dotfilesdir/i3-config" \ + "$HOME/.i3/config" + +install_dotfile "i3" \ + "$dotfilesdir/xinitrc-i3" \ + "$HOME/.xinitrc" install_dotfile "setxkbmap" \ "$dotfilesdir/xinitrc-xkbmap" \ "$HOME/.xinitrc.d/00-xkbmap" install_dotfile "dunst" \ - "$dotfilesdir/dunstrc" \ - "$HOME/.config/dunstrc" - -install_dotfile "dunst" \ "$dotfilesdir/xinitrc-dunst" \ "$HOME/.xinitrc.d/03-dunst" @@ -329,32 +340,4 @@ install_dotfile "swaylock" \ "$dotfilesdir/sway-lock" \ "$HOME/.local/bin/lock" -install_dotfile "alacritty" \ - "$dotfilesdir/alacritty.yml" \ - "$HOME/.config/alacritty/alacritty.yml" - -install_dotfile "i3" \ - "$dotfilesdir/xinitrc-i3" \ - "$HOME/.xinitrc" - -install_dotfile "i3" \ - "$dotfilesdir/i3-config" \ - "$HOME/.i3/config" - -install_dotfile "sway" \ - "$dotfilesdir/sway-config" \ - "$HOME/.config/sway/config" - -install_dotfile "setxkbmap" \ - "$dotfilesdir/xkb-birman-ru" \ - "$HOME/.config/xkb/symbols/birman-ru" - -install_dotfile "setxkbmap" \ - "$dotfilesdir/xkb-birman-us" \ - "$HOME/.config/xkb/symbols/birman-us" - -install_dotfile "htop" \ - "$dotfilesdir/htoprc" \ - "$HOME/.config/htop/htoprc" - -info "Installing successfully done.\n" +info "Installation completed successfully\n" diff --git a/sway-config b/sway-config index baae38b..2a20096 100644 --- a/sway-config +++ b/sway-config @@ -1,32 +1,33 @@ set $mod Mod4 -set $menu dmenu_path | bemenu | xargs swaymsg exec -- +set $menu dmenu_path | dmenu | xargs swaymsg exec -- floating_modifier $mod -bindsym Ctrl+grave [instance="dropdown"] scratchpad show - set $workspace_www 1:www set $workspace_mail 2:mail set $workspace_editor 3:editor set $workspace_terminals 4:terminals -assign [window_role="^browser$"] \u2192 workspace $workspace_www -assign [class="Thunderbird"] \u2192 workspace $workspace_mail -assign [title="^Neovim$"] \u2192 workspace $workspace_editor -for_window [window_role="browser"] layout tabbed +assign [app_id="thunderbird"] workspace $workspace_mail +assign [app_id="telegramdesktop"] workspace $workspace_mail +assign [app_id="firefox"] workspace $workspace_www exec ~/.swayrc.d/00-mailnotify exec ~/.swayrc.d/00-xkbmap exec ~/.swayrc.d/03-mako +#exec ~/.swayrc.d/04-foot +exec ~/.swayrc.d/05-redshift +#exec ~/.swayrc.d/06-oguri # Main hotkeys -bindsym --to-code $mod+Return exec wterm +bindsym --to-code $mod+Return exec foot bindsym --to-code $mod+r exec $menu bindsym --to-code $mod+c kill bindsym --to-code Mod1+Shift+r reload bindsym --to-code $mod+Shift+q exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' bindsym --to-code $mod+l exec lock bindsym --release Print exec "grim /home/zar/screenshot.png" -bindsym --release Shift+Print exec "scrot -s '/home/zar/%s_%H%M_%d%m%Y_$wx$h.png'" +bindsym --release Shift+Print exec 'grim -g "$(slurp)" - | wl-copy' +bindsym --release Ctrl+Print exec 'grim -g "$(slurp)" - | swappy -f -' bindsym XF86AudioRaiseVolume exec "amixer sset Master '5%+'" bindsym XF86AudioLowerVolume exec "amixer sset Master '5%-'" bindsym XF86AudioMute exec "amixer set Headphone toggle; amixer set Speaker toggle; amixer set Master on" @@ -114,5 +115,10 @@ client.background #ffffff default_border none font pango:Monaco 7 -output * bg /home/zar/.dotfiles/wallpapers/black.jpg fill +input * { + xkb_layout "birman-us,birman-ru" + xkb_options "grp:caps_toggle,grp_led:scroll,lv3:ralt_switch_multikey" +} + +output * bg /home/zar/.dotfiles/wallpapers/girl.png fill #xwayland disable @@ -40,6 +40,9 @@ set hidden " allow buffer switching without s set virtualedit=onemore " allow for cursor beyond last character set lazyredraw " no lags set ttyfast " no lags +set guicursor= +set spelllang=en +set completeopt+=preview " Style settings syntax on " turn on syntax highlight @@ -57,16 +60,19 @@ vnoremap < <gv vnoremap > >gv nnoremap s "_d noremap <leader>ss :call StripTrailingWhitespace()<CR> +nnoremap <silent> <F11> :set spell!<cr> +inoremap <silent> <F11> <C-O>:set spell!<cr> +inoremap <Tab> <C-x><C-o> " Use Tab for autocomplete, if not at beginning of line -function! Tab_Or_Complete() - if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w' - return "\<C-N>" - else - return "\<Tab>" - endif -endfunction -inoremap <Tab> <C-R>=Tab_Or_Complete()<CR> +"function! Tab_Or_Complete() +" if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w' +" return "\<C-N>" +" else +" return "\<C-x>\<C-O>" +" endif +"endfunction +"inoremap <Tab> <C-R>=Tab_Or_Complete()<CR> " Strip trailing whitespace (,ss) function! StripTrailingWhitespace() @@ -77,6 +83,10 @@ function! StripTrailingWhitespace() call setreg('/', old_query) endfunction +" Omni-complition +filetype plugin on +set omnifunc=syntaxcomplete#Complete + if has("autocmd") " settings for specific file types autocmd! FileType make setlocal noexpandtab tabstop=8 shiftwidth=8 softtabstop=8 textwidth=80 @@ -87,9 +97,10 @@ if has("autocmd") " autoreload .vimrc autocmd! bufwritepost .vimrc source $MYVIMRC + autocmd! bufwritepost init.vim source $MYVIMRC " autostrip trailing whitespaces - "autocmd! FileType c,cpp,java,go,php,javascript,puppet,python,rust,twig,xml,yaml,yml,perl,sql,vim,markdown autocmd BufWritePre <buffer> call StripTrailingWhitespace() + autocmd! FileType c,cpp,java,go,php,javascript,puppet,python,rust,twig,xml,yaml,yml,perl,sql,vim,markdown autocmd BufWritePre <buffer> call StripTrailingWhitespace() " autodetect file type for syntax highlighting autocmd! BufEnter,InsertLeave * :filetype detect @@ -105,35 +116,33 @@ if has('persistent_undo') set undofile endif -if has('cscope') -" set cscopetag cscopeverbose - -" if has('quickfix') -" set cscopequickfix=s-,c-,d-,i-,t-,e- -" endif - - cnoreabbrev csa cs add - cnoreabbrev csf cs find - cnoreabbrev csk cs kill - cnoreabbrev csr cs reset - cnoreabbrev css cs show - cnoreabbrev csh cs help +if has("nvim-0.5.0") + packadd nvim-lsp +" lua require'nvim_lsp'.rust_analyzer.setup{} + lua require'nvim_lsp'.rls.setup{} +" lua require'nvim_lsp'.clangd.setup{} + + let g:language_client_log_level = 'debug' + + function! LSPRename() + let s:newName = input('Enter new name: ', expand('<cword>')) + echom "s:newName = " . s:newName + lua vim.lsp.buf.rename(s:newName) + endfunction + + function! LSPSetMappings() + setlocal omnifunc=v:lua.vim.lsp.omnifunc + + nnoremap <silent> <buffer> gd <cmd>lua vim.lsp.buf.declaration()<CR> + nnoremap <silent> <buffer> <c-]> <cmd>lua vim.lsp.buf.definition()<CR> + nnoremap <silent> <buffer> K <cmd>lua vim.lsp.buf.hover()<CR> + nnoremap <silent> <buffer> gD <cmd>lua vim.lsp.buf.implementation()<CR> + nnoremap <silent> <buffer> <c-k> <cmd>lua vim.lsp.buf.signature_help()<CR> + nnoremap <silent> <buffer> 1gD <cmd>lua vim.lsp.buf.type_definition()<CR> + nnoremap <silent> <buffer> gr <cmd>lua vim.lsp.buf.references()<CR> + nnoremap <silent> <buffer> gR <cmd>lua vim.lsp.buf.rename()<CR> + endfunction + + au FileType lua,sh,c,python,rust :call LSPSetMappings() + "autocmd BufWritePre lua,sh,c,python,rust lua vim.lsp.buf.formatting_sync(nil, 1000) endif - -" Omni-complition -filetype plugin on -set omnifunc=syntaxcomplete#Complete -set guicursor= - -"call plug#begin('~/.local/share/nvim/plugged') -"Plug 'rking/ag.vim' -"call plug#end() -" - -nmap <LeftMouse> <nop> -imap <LeftMouse> <nop> -vmap <LeftMouse> <nop> -nmap <2-LeftMouse> <nop> -imap <2-LeftMouse> <nop> -vmap <2-LeftMouse> <nop> -set mouse= |