summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/nvim/general/commands.vim2
-rw-r--r--.config/nvim/general/functions.vim12
-rw-r--r--.config/nvim/general/settings.vim37
-rw-r--r--.config/nvim/init.vim106
-rw-r--r--.config/nvim/keys/mappings.vim14
5 files changed, 69 insertions, 102 deletions
diff --git a/.config/nvim/general/commands.vim b/.config/nvim/general/commands.vim
new file mode 100644
index 0000000..416c094
--- /dev/null
+++ b/.config/nvim/general/commands.vim
@@ -0,0 +1,2 @@
+" Creates the 'tags' file.
+command! MakeTags !ctags -R --exclude@.ctagsignore .
diff --git a/.config/nvim/general/functions.vim b/.config/nvim/general/functions.vim
new file mode 100644
index 0000000..07a67c4
--- /dev/null
+++ b/.config/nvim/general/functions.vim
@@ -0,0 +1,12 @@
+function! <SID>StripTrailingWhitespaces()
+ " Preparation: save last search, and cursor position.
+ let _s=@/
+ let l = line(".")
+ let c = col(".")
+ " Do the business:
+ %s/\s\+$//e
+ " Clean up: restore previous search history, and cursor position
+ let @/=_s
+ call cursor(l, c)
+endfunction
+nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
diff --git a/.config/nvim/general/settings.vim b/.config/nvim/general/settings.vim
new file mode 100644
index 0000000..89c6b77
--- /dev/null
+++ b/.config/nvim/general/settings.vim
@@ -0,0 +1,37 @@
+colorscheme railscasts
+syntax on " Syntax highlighting on.
+filetype on
+filetype plugin on
+filetype indent on " Load filetype-specific indent files.
+highlight NonText guifg=#4a4a59 "Invisible character colors
+highlight SpecialKey guifg=#4a4a59
+set autoindent
+set cmdheight=2 " More space for displaing messages.
+set cursorline " Highlight current line.
+set encoding=utf-8 " The encoding displayed.
+set expandtab " Tabs are spaces.
+set fileencoding=utf-8 " The encoding written to the file.
+set laststatus=0
+set listchars=tab:▸\ ,eol:¬ " Use the same symbols as TextMate for tabstops and EOLs
+set mouse=a " Enable the mouse.
+set nobackup
+set noswapfile
+set nowb
+set nowrap " Don't wrap long lines.
+set number " Turn on line numbers.
+set path+=** " Search down into subfolders.
+set ruler " Show the cursor position all the time.
+set shiftwidth=2 " Number of spaces that text is shifted when using << and >>.
+set showmatch " Highlight matching [{()}].
+set showmode " Show what mode we are in at the bottom of the screen.
+set smartindent
+set smarttab
+set softtabstop=2 " Number of spaces in tab when editing.
+set splitbelow
+set splitright " Split panes to the right and bottom.
+set t_Co=256 " Support 256 colors.
+set tabstop=2 " Number of visual spaces per tab.
+set wildignore+=**/.git/** " Ignore these directories when finding.
+set wildignore+=**/node_modules/**
+set wildignore+=**/vendor/**
+set wildmenu " Display all matching files when we tab complete.
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index 3c6e9a6..5d05222 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -1,102 +1,4 @@
-"""""""
-" VIM "
-"""""""
-
-set nobackup
-set nowb
-set noswapfile
-
-""""""""""
-" UI "
-""""""""""
-
-colorscheme railscasts
-
-" Syntax highlighting on.
-syntax on
-
-" Turn on line numbers.
-set number
-
-filetype on
-
-filetype plugin on
-
-" Load filetype-specific indent files.
-filetype indent on
-
-:set wrap linebreak nolist
-
-" Highlight matching [{()}]
-set showmatch
-
-" Open new split panes to right and bottom.
-set splitright
-set splitbelow
-
-"""""""""""""""""
-" SPACES & TABS "
-"""""""""""""""""
-
-" Number of visual spaces per tab.
-set tabstop=2
-
-" Number of spaces in tab when editing.
-set softtabstop=2
-
-" Number of spaces that text is shifted when using << and >>.
-set shiftwidth=2
-
-" Tabs are spaces.
-set expandtab
-
-"""""""""""""""""
-" FINDING FILES "
-"""""""""""""""""
-
-" Search down into subfolders.
-set path+=**
-
-" Ignore these directories when finding.
-set wildignore+=**/.git/**
-set wildignore+=**/node_modules/**
-set wildignore+=**/vendor/**
-
-" Display all matching files when we tab complete.
-set wildmenu
-
-"""""""""""""""
-" TAG JUMPING "
-"""""""""""""""
-
-" Creates the 'tags' file.
-command! MakeTags !ctags -R --exclude@.ctagsignore .
-
-""""""""
-" MISC "
-""""""""
-
-" Shortcuts provided by http://vimcasts.org
-
-" Shortcut to rapidly toggle `set list`
-nmap <leader>l :set list!<CR>
-
-" Use the same symbols as TextMate for tabstops and EOLs
-set listchars=tab:▸\ ,eol:¬
-
-"Invisible character colors
-highlight NonText guifg=#4a4a59
-highlight SpecialKey guifg=#4a4a59
-
-function! <SID>StripTrailingWhitespaces()
- " Preparation: save last search, and cursor position.
- let _s=@/
- let l = line(".")
- let c = col(".")
- " Do the business:
- %s/\s\+$//e
- " Clean up: restore previous search history, and cursor position
- let @/=_s
- call cursor(l, c)
-endfunction
-nnoremap <silent> <F5> :call <SID>StripTrailingWhitespaces()<CR>
+source $HOME/.config/nvim/general/settings.vim
+source $HOME/.config/nvim/general/functions.vim
+source $HOME/.config/nvim/general/commands.vim
+source $HOME/.config/nvim/keys/mappings.vim
diff --git a/.config/nvim/keys/mappings.vim b/.config/nvim/keys/mappings.vim
new file mode 100644
index 0000000..1f623f8
--- /dev/null
+++ b/.config/nvim/keys/mappings.vim
@@ -0,0 +1,14 @@
+" Shortcut to rapidly toggle `set list`
+nmap <leader>l :set list!<CR>
+
+" Use alt+jkhl to resize windows.
+nnoremap <M-j> :resize -2<CR>
+nnoremap <M-k> :resize +2<CR>
+nnoremap <M-h> :vertical resize -2<CR>
+nnoremap <M-l> :vertical resize +2<CR>
+
+" Make window navigation similar to dwm.
+nnoremap <C-h> <C-w>h
+nnoremap <C-j> <C-w>j
+nnoremap <C-k> <C-w>k
+nnoremap <C-l> <C-w>l