From e371d9edd474bcf89cf5d462eaccb8638900b390 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sat, 3 Oct 2020 19:27:15 -0400 Subject: Initial commit --- .config/nvim/UltiSnips/rnoweb.snippets | 122 ++++++++++++++ .config/nvim/init.vim | 289 +++++++++++++++++++++++++++++++++ 2 files changed, 411 insertions(+) create mode 100644 .config/nvim/UltiSnips/rnoweb.snippets create mode 100755 .config/nvim/init.vim (limited to '.config/nvim') diff --git a/.config/nvim/UltiSnips/rnoweb.snippets b/.config/nvim/UltiSnips/rnoweb.snippets new file mode 100644 index 0000000..4a52697 --- /dev/null +++ b/.config/nvim/UltiSnips/rnoweb.snippets @@ -0,0 +1,122 @@ +snippet \ "Begin/End Environments" +\begin{${1:element}} +${2:contents} +\end{$1} + +endsnippet + +snippet v "Import R variable in LaTeX" +\Sexpr{${1:var}} +endsnippet + +snippet eqn "Floating Equation" +\begin{eqfloat}[H] +\begin{align} + ${3:E} &= ${4:mc^2} +\end{align} +cond$5 +\label{eqn:${2:title}} +\caption{${1:A Title}} +\end{eqfloat} + +endsnippet + +snippet x "Multiplication Dot" +\cdot +endsnippet + +snippet e "Scientific Notation" +\cdot10^{${1:power}} +endsnippet + +snippet cond "Conditions for Equations" +\begin{conditions} + ${1:V} & ${2:Definition of V} +\end{conditions} +endsnippet + +snippet R "R Code" +<>= +${4:1+1} +@ +endsnippet + +snippet csv "Import CSV in R" +${1:variable_vame} <- read.csv("${2:path/to/file}.csv", +header=${3:TRUE}, +sep="${4:;}" +) + +endsnippet + +snippet xtable "Table made from R matrix" +print( + xtable(${1:matrix_name}, + caption="${2:Title of the table}", + label="tab:${3:table}", + digits=matrix($6 + c( +`!p +from time import sleep +try: + col = int(t[3])-1 + paragraph = "" + for i in range(int(t[4])-1): + paragraph += " rep(0,"+str(col)+"), <++>,\n" + paragraph += " rep(0,"+str(col)+"), <++>" + snip.rv = paragraph +except(ValueError): + sleep(1) +# paragraph = "" +# paragraph = " rep(0,"+t[3]+"), 0,\n" +# for i in range(int(t[4])-2): +# paragraph += " rep(0,"+t[3]+"), <++>,\n" +# paragraph += " rep(0,"+t[3]+"), <++>" +# snip.rv = paragraph +` + ), + nrow=${5:6}, + ncol=${4:3}, + byrow=TRUE + ), + table.placement="H" + ), + include.rownames=FALSE, + table.placement="H" +) + +endsnippet + +snippet img "Image" +\begin{figure}[H] +\begin{center} +\includegraphics[scale=${1:1}]{${2:path/to/image}} +\label{fig:${3/\s/_/g}} +\caption{${3:A Title}} +\end{center} +\end{figure} +endsnippet + +snippet b "Bold" +\textbf{${1:text}} +endsnippet + +snippet i "Italix" +\textit{${1:text}} +endsnippet + +snippet u "Underline" +\uline{${1:text}} +endsnippet + +snippet 1 "Section" +\section{${1:Title}} +endsnippet + +snippet 2 "Subsection" +\subsection{${1:Title}} +endsnippet + +snippet 3 "Subsubsection" +\subsubsection{${1:Title}} +endsnippet diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100755 index 0000000..5b11c2f --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,289 @@ +" _ +" (_) +" __ ___ _ __ ___ _ __ ___ +" \ \ / / | '_ ` _ \| '__/ __| +" \ V /| | | | | | | | | (__ +" \_/ |_|_| |_| |_|_| \___| +" +" +" #---Plug Installer---# " +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif + +" #---Vim Plugins---# " +call plug#begin() +" if has('nvim') + " Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +" else + " Plug 'Shougo/deoplete.nvim' + " Plug 'roxma/nvim-yarp' + " Plug 'roxma/vim-hug-neovim-rpc' +" endif +" Latex Deoplete source +" Plug 'hisaknown/deoplete-latex' +" Comment frames (for comment aesthetics) +Plug 'cometsong/CommentFrame.vim' +" Deoplete +Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +" Go Deoplete sources +Plug 'stamblerre/gocode', { 'rtp': 'vim', 'do': '~/.vim/plugged/gocode/vim/symlink.sh' } +Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'} +" LaTeX deoplete +Plug 'hisaknown/deoplete-latex' +" Turning vim into an R IDE +Plug 'jalvesaq/Nvim-R' +" Vim Sensible +Plug 'tpope/vim-sensible' +" Vim org tables +Plug 'dhruvasagar/vim-table-mode' +" Html linter enabler (for prettier AUR package) +Plug 'dense-analysis/ale' +" Vim Goyo +Plug 'junegunn/goyo.vim' +" Vim css hex highlight +Plug 'chrisbra/Colorizer' +" Bracket Completion +Plug 'jiangmiao/auto-pairs' +" csv filetype for vim +Plug 'chrisbra/csv.vim' +" Go developement +Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } +" sxhkd syntax +Plug 'kovetskiy/sxhkd-vim' +" Vim-Bling Search +Plug 'ivyl/vim-bling' +" Vim Hard Mode +Plug 'wikitopian/hardmode' +" I want to be a python ninja! +Plug 'metakirby5/codi.vim' +" Quickrun for python +Plug 'thinca/vim-quickrun' +" markdown preview vim +Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }} +" Emmet expansion for html +Plug 'mattn/emmet-vim' +" html preview +Plug 'turbio/bracey.vim' +" VimCompletesMe for VimTex +Plug 'ajh17/VimCompletesMe' +" Xresources colors +Plug 'dylanaraps/wal.vim' +" Nord colors +Plug 'arcticicestudio/nord-vim' +" My personal colorscheme +Plug 'ChausseBenjamin/friffle-vim' +" Vim Fugitive +Plug 'tpope/vim-fugitive' +" Vim-Surround +Plug 'tpope/vim-surround' +" Vim repeat for dot command on vim surround +Plug 'tpope/vim-repeat' +" Vimtex +Plug 'lervag/vimtex' +" C developement in vim +Plug 'vim-scripts/c.vim' +" NERDTree +Plug 'scrooloose/nerdtree' +" Git plugin for NERDTree +Plug 'Xuyuanp/nerdtree-git-plugin' +" Icons in NERDTree and Airline +Plug 'ryanoasis/vim-devicons' +" lightline +Plug 'itchyny/lightline.vim' +" Commentary +Plug 'tpope/vim-commentary' +" Vim markdown +Plug 'godlygeek/tabular' +" Ctrl-P fuzzy file finder +Plug 'ctrlpvim/ctrlp.vim' +" Vim snippet manager/tool +Plug 'sirver/UltiSnips' +" Vim snippet library +Plug 'honza/vim-snippets' +" Async shell commands +Plug 'skywind3000/asyncrun.vim' +" French grammar checker +Plug 'dpelle/vim-Grammalecte' +" All purpose grammar checker +Plug 'dpelle/vim-LanguageTool' +call plug#end() + + +" #---Basics/Recomended---# " +syntax on +filetype plugin on +set termguicolors +set t_Co=256 +set encoding=utf-8 +set path+=** " Provides tab-completion for all file related tasks +set wildmenu " Display all matching file when we tab complete +" Spelling +set complete+=kspell " Better Spell Checking +set spelllang=fr +nnoremap ;h zg +nnoremap ;j ]s +nnoremap ;k [s +nnoremap ;l z=1 +nnoremap ; z=1 +" Enable autocompletion: + set wildmode=longest,list,full + set runtimepath+=~/.config/nvim/plugged/deoplete.nvim + let g:deoplete#enable_at_startup = 1 +" Splits open at the bottom and right, which is non-retarded, unlike vim defaults. +set splitbelow splitright +set rtp+=/usr/local/opt/fzf " Fuzzy File Finder +set t_vi= " Autohide the cursor +" Automatic wordwrap without creating newlines! +set wrap +set linebreak + +" #---Plugin Preferences---# " +" Nvim-R +let R_rconsole_width = 0 +" Emmet Expansion +let g:user_emmet_leader_key=',' +" Enable kite autocompletion +let g:kite_auto_complete=1 +" MarkdownPreview +" let g:mkdp_browser = 'surf' +" Bracey +let g:bracey_browser_command = "chromium" +" Grammalecte path +let g:grammalecte_cli_py = "/usr/bin/grammalecte-cli" +" Ale Linter with prettier +let g:ale_linters_explicit = 1 +" autocmd BufWrite, *.css,*.html,*.js :ALEFix prettier +" Ultisnips + " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. + let g:UltiSnipsExpandTrigger="" + let g:UltiSnipsJumpForwardTrigger=";" + let g:UltiSnipsJumpBackwardTrigger=";n" + " If you want :UltiSnipsEdit to split your window. + let g:UltiSnipsEditSplit="vertical" + " Snippet directory + let g:UltiSnipsSnippetDirectories=[$HOME.'/.config/nvim/UltiSnips'] +" Go deoplete +let g:deoplete#sources#go#gocode_binary = '$GOPATH/bin/gocode' +" Hexokinase +let g:Hexokinase_highlighters = ['virtual'] +" GoRun Split Reuse +function! ReuseVimGoTerm(cmd) abort + for w in nvim_list_wins() + if "goterm" == nvim_buf_get_option(nvim_win_get_buf(w), 'filetype') + call nvim_win_close(w, v:true) + break + endif + endfor + execute a:cmd +endfunction +let g:go_term_enabled = 1 +let g:go_term_mode = "silent keepalt rightbelow 35 vsplit" +let g:go_def_reuse_buffer = 1 +autocmd FileType go nmap r :call ReuseVimGoTerm('GoRun') +" Vimtex pdf viewer +let g:latex_view_general_viewer = 'zathura' +let g:vimtex_view_method = "zathura" + +" #---Document Compilation/Visualisation---# " +" Compile document, be it groff/LaTeX/markdown/etc. +map c :w! \| AsyncRun compiler % +autocmd InsertLeave,TextChanged *.gd,*.ms,*.mom :w! | :execute 'silent AsyncRun compiler %' +" autocmd InsertLeave *.rmd,*.rnw,*.tex :w! | :execute 'silent AsyncRun compiler %; todotable % TODO FIXME CHANGED XXX IDEA HACK NOTE REVIEW NB BUG QUESTION COMBAK' +autocmd VimLeave *.rmd,*.rnw,*.tex !texclear % +map x :w! \| AsyncRun todotable % TODO FIXME CHANGED XXX IDEA HACK NOTE REVIEW NB BUG QUESTION COMBAK TEMP +" Open corresponding .pdf/.html or preview + map p :! opout % +" Open corresponding .pdf/.html or preview + map o :! tdout % +" Width tabstop +set tabstop=2 +" when indenting with '>', use 4 spaces width +set shiftwidth=2 + +" #---Custom Keymaps---# " +" Tab Buffer Navigation + nnoremap :bp + nnoremap :bn +" Vim split resize + map :resize+3 + map :resize-3 + map :verticalresize-3 + map :verticalresize+3 + map :split + map :vsplit +" Ninja python execution + map :Codi!! + map :QuickRun +" Shortcutting split navigation, saving a keypress: + map h + map j + map k + map l +" Create blank lines using Shift J and Shift K + nnoremap J o + nnoremap K O +" Figlet dotfile titles +command RcTitle .!figlet -s -f big +" Easily escape terminal mode +tnoremap +" Pressing shift semicolon was too long: +nnoremap : +" Fastest :w in the west +nnoremap w :w +" #---Visual Enhancements---# " +colorscheme friffle +" Remove latex underscore errors +let g:tex_no_error=1 +" let g:airline_powerline_fonts = 1 +" Lightline config +let g:lightline = { + \ 'colorscheme': 'friffle', + \ } +set noshowmode +" Vim-go breakpoints and debug +nnoremap mp :GoDebugBreakpoint +nnoremap mn :GoDebugNext +nnoremap ms :GoDebugStart +nnoremap mq :GoDebugStop + +" #---Ease Of Use---# " +" Normal/relative number toggle +set number relativenumber +augroup numbertoggle + autocmd! + autocmd BufEnter,FocusGained,InsertLeave * set relativenumber + autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber +augroup END +" Remove all trailing spaces upon write {{{ +autocmd BufWritePre * %s/\s\+$//e +" Soft Tabs +filetype plugin indent on +" NERDTRee Hotkey map +map :NERDTreeToggle + let NERDTreeDirArrowExpandable="|" + let NERDTreeDirArrowCollapsible="-" +" Close vim if the only window left open is a NERDTree +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif +" Other NERDTree Preferences +let NERDTreeMinimalUI = 1 +let NERDTreeDirArrows = 1 +let NERDTreeShowBookmarks=1 +let NERDTreeAutoDeleteBuffer = 1 +let NERDTreeQuitOnOpen = 1 +" Nvim-R send line +nmap l +" Nvim folding + let r_syntax_folding = 1 + set foldnestmax=1 + + +" #---Universal Macros---# " +" Create and navigate Markers +" inoremap ;m <++> +inoremap ;; /<++>"_c4l +inoremap << « +inoremap >> » +" #---Filetype Specific Settings---# " -- cgit v1.2.3