diff options
Diffstat (limited to 'nvim/init.vim')
| -rw-r--r-- | nvim/init.vim | 193 |
1 files changed, 0 insertions, 193 deletions
diff --git a/nvim/init.vim b/nvim/init.vim deleted file mode 100644 index 000166a..0000000 --- a/nvim/init.vim +++ /dev/null @@ -1,193 +0,0 @@ -" NeoVim init.vim -" -" Differences with good ol' Vim: -" -" NeoVim has so many of the modern and helpful Vim options on by default. I'll -" remove most of the old Vim configurations that now come by default in NeoVim. -" -" Also NeoVim uses XDG directories by default, keeping a clean directory tree. -" -" NeoVim also allows for this file to be written in Lua. I'll stick to using -" Vim script becuase it has more documentation and is more concise configuring -" Vim options. -" -" Instead of viminfo, NeoVim uses shada files (SHared DAta) (different format). -" See shada-file-name. -" -" For some reason, as of version v0.8.3 of NeoVim, Vim internal codes for shift- -" and control- function keys change in NeoVim. <S-F1> changes to <F13>, and -" <C-F1> changes to <F25>. See https://github.com/neovim/neovim/issues/7384 -" -" Plugins: There are a lot of ways to install "plug-in"s in Vim. My prefered -" way is using Vim packages, available since Vim version 8. See packages. -" -" Tips: -" * To show navigate help files: -" K " while on an option to see it's documentation -" CTRL-] " navigation while on a Vim help file -" * To re-indent: -" tab->spaces :set tabstop=n :set expandtab :retab -" spaces->tab :set noexpandtab :set tabstop={softtabstop} :retab! -" * To justify: -" To 'justify' comments or block of text (paragraph) use `gq{motion}` or -" `gp{motion}`, where {motion} can be `[/`, `]/`, `ip`, `i{`, `a{`. -" * To see the last page of previous command: -" `g<` -" * Buffer stuff: -" :ls " shows all buffers -" :b N " Go to buffer N (integer) - - -" Settings -" ---------------------------------------------------------------------- - -" Common -colorscheme industry -filetype plugin on - -" Command line: -set cmdheight=1 -set wildmenu -set wildignore+=*.o,.git,*.class -set path+=./**30 " For gf and :find, add all subdirectories relative to - " current file (30 max) to the "search space" - -" Search -set ignorecase -set smartcase - -" Screen -set nonumber -set scrolloff=5 " show a few lines of context -set colorcolumn=+1 " show ruler at position tabstop+1 -set laststatus=2 -" Add buffer number to the default status line with ruler -set statusline=%<%f\ %h%m%r%=b%02n\ \ %-14.(%l,%c%V%)\ %P - -" TODO: move to ftplugin -" TODO: create tags automatically (:!ctags -R . after :w if ft=c) -" Tag Jumping -" Instructions: create tag index (e.g. $ ctags -R .) -" place cursor on tag -" ^] to jump to definition -" g^] if more than 1 definition -" ^T to return (or ^O) - -"set cindent -"set cinoptions=:0,g0 " See C-indenting - - -" Indentation: 4 spaces -" See also: autoindent, smartindent, cindent, indentexpr -set tabstop=4 " Each '\t' takes 8 virtual (screen) columns -set shiftwidth=0 " (Auto)indentation. Also affects: >>, i_C-T, i_C-D -set expandtab " Expand inserted <Tab>s with <Space> -set smartindent " Smart indenting when starting a new line - -" Formatting: See fo-table -set formatoptions+=t " auto-wrap text (when inserting) -set formatoptions+=c " auto-wrap comments (when inserting) -set formatoptions+=q " Allow formatting of comments with "gq" -set formatoptions+=j " Removes comment leader when joining lines -set formatoptions+=l " Don't break long lines that are already typed -set formatoptions+=r " Insert current leader after <Enter> in Insert mode -set formatoptions+=p " Don't break honorifics like Prof. Smith -set formatoptions+=n " Recognize numbered lists -set formatoptions+=o " Automatically insert the current comment - " leader after `o`. - -" Wrap: Auto-break lines longer than 80 colums -set textwidth=80 -set wrap -set linebreak " Don't break words - -" Mouse -set mouse=a " Enable mouse for all modes - -" Buffers -set hidden " Allow for hidden modified buffers - -" Split -set splitbelow splitright - - -" Mappings -" ---------------------------------------------------------------------- - -let $VIMFILES = split(&rtp, ",")[0] - -map <F5> :source $VIMFILES/init.vim<CR> -map <F17> :e $VIMFILES/init.vim<CR> - -map <F7> :tabp<CR> -map <F8> :tabn<CR> -map <F19> :bNext<LF> -map <F20> :bnext<LF> - -" TODO: move to ftplugin -" C/C++ Programming: -map <F6> :w<CR>:!clear && make<CR> -"map <F10> :!./%:r<CR> -"map <F10> :!./a.out<CR> -map <F11> :cnext<CR> -map <S-F11> :cprev<CR> -" "Run cTags" -map <Leader>rt :!ctags -R .<CR> -map <C-\> :tnext<CR> -" Motion to go to beggining of function while cursor is inside -nmap [f [m[{k0 - -" pandoc (& website): -nnoremap mm :w<CR>:Md2Html<CR><CR><CR> -nmap mM mm:!updatewebsite_zaz<CR><CR> - -" asciidoctor: -nnoremap ma :w<CR>:!asciidoctor %<CR><CR> -nmap mA ma:!updatewebsite_zaz<CR><CR> - -" Funcionallity of the following depends on terminal emulator. Needs 8-bit -" input enabled -" for <Meta> = Alt key combos -" From: https://vim.fandom.com/wiki/Get_Alt_key_to_work_in_terminal -nmap <M-H> <C-W>h -nmap <M-J> <C-W>j -nmap <M-K> <C-W>k -nmap <M-L> <C-W>l - -" Go Title Case (and clear highlighted matches) -" Ref.: https://vim.fandom.com -vmap gt :s/\<\(\w\)\(\w*\)\>/\u\1\L\2/g<CR><C-L> - -" Autoformat JSON jumbled data -" Ref.: https://stackoverflow.com/questions/26214156/how-to-auto-format-json-on-save-in-vim -nnoremap gJ :%!python3 -m json.tool<CR> - -" Replaces previous WORD arithmetic expression with result (from Vim -" fandom-wiki) -inoremap <C-A> <Esc>diWi<C-R>=<C-R>"<CR> - - -" Views and Sessions (Window layout and Line folding) -" ---------------------------------------------------------------------- -" It is possible to create folds automatically but idk how to do it. -" :mkview so save them :loadview to load them (zo open one, zc close one, -" zR to open all, zM to close all, zx to restore)) - -" Views saves folds. Sessions saves all windows configuration and layout -" Load Sessions with $ vim -S Session.vim - -" To automatically save and restore views for *.c *.cpp files: -"au BufWinLeave *.c mkview -"au BufWinEnter *.c silent loadview -"au BufWinLeave *.cpp mkview -"au BufWinEnter *.cpp silent loadview - - -" Playground -" ---------- -"autocmd FileType tex nnoremap <buffer> <F6> :!./build.sh %<CR> - -"augroup TeX -" autocmd! -" autocmd BufWritePost *.tex !./build.sh % -"augroup END |
