Commit 95c479c6 authored by Nelso Jost's avatar Nelso Jost

ADD: markdown nvim

parent 4b291a46
...@@ -5,8 +5,10 @@ install-basic: ...@@ -5,8 +5,10 @@ install-basic:
$(MAKE) install-pip $(MAKE) install-pip
install-pip: install-pip:
wget https://bootstrap.pypa.io/get-pip.py && wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py && sudo python get-pip.py && rm get-pip.py sudo python3 get-pip.py
sudo python get-pip.py
rm get-pip.py
install-neovim-debian: install-neovim-debian:
sudo cp etc/apt/preferences.d/testing-priority /etc/apt/preferences.d/testing-priority sudo cp etc/apt/preferences.d/testing-priority /etc/apt/preferences.d/testing-priority
......
...@@ -134,5 +134,7 @@ alias tmuxrc="tmux source-file ~/.tmux.conf" ...@@ -134,5 +134,7 @@ alias tmuxrc="tmux source-file ~/.tmux.conf"
alias tmux="TERM=screen-256color tmux -2" alias tmux="TERM=screen-256color tmux -2"
xmodmap ~/.Xmodmap
# http://stackoverflow.com/questions/3446320/in-vim-how-to-map-save-to-ctrl-s # http://stackoverflow.com/questions/3446320/in-vim-how-to-map-save-to-ctrl-s
stty -ixon stty -ixon
...@@ -19,14 +19,18 @@ Plug 'plasticboy/vim-markdown' " markdown syntax ...@@ -19,14 +19,18 @@ Plug 'plasticboy/vim-markdown' " markdown syntax
Plug 'benmills/vimux' " exec commands on tmux panels Plug 'benmills/vimux' " exec commands on tmux panels
Plug 'xolox/vim-misc' Plug 'xolox/vim-misc'
Plug 'xolox/vim-colorscheme-switcher' Plug 'xolox/vim-colorscheme-switcher'
Plug 'lvht/tagbar-markdown' "Plug 'lvht/tagbar-markdown'
Plug 't4ku/marktag' Plug 't4ku/marktag'
Plug 'octol/vim-cpp-enhanced-highlight' Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'bkad/CamelCaseMotion' Plug 'bkad/CamelCaseMotion'
Plug 'christoomey/vim-tmux-navigator' Plug 'christoomey/vim-tmux-navigator'
"Plug 'ervandew/supertab' "Plug 'ervandew/supertab'
Plug 'vim-scripts/Solarized'
Plug 'altercation/vim-colors-solarized'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } "Plug 'reedes/vim-pencil'
"Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
"Plug 'davidhalter/jedi' "Plug 'davidhalter/jedi'
"Plug 'zchee/deoplete-jedi' "Plug 'zchee/deoplete-jedi'
" Plug 'davidhalter/jedi-vim' " Plug 'davidhalter/jedi-vim'
...@@ -37,6 +41,7 @@ Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } ...@@ -37,6 +41,7 @@ Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
call plug#end() call plug#end()
" ----------------------------------------------------------------------- " -----------------------------------------------------------------------
"set background=dark
colorscheme molokai colorscheme molokai
behave mswin behave mswin
...@@ -165,7 +170,7 @@ vnoremap <S-Tab> < ...@@ -165,7 +170,7 @@ vnoremap <S-Tab> <
"map <C-S-Up> <C-w>k "map <C-S-Up> <C-w>k
nmap <Tab> <C-w>w nmap <Tab> <C-w>w
" "
"nnoremap <silent> <Tab> :TmuxNavigatePrevious<cr> nnoremap <silent> <Tab> :TmuxNavigatePrevious<cr>
" move cursor by n lines " move cursor by n lines
nnoremap <C-Up> 5- nnoremap <C-Up> 5-
...@@ -425,4 +430,21 @@ function! XTermPasteBegin() ...@@ -425,4 +430,21 @@ function! XTermPasteBegin()
endfunction endfunction
let g:tmux_navigator_no_mappings = 1
" Add support for markdown files in tagbar.
let g:tagbar_type_markdown = {
\ 'ctagstype': 'markdown',
\ 'ctagsbin' : '~/.config/nvim/markdown2ctags.py',
\ 'ctagsargs' : '-f - --sort=yes',
\ 'kinds' : [
\ 's:sections',
\ 'i:images'
\ ],
\ 'sro' : '|',
\ 'kind2scope' : {
\ 's' : 'section',
\ },
\ 'sort': 0,
\ }
#!/usr/bin/env python
# Copyright (C) 2013 John Szakmeister <john@szakmeister.net>
# All rights reserved.
#
# This software is licensed as described in the file LICENSE.txt, which
# you should have received as part of this distribution.
import sys
import re
__version__ = '0.1.3'
class ScriptError(Exception):
pass
def ctagNameEscape(str):
return re.sub('[\t\r\n]+', ' ', str)
def ctagSearchEscape(str):
str = str.replace('\t', r'\t')
str = str.replace('\r', r'\r')
str = str.replace('\n', r'\n')
str = str.replace('\\', r'\\')
return str
class Tag(object):
def __init__(self, tagName, tagFile, tagAddress):
self.tagName = tagName
self.tagFile = tagFile
self.tagAddress = tagAddress
self.fields = []
def addField(self, type, value=None):
if type == 'kind':
type = None
self.fields.append((type, value or ""))
def _formatFields(self):
formattedFields = []
for name, value in self.fields:
if name:
s = '%s:%s' % (name, value or "")
else:
s = str(value)
formattedFields.append(s)
return '\t'.join(formattedFields)
def __str__(self):
return '%s\t%s\t%s;"\t%s' % (
self.tagName, self.tagFile, self.tagAddress,
self._formatFields())
def __repr__(self):
return "<Tag name:%s file:%s: addr:%s %s>" % (
self.tagName, self.tagFile, self.tagAddress,
self._formatFields().replace('\t', ' '))
def __cmp__(self, other):
return cmp(str(self), str(other))
@staticmethod
def section(section):
tagName = ctagNameEscape(section.name)
tagAddress = '/^%s$/' % ctagSearchEscape(section.line)
t = Tag(tagName, section.filename, tagAddress)
t.addField('kind', 's')
t.addField('line', section.lineNumber)
parents = []
p = section.parent
while p is not None:
parents.append(ctagNameEscape(p.name))
p = p.parent
parents.reverse()
if parents:
t.addField('section', '|'.join(parents))
return t
class Section(object):
def __init__(self, level, name, line, lineNumber, filename, parent=None):
self.level = level
self.name = name
self.line = line
self.lineNumber = lineNumber
self.filename = filename
self.parent = parent
def __repr__(self):
return '<Section %s %d %d>' % (self.name, self.level, self.lineNumber)
def popSections(sections, level):
while sections:
s = sections.pop()
if s and s.level < level:
sections.append(s)
return
atxHeadingRe = re.compile(r'^(#+)\s+(.*?)(?:\s+#+)?\s*$')
settextHeadingRe = re.compile(r'^[-=]+$')
settextSubjectRe = re.compile(r'^[^\s]+.*$')
def findSections(filename, lines):
sections = []
inCodeBlock = False
previousSections = []
for i, line in enumerate(lines):
# Skip GitHub Markdown style code blocks.
if line.startswith("```"):
inCodeBlock = not inCodeBlock
continue
if inCodeBlock:
continue
m = atxHeadingRe.match(line)
if m:
level = len(m.group(1))
name = m.group(2)
popSections(previousSections, level)
if previousSections:
parent = previousSections[-1]
else:
parent = None
lineNumber = i + 1
s = Section(level, name, line, lineNumber, filename, parent)
previousSections.append(s)
sections.append(s)
else:
m = settextHeadingRe.match(line)
if i and m:
if not settextSubjectRe.match(lines[i - 1]):
continue
name = lines[i-1].strip()
if line[0] == '=':
level = 1
else:
level = 2
popSections(previousSections, level)
if previousSections:
parent = previousSections[-1]
else:
parent = None
lineNumber = i
s = Section(level, name, lines[i-1], lineNumber,
filename, parent)
previousSections.append(s)
sections.append(s)
return sections
def sectionsToTags(sections):
tags = []
for section in sections:
tags.append(Tag.section(section))
return tags
def genTagsFile(output, tags, sort):
if sort == "yes":
tags = sorted(tags)
sortedLine = '!_TAG_FILE_SORTED\t1\n'
elif sort == "foldcase":
tags = sorted(tags, key=lambda x: str(x).lower())
sortedLine = '!_TAG_FILE_SORTED\t2\n'
else:
sortedLine = '!_TAG_FILE_SORTED\t0\n'
output.write('!_TAG_FILE_FORMAT\t2\n')
output.write(sortedLine)
for t in tags:
output.write(str(t))
output.write('\n')
def main():
from optparse import OptionParser
parser = OptionParser(usage = "usage: %prog [options] file(s)",
version = __version__)
parser.add_option(
"-f", "--file", metavar = "FILE", dest = "tagfile",
default = "tags",
help = 'Write tags into FILE (default: "tags"). Use "-" to write '
'tags to stdout.')
parser.add_option(
"", "--sort", metavar="[yes|foldcase|no]", dest = "sort",
choices = ["yes", "no", "foldcase"],
default = "yes",
help = 'Produce sorted output. Acceptable values are "yes", '
'"no", and "foldcase". Default is "yes".')
options, args = parser.parse_args()
if options.tagfile == '-':
output = sys.stdout
else:
output = open(options.tagfile, 'wb')
for filename in args:
f = open(filename, 'rb')
lines = f.read().splitlines()
f.close()
sections = findSections(filename, lines)
genTagsFile(output, sectionsToTags(sections), sort=options.sort)
output.flush()
output.close()
if __name__ == '__main__':
try:
main()
except IOError as e:
import errno
if e.errno == errno.EPIPE:
# Exit saying we got SIGPIPE.
sys.exit(141)
raise
except ScriptError as e:
print >>sys.stderr, "ERROR: %s" % str(e)
sys.exit(1)
...@@ -15,7 +15,6 @@ setw -g pane-base-index 1 ...@@ -15,7 +15,6 @@ setw -g pane-base-index 1
# https://github.com/neovim/neovim/issues/2035 # https://github.com/neovim/neovim/issues/2035
set -sg escape-time 0 set -sg escape-time 0
set-option -sg repeat-time 0
# enter scroll/copy-mode with pageup # enter scroll/copy-mode with pageup
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
...@@ -32,7 +31,6 @@ bind-key v split-window -v -c '#{pane_current_path}' ...@@ -32,7 +31,6 @@ bind-key v split-window -v -c '#{pane_current_path}'
bind-key C-q kill-server bind-key C-q kill-server
bind-key C-w kill-window bind-key C-w kill-window
bind-key w new-window bind-key w new-window
bind-key TAB last-pane
#run-shell ~/resurrect.tmux #run-shell ~/resurrect.tmux
# #
...@@ -59,6 +57,10 @@ set -g @resurrect-processes '~python' ...@@ -59,6 +57,10 @@ set -g @resurrect-processes '~python'
#bind-key -T copy-mode-vi C-l select-pane -R #bind-key -T copy-mode-vi C-l select-pane -R
#bind-key -T copy-mode-vi C-\ select-pane -l #bind-key -T copy-mode-vi C-\ select-pane -l
bind-key TAB select-pane -l
set-option -g repeat-time 0
# List of plugins # List of plugins
set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tpm'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment