Add missing vim files
This commit is contained in:
parent
baa12bf8fb
commit
96c7781086
3 changed files with 214 additions and 0 deletions
2
apps/neovim/.gitignore
vendored
2
apps/neovim/.gitignore
vendored
|
@ -3,3 +3,5 @@
|
|||
!init.vim
|
||||
!settings.vim
|
||||
!bindings.vim
|
||||
!plugins.vim
|
||||
!commands.vim
|
||||
|
|
97
apps/neovim/commands.vim
Normal file
97
apps/neovim/commands.vim
Normal file
|
@ -0,0 +1,97 @@
|
|||
" TODO: need a way to toggle this and maybe make it on by default except in
|
||||
" files where space indentation is expected
|
||||
fun! ShowSpaceIndentation()
|
||||
hi LeadingWhiteSpaces ctermfg=black ctermbg=8
|
||||
endfunction
|
||||
fun! HideSpaceIndentation()
|
||||
hi LeadingWhiteSpaces ctermfg=black ctermbg=black
|
||||
endfunction
|
||||
hi LeadingWhiteSpaces ctermfg=black ctermbg=black
|
||||
|
||||
:command! SpaceIndents call ShowSpaceIndentation()
|
||||
:command! ShowSpaceIndents call ShowSpaceIndentation()
|
||||
:command! HideSpaceIndents call HideSpaceIndentation()
|
||||
|
||||
" allows for manual and syntax folding... supposedly
|
||||
augroup vimrc
|
||||
au BufReadPre * setlocal foldmethod=indent
|
||||
au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
|
||||
augroup END
|
||||
|
||||
" jump to last opened position in file except in git commits
|
||||
let jump_to_pos_blacklist = ['gitcommit']
|
||||
if has("autocmd")
|
||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") && index(jump_to_pos_blacklist, &ft) | exe "normal! g'\"" | endif
|
||||
endif
|
||||
|
||||
" terminal split in neovim
|
||||
if has('nvim')
|
||||
function! TerminalSplit()
|
||||
let current_file = @%
|
||||
echo current_file
|
||||
if match(current_file, "term://*") != -1
|
||||
split
|
||||
terminal
|
||||
else
|
||||
split
|
||||
resize 24
|
||||
terminal
|
||||
endif
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" Make any necessary directories in the path when saving a file
|
||||
fun! <SID>AutoMakeDirectory()
|
||||
let s:directory = expand("<afile>:p:h")
|
||||
if !isdirectory(s:directory)
|
||||
call mkdir(s:directory, "p")
|
||||
endif
|
||||
endfun
|
||||
autocmd BufWritePre,FileWritePre * :call <SID>AutoMakeDirectory()
|
||||
|
||||
if !exists("g:make_args")
|
||||
let g:make_args="default"
|
||||
endif
|
||||
fun! RunMake()
|
||||
split
|
||||
if has('nvim')
|
||||
" run from the root of the current git repository
|
||||
let path = system("git rev-parse --show-toplevel | tr -d '\\n'")
|
||||
" TODO: handle non-git situations
|
||||
execute 'terminal cd ' . path . ' && make ' . g:make_args
|
||||
else
|
||||
execute '!make ' . g:make_args
|
||||
endif
|
||||
endfun
|
||||
|
||||
" kill the terminal buffer when the process exits
|
||||
autocmd TermClose * call feedkeys('<cr>')
|
||||
|
||||
" a toggle-able minimalistic distraction-free text editing mode
|
||||
let s:distractionFreeMode = 0
|
||||
fun! DistractionFreeModeFunc()
|
||||
if s:distractionFreeMode == 0
|
||||
let s:distractionFreeMode = 1
|
||||
AirlineToggle
|
||||
Goyo
|
||||
else
|
||||
let s:distractionFreeMode = 0
|
||||
Goyo!
|
||||
AirlineToggle
|
||||
AirlineRefresh
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" prevents normal window navigation and closing while in DistractionFreeMode
|
||||
fun! CheckCloseDistractionFreeMode()
|
||||
if s:distractionFreeMode == 1
|
||||
call DistractionFreeModeFunc()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" run the previous checking function every time we leave a window
|
||||
if has('autocmd')
|
||||
" autocmd WinLeave * call CheckCloseDistractionFreeMode()
|
||||
endif
|
||||
|
||||
command! DistractionFreeMode call DistractionFreeModeFunc()
|
115
apps/neovim/plugins.vim
Normal file
115
apps/neovim/plugins.vim
Normal file
|
@ -0,0 +1,115 @@
|
|||
" install plugin manager if needed
|
||||
augroup PluginManagerInstaller
|
||||
if has('nvim')
|
||||
if empty(glob('~/.config/nvim/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall
|
||||
endif
|
||||
else
|
||||
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
|
||||
endif
|
||||
end
|
||||
augroup End
|
||||
|
||||
" initialize plugin manager
|
||||
if has('nvim')
|
||||
call plug#begin('~/.config/nvim/bundle')
|
||||
else
|
||||
call plug#begin('~/.vim/bundle')
|
||||
endif
|
||||
|
||||
" let plugin manager manage itself
|
||||
Plug 'junegunn/vim-plug'
|
||||
|
||||
" check if we're using vim as the manpage viewer before loading session plugins
|
||||
if exists('asmanviewer')
|
||||
let g:prosession_dir = '/dev/null'
|
||||
else
|
||||
Plug 'tpope/vim-obsession' " session ease-of-use
|
||||
Plug 'dhruvasagar/vim-prosession' " more session ease-of-use
|
||||
let g:prosession_dir = '~/.config/nvim/session/'
|
||||
endif
|
||||
|
||||
Plug 'vim-airline/vim-airline' " status line
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline#extensions#tabline#enabled = 1 " automatically displays all buffers when there's only one tab open
|
||||
let g:airline#extensions#tabline#fnamemod = ':t'
|
||||
" set laststatus=2 " always show statusline
|
||||
" set noshowmode " hides default mode
|
||||
let g:airline#extensions#tabline#left_sep = ''
|
||||
let g:airline#extensions#tabline#left_alt_sep = ''
|
||||
let g:airline_right_alt_sep = ''
|
||||
let g:airline_right_sep = ''
|
||||
let g:airline_left_alt_sep= ''
|
||||
let g:airline_left_sep = ''
|
||||
let g:airline#extensions#tabline#buffers_label = ''
|
||||
|
||||
Plug 'vim-airline/vim-airline-themes' " more minimal status line
|
||||
let g:airline_mode_map = {
|
||||
\ '__' : '-',
|
||||
\ 'n' : 'N',
|
||||
\ 'i' : 'I',
|
||||
\ 'R' : 'R',
|
||||
\ 'c' : 'C',
|
||||
\ 'v' : 'V',
|
||||
\ 'V' : 'V',
|
||||
\ '' : 'V',
|
||||
\ 's' : 'S',
|
||||
\ 'S' : 'S',
|
||||
\ '' : 'S',
|
||||
\ }
|
||||
|
||||
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
|
||||
let g:indent_guide_auto_colors = 1
|
||||
let g:indent_guides_enable_on_vim_startup = 1
|
||||
|
||||
Plug 'w0rp/ale' " syntax checker
|
||||
let g:ale_completion_enabled = 1
|
||||
" let g:ale_sign_column_always = 0
|
||||
" let g:ale_set_signs = 0
|
||||
" highlight clear ALEErrorSign
|
||||
" highlight clear ALEWarningSign
|
||||
|
||||
" Plug 'neomake/neomake' " syntax checker
|
||||
|
||||
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
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
|
||||
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} " fuzzy file finding
|
||||
Plug 'junegunn/fzf.vim' " helpers for using fzf in vim
|
||||
let g:fzf_layout = { 'window': 'enew' }
|
||||
|
||||
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
|
||||
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
|
||||
Plug 'tpope/vim-commentary' " toggle comments in code easily
|
||||
Plug 'tpope/vim-repeat' " better vim repeating for plugin-provided actions
|
||||
Plug 'vim-scripts/SyntaxRange' " defined different syntax ranges in a file for highlighting
|
||||
Plug 'tmux-plugins/vim-tmux-focus-events' " allow transitions within tmux
|
||||
Plug 'christoomey/vim-tmux-navigator' " allow transitions within tmux
|
||||
Plug 'godlygeek/tabular' " align text
|
||||
Plug 'lytedev/vim-superman' " view man pages with vim
|
||||
Plug 'tpope/vim-surround' " quickly modify text surrounding objects
|
||||
Plug 'tpope/vim-speeddating' " vim knows about date-like text objects
|
||||
Plug 'tpope/vim-fugitive' " vim git commands
|
||||
Plug 'michaeljsmith/vim-indent-object' " adds an indentation level text object
|
||||
Plug 'wellle/targets.vim' " adds some more handy text objects
|
||||
Plug 'dbakker/vim-projectroot' " adds helper functions for getting to a project's root directory
|
||||
Plug 'junegunn/goyo.vim' " better distraction-free editing
|
||||
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
|
||||
Plug 'sheerun/vim-polyglot' " vim plugin loader for many languages
|
||||
|
||||
" language-specific
|
||||
" Elixir
|
||||
Plug 'slashmili/alchemist.vim', {'for': ['elixir', 'exs', 'ex']}
|
||||
|
||||
call plug#end()
|
||||
|
||||
" call neomake#configure#automake('nrwi', 500)
|
Reference in a new issue