my configs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

219 lines
5.6 KiB

  1. runtime system.vim
  2. " Plug initialization
  3. if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
  4. silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
  5. \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  6. augroup Plugins
  7. au!
  8. au VimEnter * PlugInstall | source $MYVIMRC
  9. augroup END
  10. endif
  11. call plug#begin('~/.local/share/nvim')
  12. runtime plug.vim
  13. call plug#end()
  14. if has('autocmd')
  15. "Set leader to space
  16. let g:mapleader = "\<Space>"
  17. filetype plugin indent on
  18. endif
  19. if has('syntax')
  20. " Use syntax highlighting
  21. if !exists('g:syntax_on')
  22. syntax enable
  23. endif
  24. " Use my colorscheme if using the GUI or if we have 256 colors
  25. if has('gui_running') || &t_Co >= 256
  26. silent! color monokai
  27. endif
  28. " If not monokai, then default with dark background
  29. if !exists('g:colors_name')
  30. set background=dark
  31. endif
  32. endif
  33. " Use UTF-8 if we can and env LANG didn't tell us not to
  34. if has('multi_byte') && !exists('$LANG') && &encoding ==# 'latin1'
  35. set encoding=utf-8
  36. endif
  37. " The all-important default indent settings; filetypes to tweak
  38. set autoindent " Use indent of previous line on new lines
  39. set expandtab " Use spaces instead of tabs
  40. set shiftwidth=2 " Indent with two spaces
  41. set softtabstop=2 " Insert two spaces with tab key
  42. set smartindent " Enable smart-indent
  43. set smarttab " Enable smart-tabs
  44. set tabstop=2
  45. set cindent shiftwidth=2
  46. " Let me backspace over pretty much anything
  47. set backspace=indent,eol,start
  48. " Indent wrapped lines
  49. silent! set breakindent
  50. " Give me a prompt instead of just rejecting risky :write, :saveas
  51. set confirm
  52. " Clear default 'comments' value, let the filetype handle it
  53. set comments=
  54. " Add completion options
  55. if exists('+completeopt')
  56. set completeopt+=noinsert
  57. set completeopt+=longest " Insert longest common substring
  58. set completeopt+=menuone " Show the menu even if only one match
  59. set completeopt+=noselect " Show the menu even if only one match
  60. else
  61. set completeopt=noinsert,longest,menuone,noselect
  62. endif
  63. " Don't wait for a key after Escape in insert mode
  64. " In vim-tiny but not NeoVim, so just suppress errors
  65. silent! set noesckeys
  66. " Fold based on indent, but only when I ask
  67. if has('folding')
  68. set foldlevelstart=99
  69. set foldmethod=indent
  70. endif
  71. " Delete comment leaders when joining lines, if supported
  72. silent! set formatoptions+=j
  73. " If available, use GNU grep niceties for searching
  74. if system('grep --version') =~# '^grep (GNU grep)'
  75. set grepprg=grep\ -HnRs\ --exclude='.git*'
  76. endif
  77. " Don't load GUI menus; set here before GUI starts
  78. if has('gui_running')
  79. set guioptions+=M
  80. set guioptions+=LlRrb
  81. set guioptions-=LlRrb
  82. set guioptions-=T
  83. set guioptions-=m
  84. endif
  85. " Allow buffers to have changes without being displayed
  86. set hidden
  87. " Keep much more command and search history
  88. set history=2000
  89. " Highlight completed searches; clear on reload
  90. set hlsearch
  91. if 1
  92. nohlsearch
  93. endif
  94. " Don't assume I'm editing C; let the filetype set this
  95. set include=
  96. " Show search matches as I type my pattern
  97. set incsearch
  98. " Don't join lines with two spaces at the end of sentences
  99. set nojoinspaces
  100. " Don't show a statusline if there's only one window
  101. " This is the Vim default, but NeoVim changed it
  102. if &laststatus != 1
  103. set laststatus=1
  104. endif
  105. " Don't redraw the screen during batch execution
  106. set lazyredraw
  107. " Break lines at word boundaries
  108. set linebreak
  109. " Disable command line display of file position
  110. " This is the Vim default, but NeoVim changed it
  111. if &ruler
  112. set noruler
  113. endif
  114. " Show row and column ruler information
  115. set ruler
  116. set colorcolumn=100
  117. " Options for file search with gf/:find
  118. set path-=/usr/include " Let the C/C++ filetypes set that
  119. set path+=** " Search current directory's whole tree
  120. " Prefix wrapped rows with three dots
  121. set showbreak=...
  122. " New windows go below or to the right of a split
  123. set splitbelow
  124. set splitright
  125. " Give me a bit longer to complete mappings
  126. set notimeout
  127. set nottimeout
  128. set timeoutlen=10000
  129. set ttimeoutlen=10000
  130. " No terminal mouse, even if we could
  131. silent! set ttymouse=
  132. " Keep undo files, hopefully in a dedicated directory
  133. if has('persistent_undo')
  134. set undofile
  135. set undodir^=~/.vim/cache/undo//
  136. endif
  137. set undolevels=1000 " Number of undo levels
  138. " Wildmenu settings; see also plugin/wildignore.vim
  139. set wildmenu " Use wildmenu
  140. "set wildmode=list:longest " Tab press completes and lists
  141. silent! set wildignorecase " Case insensitive, if supported
  142. " Let me move beyond buffer text in visual block mode
  143. if exists('+virtualedit')
  144. set virtualedit+=block
  145. endif
  146. set diffopt=filler,iwhite
  147. set fileencoding=utf-8
  148. set fillchars+=stl:\ ,stlnc:\
  149. set foldcolumn=1
  150. set foldlevel=0
  151. set foldmethod=indent
  152. set ignorecase " Always case-insensitive
  153. set laststatus=2
  154. set linebreak " Break lines at word (requires Wrap lines)
  155. set list lcs=tab:\|\
  156. set noerrorbells vb t_vb=
  157. set nofoldenable
  158. set number " Show line numbers
  159. set omnifunc=syntaxcomplete#Complete
  160. set scrolloff=1
  161. set showcmd
  162. set showmatch " Highlight matching brace
  163. set smartcase " Enable smart-case search
  164. set termencoding=utf-8
  165. set textwidth=100 " Line wrap (number of cols)
  166. set visualbell " Use visual bell (no beeping)
  167. " Stop C-r from being seen as backspace
  168. nnoremap <silent> <BS> :TmuxNavigateLeft<cr>
  169. " \R reloads ~/.vimrc
  170. nnoremap <Bslash>R :<C-U>source $MYVIMRC<CR>
  171. " \DEL deletes the current buffer
  172. nnoremap <Bslash><Delete> :bdelete<CR>
  173. " \INS edits a new buffer
  174. nnoremap <Bslash><Insert> :<C-U>enew<CR>
  175. " \/ types :vimgrep for me ready to enter a search pattern
  176. nnoremap <Bslash>/ :<C-U>vimgrep /\c/ **<S-Left><S-Left><Right>
  177. " \p toggles paste mode
  178. nnoremap <Bslash>p :<C-U>set paste! paste?<CR>