Make "-" a non-breaking char only for markdown docs
dblume

dblume commited on 2024-10-17 15:14:48
Showing 2 changed files, with 4 additions and 4 deletions.


Turns out I want "-" to be breaking in code, like
objectptr->method(), but I want it to be non-breaking
in non-code where I use bug tracker IDs like JIRA-1234.
... ...
@@ -5,7 +5,6 @@ set foldlevel=99
5 5
 set nowrap          " no wrapping text lines on the screen (exceptions below)
6 6
 set sidescroll=5
7 7
 set listchars+=tab:>-,precedes:<,extends:>,nbsp:·,eol:\\u21b5 " for :set list
8
-set iskeyword+=-    " Add - to list of non-word-breaking chars.
9 8
 set scrolloff=0     " EC2 defaults to 5. Set explicitly to be consistent
10 9
 set notermguicolors " Only needed for neovim while I port my color schemes
11 10
 set undofile        " undo even after closing and reopening a file
... ...
@@ -307,7 +306,8 @@ if has("autocmd")
307 306
   " Don't let smartindent unindent the # character in Python files
308 307
   autocmd FileType python  inoremap # X<c-h>#
309 308
   autocmd FileType python,c,cpp,php,brs,sh  set expandtab  " Use spaces instead of tabs
310
-  autocmd Filetype make    setl noexpandtab       " ...not for files that use tabs.
309
+  autocmd FileType make    setl noexpandtab                " ...not for files that use tabs.
310
+  autocmd FileType markdown  set iskeyword+=-  " Add - to list of non-word-breaking chars.
311 311
 
312 312
   " Use the vim command %retab before applying the following
313 313
   " two with files that have 8-space tabs.
... ...
@@ -10,7 +10,6 @@ set foldlevel=99
10 10
 set nowrap          " no wrapping text lines on the screen (exceptions below)
11 11
 set sidescroll=5
12 12
 set listchars+=tab:>-,precedes:<,extends:>,nbsp:· " for :set list
13
-set iskeyword+=-    " Add - to list of non-word-breaking chars.
14 13
 set incsearch       " Navigate to matched strings while typing. Toggle: :set is!
15 14
 set scrolloff=0     " EC2 defaults to 5. Set explicitly to be consistent
16 15
 set formatoptions+=j " Delete comment character when joining commented lines.
... ...
@@ -320,7 +319,8 @@ if has("autocmd")
320 319
   " Don't let smartindent unindent the # character in Python files
321 320
   autocmd FileType python  inoremap # X<c-h>#
322 321
   autocmd FileType python,c,cpp,php,brs,sh  set expandtab  " Use spaces instead of tabs
323
-  autocmd Filetype make    setl noexpandtab       " ...not for files that use tabs.
322
+  autocmd FileType make    setl noexpandtab                " ...not for files that use tabs.
323
+  autocmd FileType markdown  set iskeyword+=-  " Add - to list of non-word-breaking chars.
324 324
 
325 325
   " Use the vim command %retab before applying the following
326 326
   " two with files that have 8-space tabs.
327 327