Working autocomplete and linting/code checking
This commit is contained in:
parent
d9391ced2d
commit
baa12bf8fb
3 changed files with 77 additions and 356 deletions
|
@ -13,21 +13,24 @@ let mapleader = "\<Space>"
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
" terminal mappings
|
" terminal mappings
|
||||||
" open a terminal split at 80 columns
|
" open a terminal split at 80 columns
|
||||||
nnoremap <C-t> :call TerminalSplit()<CR>
|
nnoremap <C-t> :vsplit term://bash<CR>
|
||||||
tnoremap <C-t> <C-\><C-n>:call TerminalSplit()<CR>
|
nnoremap <C-S-T> :split term://bash<CR>
|
||||||
|
" tnoremap <C-t> <C-\><C-n>:call TerminalSplit()<CR>
|
||||||
|
|
||||||
" close the terminal
|
" close the terminal
|
||||||
tnoremap <C-w> <C-\><C-n>:q!<CR>
|
tnoremap <C-w> <C-\><C-n>:q!<CR>
|
||||||
|
|
||||||
" moving between terminal splits
|
" moving between terminal splits
|
||||||
tnoremap <C-h> <C-\><C-n><C-w>h
|
" tnoremap <C-h> <C-\><C-n><C-w>h
|
||||||
tnoremap <C-j> <C-\><C-n><C-w>j
|
" tnoremap <C-j> <C-\><C-n><C-w>j
|
||||||
tnoremap <C-k> <C-\><C-n><C-w>k
|
" tnoremap <C-k> <C-\><C-n><C-w>k
|
||||||
tnoremap <C-l> <C-\><C-n><C-w>l
|
" tnoremap <C-l> <C-\><C-n><C-w>l
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" enter insert mode when entering a terminal buffer
|
" enter insert mode when entering a terminal buffer
|
||||||
autocmd BufWinEnter,WinEnter term://* startinsert
|
augroup InsertModeOnBlankTerminal
|
||||||
|
autocmd BufWinEnter,WinEnter term://* startinsert
|
||||||
|
augroup END
|
||||||
|
|
||||||
" Jump to the next or previous line that has the same level or a lower
|
" Jump to the next or previous line that has the same level or a lower
|
||||||
" level of indentation than the current line.
|
" level of indentation than the current line.
|
||||||
|
@ -41,25 +44,25 @@ autocmd BufWinEnter,WinEnter term://* startinsert
|
||||||
" skipblanks (bool): true: Skip blank lines
|
" skipblanks (bool): true: Skip blank lines
|
||||||
" false: Don't skip blank lines
|
" false: Don't skip blank lines
|
||||||
function! NextIndent(exclusive, fwd, lowerlevel, skipblanks)
|
function! NextIndent(exclusive, fwd, lowerlevel, skipblanks)
|
||||||
let line = line('.')
|
let line = line('.')
|
||||||
let column = col('.')
|
let column = col('.')
|
||||||
let lastline = line('$')
|
let lastline = line('$')
|
||||||
let indent = indent(line)
|
let indent = indent(line)
|
||||||
let stepvalue = a:fwd ? 1 : -1
|
let stepvalue = a:fwd ? 1 : -1
|
||||||
while (line > 0 && line <= lastline)
|
while (line > 0 && line <= lastline)
|
||||||
let line = line + stepvalue
|
let line = line + stepvalue
|
||||||
if ( ! a:lowerlevel && indent(line) == indent ||
|
if ( ! a:lowerlevel && indent(line) == indent ||
|
||||||
\ a:lowerlevel && indent(line) < indent)
|
\ a:lowerlevel && indent(line) < indent)
|
||||||
if (! a:skipblanks || strlen(getline(line)) > 0)
|
if (! a:skipblanks || strlen(getline(line)) > 0)
|
||||||
if (a:exclusive)
|
if (a:exclusive)
|
||||||
let line = line - stepvalue
|
let line = line - stepvalue
|
||||||
endif
|
endif
|
||||||
exe line
|
exe line
|
||||||
exe "normal " column . "|"
|
exe 'normal ' column . '|'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endwhile
|
endwhile
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Moving back and forth between lines of same or lower indentation.
|
" Moving back and forth between lines of same or lower indentation.
|
||||||
|
@ -93,7 +96,7 @@ nnoremap <C-n> :NERDTree<CR>
|
||||||
" run macro across visually selected lines
|
" run macro across visually selected lines
|
||||||
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
|
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
|
||||||
function! ExecuteMacroOverVisualRange()
|
function! ExecuteMacroOverVisualRange()
|
||||||
echo "@".getcmdline()
|
echo '@'.getcmdline()
|
||||||
execute ":'<,'>normal @".nr2char(getchar())
|
execute ":'<,'>normal @".nr2char(getchar())
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
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
|
|
||||||
|
|
||||||
" vim compatibility
|
" vim compatibility
|
||||||
let $vimdir = $HOME.'/.vim'
|
let $vimdir = $HOME.'/.vim'
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
let $vimdir = $HOME.'/.config/nvim'
|
let $vimdir = $HOME.'/.config/nvim'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" OS detection functions
|
" utf8 encoding
|
||||||
|
if has('vim_starting')
|
||||||
|
set encoding=utf8
|
||||||
|
endif
|
||||||
|
|
||||||
|
" os detection functions
|
||||||
silent function! OSX()
|
silent function! OSX()
|
||||||
return has('macunix')
|
return has('macunix')
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -27,275 +20,23 @@ silent function! WINDOWS()
|
||||||
return (has('win32') || has('win64'))
|
return (has('win32') || has('win64'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" tell vim to reload the init.vim file when it saves it
|
|
||||||
" if has('nvim')
|
|
||||||
" autocmd! BufWritePost init.vim source %
|
|
||||||
" else
|
|
||||||
" autocmd! BufWritePost .vimrc source %
|
|
||||||
" end
|
|
||||||
|
|
||||||
" load a per-environment file if one exists
|
" load a per-environment file if one exists
|
||||||
if filereadable(expand("$HOME/.env_init.vim"))
|
if filereadable(expand('$HOME/.env_init.vim'))
|
||||||
source "$HOME/.env_init.vim"
|
source "$HOME/.env_init.vim"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has('vim_starting')
|
let pluginsfile=$vimdir.'/plugins.vim'
|
||||||
set encoding=utf8
|
exec 'source ' . pluginsfile
|
||||||
endif
|
|
||||||
|
|
||||||
" plugin build functions
|
|
||||||
function! BuildComposer(info)
|
|
||||||
if a:info.status != 'unchanged' || a:info.force
|
|
||||||
!cargo build --release
|
|
||||||
UpdateRemotePlugins
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! DoRemote(arg)
|
|
||||||
UpdateRemotePlugins
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" 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'
|
|
||||||
|
|
||||||
" plugins
|
|
||||||
|
|
||||||
" if vim is being launched to view man pages, don't do our session stuff!
|
|
||||||
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' " statusline
|
|
||||||
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'
|
|
||||||
let g:airline_mode_map = {
|
|
||||||
\ '__' : '-',
|
|
||||||
\ 'n' : 'N',
|
|
||||||
\ 'i' : 'I',
|
|
||||||
\ 'R' : 'R',
|
|
||||||
\ 'c' : 'C',
|
|
||||||
\ 'v' : 'V',
|
|
||||||
\ 'V' : 'V',
|
|
||||||
\ '' : 'V',
|
|
||||||
\ 's' : 'S',
|
|
||||||
\ 'S' : 'S',
|
|
||||||
\ '' : 'S',
|
|
||||||
\ }
|
|
||||||
|
|
||||||
Plug 'scrooloose/nerdtree', {'on': ['NERDTreeToggle', 'NERDTree']} " nice sidebar for files
|
|
||||||
let g:NERDTreeDirArrowExpandable = ' '
|
|
||||||
let g:NERDTreeDirArrowCollapsible = ' '
|
|
||||||
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif " close vim if last buffer is a NERD buffer
|
|
||||||
|
|
||||||
Plug 'nathanaelkane/vim-indent-guides' " indentation guides
|
|
||||||
let g:indent_guide_auto_colors = 1
|
|
||||||
let g:indent_guides_enable_on_vim_startup = 1
|
|
||||||
|
|
||||||
" Plug 'roxma/nvim-completion-manager'
|
|
||||||
|
|
||||||
" Plug 'vimwiki/vimwiki'
|
|
||||||
" let wiki1 = {}
|
|
||||||
" let wiki1.path = "~/../doc/wiki/"
|
|
||||||
" let wiki1.syntax = "markdown"
|
|
||||||
" let wiki1.ext = ".md"
|
|
||||||
" let g:vimwiki_list = [wiki1]
|
|
||||||
|
|
||||||
" Plug 'scrooloose/syntastic' " syntax checker
|
|
||||||
Plug 'w0rp/ale' " syntax checker
|
|
||||||
let g:ale_sign_column_always = 0
|
|
||||||
let g:ale_set_signs = 0
|
|
||||||
highlight clear ALEErrorSign
|
|
||||||
highlight clear ALEWarningSign
|
|
||||||
Plug 'bkad/CamelCaseMotion' " camel case and underscore word movements
|
|
||||||
Plug 'vim-scripts/LargeFile' " gracefully handle very large files
|
|
||||||
Plug 'vim-scripts/utl.vim' " allow for inter-file linking (I meant to use this instead of vimwiki)
|
|
||||||
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 'dhruvasagar/vim-table-mode' " for creating and editing crazy vim tables (I mostly use sc now though)
|
|
||||||
let g:table_mode_corner='|'
|
|
||||||
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 'airblade/vim-gitgutter' " vim git gutter information
|
|
||||||
" let g:gitgutter_override_sign_column_highlight = 0
|
|
||||||
" let g:gitgutter_sign_added = '+'
|
|
||||||
" let g:gitgutter_sign_modified = '~'
|
|
||||||
" let g:gitgutter_sign_removed = '-'
|
|
||||||
" let g:gitgutter_sign_removed_first_line = '-'
|
|
||||||
" let g:gitgutter_sign_modified_removed = '~'
|
|
||||||
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 'mikewest/vimroom' " distraction-free editing
|
|
||||||
" let g:vimroom_sidebar_height = 0
|
|
||||||
Plug 'junegunn/goyo.vim' " better distraction-free editing
|
|
||||||
Plug 'editorconfig/editorconfig-vim' " loads project-specific editor settings
|
|
||||||
|
|
||||||
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' }
|
|
||||||
|
|
||||||
" plugins for specific file types
|
|
||||||
|
|
||||||
Plug 'junegunn/vader.vim', {'for': ['vader', 'vimscript', 'vim']}
|
|
||||||
Plug 'othree/html5.vim', {'for': ['jade', 'pug', 'html', 'vue']}
|
|
||||||
Plug 'mxw/vim-jsx', {'for': ['jsx', 'javascript', 'js', 'javascript.jsx']}
|
|
||||||
let g:jsx_ext_required = 0 " allow JSX in normal JS files
|
|
||||||
Plug 'hail2u/vim-css3-syntax', {'for': ['styl', 'stylus', 'sass', 'scss', 'css', 'vue']}
|
|
||||||
Plug 'kchmck/vim-coffee-script', {'for': ['coffee', 'coffeescript', 'vue']}
|
|
||||||
Plug 'posva/vim-vue', {'for': ['vue']}
|
|
||||||
Plug 'elixir-lang/vim-elixir', {'for': ['elixir', 'ex', 'exs']}
|
|
||||||
Plug 'fsharp/vim-fsharp', {'for': ['fs', 'fsharp']}
|
|
||||||
Plug 'OrangeT/vim-csharp', {'for': ['cshtml', 'cshtml.html', 'cs', 'razor']}
|
|
||||||
Plug 'vim-erlang/vim-erlang-runtime', {'for': ['erlang', 'erl']}
|
|
||||||
" Plug 'slashmili/alchemist.vim', {'for': ['elixir', 'ex', 'exs']}
|
|
||||||
Plug 'mattn/emmet-vim', {'for': ['html', 'vue']}
|
|
||||||
Plug 'wavded/vim-stylus', {'for': ['styl', 'stylus', 'vue']}
|
|
||||||
Plug 'quabug/vim-gdscript', {'for': ['gd', 'gdscript']}
|
|
||||||
Plug 'rust-lang/rust.vim', {'for': ['rs', 'rust']}
|
|
||||||
Plug 'mustache/vim-mustache-handlebars', {'for': ['html.handlebars', 'handlebars', 'hbs']}
|
|
||||||
Plug 'plasticboy/vim-markdown', {'for': ['md', 'markdown', 'vimwiki']}
|
|
||||||
Plug 'lifepillar/pgsql.vim', {'for': ['psql', 'sql']}
|
|
||||||
Plug 'cespare/vim-toml', {'for': ['toml']}
|
|
||||||
let g:utl_cfg_hdl_scm_http_system = "silent !$BROWSER '%u#%f' &"
|
|
||||||
Plug 'digitaltoad/vim-pug', {'for': ['pug', 'jade', 'vue']}
|
|
||||||
Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']}
|
|
||||||
Plug 'evidens/vim-twig', {'for': ['php']}
|
|
||||||
Plug 'leafgarland/typescript-vim', {'for': ['ts', 'typescript']}
|
|
||||||
Plug 'jwalton512/vim-blade', {'for': ['blade', 'blade.php']}
|
|
||||||
|
|
||||||
call plug#end()
|
|
||||||
|
|
||||||
filetype on
|
filetype on
|
||||||
filetype indent on
|
filetype indent on
|
||||||
filetype plugin on
|
filetype plugin on
|
||||||
|
|
||||||
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1
|
|
||||||
|
|
||||||
" language specific configuration
|
|
||||||
|
|
||||||
" C
|
|
||||||
let c_space_errors = 1
|
|
||||||
let c_comment_strings = 0 " dont highlight strings inside C comments
|
|
||||||
|
|
||||||
" Python
|
|
||||||
let python_space_errors = 1
|
|
||||||
" autocmd FileType python setl tabstop=4 expandtab shiftwidth=4 softtabstop=4
|
|
||||||
" autocmd FileType js setl tabstop=2 expandtab shiftwidth=2 softtabstop=2
|
|
||||||
" autocmd FileType vue setl tabstop=2 expandtab shiftwidth=2 softtabstop=2
|
|
||||||
autocmd FileType php setl tabstop=4 expandtab shiftwidth=4 softtabstop=4
|
|
||||||
|
|
||||||
" Markdown
|
|
||||||
autocmd BufNewFile,BufReadPost *.md setl filetype=markdown spell
|
|
||||||
|
|
||||||
" Text
|
|
||||||
autocmd BufNewFile,BufReadPost *.txt setl spell textwidth=0 wrapmargin=0
|
|
||||||
|
|
||||||
" 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>')
|
|
||||||
|
|
||||||
let settingsfile=$vimdir.'/settings.vim'
|
let settingsfile=$vimdir.'/settings.vim'
|
||||||
exec 'source ' . settingsfile
|
exec 'source ' . settingsfile
|
||||||
|
|
||||||
if exists('asmanviewer')
|
let commandsfile=$vimdir.'/commands.vim'
|
||||||
set nonumber " no line numbers when viewing a man page
|
exec 'source ' . commandsfile
|
||||||
set norelativenumber " no line numbers when viewing a man page
|
|
||||||
else
|
|
||||||
set nonumber " line numbers
|
|
||||||
set norelativenumber " line numbers
|
|
||||||
endif
|
|
||||||
|
|
||||||
" 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()
|
|
||||||
|
|
||||||
let bindingsfile=$vimdir.'/bindings.vim'
|
let bindingsfile=$vimdir.'/bindings.vim'
|
||||||
exec 'source ' . bindingsfile
|
exec 'source ' . bindingsfile
|
||||||
|
|
||||||
" modify higlight colors
|
|
||||||
hi Search cterm=NONE ctermbg=blue ctermfg=black
|
|
||||||
highlight LineNr ctermbg=none ctermfg=8
|
|
||||||
highlight CursorLineNr ctermbg=18 ctermfg=gray
|
|
||||||
hi IndentGuidesEven ctermbg=18
|
|
||||||
|
|
||||||
fun! VueModifiedFT()
|
|
||||||
set ft=vue
|
|
||||||
endfunction
|
|
||||||
:command! VueModifiedFT call VueModifiedFT()
|
|
||||||
autocmd BufRead,BufNewFile *.vue VueModifiedFT
|
|
||||||
|
|
|
@ -1,4 +1,22 @@
|
||||||
" whitespace
|
scriptencoding utf8
|
||||||
|
|
||||||
|
" fix neovim cursor
|
||||||
|
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 1
|
||||||
|
|
||||||
|
let g:ale_fix_on_save = 1
|
||||||
|
|
||||||
|
" line number defaults
|
||||||
|
set nonumber
|
||||||
|
set norelativenumber
|
||||||
|
|
||||||
|
" different settings if using vim as a manpage viewer
|
||||||
|
" if exists('asmanviewer')
|
||||||
|
" set nonumber " no line numbers when viewing a man page
|
||||||
|
" set norelativenumber " no line numbers when viewing a man page
|
||||||
|
" else
|
||||||
|
" set nonumber " line numbers
|
||||||
|
" set norelativenumber " line numbers
|
||||||
|
" endif
|
||||||
|
|
||||||
" use tabs at a two-space width
|
" use tabs at a two-space width
|
||||||
set tabstop=2
|
set tabstop=2
|
||||||
|
@ -15,21 +33,12 @@ set nostartofline
|
||||||
set listchars=trail:·,tab:\ \ ,trail:~
|
set listchars=trail:·,tab:\ \ ,trail:~
|
||||||
" set listchars=eol:\ ,tab:>-,trail:~,extends:>,precedes:<,space:·
|
" set listchars=eol:\ ,tab:>-,trail:~,extends:>,precedes:<,space:·
|
||||||
|
|
||||||
" look and feel
|
|
||||||
"
|
|
||||||
" try and keep text (and code) to a width of 80 characters
|
" try and keep text (and code) to a width of 80 characters
|
||||||
set wrap
|
set wrap
|
||||||
set linebreak
|
set linebreak
|
||||||
set breakindent
|
set breakindent
|
||||||
set textwidth=80
|
set textwidth=80
|
||||||
set formatoptions=crql1j
|
set formatoptions=crql1j " :h fo-table
|
||||||
" t autowrap to textwidth
|
|
||||||
" c autowrap comments to textwidth
|
|
||||||
" r autoinsert comment leader with <enter>
|
|
||||||
" q allow formatting of comments with gq
|
|
||||||
" l lines longer than 'textwidth' on insert do not get formatted
|
|
||||||
" 1 don't break a line after a one-letter word - break it before
|
|
||||||
" j where it makes sense, remove a comment leader when joining lines
|
|
||||||
|
|
||||||
" handle window title
|
" handle window title
|
||||||
set title
|
set title
|
||||||
|
@ -37,9 +46,6 @@ set title
|
||||||
" don't do syntax highlighting on lines longer than 2048 characters
|
" don't do syntax highlighting on lines longer than 2048 characters
|
||||||
set synmaxcol=2048
|
set synmaxcol=2048
|
||||||
|
|
||||||
" relative line numbers
|
|
||||||
set relativenumber
|
|
||||||
|
|
||||||
" don't highlight the current line
|
" don't highlight the current line
|
||||||
set nocursorline
|
set nocursorline
|
||||||
|
|
||||||
|
@ -73,35 +79,27 @@ set timeout
|
||||||
set ttimeoutlen=200
|
set ttimeoutlen=200
|
||||||
set isfname+=32
|
set isfname+=32
|
||||||
|
|
||||||
set vb t_vb=
|
" no freakin' bell
|
||||||
|
set visualbell t_vb=
|
||||||
if has('autocmd')
|
if has('autocmd')
|
||||||
autocmd GUIEnter * set visualbell t_vb=
|
augroup DisableVisualVell
|
||||||
|
autocmd GUIEnter * set visualbell t_vb=
|
||||||
|
augroup END
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" color scheme
|
||||||
let base16colorspace=256
|
let base16colorspace=256
|
||||||
set background=dark
|
set background=dark
|
||||||
|
syntax enable
|
||||||
colorscheme base16-donokai
|
colorscheme base16-donokai
|
||||||
|
|
||||||
|
" hide stuff
|
||||||
highlight SignColumn ctermbg=black guibg=black
|
highlight SignColumn ctermbg=black guibg=black
|
||||||
highlight GitGutterAdd ctermbg=black guibg=black
|
highlight GitGutterAdd ctermbg=black guibg=black
|
||||||
highlight GitGutterDelete ctermbg=black guibg=black
|
highlight GitGutterDelete ctermbg=black guibg=black
|
||||||
highlight GitGutterChange ctermbg=black guibg=black
|
highlight GitGutterChange ctermbg=black guibg=black
|
||||||
highlight GitGutterChangeDelete ctermbg=black guibg=black
|
highlight GitGutterChangeDelete ctermbg=black guibg=black
|
||||||
|
|
||||||
" 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()
|
|
||||||
|
|
||||||
hi NonText ctermfg=black guifg=black
|
hi NonText ctermfg=black guifg=black
|
||||||
|
|
||||||
set hidden " allows buffer switching without saving
|
set hidden " allows buffer switching without saving
|
||||||
|
@ -145,37 +143,16 @@ set laststatus=0
|
||||||
" yank to OS clipboard
|
" yank to OS clipboard
|
||||||
set clipboard+=unnamed
|
set clipboard+=unnamed
|
||||||
|
|
||||||
" 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
|
|
||||||
|
|
||||||
set nofoldenable
|
set nofoldenable
|
||||||
setlocal nofoldenable
|
setlocal nofoldenable
|
||||||
|
|
||||||
" 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
|
|
||||||
|
|
||||||
" no empty buffer on startup
|
" no empty buffer on startup
|
||||||
autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif
|
augroup DisableEmptyBuffer
|
||||||
|
autocmd VimEnter * nested if bufname('')=='' && line('$') == 1 && col('$')==1 && !&modified | bd % | endif
|
||||||
" terminal split in neovim
|
augroup END
|
||||||
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
|
|
||||||
|
|
||||||
|
" modify higlight colors
|
||||||
|
hi Search cterm=NONE ctermbg=blue ctermfg=black
|
||||||
|
highlight LineNr ctermbg=none ctermfg=8
|
||||||
|
highlight CursorLineNr ctermbg=18 ctermfg=gray
|
||||||
|
hi IndentGuidesEven ctermbg=18
|
||||||
|
|
Reference in a new issue