From 956df69d7496081db5e7b3621a0bcc7b9d7f7dfc Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Wed, 8 Dec 2021 11:52:16 +0100 Subject: move to .config folder --- .config/.alacritty.yml | 38 ++++++++ .config/i3/config | 155 ++++++++++++++++++++++++++++++ .config/i3blocks/config | 39 ++++++++ .config/i3blocks/i3_battery.sh | 18 ++++ .config/nvim/init.vim | 192 +++++++++++++++++++++++++++++++++++++ .config/nvim/lua/git.lua | 29 ++++++ .config/nvim/lua/lsp_conf.lua | 77 +++++++++++++++ .config/nvim/lua/lualine_style.lua | 7 ++ .config/redshift.conf | 21 ++++ .config/starship.toml | 23 +++++ config/redshift.conf | 21 ---- config/starship.toml | 23 ----- i3/config | 155 ------------------------------ i3blocks/config | 39 -------- i3blocks/i3_battery.sh | 18 ---- nvim/init.vim | 192 ------------------------------------- nvim/lua/git.lua | 29 ------ nvim/lua/lsp_conf.lua | 77 --------------- nvim/lua/lualine_style.lua | 7 -- 19 files changed, 599 insertions(+), 561 deletions(-) create mode 100644 .config/.alacritty.yml create mode 100644 .config/i3/config create mode 100644 .config/i3blocks/config create mode 100755 .config/i3blocks/i3_battery.sh create mode 100644 .config/nvim/init.vim create mode 100644 .config/nvim/lua/git.lua create mode 100644 .config/nvim/lua/lsp_conf.lua create mode 100644 .config/nvim/lua/lualine_style.lua create mode 100644 .config/redshift.conf create mode 100644 .config/starship.toml delete mode 100644 config/redshift.conf delete mode 100644 config/starship.toml delete mode 100644 i3/config delete mode 100644 i3blocks/config delete mode 100755 i3blocks/i3_battery.sh delete mode 100644 nvim/init.vim delete mode 100644 nvim/lua/git.lua delete mode 100644 nvim/lua/lsp_conf.lua delete mode 100644 nvim/lua/lualine_style.lua diff --git a/.config/.alacritty.yml b/.config/.alacritty.yml new file mode 100644 index 0000000..64fbd8c --- /dev/null +++ b/.config/.alacritty.yml @@ -0,0 +1,38 @@ +shell: + program: /usr/bin/tmux + args: + - new-session + +font: + normal: + family: DejaVuSansMono + style: Nerd + +colors: + primary: + background: "0x111111" + foreground: "0xc1c1c1" + + cursor: + text: "0x424242" + cursor: "0x808080" + + normal: + black: "0x111111" + red: "0xaf005f" + green: "0x5faf00" + yellow: "0xd7af5f" + blue: "0x5fafd7" + magenta: "0x808080" + cyan: "0xd7875f" + white: "0xf2f2f2" + + bright: + black: "0x6a6a6a" + red: "0x5faf5f" + green: "0xafd700" + yellow: "0xaf87d7" + blue: "0xffaf00" + magenta: "0xffaf00" + cyan: "0x00afaf" + white: "0x5f8787" diff --git a/.config/i3/config b/.config/i3/config new file mode 100644 index 0000000..e5fec84 --- /dev/null +++ b/.config/i3/config @@ -0,0 +1,155 @@ +# Default modkey +set $mod Mod4 + +font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +font pango:DejaVu Sans Mono 10 +font pango:DejaVu Sans Mono, Terminus Bold Semi-Condensed 11 +font pango:Terminus 11px + +# Start a terminal +bindsym $mod+Return exec alacritty --config-file ~/.alacrittyi3.yml + +# Kill focused window +bindsym $mod+Shift+q kill + +# Move between windows +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# Alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# Move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# Alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# Split in horizontal orientation +bindsym $mod+Mod1+v split h + +# Split in vertical orientation +bindsym $mod+Mod1+h split v + +# Enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# Change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# Toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# Change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# Focus the parent container +bindsym $mod+a focus parent + +# Open d-menu +bindsym $mod+d exec dmenu_run + +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + + +# Volume +set $sink `pactl list short sinks | grep RUNNING | cut -f1` +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume $sink +10% +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume $sink -10% +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute $sink toggle + +# Screenshots +set $screenshot-name `date +%d%m%Y-%H%M%S.png` +bindsym Print exec import -window root $screenshot-name +bindsym Shift+Print exec import $screenshot-name + +# Reload the configuration file +bindsym $mod+Shift+c reload + +# Restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart + +# Resize window (you can also use the mouse for that) +mode "resize" +{ + # Resize with the arrow keys + bindsym Left resize grow width 1 px or 1 ppt + bindsym Down resize shrink height 1 px or 1 ppt + bindsym Up resize grow height 1 px or 1 ppt + bindsym Right resize shrink width 1 px or 1 ppt + + # Back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode "resize" + + +# Start i3blocks to display a workspace bar +bar { + font pango: DejaVuSansMono Nerd Font 9 + i3bar_command i3bar + position bottom + strip_workspace_numbers yes + tray_output nonprimary + status_command i3blocks + + colors { + background #282A36 + statusline #F8F8F2 + separator #44475A + + focused_workspace #44475A #44475A #F8F8F2 + active_workspace #282A36 #44475A #F8F8F2 + inactive_workspace #282A36 #282A36 #BFBFBF + urgent_workspace #FF5555 #FF5555 #F8F8F2 + binding_mode #FF5555 #FF5555 #F8F8F2 + } +} diff --git a/.config/i3blocks/config b/.config/i3blocks/config new file mode 100644 index 0000000..6653643 --- /dev/null +++ b/.config/i3blocks/config @@ -0,0 +1,39 @@ +command=/usr/share/i3blocks/$BLOCK_NAME +separator_block_width=15 + +[weather] +command=curl -Ss 'https://wttr.in/Catania?0&T&Q' | cut -c 16- | head -2 | xargs echo +interval=3600 +color=#A4C2F4 + +[memory] +label=MEM +separator=false +interval=30 + +[disk] +label=DISK +interval=30 + +[cpu_usage] +label=CPU +interval=10 +min_width=CPU: 100.00% + +[wifi] +command=iwgetid -r | tr '\n' ' ' && grep $(iwgetid -m | awk '{ printf "%s", $1 }') /proc/net/wireless | awk '{ printf "%i%\n", int($3 * 100 / 70) }';exit 0 instance=wlp2s0 +interval=5 +label= + +[battery] +command=i3_battery.sh +interval=10 + +[volume] +command=pulsemixer --get-volume | cut -d " " -f 1; exit 0 +interval=1 +label= + +[time] +command=date +interval=1 diff --git a/.config/i3blocks/i3_battery.sh b/.config/i3blocks/i3_battery.sh new file mode 100755 index 0000000..97ea493 --- /dev/null +++ b/.config/i3blocks/i3_battery.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +BAT=$(acpi -b | grep -E -o '[0-9][0-9]?%') +CHECK_CHARGING=$(acpi -b | grep -E -o 'Charging') + +# Full and short texts +echo "Battery: $BAT" +echo "BAT: $BAT" + +if [ "$CHECK_CHARGING" != "" ]; then + echo "#1abc9c" + exit 0 +fi +# Set urgent flag below 5% or use orange below 20% +[ ${BAT%?} -le 5 ] && exit 33 +[ ${BAT%?} -le 35 ] && echo "#d35400" + +exit 0 diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..77f3cfb --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,192 @@ +autocmd! bufwritepost .vimrc source % + +call plug#begin('~/.vim/plugged') +Plug 'cespare/vim-toml', { 'branch': 'main' } +"Plug 'rust-lang/rust.vim' +Plug 'nvim-lua/plenary.nvim' +Plug 'lewis6991/gitsigns.nvim' +Plug 'nvim-lualine/lualine.nvim' +Plug 'kyazdani42/nvim-web-devicons' +Plug 'luochen1990/rainbow' " color parentheses +Plug 'terryma/vim-multiple-cursors' +Plug 'tpope/vim-fugitive' " git extension for commit logs and etc. +Plug 'editorconfig/editorconfig-vim' +Plug 'ap/vim-css-color' +Plug 'Yggdroot/indentLine' + +Plug 'google/vim-searchindex' + +Plug 'kazhala/close-buffers.nvim' + +if has('nvim') + Plug 'rktjmp/lush.nvim' + Plug 'ellisonleao/gruvbox.nvim' + + Plug 'nvim-telescope/telescope.nvim' + Plug 'neovim/nvim-lspconfig' + Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} + Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} + Plug 'kyazdani42/nvim-tree.lua' + Plug 'ray-x/lsp_signature.nvim' + Plug 'folke/todo-comments.nvim' + Plug 'saecki/crates.nvim' + Plug 'gelguy/wilder.nvim', { 'do': ':UpdateRemotePlugins' } + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + + Plug 'jose-elias-alvarez/null-ls.nvim' + Plug 'folke/trouble.nvim' + Plug 'folke/lsp-colors.nvim' +endif + + +call plug#end() " required + +syntax on + +set runtimepath+=~/.vim-plugins/LanguageClient-neovim + +set completeopt=menu,menuone,noselect + +set clipboard=unnamed +set mouse=a " click with mouse +set wildmenu +set wildmode=longest,list:full +set wildignore=*~,*.png,*.jpg,*.gif,Thumbs.db,*.min.js,*.swp,*.o,vendor + +set number " number of the current line +set relativenumber " relative number, ..-2 -1 x 1 2, where x is current line +set textwidth=80 +set colorcolumn=80 +set nowrap +set fo-=t + +set tabstop=4 +set shiftwidth=4 +set expandtab " convert tabs in spaces + +set ai " auto indent +set autoread + +set encoding=UTF-8 +set history=1000 +set wildignore+=*.pyc + +set hlsearch " highlight search +set incsearch + +set nowritebackup +set laststatus=2 + +"set cursorline + +set list " spaces as characters +set listchars=eol:⏎,tab:»·,trail:ˑ,nbsp:⎵ + +set foldmethod=indent + +set splitright " split on right side +set lazyredraw +set ttyfast + +set noswapfile + +" rust +" let g:rustfmt_autosave = 1 +" let g:rustfmt_emit_files = 1 +" let g:rustfmt_fail_silently = 0 +" let g:rust_clip_command = 'xclip -selection clipboard' + +set termguicolors +set background=dark + +if has('nvim') + colorscheme gruvbox + highlight CursorLineNr ctermbg=NONE guibg=NONE + + lua require('lualine_style') + lua require('git') + let g:coq_settings = { 'auto_start': v:true } + lua require('lsp_conf') + + lua require('nvim-tree').setup() + lua require('todo-comments').setup() + + call wilder#setup({ + \ 'modes': [':', '/', '?'], + \ }) + call wilder#set_option('renderer', wilder#popupmenu_renderer(wilder#popupmenu_border_theme({ + \ 'highlights': { + \ 'border': 'Normal', + \ }, + \ 'border': 'rounded', + \ 'left': [ + \ ' ', wilder#popupmenu_devicons(), + \ ], + \ }))) + lua require('nvim-treesitter.configs').setup({ highlight = { enable = true, }, }) + + lua require('lsp-colors').setup() + + nnoremap xx TroubleToggle +else + colorscheme pablo +endif + +let g:indentLine_char = '¦' + +let g:netrw_liststyle=1 + +filetype plugin indent on +set nocompatible + +set showcmd " show commands at bottom + + +" nvim-tree +let g:nvim_tree_quit_on_open = 1 +let g:nvim_tree_highlight_opened_files = 1 +nnoremap :NvimTreeToggle + +" ------------ +" MAPS +" ----------- +let mapleader = "," + +nnoremap j gj +nnoremap k gk + +nnoremap tn :tabnew +nnoremap rt :RainbowToggle + +" buffers +nnoremap ]b :bnext +nnoremap [b :bprev +nnoremap b Telescope buffers + +" tabs +nnoremap ]t :tabn +nnoremap [t :tabp + +" only one window +nnoremap o :only + + +nnoremap ff Telescope find_files +nnoremap fg Telescope live_grep +nnoremap fh Telescope help_tags + +nnoremap pa :set paste +nnoremap npa :set nopaste + + +nmap cr :!command cargo r +nmap :EditorConfigReload + +if &diff + "Get from remote + nnoremap dr :diffgetRE + "Get from base + nnoremap db :diffgetBA + "Get from local + nnoremap dl :diffgetLO +endif diff --git a/.config/nvim/lua/git.lua b/.config/nvim/lua/git.lua new file mode 100644 index 0000000..2f9cbc4 --- /dev/null +++ b/.config/nvim/lua/git.lua @@ -0,0 +1,29 @@ +require('gitsigns').setup { + signs = { + add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + }, + keymaps = { + -- Default keymap options + noremap = true, + + ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'"}, + ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'"}, + + ['n hs'] = 'lua require"gitsigns".stage_hunk()', + ['v hs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', + ['n hS'] = 'lua require"gitsigns".stage_buffer()', + ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', + ['n hp'] = 'lua require"gitsigns".preview_hunk()', + ['n hB'] = 'lua require"gitsigns".blame_line(true)', + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = true, -- Toggle with `:Gitsigns toggle_numhl` + watch_gitdir = { + interval = 1000, + follow_files = true + }, +} diff --git a/.config/nvim/lua/lsp_conf.lua b/.config/nvim/lua/lsp_conf.lua new file mode 100644 index 0000000..e339a5c --- /dev/null +++ b/.config/nvim/lua/lsp_conf.lua @@ -0,0 +1,77 @@ +local nvim_lsp = require('lspconfig') +local coq = require('coq') +local null_ls = require("null-ls") +local trouble = require("trouble") + +-- Redefine sign. +local signs = { Error = 'E', Warning = 'W', Hint = 'H', Information = 'I' } + +for type, icon in pairs(signs) do + local hl = 'LspDiagnosticsSign' .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) +end + +local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end +local opts = { noremap=true, silent=true } + +null_ls.config({ + debug = false, + save_after_format = false, + sources = { + -- Python + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.isort, + null_ls.builtins.diagnostics.flake8, + -- Rust + null_ls.builtins.formatting.rustfmt, + -- C + null_ls.builtins.formatting.clang_format, + -- JS/TS + null_ls.builtins.formatting.prettier, + } +}) + +-- Setup lspconfig. + +--- Use a loop to conveniently call 'setup' on multiple servers and +-- map buffer local keybindings when the language server attaches +local servers = { 'pyright', 'rust_analyzer', 'tsserver', 'clangd' } +for _, lsp in ipairs(servers) do + nvim_lsp[lsp].setup { + capabilities = coq.lsp_ensure_capabilities(), + on_attach = function(client, bufnr) + client.resolved_capabilities.document_formatting = false + + require "lsp_signature".on_attach() + + -- Mappings. + local opts = { noremap=true, silent=true } + + -- See `:help vim.lsp.*` for documentation on any of the below functions + buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + end, + flags = { + debounce_text_changes = 150, + } + } +end + +nvim_lsp["null-ls"].setup({ + on_attach = function(client) + if client.resolved_capabilities.document_formatting then + buf_set_keymap('n', '', 'lua vim.lsp.buf.formatting_sync()', opts) + vim.cmd "autocmd BufWritePre lua vim.lsp.buf.formatting_seq_sync()" + end + end +}) + +trouble.setup({ + use_lsp_diagnostic_signs = true, + auto_close = true, + auto_open = true +}) + diff --git a/.config/nvim/lua/lualine_style.lua b/.config/nvim/lua/lualine_style.lua new file mode 100644 index 0000000..bb7738b --- /dev/null +++ b/.config/nvim/lua/lualine_style.lua @@ -0,0 +1,7 @@ +require'lualine'.setup{ + options = { + theme = 'powerline', + section_separators = { left = '', right = ''}, + component_separators = { left = '|', right = '|'}, + }, +} diff --git a/.config/redshift.conf b/.config/redshift.conf new file mode 100644 index 0000000..7d76847 --- /dev/null +++ b/.config/redshift.conf @@ -0,0 +1,21 @@ +[redshift] + +temp-day=5700 +temp-night=4500 + +fade=1 + +; Custom dawn/dusk intervals. +dawn-time=6:00-7:45 +dusk-time=20:00-21:00 + +gamma-day=1 +gamma-night=0.8 + +location-provider=manual + +adjustment-method=randr + +[manual] +lat=37.46 +lon=15.05 diff --git a/.config/starship.toml b/.config/starship.toml new file mode 100644 index 0000000..344b069 --- /dev/null +++ b/.config/starship.toml @@ -0,0 +1,23 @@ +add_newline = false + +[directory] +truncation_length = 15 +style = "cyan" + +[line_break] +disabled = true + +[custom.docker] +description = "Shows the docker symbol if the current directory has Dockerfile or docker-compose.yml files" +command = "echo 🐳" +files = ["Dockerfile", "docker-compose.yml", "docker-compose.yaml"] +when = """ command -v docker &> /dev/null; exit (echo $?); """ + +[custom.ssh_keys] +description = "SSH key count" +when = "ssh-add -l | grep -v -q 'no identities'" +command = "ssh-add -l | grep -v 'no identities' | wc -l" +format = "$symbol[$output]($style) " +shell = ["bash", "--noprofile", "--norc"] +symbol = "🔑" +style = "bold fg:green" diff --git a/config/redshift.conf b/config/redshift.conf deleted file mode 100644 index 7d76847..0000000 --- a/config/redshift.conf +++ /dev/null @@ -1,21 +0,0 @@ -[redshift] - -temp-day=5700 -temp-night=4500 - -fade=1 - -; Custom dawn/dusk intervals. -dawn-time=6:00-7:45 -dusk-time=20:00-21:00 - -gamma-day=1 -gamma-night=0.8 - -location-provider=manual - -adjustment-method=randr - -[manual] -lat=37.46 -lon=15.05 diff --git a/config/starship.toml b/config/starship.toml deleted file mode 100644 index 344b069..0000000 --- a/config/starship.toml +++ /dev/null @@ -1,23 +0,0 @@ -add_newline = false - -[directory] -truncation_length = 15 -style = "cyan" - -[line_break] -disabled = true - -[custom.docker] -description = "Shows the docker symbol if the current directory has Dockerfile or docker-compose.yml files" -command = "echo 🐳" -files = ["Dockerfile", "docker-compose.yml", "docker-compose.yaml"] -when = """ command -v docker &> /dev/null; exit (echo $?); """ - -[custom.ssh_keys] -description = "SSH key count" -when = "ssh-add -l | grep -v -q 'no identities'" -command = "ssh-add -l | grep -v 'no identities' | wc -l" -format = "$symbol[$output]($style) " -shell = ["bash", "--noprofile", "--norc"] -symbol = "🔑" -style = "bold fg:green" diff --git a/i3/config b/i3/config deleted file mode 100644 index e5fec84..0000000 --- a/i3/config +++ /dev/null @@ -1,155 +0,0 @@ -# Default modkey -set $mod Mod4 - -font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 -font pango:DejaVu Sans Mono 10 -font pango:DejaVu Sans Mono, Terminus Bold Semi-Condensed 11 -font pango:Terminus 11px - -# Start a terminal -bindsym $mod+Return exec alacritty --config-file ~/.alacrittyi3.yml - -# Kill focused window -bindsym $mod+Shift+q kill - -# Move between windows -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right - -# Alternatively, you can use the cursor keys: -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right - -# Move focused window -bindsym $mod+Shift+h move left -bindsym $mod+Shift+j move down -bindsym $mod+Shift+k move up -bindsym $mod+Shift+l move right - -# Alternatively, you can use the cursor keys: -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right - -# Split in horizontal orientation -bindsym $mod+Mod1+v split h - -# Split in vertical orientation -bindsym $mod+Mod1+h split v - -# Enter fullscreen mode for the focused container -bindsym $mod+f fullscreen toggle - -# Change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -# Toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# Change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# Focus the parent container -bindsym $mod+a focus parent - -# Open d-menu -bindsym $mod+d exec dmenu_run - -set $ws1 "1" -set $ws2 "2" -set $ws3 "3" -set $ws4 "4" -set $ws5 "5" -set $ws6 "6" -set $ws7 "7" -set $ws8 "8" -set $ws9 "9" -set $ws10 "10" - -# switch to workspace -bindsym $mod+1 workspace number $ws1 -bindsym $mod+2 workspace number $ws2 -bindsym $mod+3 workspace number $ws3 -bindsym $mod+4 workspace number $ws4 -bindsym $mod+5 workspace number $ws5 -bindsym $mod+6 workspace number $ws6 -bindsym $mod+7 workspace number $ws7 -bindsym $mod+8 workspace number $ws8 -bindsym $mod+9 workspace number $ws9 -bindsym $mod+0 workspace number $ws10 - -# move focused container to workspace -bindsym $mod+Shift+1 move container to workspace number $ws1 -bindsym $mod+Shift+2 move container to workspace number $ws2 -bindsym $mod+Shift+3 move container to workspace number $ws3 -bindsym $mod+Shift+4 move container to workspace number $ws4 -bindsym $mod+Shift+5 move container to workspace number $ws5 -bindsym $mod+Shift+6 move container to workspace number $ws6 -bindsym $mod+Shift+7 move container to workspace number $ws7 -bindsym $mod+Shift+8 move container to workspace number $ws8 -bindsym $mod+Shift+9 move container to workspace number $ws9 -bindsym $mod+Shift+0 move container to workspace number $ws10 - - -# Volume -set $sink `pactl list short sinks | grep RUNNING | cut -f1` -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume $sink +10% -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume $sink -10% -bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute $sink toggle - -# Screenshots -set $screenshot-name `date +%d%m%Y-%H%M%S.png` -bindsym Print exec import -window root $screenshot-name -bindsym Shift+Print exec import $screenshot-name - -# Reload the configuration file -bindsym $mod+Shift+c reload - -# Restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart - -# Resize window (you can also use the mouse for that) -mode "resize" -{ - # Resize with the arrow keys - bindsym Left resize grow width 1 px or 1 ppt - bindsym Down resize shrink height 1 px or 1 ppt - bindsym Up resize grow height 1 px or 1 ppt - bindsym Right resize shrink width 1 px or 1 ppt - - # Back to normal: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" -} - -bindsym $mod+r mode "resize" - - -# Start i3blocks to display a workspace bar -bar { - font pango: DejaVuSansMono Nerd Font 9 - i3bar_command i3bar - position bottom - strip_workspace_numbers yes - tray_output nonprimary - status_command i3blocks - - colors { - background #282A36 - statusline #F8F8F2 - separator #44475A - - focused_workspace #44475A #44475A #F8F8F2 - active_workspace #282A36 #44475A #F8F8F2 - inactive_workspace #282A36 #282A36 #BFBFBF - urgent_workspace #FF5555 #FF5555 #F8F8F2 - binding_mode #FF5555 #FF5555 #F8F8F2 - } -} diff --git a/i3blocks/config b/i3blocks/config deleted file mode 100644 index 6653643..0000000 --- a/i3blocks/config +++ /dev/null @@ -1,39 +0,0 @@ -command=/usr/share/i3blocks/$BLOCK_NAME -separator_block_width=15 - -[weather] -command=curl -Ss 'https://wttr.in/Catania?0&T&Q' | cut -c 16- | head -2 | xargs echo -interval=3600 -color=#A4C2F4 - -[memory] -label=MEM -separator=false -interval=30 - -[disk] -label=DISK -interval=30 - -[cpu_usage] -label=CPU -interval=10 -min_width=CPU: 100.00% - -[wifi] -command=iwgetid -r | tr '\n' ' ' && grep $(iwgetid -m | awk '{ printf "%s", $1 }') /proc/net/wireless | awk '{ printf "%i%\n", int($3 * 100 / 70) }';exit 0 instance=wlp2s0 -interval=5 -label= - -[battery] -command=i3_battery.sh -interval=10 - -[volume] -command=pulsemixer --get-volume | cut -d " " -f 1; exit 0 -interval=1 -label= - -[time] -command=date -interval=1 diff --git a/i3blocks/i3_battery.sh b/i3blocks/i3_battery.sh deleted file mode 100755 index 97ea493..0000000 --- a/i3blocks/i3_battery.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -BAT=$(acpi -b | grep -E -o '[0-9][0-9]?%') -CHECK_CHARGING=$(acpi -b | grep -E -o 'Charging') - -# Full and short texts -echo "Battery: $BAT" -echo "BAT: $BAT" - -if [ "$CHECK_CHARGING" != "" ]; then - echo "#1abc9c" - exit 0 -fi -# Set urgent flag below 5% or use orange below 20% -[ ${BAT%?} -le 5 ] && exit 33 -[ ${BAT%?} -le 35 ] && echo "#d35400" - -exit 0 diff --git a/nvim/init.vim b/nvim/init.vim deleted file mode 100644 index 77f3cfb..0000000 --- a/nvim/init.vim +++ /dev/null @@ -1,192 +0,0 @@ -autocmd! bufwritepost .vimrc source % - -call plug#begin('~/.vim/plugged') -Plug 'cespare/vim-toml', { 'branch': 'main' } -"Plug 'rust-lang/rust.vim' -Plug 'nvim-lua/plenary.nvim' -Plug 'lewis6991/gitsigns.nvim' -Plug 'nvim-lualine/lualine.nvim' -Plug 'kyazdani42/nvim-web-devicons' -Plug 'luochen1990/rainbow' " color parentheses -Plug 'terryma/vim-multiple-cursors' -Plug 'tpope/vim-fugitive' " git extension for commit logs and etc. -Plug 'editorconfig/editorconfig-vim' -Plug 'ap/vim-css-color' -Plug 'Yggdroot/indentLine' - -Plug 'google/vim-searchindex' - -Plug 'kazhala/close-buffers.nvim' - -if has('nvim') - Plug 'rktjmp/lush.nvim' - Plug 'ellisonleao/gruvbox.nvim' - - Plug 'nvim-telescope/telescope.nvim' - Plug 'neovim/nvim-lspconfig' - Plug 'ms-jpq/coq_nvim', {'branch': 'coq'} - Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'} - Plug 'kyazdani42/nvim-tree.lua' - Plug 'ray-x/lsp_signature.nvim' - Plug 'folke/todo-comments.nvim' - Plug 'saecki/crates.nvim' - Plug 'gelguy/wilder.nvim', { 'do': ':UpdateRemotePlugins' } - Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} - - Plug 'jose-elias-alvarez/null-ls.nvim' - Plug 'folke/trouble.nvim' - Plug 'folke/lsp-colors.nvim' -endif - - -call plug#end() " required - -syntax on - -set runtimepath+=~/.vim-plugins/LanguageClient-neovim - -set completeopt=menu,menuone,noselect - -set clipboard=unnamed -set mouse=a " click with mouse -set wildmenu -set wildmode=longest,list:full -set wildignore=*~,*.png,*.jpg,*.gif,Thumbs.db,*.min.js,*.swp,*.o,vendor - -set number " number of the current line -set relativenumber " relative number, ..-2 -1 x 1 2, where x is current line -set textwidth=80 -set colorcolumn=80 -set nowrap -set fo-=t - -set tabstop=4 -set shiftwidth=4 -set expandtab " convert tabs in spaces - -set ai " auto indent -set autoread - -set encoding=UTF-8 -set history=1000 -set wildignore+=*.pyc - -set hlsearch " highlight search -set incsearch - -set nowritebackup -set laststatus=2 - -"set cursorline - -set list " spaces as characters -set listchars=eol:⏎,tab:»·,trail:ˑ,nbsp:⎵ - -set foldmethod=indent - -set splitright " split on right side -set lazyredraw -set ttyfast - -set noswapfile - -" rust -" let g:rustfmt_autosave = 1 -" let g:rustfmt_emit_files = 1 -" let g:rustfmt_fail_silently = 0 -" let g:rust_clip_command = 'xclip -selection clipboard' - -set termguicolors -set background=dark - -if has('nvim') - colorscheme gruvbox - highlight CursorLineNr ctermbg=NONE guibg=NONE - - lua require('lualine_style') - lua require('git') - let g:coq_settings = { 'auto_start': v:true } - lua require('lsp_conf') - - lua require('nvim-tree').setup() - lua require('todo-comments').setup() - - call wilder#setup({ - \ 'modes': [':', '/', '?'], - \ }) - call wilder#set_option('renderer', wilder#popupmenu_renderer(wilder#popupmenu_border_theme({ - \ 'highlights': { - \ 'border': 'Normal', - \ }, - \ 'border': 'rounded', - \ 'left': [ - \ ' ', wilder#popupmenu_devicons(), - \ ], - \ }))) - lua require('nvim-treesitter.configs').setup({ highlight = { enable = true, }, }) - - lua require('lsp-colors').setup() - - nnoremap xx TroubleToggle -else - colorscheme pablo -endif - -let g:indentLine_char = '¦' - -let g:netrw_liststyle=1 - -filetype plugin indent on -set nocompatible - -set showcmd " show commands at bottom - - -" nvim-tree -let g:nvim_tree_quit_on_open = 1 -let g:nvim_tree_highlight_opened_files = 1 -nnoremap :NvimTreeToggle - -" ------------ -" MAPS -" ----------- -let mapleader = "," - -nnoremap j gj -nnoremap k gk - -nnoremap tn :tabnew -nnoremap rt :RainbowToggle - -" buffers -nnoremap ]b :bnext -nnoremap [b :bprev -nnoremap b Telescope buffers - -" tabs -nnoremap ]t :tabn -nnoremap [t :tabp - -" only one window -nnoremap o :only - - -nnoremap ff Telescope find_files -nnoremap fg Telescope live_grep -nnoremap fh Telescope help_tags - -nnoremap pa :set paste -nnoremap npa :set nopaste - - -nmap cr :!command cargo r -nmap :EditorConfigReload - -if &diff - "Get from remote - nnoremap dr :diffgetRE - "Get from base - nnoremap db :diffgetBA - "Get from local - nnoremap dl :diffgetLO -endif diff --git a/nvim/lua/git.lua b/nvim/lua/git.lua deleted file mode 100644 index 2f9cbc4..0000000 --- a/nvim/lua/git.lua +++ /dev/null @@ -1,29 +0,0 @@ -require('gitsigns').setup { - signs = { - add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - }, - keymaps = { - -- Default keymap options - noremap = true, - - ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'"}, - ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'"}, - - ['n hs'] = 'lua require"gitsigns".stage_hunk()', - ['v hs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', - ['n hS'] = 'lua require"gitsigns".stage_buffer()', - ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', - ['n hp'] = 'lua require"gitsigns".preview_hunk()', - ['n hB'] = 'lua require"gitsigns".blame_line(true)', - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = true, -- Toggle with `:Gitsigns toggle_numhl` - watch_gitdir = { - interval = 1000, - follow_files = true - }, -} diff --git a/nvim/lua/lsp_conf.lua b/nvim/lua/lsp_conf.lua deleted file mode 100644 index e339a5c..0000000 --- a/nvim/lua/lsp_conf.lua +++ /dev/null @@ -1,77 +0,0 @@ -local nvim_lsp = require('lspconfig') -local coq = require('coq') -local null_ls = require("null-ls") -local trouble = require("trouble") - --- Redefine sign. -local signs = { Error = 'E', Warning = 'W', Hint = 'H', Information = 'I' } - -for type, icon in pairs(signs) do - local hl = 'LspDiagnosticsSign' .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) -end - -local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end -local opts = { noremap=true, silent=true } - -null_ls.config({ - debug = false, - save_after_format = false, - sources = { - -- Python - null_ls.builtins.formatting.black, - null_ls.builtins.formatting.isort, - null_ls.builtins.diagnostics.flake8, - -- Rust - null_ls.builtins.formatting.rustfmt, - -- C - null_ls.builtins.formatting.clang_format, - -- JS/TS - null_ls.builtins.formatting.prettier, - } -}) - --- Setup lspconfig. - ---- Use a loop to conveniently call 'setup' on multiple servers and --- map buffer local keybindings when the language server attaches -local servers = { 'pyright', 'rust_analyzer', 'tsserver', 'clangd' } -for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { - capabilities = coq.lsp_ensure_capabilities(), - on_attach = function(client, bufnr) - client.resolved_capabilities.document_formatting = false - - require "lsp_signature".on_attach() - - -- Mappings. - local opts = { noremap=true, silent=true } - - -- See `:help vim.lsp.*` for documentation on any of the below functions - buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - end, - flags = { - debounce_text_changes = 150, - } - } -end - -nvim_lsp["null-ls"].setup({ - on_attach = function(client) - if client.resolved_capabilities.document_formatting then - buf_set_keymap('n', '', 'lua vim.lsp.buf.formatting_sync()', opts) - vim.cmd "autocmd BufWritePre lua vim.lsp.buf.formatting_seq_sync()" - end - end -}) - -trouble.setup({ - use_lsp_diagnostic_signs = true, - auto_close = true, - auto_open = true -}) - diff --git a/nvim/lua/lualine_style.lua b/nvim/lua/lualine_style.lua deleted file mode 100644 index bb7738b..0000000 --- a/nvim/lua/lualine_style.lua +++ /dev/null @@ -1,7 +0,0 @@ -require'lualine'.setup{ - options = { - theme = 'powerline', - section_separators = { left = '', right = ''}, - component_separators = { left = '|', right = '|'}, - }, -} -- cgit v1.2.3-18-g5258