diff --git a/nvim-init.vim b/nvim-init.vim index 74febc2..5420466 100644 --- a/nvim-init.vim +++ b/nvim-init.vim @@ -24,7 +24,7 @@ let g:tex_conceal='' " I said no conceals set shell=/bin/zsh " use zsh instead of bash set number " line numbers on the left side -set relativenumber " number+relativenumber = relative numbers for all but current line +"set relativenumber " number+relativenumber = relative numbers for all but current line " toggle hybrid relative numbers when entering/leaving insert mode ":augroup numbertoggle ": autocmd! @@ -43,6 +43,22 @@ set ignorecase smartcase " don't match case if typing in all-lowercase " Ctrl+Backspace deletes previous word like in most text editors inoremap  dba +" Useless mode that I only activate accidentally +nnoremap Q + +" Remove trailing whitespace on save {{{2 +fun! CleanExtraSpaces() + let save_cursor = getpos(".") + let old_query = getreg('/') + silent! %s/\s\+$//e + call setpos('.', save_cursor) + call setreg('/', old_query) +endfun + +if has("autocmd") + autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces() +endif + " Switching buffers {{{2 nnoremap :bprev " s-F2 nnoremap :bnext " s-F3 @@ -78,7 +94,7 @@ vnoremap zf " Escape from NeoVim terminals tnoremap " Just hit the [à0] button on an AZERTY, no need to do shift+à to for 0 -nnoremap à 0 +nnoremap à 0 inoremap jj " Clear highlighting after a search nnoremap n :noh @@ -103,10 +119,10 @@ inoremap ^i " System clipboard {{{2 " Copy to clipboard " Paste from clipboard -vnoremap y "+y | nnoremap p "+p -nnoremap Y "+yg_ | nnoremap P "+P -nnoremap y "+y | vnoremap p "+p -nnoremap yy "+yy | vnoremap P "+P +vnoremap y "+y | vnoremap d "+d | nnoremap p "+p +nnoremap Y "+yg_ | nnoremap D "+dg_ | nnoremap P "+P +nnoremap y "+y | nnoremap y "+d | vnoremap p "+p +nnoremap yy "+yy | nnoremap dd "+dd | vnoremap P "+P " Opening windows {{{2 nnoremap j @@ -192,6 +208,8 @@ set undofile set directory^=/tmp/vim-swapfile// + + " Plug-ins {{{1 " ============= @@ -210,7 +228,7 @@ call plug#begin('~/.config/nvim/plug') "Plug 'neovimhaskell/haskell-vim', { 'for': 'haskell' } " included in vim-polyglot "Plug 'LaTeX-Box-Team/LaTeX-Box', { 'for': 'tex' } " included in vim-polyglot "Plug 'rust-lang/rust.vim', { 'for': 'rust' } " included in vim-polyglot -"Plug 'ap/vim-css-color' " CSS color names + Plug 'ap/vim-css-color' " CSS color names " C/C++ "Plug 'vim-scripts/c.vim', { 'for': ['c', 'cpp', 'objc'] } " various IDE-like C features @@ -218,9 +236,9 @@ call plug#begin('~/.config/nvim/plug') "Plug 'derekwyatt/vim-fswitch', { 'for': ['c', 'cpp', 'objc'] } " switch between companion source files (e.g. .h and .cpp) Plug 'derekwyatt/vim-fswitch', { 'on': 'FSRight' } " switch between companion source files (e.g. .h and .cpp) "Plug 'derekwyatt/vim-protodef', { 'for': ['c', 'cpp', 'objc'] } " pull in C++ function prototypes into implementation files - Plug 'vim-scripts/Conque-GDB', { 'for': ['c', 'cpp', 'objc'] } " GDB command line interface and terminal emulator -"Plug 'Shougo/vimproc.vim', { 'do': 'make' } " dependency of vim-vebugger, asynchronous execution library -"Plug 'idanarye/vim-vebugger', { 'for': ['c', 'cpp', 'objc', 'java', 'python', 'ruby'] } " debugger frontend for GDB, LDB, PDB, RDebug e.a. +"Plug 'vim-scripts/Conque-GDB', { 'for': ['c', 'cpp', 'objc'] } " GDB command line interface and terminal emulator + Plug 'Shougo/vimproc.vim', { 'do': 'make' } " dependency of vim-vebugger, asynchronous execution library + Plug 'idanarye/vim-vebugger', { 'for': ['c', 'cpp', 'objc', 'java', 'python', 'ruby'] } " debugger frontend for GDB, LDB, PDB, RDebug e.a. " Edit "Plug 'jiangmiao/auto-pairs' " insert or delete [], (), '' etc. in pairs @@ -262,6 +280,7 @@ call plug#begin('~/.config/nvim/plug') "Plug 'kassio/neoterm', { 'on': 'T' } " wrapper of some neovim's :terminal functions "Plug 'tpope/vim-fugitive' " a Git wrapper "Plug 'vim-scripts/TeTrIs.vim' " Tetris clone + Plug 'ledger/vim-ledger', { 'for': ['journal'] } " accounting with ledger call plug#end()" @@ -278,6 +297,7 @@ hi Comment guifg=#888888 hi link Whitespace Conceal hi CursorLine guibg=NONE ctermbg=NONE hi CursorLineNr guibg=NONE ctermbg=NONE +hi Folded guifg=#3b4048 ctermfg=16 guibg=NONE ctermbg=NONE gui=italic cterm=italic " Haskell {{{2 " ------------ @@ -333,22 +353,23 @@ nnoremap ;def :call protodef#ReturnSkeletonsFromPrototypesForCurrentBuffer({}) :ConqueGdb --args build/tests --debug +"nnoremap :ConqueGdb --args build/simulation --debug " Vebugger {{{2 " ------------- "let g:vebugger_leader='v' +let g:vebugger_leader=',' " "nnoremap :VBGstepOver "nnoremap :VBGstepIn @@ -388,14 +409,17 @@ nmap a (EasyAlign) " Wildfire {{{2 " ------------- -nmap s (wildfire-quick-select) +"nmap s (wildfire-quick-select) let g:wildfire_objects = ["iw", "i'", "i`", 'i"', "i)", "i]", "i}", "ip", "it"] " YouCompleteMe {{{2 " ------------------ "noremap g :YcmCompleter GoToImprecise -noremap g :YcmCompleter GoTo -noremap :YcmCompleter FixIt +noremap gg :YcmCompleter GoTo +noremap gi :YcmCompleter GoToImprecise +noremap gf :YcmCompleter FixIt +noremap st :YcmCompleter GetType +noremap si :YcmCompleter GetTypeImprecise let g:ycm_enable_diagnostic_highlighting=0 let g:ycm_complete_in_comments=1 @@ -446,6 +470,7 @@ let NERDTreeIgnore=[ \ ".*\\.hi$", \ ".*\\.pyc$", \ ".*\\.bak$", + \ ".*\\.ozf$", \ ".*\\~$" \ ] @@ -526,8 +551,9 @@ let g:airline#extensions#ale#enabled=1 " Ale {{{2 " -------- let g:ale_linters = { -\ 'c': [], -\ 'cpp': [], +\ 'c': [], +\ 'cpp': [], +\ 'markdown': [], \} let g:ale_lint_on_text_change='normal' let g:ale_lint_on_insert_leave=1 @@ -571,5 +597,11 @@ let g:EditorConfig_core_mode = 'external_command' " TeTrIs {{{2 " ----------- +" Ledger {{{2 +" ----------- +autocmd BufEnter,BufRead *.journal | setlocal modelines=1 +autocmd BufEnter,BufRead *.journal | inoremap !! :call ledger#entry():call CleanLedgerEntry() +autocmd BufEnter,BufRead *.journal | vnoremap :call NextEntry() + " modeline {{{1 -" vim: set foldmethod=marker foldlevel=1 et ts=2 sw=2 ft=vim nowrap : +" vim: set foldmethod=marker foldlevel=1 noet ft=vim nowrap :