Quality of life improvements

This commit is contained in:
Augusto Gunsch 2021-11-27 10:28:43 -03:00
parent 4895a0e8eb
commit 5902489017
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
4 changed files with 63 additions and 30 deletions

View File

@ -1,4 +1,4 @@
[Settings] [Settings]
gtk-icon-theme-name = breeze-dark gtk-icon-theme-name = Material-Black-Lime-Numix
gtk-theme-name = Midnight-Blue gtk-theme-name = Material-Black-Lime
gtk-application-prefer-dark-theme = true gtk-application-prefer-dark-theme = true

View File

@ -18,8 +18,9 @@ filetype indent off
hi Whitespace ctermfg=233 hi Whitespace ctermfg=233
hi SignColumn ctermbg=233 hi SignColumn ctermbg=233
nnoremap <F12> :set et<cr>:set ts=4<cr>:set sw=4<cr>
nnoremap <F11> :set noet<cr>:set ts=8<cr>:set sw=8<cr>
nnoremap <F5> :set list!<cr> nnoremap <F5> :set list!<cr>
nnoremap <F12> :!sample-compile-flags<cr>
noremap - ddp noremap - ddp
nnoremap _ ddkP nnoremap _ ddkP
@ -37,14 +38,7 @@ vnoremap <leader>" <esc>a"<esc>`<i"<esc>`>
nnoremap H 0 nnoremap H 0
nnoremap L $ nnoremap L $
" auto indent " auto indent
nnoremap <c-q> gg=G<c-o> "vnoremap <c-q> <esc>:lua vim.lsp.buf.range_formatting()<cr>
" Used in abbrevs to remove a space
" append: <c-r>=Eatchar('\s')<cr>
func Eatchar(pat)
let c = nr2char(getchar(0))
return (c =~ a:pat) ? '' : c
endfunc
call plug#begin('~/.config/nvim/plugged') call plug#begin('~/.config/nvim/plugged')
@ -65,7 +59,7 @@ Plug 'drmingdrmer/xptemplate'
call plug#end() call plug#end()
nnoremap <C-n> :silent NERDTreeToggle<CR> nnoremap <C-n> <cmd>silent NERDTreeToggle<CR>
augroup nerdtree augroup nerdtree
" Exit Vim if NERDTree is the only window remaining in the only tab. " Exit Vim if NERDTree is the only window remaining in the only tab.
@ -107,29 +101,50 @@ require'compe'.setup {
--- IMPORTANT --- IMPORTANT
vim.api.nvim_set_keymap('i', '<cr>', 'compe#confirm("<cr>")', { expr = true }) vim.api.nvim_set_keymap('i', '<cr>', 'compe#confirm("<cr>")', { expr = true })
--- LSP local common_bindings = function(client, bufnr)
local nvim_lsp = require('lspconfig')
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
--Enable completion triggered by <c-x><c-o> --Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
end end
-- Use a loop to conveniently call 'setup' on multiple servers and local default_formatting = function(client, bufnr)
-- map buffer local keybindings when the language server attaches local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local servers = { 'pylsp', 'clangd', 'rls', 'tsserver' }
for _, lsp in ipairs(servers) do local opts = { noremap=true, silent=true }
buf_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end
local default_attach = function(client, bufnr)
common_bindings(client, bufnr)
default_formatting(client, bufnr)
end
local setup = function(lsp, on_attach, options)
local nvim_lsp = require('lspconfig')
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
on_attach = on_attach, on_attach = on_attach,
flags = { flags = {
debounce_text_changes = 150, debounce_text_changes = 150,
} },
options=options
} }
end end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = { 'pylsp', 'clangd', 'rls', 'tsserver' }
for _, lsp in ipairs(servers) do
setup(lsp, default_attach)
end
-- Servers with custom setup
-- placeholder
EOF EOF
" auto close scratch buffer (preview window) " auto close scratch buffer (preview window)

View File

@ -1,26 +1,44 @@
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
export EDITOR="/usr/bin/nvim" export EDITOR="/usr/bin/nvim"
#vim # vim
alias vim="nvim" alias vim="nvim"
#ls # ls
alias ls="ls --color=auto" alias ls="ls --color=auto"
alias ..="cd .." alias ..="cd .."
alias ...="cd ../.." alias ...="cd ../.."
alias ....="cd ../../.." alias ....="cd ../../.."
alias .....="cd ../../../.." alias .....="cd ../../../.."
alias ......="cd ../../../../.."
alias .......="cd ../../../../../.."
# improved reset and clear # improved reset and clear
alias reset="tput reset" alias reset="tput reset"
alias clear="tput reset" alias clear="tput reset"
# better du # better du
alias du="du -h" alias du="du -hd 1"
#better feh # better feh
alias feh="feh -." alias feh="feh -."
#vi keybindings # vi keybindings
alias info="info --vi-keys" alias info="info --vi-keys"
# grepa
alias grepa="grep -n --color=always -r --exclude-dir=venv"
# less
alias less="less -R"
# find
alias find="find -name"
# sl
alias sl="ls"
finder() {
grepa "$1" | less
}

View File

@ -1,3 +1,3 @@
gtk-icon-theme-name = "breeze-dark" gtk-icon-theme-name = "Material-Black-Cherry"
gtk-theme-name = "Midnight-Blue" gtk-theme-name = "Material-Black-Cherry"
gtk-application-prefer-dark-theme = "true" gtk-application-prefer-dark-theme = "true"