diff --git a/neovim/init.vim b/neovim/init.vim index 0ebac49..9d708aa 100644 --- a/neovim/init.vim +++ b/neovim/init.vim @@ -2,11 +2,7 @@ " http://nvim.fisadev.com " version: 11.1 -" TODO current problems: -" * end key not working undef tmux+fish - -" ============================================================================ -" Vim-plug initialization +" Vim-plug initialization {{{ " Avoid modifying this section, unless you are very sure of what you are doing let vim_plug_just_installed = 0 @@ -25,9 +21,8 @@ if vim_plug_just_installed endif " Obscure hacks done, you can now modify the rest of the .vimrc as you wish :) - -" ============================================================================ -" Active plugins +" }}} +" Active plugins {{{ " You can disable or add new ones here: " this needs to be here, so vim-plug knows we are declaring the plugins we @@ -36,9 +31,6 @@ call plug#begin('~/.config/nvim/plugged') " Now the actual plugins: -" Override configs by directory -Plug 'arielrossanigo/dir-configs-override.vim' - " Code commenter Plug 'scrooloose/nerdcommenter' @@ -53,8 +45,8 @@ Plug 'majutsushi/tagbar' " Search results counter Plug 'vim-scripts/IndexedSearch' -" Terminal Vim with 256 colors colorscheme -Plug 'fisadev/fisa-vim-colorscheme' +" Badwolf Colorscheme +Plug 'sjl/badwolf' " Airline Plug 'vim-airline/vim-airline' @@ -67,9 +59,6 @@ Plug 'vim-airline/vim-airline-themes' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' -" Pending tasks list -Plug 'fisadev/FixedTaskList.vim' - " Async autocompletion Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Completion from other opened files @@ -95,13 +84,8 @@ Plug 'jeetsukumaran/vim-indentwise' " Better language packs Plug 'sheerun/vim-polyglot' -" Ack code search (requires ack installed in the system) -Plug 'mileszs/ack.vim' -" TODO is there a way to prevent the progress which hides the editor? - " Paint css colors with the real color Plug 'lilydjwg/colorizer' -" TODO is there a better option for neovim? " Window chooser Plug 't9md/vim-choosewin' @@ -124,34 +108,23 @@ Plug 'mhinz/vim-signify' " Yank history navigation Plug 'vim-scripts/YankRing.vim' -" Linters -Plug 'neomake/neomake' -" TODO is it running on save? or when? -" TODO not detecting errors, just style, is it using pylint? - -" Relative numbering of lines (0 is the current line) -" (disabled by default because is very intrusive and can't be easily toggled -" on/off. When the plugin is present, will always activate the relative -" numbering every time you go to normal mode. Author refuses to add a setting -" to avoid that) -Plug 'myusuf3/numbers.vim' +" Black Linter integration +Plug 'psf/black' " Nice icons -" Plug 'ryanoasis/vim-devicons' +Plug 'ryanoasis/vim-devicons' " Tell vim-plug we finished declaring plugins, so it can load them call plug#end() -" ============================================================================ " Install plugins the first time vim runs if vim_plug_just_installed echo "Installing Bundles, please ignore key map error messages" :PlugInstall endif - -" ============================================================================ -" Vim settings and mappings +" }}} +" Vim settings and mappings {{{ " You can edit them as you wish " tabs and spaces handling @@ -161,41 +134,55 @@ set softtabstop=4 set shiftwidth=4 " show line numbers -set nu +set relativenumber + +" Toggle between number and relativenumber +function! ToggleNumber() + if(&relativenumber == 1) + set norelativenumber + set number + else + set relativenumber + endif +endfunc + +nnoremap :call ToggleNumber() -" remove ugly vertical lines on window division -set fillchars+=vert:\ +" Highlight current line +set cursorline + +" Load filetype-specific indent files +filetype indent on + +" Visual autocompletion for command window +set wildmenu + +" Redraw only when needed +set lazyredraw + +" Highlight matching brackets +set showmatch " use 256 colors when possible if (&term =~? 'mlterm\|xterm\|xterm-256\|screen-256') || has('nvim') let &t_Co = 256 - colorscheme fisa + colorscheme badwolf else colorscheme delek endif " needed so deoplete can auto select the first suggestion -set completeopt+=noinsert +" set completeopt+=noinsert " comment this line to enable autocompletion preview window " (displays documentation related to the selected completion option) -set completeopt-=preview +" set completeopt-=preview " autocompletion of files and commands behaves like shell " (complete only the common part, list the options that match) set wildmode=list:longest -" save as sudo -ca w!! w !sudo tee "%" - -" tab navigation mappings -map tt :tabnew -map :tabn -imap :tabn -map :tabp -imap :tabp - -" when scrolling, keep cursor 3 lines away from screen border -set scrolloff=3 +" when scrolling, keep cursor 5 lines away from screen border +set scrolloff=5 " clear search results nnoremap // :noh @@ -203,83 +190,96 @@ nnoremap // :noh " clear empty spaces at the end of lines on save of python files autocmd BufWritePre *.py :%s/\s\+$//e -" fix problems with uncommon shells (fish, xonsh) and plugins running commands -" (neomake, ...) -set shell=/bin/bash - " Ability to add python breakpoints " (I use ipdb, but you can change it to whatever tool you use for debugging) -au FileType python map b Oimport ipdb; ipdb.set_trace() - -" ============================================================================ -" Plugins settings and mappings -" Edit them as you wish. - -" Tagbar ----------------------------- +au FileType python map b Oimport pudb; pudb.set_trace() + +set incsearch " Search as characters are entered +set hlsearch " Highlight matches + +" Turn off search highlight +nnoremap :nohlsearch + +" Enable folding +set foldenable +set foldlevelstart=10 " Open most folds when file opened +set foldnestmax=10 " Only nest folds 10 deep +" Use Space to open and close folds +nnoremap za +set foldmethod=indent + +" Movement remaps +" Visually move between lines +nnoremap j gj +nnoremap k gk +" Move to beginning/end of line with better keybindings +nnoremap B ^ +nnoremap E $ +" Highlight last inserted text +nnoremap gV `[v`] + +" Leader Shortcuts +let mapleader="," +" Use jk as escape +inoremap jk + +" Check final line for modeline +set modelines=1 +" }}} +" Plugins settings and mappings {{{ +" Tagbar {{{ " toggle tagbar display map :TagbarToggle " autofocus on tagbar open let g:tagbar_autofocus = 1 - -" NERDTree ----------------------------- +" }}} +" NERDTree {{{ " toggle nerdtree display map :NERDTreeToggle " open nerdtree with the current file selected -nmap ,t :NERDTreeFind +nmap t :NERDTreeFind " don;t show these file types let NERDTreeIgnore = ['\.pyc$', '\.pyo$'] +" }}} +" Black {{{ -" Tasklist ------------------------------ - -" show pending tasks list -map :TaskList - -" Neomake ------------------------------ - -" Run linter on write -autocmd! BufWritePost * Neomake - -" Check code as python3 by default -let g:neomake_python_python_maker = neomake#makers#ft#python#python() -let g:neomake_python_flake8_maker = neomake#makers#ft#python#flake8() -let g:neomake_python_python_maker.exe = 'python3 -m py_compile' -let g:neomake_python_flake8_maker.exe = 'python3 -m flake8' +" Execute Black on file save +autocmd BufWritePre *.py execute ':Black' -" Disable error messages inside the buffer, next to the problematic line -let g:neomake_virtualtext_current_error = 0 - -" Fzf ------------------------------ +" Execute Black with keypress +nnoremap :Black +" }}} +" Fzf {{{ " file finder mapping -nmap ,e :Files +nmap e :Files " tags (symbols) in current file finder mapping -nmap ,g :BTag +nmap g :BTag " tags (symbols) in all files finder mapping -nmap ,G :Tags +nmap G :Tags " general code finder in current file mapping -nmap ,f :BLines +nmap f :BLines " general code finder in all files mapping -nmap ,F :Lines +nmap F :Lines " commands finder mapping -nmap ,c :Commands +nmap c :Commands " to be able to call CtrlP with default search text -"function! CtrlPWithSearchText(search_text, ctrlp_command_end) - "execute ':CtrlP' . a:ctrlp_command_end - "call feedkeys(a:search_text) -"endfunction +function! CtrlPWithSearchText(search_text, ctrlp_command_end) + execute ':CtrlP' . a:ctrlp_command_end + call feedkeys(a:search_text) +endfunction " same as previous mappings, but calling with current word as default text -"nmap ,wg :call CtrlPWithSearchText(expand(''), 'BufTag') -"nmap ,wG :call CtrlPWithSearchText(expand(''), 'BufTagAll') -"nmap ,wf :call CtrlPWithSearchText(expand(''), 'Line') -"nmap ,we :call CtrlPWithSearchText(expand(''), '') -"nmap ,pe :call CtrlPWithSearchText(expand(''), '') -"nmap ,wm :call CtrlPWithSearchText(expand(''), 'MRUFiles') -"nmap ,wc :call CtrlPWithSearchText(expand(''), 'CmdPalette') - - -" Deoplete ----------------------------- +nmap wg :call CtrlPWithSearchText(expand(''), 'BufTag') +nmap wG :call CtrlPWithSearchText(expand(''), 'BufTagAll') +nmap wf :call CtrlPWithSearchText(expand(''), 'Line') +nmap we :call CtrlPWithSearchText(expand(''), '') +nmap pe :call CtrlPWithSearchText(expand(''), '') +nmap wm :call CtrlPWithSearchText(expand(''), 'MRUFiles') +nmap wc :call CtrlPWithSearchText(expand(''), 'CmdPalette') +" }}} +" Deoplete {{{ " Use deoplete. @@ -289,8 +289,8 @@ let g:deoplete#enable_smart_case = 1 " complete with words from any opened file let g:context_filetype#same_filetypes = {} let g:context_filetype#same_filetypes._ = '_' - -" Jedi-vim ------------------------------ +" }}} +" Jedi-vim {{{ " Disable autocompletion (using deoplete instead) let g:jedi#completions_enabled = 0 @@ -303,22 +303,16 @@ let g:jedi#usages_command = ',o' " Find assignments let g:jedi#goto_assignments_command = ',a' " Go to definition in new tab -nmap ,D :tab split:call jedi#goto() - -" Ack.vim ------------------------------ - -" mappings -nmap ,r :Ack -nmap ,wr :Ack - -" Window Chooser ------------------------------ +nmap D :tab split:call jedi#goto() +" }}} +" Window Chooser {{{ " mapping nmap - (choosewin) " show big letters let g:choosewin_overlay_enable = 1 - -" Signify ------------------------------ +" }}} +" Signify {{{ " this first setting decides in which order try to guess your current vcs " UPDATE it to reflect your preferences, it will speed up opening files @@ -333,44 +327,40 @@ highlight DiffChange cterm=bold ctermbg=none ctermfg=227 highlight SignifySignAdd cterm=bold ctermbg=237 ctermfg=119 highlight SignifySignDelete cterm=bold ctermbg=237 ctermfg=167 highlight SignifySignChange cterm=bold ctermbg=237 ctermfg=227 - -" Autoclose ------------------------------ +" }}} +" Autoclose {{{ " Fix to let ESC work as espected with Autoclose plugin " (without this, when showing an autocompletion window, ESC won't leave insert " mode) let g:AutoClosePumvisible = {"ENTER": "\", "ESC": "\"} - -" Yankring ------------------------------- +" }}} +" Yankring {{{ " Fix for yankring and neovim problem when system has non-text things copied " in clipboard let g:yankring_clipboard_monitor = 0 let g:yankring_history_dir = '~/.config/nvim/' +" }}} +" Airline {{{ -" Airline ------------------------------ - -let g:airline_powerline_fonts = 0 +let g:airline_powerline_fonts = 1 let g:airline_theme = 'bubblegum' let g:airline#extensions#whitespace#enabled = 0 - +let g:airline#extensions#tabline#enabled = 1 " to use fancy symbols for airline, uncomment the following lines and use a " patched font (more info on docs/fancy_symbols.rst) -"if !exists('g:airline_symbols') - "let g:airline_symbols = {} -"endif -"let g:airline_left_sep = '⮀' -"let g:airline_left_alt_sep = '⮁' -"let g:airline_right_sep = '⮂' -"let g:airline_right_alt_sep = '⮃' -"let g:airline_symbols.branch = '⭠' -"let g:airline_symbols.readonly = '⭤' -"let g:airline_symbols.linenr = '⭡' - - -" Custom configurations ---------------- - -" Include user's custom nvim configurations -if filereadable(expand("~/.config/nvim/custom.vim")) - source ~/.config/nvim/custom.vim +if !exists('g:airline_symbols') + let g:airline_symbols = {} endif +let g:airline_left_sep = '⮀' +let g:airline_left_alt_sep = '⮁' +let g:airline_right_sep = '⮂' +let g:airline_right_alt_sep = '⮃' +let g:airline_symbols.branch = '⭠' +let g:airline_symbols.readonly = '⭤' +let g:airline_symbols.linenr = '⭡' +" }}} +" }}} + +" vim:foldmethod=marker:foldlevel=0 diff --git a/zsh/.zshrc b/zsh/.zshrc index ff17691..5a38606 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -121,8 +121,14 @@ alias ls='lsd --group-dirs first' alias ll='lsd --group-dirs first -la' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' -alias vi='vim' +alias vi='nvim' +alias vim='nvim' alias xclip='xclip -selection c' +alias maim-clip="maim -s -f png | copyq copy image/png -" +alias maim-window="maim -st 9999999 | convert - \( +clone -background black -shadow 80x3+5+5 \) +swap -background none -layers merge +repage $HOME/Media/Pictures/Screenshots/$(date -Ins).png" +alias maim-color="maim -st 0 | convert - -resize 1x1\! -format '%[pixel:p{0,0}]' info:-" +alias maim-fullscreen="maim -f png | copyq copy image/png -" +alias maim-clip-file="maim -s -f png $HOME/Media/Pictures/Screenshots/$(date -Ins).png" export VISUAL=vim export EDITOR=$VISUAL