summaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-12-08 11:52:16 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-12-08 11:52:16 +0100
commit956df69d7496081db5e7b3621a0bcc7b9d7f7dfc (patch)
tree2c1de01541d70d1cbcb59974e42102440359f153 /.config
parent1eca5dc0fe3648341e1707efc811162fc5056888 (diff)
move to .config folder
Diffstat (limited to '.config')
-rw-r--r--.config/.alacritty.yml38
-rw-r--r--.config/i3/config155
-rw-r--r--.config/i3blocks/config39
-rwxr-xr-x.config/i3blocks/i3_battery.sh18
-rw-r--r--.config/nvim/init.vim192
-rw-r--r--.config/nvim/lua/git.lua29
-rw-r--r--.config/nvim/lua/lsp_conf.lua77
-rw-r--r--.config/nvim/lua/lualine_style.lua7
-rw-r--r--.config/redshift.conf21
-rw-r--r--.config/starship.toml23
10 files changed, 599 insertions, 0 deletions
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 <leader>xx <cmd>TroubleToggle<cr>
+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 <C-t> :NvimTreeToggle<CR>
+
+" ------------
+" MAPS
+" -----------
+let mapleader = ","
+
+nnoremap j gj
+nnoremap k gk
+
+nnoremap tn :tabnew<CR>
+nnoremap <leader>rt :RainbowToggle<CR>
+
+" buffers
+nnoremap ]b :bnext<CR>
+nnoremap [b :bprev<CR>
+nnoremap <leader>b <cmd>Telescope buffers<cr>
+
+" tabs
+nnoremap ]t :tabn<CR>
+nnoremap [t :tabp<CR>
+
+" only one window
+nnoremap <leader>o :only<CR>
+
+
+nnoremap <leader>ff <cmd>Telescope find_files<cr>
+nnoremap <leader>fg <cmd>Telescope live_grep<cr>
+nnoremap <leader>fh <cmd>Telescope help_tags<cr>
+
+nnoremap <leader>pa :set paste<CR>
+nnoremap <leader>npa :set nopaste<CR>
+
+
+nmap <leader>cr :!command cargo r<CR>
+nmap <F6> :EditorConfigReload<CR>
+
+if &diff
+ "Get from remote
+ nnoremap dr :diffget<Space>RE<CR>
+ "Get from base
+ nnoremap db :diffget<Space>BA<CR>
+ "Get from local
+ nnoremap dl :diffget<Space>LO<CR>
+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' : '<cmd>lua require\"gitsigns.actions\".next_hunk()<CR>'"},
+ ['n [c'] = { expr = true, "&diff ? '[c' : '<cmd>lua require\"gitsigns.actions\".prev_hunk()<CR>'"},
+
+ ['n hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>',
+ ['v hs'] = '<cmd>lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})<CR>',
+ ['n hS'] = '<cmd>lua require"gitsigns".stage_buffer()<CR>',
+ ['n hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>',
+ ['n hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
+ ['n hB'] = '<cmd>lua require"gitsigns".blame_line(true)<CR>',
+ },
+ 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', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
+ buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
+ buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
+ buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
+ buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', 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', '<A-f>', '<cmd>lua vim.lsp.buf.formatting_sync()<cr>', opts)
+ vim.cmd "autocmd BufWritePre <buffer> 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"