summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormitsuo <[email protected]>2020-09-17 16:20:13 -0500
committermitsuo <[email protected]>2020-09-17 16:20:13 -0500
commit0be5fb0d3d276a0e148dde68d79eaa08e10d82ff (patch)
tree9625682436cd710a0a9de3aa6b9d44a3de398310
parente1b90958e2e7a0270c0c7326fc4c8997ba2b9e62 (diff)
downloaddotfiles-0be5fb0d3d276a0e148dde68d79eaa08e10d82ff.tar.gz
dotfiles-0be5fb0d3d276a0e148dde68d79eaa08e10d82ff.tar.bz2
dotfiles-0be5fb0d3d276a0e148dde68d79eaa08e10d82ff.zip
removed XDG compliance to vim
-rw-r--r--bash_aliases2
-rw-r--r--fun.vim3
-rw-r--r--profile2
-rw-r--r--vimrc205
4 files changed, 132 insertions, 80 deletions
diff --git a/bash_aliases b/bash_aliases
index bdf2229..a6cacab 100644
--- a/bash_aliases
+++ b/bash_aliases
@@ -1,7 +1,7 @@
# Shortcuts
# ======================================================================
alias aliases='vim ~/.bash_aliases && source ~/.bash_aliases'
-alias evrc='vim ~/.config/vim/vimrc'
+alias evrc='vim ~/.vim/vimrc'
alias ebrc='vim ~/.bashrc && source ~/.bashrc'
diff --git a/fun.vim b/fun.vim
index 909c328..b184d4c 100644
--- a/fun.vim
+++ b/fun.vim
@@ -58,9 +58,10 @@ command Md2Html call Md2Html()
" Compiles and Runs a C++ project
+" TODO: how to add program's arguments or file redirectioning from command.
function! CompRunProj ( )
exe ":w"
- exe ":! g++ -o " . expand("%:r") . " *.cpp"
+ exe ":! g++ -o " . expand("%:r") . "-g *.cpp"
exe ":! ./" . expand("%:r")
endfunction
diff --git a/profile b/profile
index ad5704b..ca4a21f 100644
--- a/profile
+++ b/profile
@@ -15,8 +15,6 @@ export XDG_DATA_HOME="$HOME/.local/share"
#export XDG_DATA_DIRS="/usr/local/share:/usr/share"
#export XDG_CONFIG_DIRS="/etc/xdg"
-export VIMINIT=":source $XDG_CONFIG_HOME"/vim/vimrc
-
# Fun
# ======================================================================
diff --git a/vimrc b/vimrc
index 80b2acd..3fbd118 100644
--- a/vimrc
+++ b/vimrc
@@ -1,50 +1,49 @@
" mitsuo's vimrc
" Created c. 2019-11-11
-" Last update (after destroying it accidentally) 2020-09-02
+" Last update (after destroying it accidentally): 2020-09-02
"
" ┌─┬─┬─┬─┬─┬─┐
-" │m│i│t│s│u│o│✓x が
-" ├─┼─┼─┼─┼─┼─┤ ん
-" │v│i│m│r│c│←│█▓▒░ ば
-" └─┴─┴─┴─┴─┴─┘ れ
+" │m│i│t│s│u│o│✓x け が
+" ├─┼─┼─┼─┼─┼─┤ ん
+" │v│i│m│r│c│←│█▓▒░ り ば
+" └─┴─┴─┴─┴─┴─┘ こ れ
-" XDG compliant
-" TODO: sort sections
+" XDG compliant REMOVED :D (what a pain)
+" TODO: - sort sections
" Variables
" ----------------------------------------------------------------------
-set undodir=$XDG_DATA_HOME/vim/undo
-set directory=$XDG_DATA_HOME/vim/swap
-set backupdir=$XDG_DATA_HOME/vim/backup
-set viminfo+='1000,n$XDG_DATA_HOME/vim/viminfo
-set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after
-" TODO fix this
-"let vcpath="~/.vim/vimfun/" " vim configuration path
+set undodir=~/.vim/undo
+set viminfofile=~/.vim/viminfo
+set viewdir=~/.vim/view
" Useful
" ----------------------------------------------------------------------
set nocompatible
" Auto-recognize files and apply pluggins
-" filetype plugin indent on
+filetype plugin indent on " See :h vimrc-filetype
syntax on
" Search files
-set wildmenu
-set path+=** " Search down into subfolders
+set wildmenu " command-line <Tab> completion <-- soo good
+set wildignore+=*.o,*.obj,.git,*.rbc,*.class
+set path+=./**30 " For gf and :find, add all subdirectories relative to
+ " current file (30 max) to the "search space"
-set showcmd " show partial command on last line (below status bar)
set scrolloff=5 " show a few lines of context
-" not default in some systems
set backspace=indent,eol,start " Allow <BS> and <Del> in insert mode
" number gutter
set nonumber
set norelativenumber
-" Tag Jumping
+" Store session information
+set viminfo+='1000
+
+" Tag Jumping <-- so cool
" Instructions: create tag index (e.g. $ ctags -R .)
" place cursor on tag
" ^] to jump to definition
@@ -53,13 +52,22 @@ set norelativenumber
" TODO: create tags automatically (:!ctags -R . after :w if ft=c)
+" Status line
+" ----------------------------------------------------------------------
+set showcmd " show partial command on last line (below status bar)
+" just add buffer number to the default
+set statusline=%<%f\ %h%m%r%=b%02n\ \ %-14.(%l,%c%V%)\ %P
+
" Search
" ----------------------------------------------------------------------
-set hlsearch
-set incsearch
-" Redraw and turn off search highlight in normal mode (non recursive)
+set hlsearch " highlight search (this can be annoying if no shortcut to then
+ " clear the highlight
+set incsearch " Incrementally move cursor while typing search-string
+" stop highlight only for current search.
+" (Still preserve <C-L> updating directory in netrw)
nnoremap <C-L> :nohl<CR><C-L>
+" Ignore case only when pattern is lowercase (both needed)
set ignorecase
set smartcase
@@ -68,17 +76,25 @@ set smartcase
" ----------------------------------------------------------------------
" 4 column softtabs (uses ' ', not '\t').
" TODO: move this 'guide' to somewhere apropiate
-" tab->softtab (:set tabstop=n) (:set expandtab) :retab
+" tab->softtab :set tabstop=n :set expandtab :retab
" softtab->tab :set noexpandtab :set tabstop={softtabstop} :retab!
-" Caution: This will insert a tab wherever it can, even between words
-" separated by as few as 2 spaces!
-set tabstop=8
-set softtabstop=4
-set shiftwidth=4
-set expandtab
-" autoindent -> smartindent -> cindent -> indentexpr (from less to more
-" general, each one overrides the previous ones)
-set smartindent " This is a really nice and simple one
+" Caution:
+" - This will insert a tab wherever it can, even between words
+" separated by as few as 2 spaces if ts=2!
+" - Not recommended at all. Use some other program to only translate
+" leading indenting from space to tabs. Also using tabs is not very
+" good. My opinion is that they are good as a special character to
+" separate data (like comma for CSV).
+set tabstop=8 " '\t' or HT = 8 virtual columns
+set shiftwidth=4 " Indentation with >> and C-T and C-D (insert mode)
+set softtabstop=4 " For "inserted tabs" (inserts <Space> and <Tab>
+ " minimizing <Space>)
+set expandtab " Expand with <Space> the inserted <Tab>s
+"set smarttab " Use shiftwidth for inserted <Tabs> in the front of
+ " a line (Maybe useful for YAML)
+" autoindent -> smartindent -> cindent -> indentexpr
+" (from simple/less general to complex/more general)
+set smartindent " This is a really nice and simple one
"set cindent
"set cinoptions=:0,g0 " See C-indenting
@@ -86,40 +102,67 @@ set smartindent " This is a really nice and simple one
" Automatic formatting
" ----------------------------------------------------------------------
" see fo-table
-set formatoptions=rql
-set formatoptions-=o " Automatically insert the current comment leader
- " after hitting 'o'.
-set formatoptions+=t " auto-wrap text (when inserting)
-set formatoptions+=c " auto-wrap comments (when inserting)
-set formatoptions+=p " Don't break honorifics like Prof. Smith
-set formatoptions+=n " Allow lists
-set formatoptions+=j " Removes comment leader when joining lines
+set formatoptions=l " Don't break long lines that are already typed
+set formatoptions+=q " Allow formatting of comments with "gq"
+set formatoptions+=r " Insert current leader after <Enter> in Insert mode
+set formatoptions-=o " Automatically insert the current comment leader
+ " after hitting 'o'.
+set formatoptions+=t " auto-wrap text (when inserting)
+set formatoptions+=c " auto-wrap comments (when inserting)
+set formatoptions+=p " Don't break honorifics like Prof. Smith
+set formatoptions+=n " Allow lists
+set formatoptions+=j " Removes comment leader when joining lines
" Word wrap
" ----------------------------------------------------------------------
-set wrap
-set linebreak
+set wrap " Visual wrapping of lines wider than window
+set linebreak " Works with previous option to not break words
" To 'justify' comments or block of text (paragraph) use "gq{motion}" or
" "gp{motion}", where {motion} can be "[/", "]/", "ip", "i{", "a{".
-set textwidth=80
+set textwidth=80 " auto break inserted text longer than 80 colums
" Other settings
" ----------------------------------------------------------------------
-set mouse=a
+set mouse=a " Enable for all modes
" set cmdheight=1
" Always display the status line, even if only one window is displayed
set laststatus=2
set ruler
set encoding=utf-8
+set more " Enable more-prompt for listings that don't fit in
+ " screen
+"hint: g< command can be used to see the last page of previous command.
" Mappings
" ----------------------------------------------------------------------
-map <F5> :source ~/.config/vim/vimrc<CR>
+" F1 is help, F11 is full screen (terminal emulator)
+map <F5> :source ~/.vim/vimrc<CR>
+map <S-F5> :e ~/.vim/vimrc<CR>
map <F7> :tabp<CR>
map <F8> :tabn<CR>
+map <F9> :w<CR>:!./make.sh<CR>
+" One has to do :E first in order for this to work
+map <F12> :Rex<CR>
+" <Leader> = '\' when 'mapleader' is empty
+" Change to the directory of the current file and generate tags recursively
+" there.
+" TODO: make the change of directory whenever a .c .cpp .h file is opened
+map <Leader>rt :cd %:h<CR>:!ctags -R .<CR>
+map <C-\> :tnext<CR>
+" Motion to go to beggining of function while cursor is inside
+nmap [f [m[{k0
+
+" Funcionallity of the following depends on terminal (8bit input enabled needed
+" 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
" Yanking and pasting
@@ -152,12 +195,29 @@ set fileencoding=utf-8
" Functions
" ----------------------------------------------------------------------
" TODO: maybe replace with $runtimepath
-source ~/.config/vim/fun.vim
+source ~/.vim/fun.vim
+
+
+" 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
" Snippets
" ----------------------------------------------------------------------
-nnoremap ,ch :-1r ~/.config/vim/snippets/cheader.c<CR>
+" I deleted the file accidently
+"nnoremap ,ch :-1r ~/.vim/snippets/cheader.c<CR>
" File Browsing
@@ -177,44 +237,37 @@ let g:netrw_altv=1 " open splits to the right
" Additions
" ----------------------------------------------------------------------
-" TODO: Funcion para reindentar archivo con mi configuracion. Esta funcion de
-" vim.fandom.com no se como funciona. (Ver perlexpr?)
-":command! -nargs=1 -range SuperRetab <line1>,<line2>s/\v%(^ *)@<= {<args>}/\t/g
-"FIX: this shit :(
-" digr :) 0x263a :( 0x2639
-
-" yields result of previous WORD arithmetic expression (from the Vim wiki)
-"inoremap <C-A> <C-O>yiW<End>=<C-R>=<C-R>0<CR>
-" Replaces previous WORD arithmetic expression with result
+" Replaces previous WORD arithmetic expression with result (from Vim
+" fandom-wiki)
inoremap <C-A> <Esc>diWi<C-R>=<C-R>"<CR>
-" iVim
-" ----------------------------------------------------------------------
-" TODO: map :h _argument_ to :h _argument_ <C-w>L<C-w>| makes help window
-" almost fill the super small screen.
-
-
" Plugins
" ----------------------------------------------------------------------
-" Automatic vim-plug install
-if empty(glob('$XDG_CONFIG_HOME/vim/autoload/plug.vim'))
- silent !curl -fLo $XDG_CONFIG_HOME/vim/autoload/plug.vim --create-dirs
- \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
-endif
+" I disabled it bc I think it interferes with formatoptions
+"" Automatic vim-plug install
+"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
+"
+"call plug#begin()
+"Plug 'ARM9/arm-syntax-vim'
+"autocmd BufNewFile,BufRead *.s,*.S set filetype=arm " arm = armv6/7
+"
+"call plug#end()
-call plug#begin()
-Plug 'ARM9/arm-syntax-vim'
-autocmd BufNewFile,BufRead *.s,*.S set filetype=arm " arm = armv6/7
+" Other plugins
+source ~/.vim/plugins/IndexedSearch.vim
-call plug#end()
-" Other plugins
-source ~/.config/vim/plugins/*
+" Colors
+" ----------------------------------------------------------------------
+" ADDME :)
-" Ducktape
+" Ducktape (place this in ~/.vim/after (after directory))
" ----------------------------------------------------------------------
" Not even the ducktape worked for this one on C files TODO
set formatoptions-=o " Automatically insert the current comment leader